diff --git a/abap-api-tools/README.md b/abap-api-tools/README.md index a4e9688a..6d8c80a7 100644 --- a/abap-api-tools/README.md +++ b/abap-api-tools/README.md @@ -366,14 +366,20 @@ short: ## Integration -Your tools and applications can use integration API `call` and `get` methods, to access ABAP annotations and call templates. +Integration api provides ABAP annotations, call templates and pre-fabricated ui components, for consumption by other tools, applications or SDKs: -Either the destination id or connection parameters can be provided, with one or more RFM names. +| Method | Output | Backend connection | +| ------ | -------------------------------- | ------------------ | +| `call` | Call templates | required | +| `get` | Call templates, ABAP annotations | required | +| `make` | Call templates, ui components | not required | -Check [unit tests](https://github.com/SAP/fundamental-tools/tree/main/abap-api-tools/tests) for usage details and result data structure. +Either the destination id or connection parameters can be used, with one or more RFM names. + +Check usage examples in [unit tests](https://github.com/SAP/fundamental-tools/blob/main/abap-api-tools/tests/cliapi.spec.js) and [reference results](https://github.com/SAP/fundamental-tools/blob/main/abap-api-tools/tests/results.js) for data structures' details. ```ts -import { CliApi, CliResult, RfcConnectionParameters } from "abap-api-tools"; +import { AbapCliApi, AbapCliResult, RfcConnectionParameters, AnnotationsType } from "abap-api-tools"; const cp: RfcConnectionParameters = { user: "demo", @@ -385,13 +391,18 @@ const cp: RfcConnectionParameters = { }; (async () => { - let R:CliResult; + let R:AbapCliResult; + + const api = new AbapCliApi(); - const api = new CliApi(); + // Call templates + R = await a.call("MME", "stfc_connection"); - R = await a.get(cp, ["stfc_connection", "stfc_structure"]); // annotations only + // Call templates and annotations + R = await a.get(cp, ["stfc_connection", "stfc_structure"]); - R = await a.call("MME", "stfc_connection"); // annotations and call templates + // Call templates and ui components + R = await a.make(R.annotations as AnnotationsType, "fudamental-ngx"); })(); ``` diff --git a/abap-api-tools/package-lock.json b/abap-api-tools/package-lock.json index 7cf47298..394ccc30 100644 --- a/abap-api-tools/package-lock.json +++ b/abap-api-tools/package-lock.json @@ -1,11 +1,11 @@ { "name": "abap-api-tools", - "version": "1.7.1", + "version": "1.8.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.7.1", + "version": "1.8.0", "cpu": [ "!arm" ], diff --git a/abap-api-tools/package.json b/abap-api-tools/package.json index 6409d291..f6cd2526 100644 --- a/abap-api-tools/package.json +++ b/abap-api-tools/package.json @@ -1,7 +1,7 @@ { "name": "abap-api-tools", "description": "ABAP api tools", - "version": "1.7.1", + "version": "1.8.0", "homepage": "https://github.com/sap/fundamental-tools", "author": "SAP", "license": "Apache-2.0", @@ -31,7 +31,8 @@ "dependencies": "npm i --save chalk js-yaml loglevel sprintf-js yargs node-rfc", "devDependencies": "npm i --save-dev @types/node @types/js-yaml @types/sprintf-js @types/yargs @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint jest typescript", "build": "reuse lint && rm -rf dist && npm run ts && npm run lint", - "lock": "npm install --package-lock-only" + "lock": "npm install --package-lock-only", + "test": "jest tests --detectOpenHandles" }, "keywords": [ "sap", diff --git a/abap-api-tools/src/ts/abap.ts b/abap-api-tools/src/ts/abap.ts index 19a1828c..eecbd408 100644 --- a/abap-api-tools/src/ts/abap.ts +++ b/abap-api-tools/src/ts/abap.ts @@ -36,7 +36,7 @@ export const Command = Object.freeze({ export type ApiListType = Record; export type Destination = string | RfcConnectionParameters; -export { RfcConnectionParameters }; +export { RfcConnectionParameters, AnnotationsType }; export type Arguments = { //[argName: string]: unknown; @@ -53,13 +53,15 @@ export type Arguments = { save?: boolean; textOnly?: string; ui?: string; + "sort-fields"?: boolean; runInBg?: boolean; }; -export type CliResult = { +export type AbapCliResult = { annotations?: AnnotationsType; frontend?: FrontendResult; }; + class CliHandler { private argv: Arguments; @@ -98,20 +100,20 @@ class CliHandler { log.debug(argv); } - async run(): Promise { - const result: CliResult = {}; + async run(): Promise { + const result: AbapCliResult = {}; if (this.argv.apilist) { for (const api_name of Object.keys(this.argv.apilist)) { - let annotations: AnnotationsType = { - parameters: {}, - fields: {}, - stat: {}, - }; + let annotations = {} as AnnotationsType; if ([Command.call, Command.get].includes(this.argv.cmd)) { log.debug(`backend run ${api_name}`); const backend = new Backend(api_name, this.argv); annotations = await backend.parse(); - result[api_name] = { annotations: annotations }; + if (this.argv.cmd === Command.get) { + // call method annotations are w/o search helps + // only get annotations are complete + result[api_name] = { annotations: annotations }; + } } if ( @@ -155,14 +157,18 @@ class CliHandler { } } -export class CliApi { - private options = { lang: DefaultLanguage, debug: false }; +export class AbapCliApi { + private options = { + lang: DefaultLanguage, + "sort-fields": false, + debug: false, + }; async call( dest: Destination, rfm_names: string | string[], options?: { lang?: string; debug?: boolean } - ): Promise { + ): Promise { if (options) { Object.assign(this.options, options); } @@ -194,7 +200,7 @@ export class CliApi { dest: Destination, rfm_names: string | string[], options?: { lang?: string; debug?: boolean } - ): Promise { + ): Promise { if (options) { Object.assign(this.options, options); } @@ -221,6 +227,37 @@ export class CliApi { return result[""]; } + + make( + annotations: AnnotationsType, + ui: string, + options?: { "sort-fields"?: boolean; debug?: boolean } + ): AbapCliResult { + if (options) { + Object.assign(this.options, options); + } + + log.setDefaultLevel( + this.options.debug ? log.levels.DEBUG : log.levels.SILENT + ); + + const args: Arguments = { + _: [Command.make], + $0: "abap", + cmd: Command.make, + output: "", + apilist: { "": Object.keys(annotations.parameters) }, + ui: ui, + "sort-fields": this.options["sort-fields"], + lang: this.options.lang, + debug: this.options.debug, + runInBg: true, + }; + + const frontend = new Frontend("", annotations, args); + const result: AbapCliResult = { frontend: frontend.parse() }; + return result; + } } // invoked via CLI diff --git a/abap-api-tools/src/ts/utils.ts b/abap-api-tools/src/ts/utils.ts index bbdcca87..438ef594 100644 --- a/abap-api-tools/src/ts/utils.ts +++ b/abap-api-tools/src/ts/utils.ts @@ -47,6 +47,8 @@ export function makeDir(dir: string): void { } export function isEmpty(obj: Record): boolean { + if (obj === undefined) return true; + if (Array.isArray(obj)) return obj.length === 0; return Object.keys(obj).length === 0; } diff --git a/abap-api-tools/tests/cliapi.spec.js b/abap-api-tools/tests/cliapi.spec.js index 844abaa2..74230eef 100644 --- a/abap-api-tools/tests/cliapi.spec.js +++ b/abap-api-tools/tests/cliapi.spec.js @@ -2,12 +2,14 @@ // // SPDX-License-Identifier: Apache-2.0 -const CliApi = require("../dist/abap").CliApi; +const AbapCliApi = require("../dist/abap").AbapCliApi; + +const Result = require("./results"); ("use strict"); -describe("Pool Options", () => { - const api = new CliApi(); +describe("Integration API", () => { + const api = new AbapCliApi(); const cp = { user: "demo", @@ -18,574 +20,61 @@ describe("Pool Options", () => { lang: "EN", }; - const RESULT1 = { - annotations: { - alpha: { all: [], rfm: {} }, - fields: { - SYST: { - LISEL: { - format: { - DATATYPE: "CHAR", - DOMNAME: "SYCHAR255", - INTTYPE: "C", - LENG: 255, - OUTPUTLEN: 255, - ROLLNAME: "SYST_LISEL", - }, - text: { - FIELDTEXT: "ABAP System Field: Content of Selected List Line", - REPTEXT: "Line Content", - SCRTEXT_L: "Line Content", - SCRTEXT_M: "Line Content", - SCRTEXT_S: "Line", - }, - }, - }, - }, - helps: {}, - parameters: { - STFC_CONNECTION: { - ECHOTEXT: { - FIELDNAME: "LISEL", - PARAMCLASS: "E", - PARAMTEXT: "", - TABNAME: "SYST", - functionName: "STFC_CONNECTION", - paramName: "ECHOTEXT", - paramType: "var", - required: true, - }, - REQUTEXT: { - FIELDNAME: "LISEL", - PARAMCLASS: "I", - PARAMTEXT: "", - TABNAME: "SYST", - functionName: "STFC_CONNECTION", - paramName: "REQUTEXT", - paramType: "var", - required: true, - }, - RESPTEXT: { - FIELDNAME: "LISEL", - PARAMCLASS: "E", - PARAMTEXT: "", - TABNAME: "SYST", - functionName: "STFC_CONNECTION", - paramName: "RESPTEXT", - paramType: "var", - required: true, - }, - }, - }, - stat: { - STFC_CONNECTION: { exception: 0, struct: 0, table: 0, var: 3 }, - }, - usage: {}, - }, - frontend: { - STFC_CONNECTION: { - js: - "//\n" + - "// STFC_CONNECTION var: 3 struct: 0 table: 0 exception: 0\n" + - "//\n" + - "// abap api\n" + - "//\n" + - "\n" + - "// prettier-ignore\n" + - "const parameters = {\n" + - "\n" + - "// IMPORT PARAMETERS\n" + - "\n" + - 'REQUTEXT : "", // CHAR (255) no text (en)\n' + - "\n" + - "// EXPORT PARAMETERS\n" + - "\n" + - '// ECHOTEXT : "", // CHAR (255) no text (en)\n' + - '// RESPTEXT : "", // CHAR (255) no text (en)\n' + - "};\n" + - "\n" + - 'const result = await client.call("STFC_CONNECTION", parameters);\n' + - "\n" + - "//\n" + - "// IMPORT PARAMETERS\n" + - "//\n" + - "\n" + - "\n" + - "//\n" + - "// EXPORT PARAMETERS\n" + - "//\n", - }, - }, - }; + test("call: stfc_connection, connection parameters", async () => { + expect.assertions(2); - const RESULT2 = { - annotations: { - alpha: { all: [], rfm: {} }, - fields: { - RFCTEST: { - RFCCHAR1: { - format: { - DATATYPE: "CHAR", - DOMNAME: "RFCCHAR1", - INTTYPE: "C", - LENG: 1, - LOWERCASE: "X", - OUTPUTLEN: 1, - ROLLNAME: "RFCCHAR1", - }, - text: { - FIELDTEXT: "Character field of length 1", - REPTEXT: "char1", - SCRTEXT_L: "char1", - SCRTEXT_M: "char1", - SCRTEXT_S: "char1", - }, - }, - RFCCHAR2: { - format: { - DATATYPE: "CHAR", - DOMNAME: "RFCCHAR2", - INTTYPE: "C", - LENG: 2, - OUTPUTLEN: 2, - ROLLNAME: "RFCCHAR2", - }, - text: { - FIELDTEXT: "Character field of length 2", - REPTEXT: "char2", - SCRTEXT_L: "char2", - SCRTEXT_M: "char2", - SCRTEXT_S: "char2", - }, - }, - RFCCHAR4: { - format: { - DATATYPE: "CHAR", - DOMNAME: "RFCCHAR4", - INTTYPE: "C", - LENG: 4, - LOWERCASE: "X", - OUTPUTLEN: 4, - ROLLNAME: "RFCCHAR4", - }, - text: { - FIELDTEXT: "Character field of length 4", - REPTEXT: "char4", - SCRTEXT_L: "char4", - SCRTEXT_M: "char4", - SCRTEXT_S: "char4", - }, - }, - RFCDATA1: { - format: { - DATATYPE: "CHAR", - DOMNAME: "TEXT50", - INTTYPE: "C", - LENG: 50, - LOWERCASE: "X", - OUTPUTLEN: 50, - ROLLNAME: "CHAR50", - }, - text: { - FIELDTEXT: "Comment", - REPTEXT: "c", - SCRTEXT_L: "c", - SCRTEXT_M: "c", - SCRTEXT_S: "c", - }, - }, - RFCDATA2: { - format: { - DATATYPE: "CHAR", - DOMNAME: "TEXT50", - INTTYPE: "C", - LENG: 50, - LOWERCASE: "X", - OUTPUTLEN: 50, - ROLLNAME: "CHAR50", - }, - text: { - FIELDTEXT: "Comment", - REPTEXT: "c", - SCRTEXT_L: "c", - SCRTEXT_M: "c", - SCRTEXT_S: "c", - }, - }, - RFCDATE: { - format: { - DATATYPE: "DATS", - DOMNAME: "RFCDATE", - INTTYPE: "D", - LENG: 8, - OUTPUTLEN: 10, - ROLLNAME: "RFCDATE", - }, - text: { - FIELDTEXT: "Date field", - REPTEXT: "Date", - SCRTEXT_L: "Date", - SCRTEXT_M: "Date", - SCRTEXT_S: "Date", - }, - }, - RFCFLOAT: { - format: { - DATATYPE: "FLTP", - DECIMALS: 16, - DOMNAME: "RFCFLOAT", - INTTYPE: "F", - LENG: 16, - OUTPUTLEN: 22, - ROLLNAME: "RFCFLOAT", - }, - text: { - FIELDTEXT: "Float field", - REPTEXT: "Float", - SCRTEXT_L: "Float", - SCRTEXT_M: "Float", - SCRTEXT_S: "Float", - }, - }, - RFCHEX3: { - format: { - DATATYPE: "RAW", - DOMNAME: "RFCHEX3", - INTTYPE: "X", - LENG: 3, - OUTPUTLEN: 6, - ROLLNAME: "RFCHEX3", - }, - text: { - FIELDTEXT: "HEX field of length 3", - REPTEXT: "hex3", - SCRTEXT_L: "hex3", - SCRTEXT_M: "hex3", - SCRTEXT_S: "hex3", - }, - }, - RFCINT1: { - format: { - DATATYPE: "INT1", - DOMNAME: "RFCINT1", - INTTYPE: "b", - LENG: 3, - OUTPUTLEN: 3, - ROLLNAME: "RFCINT1", - }, - text: { - FIELDTEXT: "INT1 field", - REPTEXT: "INT1", - SCRTEXT_L: "INT1", - SCRTEXT_M: "INT1", - SCRTEXT_S: "INT1", - }, - }, - RFCINT2: { - format: { - DATATYPE: "INT2", - DOMNAME: "RFCINT2", - INTTYPE: "s", - LENG: 5, - OUTPUTLEN: 5, - ROLLNAME: "RFCINT2", - }, - text: { - FIELDTEXT: "INT2 field", - REPTEXT: "INT2", - SCRTEXT_L: "INT2", - SCRTEXT_M: "INT2", - SCRTEXT_S: "INT2", - }, - }, - RFCINT4: { - format: { - DATATYPE: "INT4", - DOMNAME: "RFCINT4", - INTTYPE: "I", - LENG: 10, - OUTPUTLEN: 10, - ROLLNAME: "RFCINT4", - }, - text: { - FIELDTEXT: "INT4 field", - REPTEXT: "INT4", - SCRTEXT_L: "INT4", - SCRTEXT_M: "INT4", - SCRTEXT_S: "INT4", - }, - }, - RFCTIME: { - format: { - DATATYPE: "TIMS", - DOMNAME: "RFCTIME", - INTTYPE: "T", - LENG: 6, - OUTPUTLEN: 8, - ROLLNAME: "RFCTIME", - }, - text: { - FIELDTEXT: "Validity Period", - REPTEXT: "Validity Period", - SCRTEXT_L: "Validity Period", - SCRTEXT_M: "Validity Period", - SCRTEXT_S: "Duration", - }, - }, - }, - SYST: { - LISEL: { - format: { - DATATYPE: "CHAR", - DOMNAME: "SYCHAR255", - INTTYPE: "C", - LENG: 255, - OUTPUTLEN: 255, - ROLLNAME: "SYST_LISEL", - }, - text: { - FIELDTEXT: "ABAP System Field: Content of Selected List Line", - REPTEXT: "Line Content", - SCRTEXT_L: "Line Content", - SCRTEXT_M: "Line Content", - SCRTEXT_S: "Line", - }, - }, - }, - }, - helps: {}, - parameters: { - STFC_CONNECTION: { - ECHOTEXT: { - FIELDNAME: "LISEL", - PARAMCLASS: "E", - PARAMTEXT: "", - TABNAME: "SYST", - functionName: "STFC_CONNECTION", - paramName: "ECHOTEXT", - paramType: "var", - required: true, - }, - REQUTEXT: { - FIELDNAME: "LISEL", - PARAMCLASS: "I", - PARAMTEXT: "", - TABNAME: "SYST", - functionName: "STFC_CONNECTION", - paramName: "REQUTEXT", - paramType: "var", - required: true, - }, - RESPTEXT: { - FIELDNAME: "LISEL", - PARAMCLASS: "E", - PARAMTEXT: "", - TABNAME: "SYST", - functionName: "STFC_CONNECTION", - paramName: "RESPTEXT", - paramType: "var", - required: true, - }, - }, - STFC_STRUCTURE: { - ECHOSTRUCT: { - PARAMCLASS: "E", - PARAMTEXT: "Exporting structure", - TABNAME: "RFCTEST", - functionName: "STFC_STRUCTURE", - paramName: "ECHOSTRUCT", - paramType: "struct", - required: true, - }, - IMPORTSTRUCT: { - PARAMCLASS: "I", - PARAMTEXT: "Importing structure", - TABNAME: "RFCTEST", - functionName: "STFC_STRUCTURE", - paramName: "IMPORTSTRUCT", - paramType: "struct", - required: true, - }, - RESPTEXT: { - FIELDNAME: "LISEL", - PARAMCLASS: "E", - PARAMTEXT: "Exporting response message", - TABNAME: "SYST", - functionName: "STFC_STRUCTURE", - paramName: "RESPTEXT", - paramType: "var", - required: true, - }, - RFCTABLE: { - PARAMCLASS: "T", - PARAMTEXT: "Importing/exporting table", - TABNAME: "RFCTEST", - functionName: "STFC_STRUCTURE", - paramName: "RFCTABLE", - paramType: "table", - required: true, - }, - }, - }, - stat: { - STFC_CONNECTION: { exception: 0, struct: 0, table: 0, var: 3 }, - STFC_STRUCTURE: { exception: 0, struct: 2, table: 1, var: 1 }, - }, - usage: { RFCTEST: ["STFC_STRUCTURE"] }, - }, - frontend: { - STFC_CONNECTION: { - js: - "//\n" + - "// STFC_CONNECTION var: 3 struct: 0 table: 0 exception: 0\n" + - "//\n" + - "// abap api\n" + - "//\n" + - "\n" + - "// prettier-ignore\n" + - "const parameters = {\n" + - "\n" + - "// IMPORT PARAMETERS\n" + - "\n" + - 'REQUTEXT : "", // CHAR (255) no text (en)\n' + - "\n" + - "// EXPORT PARAMETERS\n" + - "\n" + - '// ECHOTEXT : "", // CHAR (255) no text (en)\n' + - '// RESPTEXT : "", // CHAR (255) no text (en)\n' + - "};\n" + - "\n" + - 'const result = await client.call("STFC_CONNECTION", parameters);\n' + - "\n" + - "//\n" + - "// IMPORT PARAMETERS\n" + - "//\n" + - "\n" + - "\n" + - "//\n" + - "// EXPORT PARAMETERS\n" + - "//\n", - }, - STFC_STRUCTURE: { - js: - "//\n" + - "// STFC_STRUCTURE var: 1 struct: 2 table: 1 exception: 0\n" + - "//\n" + - "// abap api\n" + - "//\n" + - "\n" + - "// prettier-ignore\n" + - "const parameters = {\n" + - "\n" + - "// IMPORT PARAMETERS\n" + - "\n" + - "IMPORTSTRUCT : {}, // RFCTEST Importing structure\n" + - "\n" + - "// TABLE PARAMETERS\n" + - "\n" + - "RFCTABLE : [], // RFCTEST Importing/exporting table\n" + - "\n" + - "// EXPORT PARAMETERS\n" + - "\n" + - '// RESPTEXT : "", // CHAR (255) Exporting response message\n' + - "// ECHOSTRUCT : {}, // RFCTEST Exporting structure\n" + - "};\n" + - "\n" + - 'const result = await client.call("STFC_STRUCTURE", parameters);\n' + - "\n" + - "//\n" + - "// IMPORT PARAMETERS\n" + - "//\n" + - "\n" + - "// RFCTEST Importing structure\n" + - "\n" + - "// prettier-ignore\n" + - "const IMPORTSTRUCT= {\n" + - ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + - ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + - " RFCINT2 : 0, // INT2 (5) INT2 field\n" + - " RFCINT1 : 0, // INT1 (3) INT1 field\n" + - ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + - " RFCINT4 : 0, // INT4 (10) INT4 field\n" + - " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + - ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + - ' RFCTIME : "", // TIMS (6) Validity Period\n' + - ' RFCDATE : "", // DATS (8) Date field\n' + - ' RFCDATA1 : "", // CHAR (50) Comment\n' + - ' RFCDATA2 : "", // CHAR (50) Comment\n' + - "};\n" + - "\n" + - "\n" + - "//\n" + - "// TABLE PARAMETERS\n" + - "//\n" + - "\n" + - "// RFCTEST Importing/exporting table\n" + - "const RFCTABLE= [];\n" + - "\n" + - "// prettier-ignore\n" + - "const RFCTABLE= {\n" + - ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + - ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + - " RFCINT2 : 0, // INT2 (5) INT2 field\n" + - " RFCINT1 : 0, // INT1 (3) INT1 field\n" + - ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + - " RFCINT4 : 0, // INT4 (10) INT4 field\n" + - " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + - ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + - ' RFCTIME : "", // TIMS (6) Validity Period\n' + - ' RFCDATE : "", // DATS (8) Date field\n' + - ' RFCDATA1 : "", // CHAR (50) Comment\n' + - ' RFCDATA2 : "", // CHAR (50) Comment\n' + - "};\n" + - "\n" + - "\n" + - "//\n" + - "// EXPORT PARAMETERS\n" + - "//\n" + - "\n" + - "// RFCTEST Exporting structure\n" + - "\n" + - "// prettier-ignore\n" + - "const ECHOSTRUCT= {\n" + - ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + - ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + - " RFCINT2 : 0, // INT2 (5) INT2 field\n" + - " RFCINT1 : 0, // INT1 (3) INT1 field\n" + - ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + - " RFCINT4 : 0, // INT4 (10) INT4 field\n" + - " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + - ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + - ' RFCTIME : "", // TIMS (6) Validity Period\n' + - ' RFCDATE : "", // DATS (8) Date field\n' + - ' RFCDATA1 : "", // CHAR (50) Comment\n' + - ' RFCDATA2 : "", // CHAR (50) Comment\n' + - "};\n", - }, - }, - }; + const result = await api.call(cp, "stfc_connection"); + + expect(Object.keys(result)).toEqual(["frontend"]); + expect(result.frontend).toMatchObject(Result.Call1.frontend); + }); + + test("call: array rfm, destination", async () => { + expect.assertions(2); + + const result = await api.call("MME", ["stfc_connection", "stfc_structure"]); - test("api: single rfm, destination", async () => { + expect(Object.keys(result)).toEqual(["frontend"]); + expect(result.frontend).toMatchObject(Result.Call2.frontend); + }); + + test("get : stfc_connection destination", async () => { expect.assertions(2); + const result = await api.get("MME", "stfc_connection"); - expect(result.annotations).toMatchObject(RESULT1.annotations); - expect(result.frontend).toMatchObject(RESULT1.frontend); + expect(result.annotations).toMatchObject(Result.GetStfcConn.annotations); + expect(result.frontend).toMatchObject(Result.GetStfcConn.frontend); }); - test("api: single rfm, connection parameters", async () => { + test("get : stfc_structure, connection parameters", async () => { expect.assertions(2); - const result = await api.get(cp, "stfc_connection"); - expect(result.annotations).toMatchObject(RESULT1.annotations); - expect(result.frontend).toMatchObject(RESULT1.frontend); + const result = await api.get(cp, "stfc_structure"); + + expect(result.annotations).toEqual(Result.GetStfcStruct.annotations); + expect(result.frontend).toMatchObject(Result.GetStfcStruct.frontend); }); - test("api: array rfm, destination", async () => { + test("get : array rfm, destination", async () => { expect.assertions(2); + const result = await api.get("MME", ["stfc_connection", "stfc_structure"]); - expect(result.annotations).toMatchObject(RESULT2.annotations); - expect(result.frontend).toMatchObject(RESULT2.frontend); + expect(result.annotations).toMatchObject(Result.Get2.annotations); + expect(result.frontend).toMatchObject(Result.Get2.frontend); + }); + + test("make: stfc_structure", async () => { + expect.assertions(1); + + const result = api.make( + Result.GetStfcStruct.annotations, + "fundamental-ngx" + ); + + expect(result.frontend.STFC_STRUCTURE.html).toEqual( + Result.MakeStfcStruct.frontend.STFC_STRUCTURE.html + ); }); }); diff --git a/abap-api-tools/tests/results.js b/abap-api-tools/tests/results.js new file mode 100644 index 00000000..3df71421 --- /dev/null +++ b/abap-api-tools/tests/results.js @@ -0,0 +1,1544 @@ +exports.Call1 = { + frontend: { + STFC_CONNECTION: { + js: + "//\n" + + "// STFC_CONNECTION var: 3 struct: 0 table: 0 exception: 0\n" + + "//\n" + + "// abap api\n" + + "//\n" + + "\n" + + "// prettier-ignore\n" + + "const parameters = {\n" + + "\n" + + "// IMPORT PARAMETERS\n" + + "\n" + + 'REQUTEXT : "", // CHAR (255) no text (en)\n' + + "\n" + + "// EXPORT PARAMETERS\n" + + "\n" + + '// ECHOTEXT : "", // CHAR (255) no text (en)\n' + + '// RESPTEXT : "", // CHAR (255) no text (en)\n' + + "};\n" + + "\n" + + 'const result = await client.call("STFC_CONNECTION", parameters);\n' + + "\n" + + "//\n" + + "// IMPORT PARAMETERS\n" + + "//\n" + + "\n" + + "\n" + + "//\n" + + "// EXPORT PARAMETERS\n" + + "//\n", + }, + }, +}; + +exports.Call2 = { + frontend: { + STFC_CONNECTION: { + js: + "//\n" + + "// STFC_CONNECTION var: 3 struct: 0 table: 0 exception: 0\n" + + "//\n" + + "// abap api\n" + + "//\n" + + "\n" + + "// prettier-ignore\n" + + "const parameters = {\n" + + "\n" + + "// IMPORT PARAMETERS\n" + + "\n" + + 'REQUTEXT : "", // CHAR (255) no text (en)\n' + + "\n" + + "// EXPORT PARAMETERS\n" + + "\n" + + '// ECHOTEXT : "", // CHAR (255) no text (en)\n' + + '// RESPTEXT : "", // CHAR (255) no text (en)\n' + + "};\n" + + "\n" + + 'const result = await client.call("STFC_CONNECTION", parameters);\n' + + "\n" + + "//\n" + + "// IMPORT PARAMETERS\n" + + "//\n" + + "\n" + + "\n" + + "//\n" + + "// EXPORT PARAMETERS\n" + + "//\n", + }, + STFC_STRUCTURE: { + js: + "//\n" + + "// STFC_STRUCTURE var: 1 struct: 2 table: 1 exception: 0\n" + + "//\n" + + "// abap api\n" + + "//\n" + + "\n" + + "// prettier-ignore\n" + + "const parameters = {\n" + + "\n" + + "// IMPORT PARAMETERS\n" + + "\n" + + "IMPORTSTRUCT : {}, // RFCTEST Importing structure\n" + + "\n" + + "// TABLE PARAMETERS\n" + + "\n" + + "RFCTABLE : [], // RFCTEST Importing/exporting table\n" + + "\n" + + "// EXPORT PARAMETERS\n" + + "\n" + + '// RESPTEXT : "", // CHAR (255) Exporting response message\n' + + "// ECHOSTRUCT : {}, // RFCTEST Exporting structure\n" + + "};\n" + + "\n" + + 'const result = await client.call("STFC_STRUCTURE", parameters);\n' + + "\n" + + "//\n" + + "// IMPORT PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Importing structure\n" + + "\n" + + "// prettier-ignore\n" + + "const IMPORTSTRUCT= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n" + + "\n" + + "\n" + + "//\n" + + "// TABLE PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Importing/exporting table\n" + + "const RFCTABLE= [];\n" + + "\n" + + "// prettier-ignore\n" + + "const RFCTABLE= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n" + + "\n" + + "\n" + + "//\n" + + "// EXPORT PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Exporting structure\n" + + "\n" + + "// prettier-ignore\n" + + "const ECHOSTRUCT= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n", + }, + }, +}; + +exports.GetStfcConn = { + annotations: { + alpha: { all: [], rfm: {} }, + fields: { + SYST: { + LISEL: { + format: { + DATATYPE: "CHAR", + DOMNAME: "SYCHAR255", + INTTYPE: "C", + LENG: 255, + OUTPUTLEN: 255, + ROLLNAME: "SYST_LISEL", + }, + text: { + FIELDTEXT: "ABAP System Field: Content of Selected List Line", + REPTEXT: "Line Content", + SCRTEXT_L: "Line Content", + SCRTEXT_M: "Line Content", + SCRTEXT_S: "Line", + }, + }, + }, + }, + helps: {}, + parameters: { + STFC_CONNECTION: { + ECHOTEXT: { + FIELDNAME: "LISEL", + PARAMCLASS: "E", + PARAMTEXT: "", + TABNAME: "SYST", + functionName: "STFC_CONNECTION", + paramName: "ECHOTEXT", + paramType: "var", + required: true, + }, + REQUTEXT: { + FIELDNAME: "LISEL", + PARAMCLASS: "I", + PARAMTEXT: "", + TABNAME: "SYST", + functionName: "STFC_CONNECTION", + paramName: "REQUTEXT", + paramType: "var", + required: true, + }, + RESPTEXT: { + FIELDNAME: "LISEL", + PARAMCLASS: "E", + PARAMTEXT: "", + TABNAME: "SYST", + functionName: "STFC_CONNECTION", + paramName: "RESPTEXT", + paramType: "var", + required: true, + }, + }, + }, + stat: { + STFC_CONNECTION: { exception: 0, struct: 0, table: 0, var: 3 }, + }, + usage: {}, + }, + frontend: { + STFC_CONNECTION: { + js: + "//\n" + + "// STFC_CONNECTION var: 3 struct: 0 table: 0 exception: 0\n" + + "//\n" + + "// abap api\n" + + "//\n" + + "\n" + + "// prettier-ignore\n" + + "const parameters = {\n" + + "\n" + + "// IMPORT PARAMETERS\n" + + "\n" + + 'REQUTEXT : "", // CHAR (255) no text (en)\n' + + "\n" + + "// EXPORT PARAMETERS\n" + + "\n" + + '// ECHOTEXT : "", // CHAR (255) no text (en)\n' + + '// RESPTEXT : "", // CHAR (255) no text (en)\n' + + "};\n" + + "\n" + + 'const result = await client.call("STFC_CONNECTION", parameters);\n' + + "\n" + + "//\n" + + "// IMPORT PARAMETERS\n" + + "//\n" + + "\n" + + "\n" + + "//\n" + + "// EXPORT PARAMETERS\n" + + "//\n", + }, + }, +}; + +exports.GetStfcStruct = { + annotations: { + alpha: { all: [], rfm: {} }, + fields: { + RFCTEST: { + RFCCHAR1: { + format: { + DATATYPE: "CHAR", + DOMNAME: "RFCCHAR1", + INTTYPE: "C", + LENG: 1, + LOWERCASE: "X", + OUTPUTLEN: 1, + ROLLNAME: "RFCCHAR1", + }, + text: { + FIELDTEXT: "Character field of length 1", + REPTEXT: "char1", + SCRTEXT_L: "char1", + SCRTEXT_M: "char1", + SCRTEXT_S: "char1", + }, + }, + RFCCHAR2: { + format: { + DATATYPE: "CHAR", + DOMNAME: "RFCCHAR2", + INTTYPE: "C", + LENG: 2, + OUTPUTLEN: 2, + ROLLNAME: "RFCCHAR2", + }, + text: { + FIELDTEXT: "Character field of length 2", + REPTEXT: "char2", + SCRTEXT_L: "char2", + SCRTEXT_M: "char2", + SCRTEXT_S: "char2", + }, + }, + RFCCHAR4: { + format: { + DATATYPE: "CHAR", + DOMNAME: "RFCCHAR4", + INTTYPE: "C", + LENG: 4, + LOWERCASE: "X", + OUTPUTLEN: 4, + ROLLNAME: "RFCCHAR4", + }, + text: { + FIELDTEXT: "Character field of length 4", + REPTEXT: "char4", + SCRTEXT_L: "char4", + SCRTEXT_M: "char4", + SCRTEXT_S: "char4", + }, + }, + RFCDATA1: { + format: { + DATATYPE: "CHAR", + DOMNAME: "TEXT50", + INTTYPE: "C", + LENG: 50, + LOWERCASE: "X", + OUTPUTLEN: 50, + ROLLNAME: "CHAR50", + }, + text: { + FIELDTEXT: "Comment", + REPTEXT: "c", + SCRTEXT_L: "c", + SCRTEXT_M: "c", + SCRTEXT_S: "c", + }, + }, + RFCDATA2: { + format: { + DATATYPE: "CHAR", + DOMNAME: "TEXT50", + INTTYPE: "C", + LENG: 50, + LOWERCASE: "X", + OUTPUTLEN: 50, + ROLLNAME: "CHAR50", + }, + text: { + FIELDTEXT: "Comment", + REPTEXT: "c", + SCRTEXT_L: "c", + SCRTEXT_M: "c", + SCRTEXT_S: "c", + }, + }, + RFCDATE: { + format: { + DATATYPE: "DATS", + DOMNAME: "RFCDATE", + INTTYPE: "D", + LENG: 8, + OUTPUTLEN: 10, + ROLLNAME: "RFCDATE", + }, + text: { + FIELDTEXT: "Date field", + REPTEXT: "Date", + SCRTEXT_L: "Date", + SCRTEXT_M: "Date", + SCRTEXT_S: "Date", + }, + }, + RFCFLOAT: { + format: { + DATATYPE: "FLTP", + DECIMALS: 16, + DOMNAME: "RFCFLOAT", + INTTYPE: "F", + LENG: 16, + OUTPUTLEN: 22, + ROLLNAME: "RFCFLOAT", + }, + text: { + FIELDTEXT: "Float field", + REPTEXT: "Float", + SCRTEXT_L: "Float", + SCRTEXT_M: "Float", + SCRTEXT_S: "Float", + }, + }, + RFCHEX3: { + format: { + DATATYPE: "RAW", + DOMNAME: "RFCHEX3", + INTTYPE: "X", + LENG: 3, + OUTPUTLEN: 6, + ROLLNAME: "RFCHEX3", + }, + text: { + FIELDTEXT: "HEX field of length 3", + REPTEXT: "hex3", + SCRTEXT_L: "hex3", + SCRTEXT_M: "hex3", + SCRTEXT_S: "hex3", + }, + }, + RFCINT1: { + format: { + DATATYPE: "INT1", + DOMNAME: "RFCINT1", + INTTYPE: "b", + LENG: 3, + OUTPUTLEN: 3, + ROLLNAME: "RFCINT1", + }, + text: { + FIELDTEXT: "INT1 field", + REPTEXT: "INT1", + SCRTEXT_L: "INT1", + SCRTEXT_M: "INT1", + SCRTEXT_S: "INT1", + }, + }, + RFCINT2: { + format: { + DATATYPE: "INT2", + DOMNAME: "RFCINT2", + INTTYPE: "s", + LENG: 5, + OUTPUTLEN: 5, + ROLLNAME: "RFCINT2", + }, + text: { + FIELDTEXT: "INT2 field", + REPTEXT: "INT2", + SCRTEXT_L: "INT2", + SCRTEXT_M: "INT2", + SCRTEXT_S: "INT2", + }, + }, + RFCINT4: { + format: { + DATATYPE: "INT4", + DOMNAME: "RFCINT4", + INTTYPE: "I", + LENG: 10, + OUTPUTLEN: 10, + ROLLNAME: "RFCINT4", + }, + text: { + FIELDTEXT: "INT4 field", + REPTEXT: "INT4", + SCRTEXT_L: "INT4", + SCRTEXT_M: "INT4", + SCRTEXT_S: "INT4", + }, + }, + RFCTIME: { + format: { + DATATYPE: "TIMS", + DOMNAME: "RFCTIME", + INTTYPE: "T", + LENG: 6, + OUTPUTLEN: 8, + ROLLNAME: "RFCTIME", + }, + text: { + FIELDTEXT: "Validity Period", + REPTEXT: "Validity Period", + SCRTEXT_L: "Validity Period", + SCRTEXT_M: "Validity Period", + SCRTEXT_S: "Duration", + }, + }, + }, + SYST: { + LISEL: { + format: { + DATATYPE: "CHAR", + DOMNAME: "SYCHAR255", + INTTYPE: "C", + LENG: 255, + OUTPUTLEN: 255, + ROLLNAME: "SYST_LISEL", + }, + text: { + FIELDTEXT: "ABAP System Field: Content of Selected List Line", + REPTEXT: "Line Content", + SCRTEXT_L: "Line Content", + SCRTEXT_M: "Line Content", + SCRTEXT_S: "Line", + }, + }, + }, + }, + helps: {}, + parameters: { + STFC_STRUCTURE: { + ECHOSTRUCT: { + PARAMCLASS: "E", + PARAMTEXT: "Exporting structure", + TABNAME: "RFCTEST", + functionName: "STFC_STRUCTURE", + paramName: "ECHOSTRUCT", + paramType: "struct", + required: true, + }, + IMPORTSTRUCT: { + PARAMCLASS: "I", + PARAMTEXT: "Importing structure", + TABNAME: "RFCTEST", + functionName: "STFC_STRUCTURE", + paramName: "IMPORTSTRUCT", + paramType: "struct", + required: true, + }, + RESPTEXT: { + FIELDNAME: "LISEL", + PARAMCLASS: "E", + PARAMTEXT: "Exporting response message", + TABNAME: "SYST", + functionName: "STFC_STRUCTURE", + paramName: "RESPTEXT", + paramType: "var", + required: true, + }, + RFCTABLE: { + PARAMCLASS: "T", + PARAMTEXT: "Importing/exporting table", + TABNAME: "RFCTEST", + functionName: "STFC_STRUCTURE", + paramName: "RFCTABLE", + paramType: "table", + required: true, + }, + }, + }, + stat: { STFC_STRUCTURE: { exception: 0, struct: 2, table: 1, var: 1 } }, + usage: { RFCTEST: ["STFC_STRUCTURE"] }, + }, + frontend: { + STFC_STRUCTURE: { + js: + "//\n" + + "// STFC_STRUCTURE var: 1 struct: 2 table: 1 exception: 0\n" + + "//\n" + + "// abap api\n" + + "//\n" + + "\n" + + "// prettier-ignore\n" + + "const parameters = {\n" + + "\n" + + "// IMPORT PARAMETERS\n" + + "\n" + + "IMPORTSTRUCT : {}, // RFCTEST Importing structure\n" + + "\n" + + "// TABLE PARAMETERS\n" + + "\n" + + "RFCTABLE : [], // RFCTEST Importing/exporting table\n" + + "\n" + + "// EXPORT PARAMETERS\n" + + "\n" + + '// RESPTEXT : "", // CHAR (255) Exporting response message\n' + + "// ECHOSTRUCT : {}, // RFCTEST Exporting structure\n" + + "};\n" + + "\n" + + 'const result = await client.call("STFC_STRUCTURE", parameters);\n' + + "\n" + + "//\n" + + "// IMPORT PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Importing structure\n" + + "\n" + + "// prettier-ignore\n" + + "const IMPORTSTRUCT= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n" + + "\n" + + "\n" + + "//\n" + + "// TABLE PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Importing/exporting table\n" + + "const RFCTABLE= [];\n" + + "\n" + + "// prettier-ignore\n" + + "const RFCTABLE= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n" + + "\n" + + "\n" + + "//\n" + + "// EXPORT PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Exporting structure\n" + + "\n" + + "// prettier-ignore\n" + + "const ECHOSTRUCT= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n", + }, + }, +}; + +exports.Get2 = { + annotations: { + alpha: { all: [], rfm: {} }, + fields: { + RFCTEST: { + RFCCHAR1: { + format: { + DATATYPE: "CHAR", + DOMNAME: "RFCCHAR1", + INTTYPE: "C", + LENG: 1, + LOWERCASE: "X", + OUTPUTLEN: 1, + ROLLNAME: "RFCCHAR1", + }, + text: { + FIELDTEXT: "Character field of length 1", + REPTEXT: "char1", + SCRTEXT_L: "char1", + SCRTEXT_M: "char1", + SCRTEXT_S: "char1", + }, + }, + RFCCHAR2: { + format: { + DATATYPE: "CHAR", + DOMNAME: "RFCCHAR2", + INTTYPE: "C", + LENG: 2, + OUTPUTLEN: 2, + ROLLNAME: "RFCCHAR2", + }, + text: { + FIELDTEXT: "Character field of length 2", + REPTEXT: "char2", + SCRTEXT_L: "char2", + SCRTEXT_M: "char2", + SCRTEXT_S: "char2", + }, + }, + RFCCHAR4: { + format: { + DATATYPE: "CHAR", + DOMNAME: "RFCCHAR4", + INTTYPE: "C", + LENG: 4, + LOWERCASE: "X", + OUTPUTLEN: 4, + ROLLNAME: "RFCCHAR4", + }, + text: { + FIELDTEXT: "Character field of length 4", + REPTEXT: "char4", + SCRTEXT_L: "char4", + SCRTEXT_M: "char4", + SCRTEXT_S: "char4", + }, + }, + RFCDATA1: { + format: { + DATATYPE: "CHAR", + DOMNAME: "TEXT50", + INTTYPE: "C", + LENG: 50, + LOWERCASE: "X", + OUTPUTLEN: 50, + ROLLNAME: "CHAR50", + }, + text: { + FIELDTEXT: "Comment", + REPTEXT: "c", + SCRTEXT_L: "c", + SCRTEXT_M: "c", + SCRTEXT_S: "c", + }, + }, + RFCDATA2: { + format: { + DATATYPE: "CHAR", + DOMNAME: "TEXT50", + INTTYPE: "C", + LENG: 50, + LOWERCASE: "X", + OUTPUTLEN: 50, + ROLLNAME: "CHAR50", + }, + text: { + FIELDTEXT: "Comment", + REPTEXT: "c", + SCRTEXT_L: "c", + SCRTEXT_M: "c", + SCRTEXT_S: "c", + }, + }, + RFCDATE: { + format: { + DATATYPE: "DATS", + DOMNAME: "RFCDATE", + INTTYPE: "D", + LENG: 8, + OUTPUTLEN: 10, + ROLLNAME: "RFCDATE", + }, + text: { + FIELDTEXT: "Date field", + REPTEXT: "Date", + SCRTEXT_L: "Date", + SCRTEXT_M: "Date", + SCRTEXT_S: "Date", + }, + }, + RFCFLOAT: { + format: { + DATATYPE: "FLTP", + DECIMALS: 16, + DOMNAME: "RFCFLOAT", + INTTYPE: "F", + LENG: 16, + OUTPUTLEN: 22, + ROLLNAME: "RFCFLOAT", + }, + text: { + FIELDTEXT: "Float field", + REPTEXT: "Float", + SCRTEXT_L: "Float", + SCRTEXT_M: "Float", + SCRTEXT_S: "Float", + }, + }, + RFCHEX3: { + format: { + DATATYPE: "RAW", + DOMNAME: "RFCHEX3", + INTTYPE: "X", + LENG: 3, + OUTPUTLEN: 6, + ROLLNAME: "RFCHEX3", + }, + text: { + FIELDTEXT: "HEX field of length 3", + REPTEXT: "hex3", + SCRTEXT_L: "hex3", + SCRTEXT_M: "hex3", + SCRTEXT_S: "hex3", + }, + }, + RFCINT1: { + format: { + DATATYPE: "INT1", + DOMNAME: "RFCINT1", + INTTYPE: "b", + LENG: 3, + OUTPUTLEN: 3, + ROLLNAME: "RFCINT1", + }, + text: { + FIELDTEXT: "INT1 field", + REPTEXT: "INT1", + SCRTEXT_L: "INT1", + SCRTEXT_M: "INT1", + SCRTEXT_S: "INT1", + }, + }, + RFCINT2: { + format: { + DATATYPE: "INT2", + DOMNAME: "RFCINT2", + INTTYPE: "s", + LENG: 5, + OUTPUTLEN: 5, + ROLLNAME: "RFCINT2", + }, + text: { + FIELDTEXT: "INT2 field", + REPTEXT: "INT2", + SCRTEXT_L: "INT2", + SCRTEXT_M: "INT2", + SCRTEXT_S: "INT2", + }, + }, + RFCINT4: { + format: { + DATATYPE: "INT4", + DOMNAME: "RFCINT4", + INTTYPE: "I", + LENG: 10, + OUTPUTLEN: 10, + ROLLNAME: "RFCINT4", + }, + text: { + FIELDTEXT: "INT4 field", + REPTEXT: "INT4", + SCRTEXT_L: "INT4", + SCRTEXT_M: "INT4", + SCRTEXT_S: "INT4", + }, + }, + RFCTIME: { + format: { + DATATYPE: "TIMS", + DOMNAME: "RFCTIME", + INTTYPE: "T", + LENG: 6, + OUTPUTLEN: 8, + ROLLNAME: "RFCTIME", + }, + text: { + FIELDTEXT: "Validity Period", + REPTEXT: "Validity Period", + SCRTEXT_L: "Validity Period", + SCRTEXT_M: "Validity Period", + SCRTEXT_S: "Duration", + }, + }, + }, + SYST: { + LISEL: { + format: { + DATATYPE: "CHAR", + DOMNAME: "SYCHAR255", + INTTYPE: "C", + LENG: 255, + OUTPUTLEN: 255, + ROLLNAME: "SYST_LISEL", + }, + text: { + FIELDTEXT: "ABAP System Field: Content of Selected List Line", + REPTEXT: "Line Content", + SCRTEXT_L: "Line Content", + SCRTEXT_M: "Line Content", + SCRTEXT_S: "Line", + }, + }, + }, + }, + helps: {}, + parameters: { + STFC_CONNECTION: { + ECHOTEXT: { + FIELDNAME: "LISEL", + PARAMCLASS: "E", + PARAMTEXT: "", + TABNAME: "SYST", + functionName: "STFC_CONNECTION", + paramName: "ECHOTEXT", + paramType: "var", + required: true, + }, + REQUTEXT: { + FIELDNAME: "LISEL", + PARAMCLASS: "I", + PARAMTEXT: "", + TABNAME: "SYST", + functionName: "STFC_CONNECTION", + paramName: "REQUTEXT", + paramType: "var", + required: true, + }, + RESPTEXT: { + FIELDNAME: "LISEL", + PARAMCLASS: "E", + PARAMTEXT: "", + TABNAME: "SYST", + functionName: "STFC_CONNECTION", + paramName: "RESPTEXT", + paramType: "var", + required: true, + }, + }, + STFC_STRUCTURE: { + ECHOSTRUCT: { + PARAMCLASS: "E", + PARAMTEXT: "Exporting structure", + TABNAME: "RFCTEST", + functionName: "STFC_STRUCTURE", + paramName: "ECHOSTRUCT", + paramType: "struct", + required: true, + }, + IMPORTSTRUCT: { + PARAMCLASS: "I", + PARAMTEXT: "Importing structure", + TABNAME: "RFCTEST", + functionName: "STFC_STRUCTURE", + paramName: "IMPORTSTRUCT", + paramType: "struct", + required: true, + }, + RESPTEXT: { + FIELDNAME: "LISEL", + PARAMCLASS: "E", + PARAMTEXT: "Exporting response message", + TABNAME: "SYST", + functionName: "STFC_STRUCTURE", + paramName: "RESPTEXT", + paramType: "var", + required: true, + }, + RFCTABLE: { + PARAMCLASS: "T", + PARAMTEXT: "Importing/exporting table", + TABNAME: "RFCTEST", + functionName: "STFC_STRUCTURE", + paramName: "RFCTABLE", + paramType: "table", + required: true, + }, + }, + }, + stat: { + STFC_CONNECTION: { exception: 0, struct: 0, table: 0, var: 3 }, + STFC_STRUCTURE: { exception: 0, struct: 2, table: 1, var: 1 }, + }, + usage: { RFCTEST: ["STFC_STRUCTURE"] }, + }, + frontend: { + STFC_CONNECTION: { + js: + "//\n" + + "// STFC_CONNECTION var: 3 struct: 0 table: 0 exception: 0\n" + + "//\n" + + "// abap api\n" + + "//\n" + + "\n" + + "// prettier-ignore\n" + + "const parameters = {\n" + + "\n" + + "// IMPORT PARAMETERS\n" + + "\n" + + 'REQUTEXT : "", // CHAR (255) no text (en)\n' + + "\n" + + "// EXPORT PARAMETERS\n" + + "\n" + + '// ECHOTEXT : "", // CHAR (255) no text (en)\n' + + '// RESPTEXT : "", // CHAR (255) no text (en)\n' + + "};\n" + + "\n" + + 'const result = await client.call("STFC_CONNECTION", parameters);\n' + + "\n" + + "//\n" + + "// IMPORT PARAMETERS\n" + + "//\n" + + "\n" + + "\n" + + "//\n" + + "// EXPORT PARAMETERS\n" + + "//\n", + }, + STFC_STRUCTURE: { + js: + "//\n" + + "// STFC_STRUCTURE var: 1 struct: 2 table: 1 exception: 0\n" + + "//\n" + + "// abap api\n" + + "//\n" + + "\n" + + "// prettier-ignore\n" + + "const parameters = {\n" + + "\n" + + "// IMPORT PARAMETERS\n" + + "\n" + + "IMPORTSTRUCT : {}, // RFCTEST Importing structure\n" + + "\n" + + "// TABLE PARAMETERS\n" + + "\n" + + "RFCTABLE : [], // RFCTEST Importing/exporting table\n" + + "\n" + + "// EXPORT PARAMETERS\n" + + "\n" + + '// RESPTEXT : "", // CHAR (255) Exporting response message\n' + + "// ECHOSTRUCT : {}, // RFCTEST Exporting structure\n" + + "};\n" + + "\n" + + 'const result = await client.call("STFC_STRUCTURE", parameters);\n' + + "\n" + + "//\n" + + "// IMPORT PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Importing structure\n" + + "\n" + + "// prettier-ignore\n" + + "const IMPORTSTRUCT= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n" + + "\n" + + "\n" + + "//\n" + + "// TABLE PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Importing/exporting table\n" + + "const RFCTABLE= [];\n" + + "\n" + + "// prettier-ignore\n" + + "const RFCTABLE= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n" + + "\n" + + "\n" + + "//\n" + + "// EXPORT PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Exporting structure\n" + + "\n" + + "// prettier-ignore\n" + + "const ECHOSTRUCT= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n", + }, + }, +}; + +exports.MakeStfcStruct = { + frontend: { + STFC_STRUCTURE: { + js: + "//\n" + + "// STFC_STRUCTURE var: 1 struct: 2 table: 1 exception: 0\n" + + "//\n" + + "// abap api\n" + + "//\n" + + "\n" + + "// prettier-ignore\n" + + "const parameters = {\n" + + "\n" + + "// IMPORT PARAMETERS\n" + + "\n" + + "IMPORTSTRUCT : {}, // RFCTEST Importing structure\n" + + "\n" + + "// TABLE PARAMETERS\n" + + "\n" + + "RFCTABLE : [], // RFCTEST Importing/exporting table\n" + + "\n" + + "// EXPORT PARAMETERS\n" + + "\n" + + '// RESPTEXT : "", // CHAR (255) Exporting response message\n' + + "// ECHOSTRUCT : {}, // RFCTEST Exporting structure\n" + + "};\n" + + "\n" + + 'const result = await client.call("STFC_STRUCTURE", parameters);\n' + + "\n" + + "//\n" + + "// IMPORT PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Importing structure\n" + + "\n" + + "// prettier-ignore\n" + + "const IMPORTSTRUCT= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n" + + "\n" + + "\n" + + "//\n" + + "// TABLE PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Importing/exporting table\n" + + "const RFCTABLE= [];\n" + + "\n" + + "// prettier-ignore\n" + + "const RFCTABLE= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n" + + "\n" + + "\n" + + "//\n" + + "// EXPORT PARAMETERS\n" + + "//\n" + + "\n" + + "// RFCTEST Exporting structure\n" + + "\n" + + "// prettier-ignore\n" + + "const ECHOSTRUCT= {\n" + + ' RFCFLOAT : "0.0", // FLTP (16.16) Float field\n' + + ' RFCCHAR1 : "", // CHAR (1) Character field of length 1\n' + + " RFCINT2 : 0, // INT2 (5) INT2 field\n" + + " RFCINT1 : 0, // INT1 (3) INT1 field\n" + + ' RFCCHAR4 : "", // CHAR (4) Character field of length 4\n' + + " RFCINT4 : 0, // INT4 (10) INT4 field\n" + + " RFCHEX3 : bytes(), // RAW (3) HEX field of length 3\n" + + ' RFCCHAR2 : "", // CHAR (2) Character field of length 2\n' + + ' RFCTIME : "", // TIMS (6) Validity Period\n' + + ' RFCDATE : "", // DATS (8) Date field\n' + + ' RFCDATA1 : "", // CHAR (50) Comment\n' + + ' RFCDATA2 : "", // CHAR (50) Comment\n' + + "};\n", + html: ` + + + + + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + + + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Character field of length 1Character field of length 2Character field of length 4CommentCommentDate fieldFloat fieldHEX field of length 3INT1 fieldINT2 fieldINT4 fieldValidity Period
{{ RFCCHAR1 }}{{ RFCCHAR2 }}{{ RFCCHAR4 }}{{ RFCDATA1 }}{{ RFCDATA2 }}{{ RFCDATE }}{{ RFCFLOAT }}{{ RFCHEX3 }}{{ RFCINT1 }}{{ RFCINT2 }}{{ RFCINT4 }}{{ RFCTIME }}
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+`, + }, + }, +};