@abaplint/runtime 2.7.57 → 2.7.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/statements/call_function.d.ts +2 -1
- package/build/src/statements/call_function.js +30 -14
- package/build/src/statements/convert.js +3 -0
- package/build/src/statements/index.d.ts +4 -0
- package/build/src/statements/index.js +4 -0
- package/build/src/statements/receive.d.ts +9 -0
- package/build/src/statements/receive.js +40 -0
- package/build/src/statements/wait.d.ts +5 -0
- package/build/src/statements/wait.js +15 -0
- package/package.json +1 -1
|
@@ -1,35 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CallFunction = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const receive_1 = require("./receive");
|
|
4
6
|
class CallFunction {
|
|
5
7
|
constructor(context) {
|
|
6
8
|
this.context = context;
|
|
7
9
|
}
|
|
8
10
|
// note: this is only called if DESTINIATION is supplied
|
|
9
11
|
async callFunction(options) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
const param = {
|
|
13
|
+
exporting: options.exporting,
|
|
14
|
+
importing: options.importing,
|
|
15
|
+
tables: options.tables,
|
|
16
|
+
changing: options.changing,
|
|
17
|
+
exceptions: options.exceptions,
|
|
18
|
+
};
|
|
19
|
+
options.name = options.name.trimEnd();
|
|
20
|
+
if (options.destination) {
|
|
21
|
+
if (options.destination.trim() === "") {
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
await abap.FunctionModules[options.name](param);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const dest = this.context.RFCDestinations[options.destination];
|
|
27
|
+
if (dest === undefined) {
|
|
28
|
+
throw new Error(`RFC destination ${options.destination} does not exist`);
|
|
29
|
+
}
|
|
30
|
+
await dest.call(options.name, {
|
|
12
31
|
exporting: options.exporting,
|
|
13
32
|
importing: options.importing,
|
|
14
33
|
tables: options.tables,
|
|
15
34
|
changing: options.changing,
|
|
16
35
|
exceptions: options.exceptions,
|
|
17
|
-
};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else if (options.calling) {
|
|
18
39
|
// @ts-ignore
|
|
19
40
|
await abap.FunctionModules[options.name](param);
|
|
20
|
-
|
|
41
|
+
// save importing + tables + changing + exception for RECEIVE RESULTS
|
|
42
|
+
(0, receive_1._receiveSetResult)(param);
|
|
43
|
+
// call the callback, async
|
|
44
|
+
options.calling({ p_task: new types_1.Character(8).set("OPENABAP") });
|
|
21
45
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
throw new Error(`RFC destination ${options.destination} does not exist`);
|
|
46
|
+
else {
|
|
47
|
+
throw new Error("runtime: callFunction, unexpected input");
|
|
25
48
|
}
|
|
26
|
-
await dest.call(options.name, {
|
|
27
|
-
exporting: options.exporting,
|
|
28
|
-
importing: options.importing,
|
|
29
|
-
tables: options.tables,
|
|
30
|
-
changing: options.changing,
|
|
31
|
-
exceptions: options.exceptions,
|
|
32
|
-
});
|
|
33
49
|
}
|
|
34
50
|
}
|
|
35
51
|
exports.CallFunction = CallFunction;
|
|
@@ -16,6 +16,7 @@ import { cast } from "./cast";
|
|
|
16
16
|
import { getBit } from "./get_bit";
|
|
17
17
|
import { readReport } from "./read_report";
|
|
18
18
|
import { raiseEvent } from "./raise_event";
|
|
19
|
+
import { receive } from "./receive";
|
|
19
20
|
import { getLocale } from "./get_locale";
|
|
20
21
|
import { getParameter } from "./get_parameter";
|
|
21
22
|
import { setLocale } from "./set_locale";
|
|
@@ -35,6 +36,7 @@ import { rollback } from "./rollback";
|
|
|
35
36
|
import { setBit } from "./set_bit";
|
|
36
37
|
import { shift } from "./shift";
|
|
37
38
|
import { sort } from "./sort";
|
|
39
|
+
import { wait } from "./wait";
|
|
38
40
|
import { setHandler } from "./set_handler";
|
|
39
41
|
import { split } from "./split";
|
|
40
42
|
import { translate } from "./translate";
|
|
@@ -83,6 +85,8 @@ export declare class Statements {
|
|
|
83
85
|
sort: typeof sort;
|
|
84
86
|
split: typeof split;
|
|
85
87
|
translate: typeof translate;
|
|
88
|
+
wait: typeof wait;
|
|
89
|
+
receive: typeof receive;
|
|
86
90
|
private readonly context;
|
|
87
91
|
private readonly traceTotals;
|
|
88
92
|
constructor(context: Context);
|
|
@@ -19,6 +19,7 @@ const cast_1 = require("./cast");
|
|
|
19
19
|
const get_bit_1 = require("./get_bit");
|
|
20
20
|
const read_report_1 = require("./read_report");
|
|
21
21
|
const raise_event_1 = require("./raise_event");
|
|
22
|
+
const receive_1 = require("./receive");
|
|
22
23
|
const get_locale_1 = require("./get_locale");
|
|
23
24
|
const get_parameter_1 = require("./get_parameter");
|
|
24
25
|
const set_locale_1 = require("./set_locale");
|
|
@@ -39,6 +40,7 @@ const select_1 = require("./select");
|
|
|
39
40
|
const set_bit_1 = require("./set_bit");
|
|
40
41
|
const shift_1 = require("./shift");
|
|
41
42
|
const sort_1 = require("./sort");
|
|
43
|
+
const wait_1 = require("./wait");
|
|
42
44
|
const set_handler_1 = require("./set_handler");
|
|
43
45
|
const split_1 = require("./split");
|
|
44
46
|
const translate_1 = require("./translate");
|
|
@@ -86,6 +88,8 @@ class Statements {
|
|
|
86
88
|
this.sort = sort_1.sort;
|
|
87
89
|
this.split = split_1.split;
|
|
88
90
|
this.translate = translate_1.translate;
|
|
91
|
+
this.wait = wait_1.wait;
|
|
92
|
+
this.receive = receive_1.receive;
|
|
89
93
|
this.context = context;
|
|
90
94
|
this.traceTotals = {};
|
|
91
95
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface IReceiveOptions {
|
|
2
|
+
exporting?: any;
|
|
3
|
+
importing?: any;
|
|
4
|
+
tables?: any;
|
|
5
|
+
changing?: any;
|
|
6
|
+
exceptions?: any;
|
|
7
|
+
}
|
|
8
|
+
export declare function _receiveSetResult(options: IReceiveOptions): void;
|
|
9
|
+
export declare function receive(options: IReceiveOptions): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.receive = exports._receiveSetResult = void 0;
|
|
4
|
+
let cache = undefined;
|
|
5
|
+
function _receiveSetResult(options) {
|
|
6
|
+
cache = options;
|
|
7
|
+
}
|
|
8
|
+
exports._receiveSetResult = _receiveSetResult;
|
|
9
|
+
function receive(options) {
|
|
10
|
+
if (cache === undefined) {
|
|
11
|
+
throw new Error("runtime receive(), no results");
|
|
12
|
+
}
|
|
13
|
+
for (const a in cache.importing || []) {
|
|
14
|
+
const aval = cache.importing[a];
|
|
15
|
+
const bval = options.importing[a];
|
|
16
|
+
if (bval === undefined) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
bval.set(aval);
|
|
20
|
+
}
|
|
21
|
+
for (const a in cache.tables || []) {
|
|
22
|
+
const aval = cache.tables[a];
|
|
23
|
+
const bval = options.tables[a];
|
|
24
|
+
if (bval === undefined) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
bval.set(aval);
|
|
28
|
+
}
|
|
29
|
+
for (const a in cache.changing || []) {
|
|
30
|
+
const aval = cache.changing[a];
|
|
31
|
+
const bval = options.changing[a];
|
|
32
|
+
if (bval === undefined) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
bval.set(aval);
|
|
36
|
+
}
|
|
37
|
+
cache = undefined;
|
|
38
|
+
}
|
|
39
|
+
exports.receive = receive;
|
|
40
|
+
//# sourceMappingURL=receive.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wait = void 0;
|
|
4
|
+
async function wait(options) {
|
|
5
|
+
await new Promise(r => setTimeout(r, 50));
|
|
6
|
+
while (true) {
|
|
7
|
+
if (options.cond() === true) {
|
|
8
|
+
break;
|
|
9
|
+
}
|
|
10
|
+
await new Promise(r => setTimeout(r, 500));
|
|
11
|
+
console.log("WAIT waiting another round");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.wait = wait;
|
|
15
|
+
//# sourceMappingURL=wait.js.map
|