@abaplint/runtime 2.1.57 → 2.1.60
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.
|
@@ -3,50 +3,61 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createData = void 0;
|
|
4
4
|
const clone_1 = require("../clone");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
|
+
function throwGlobalException(name) {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
if (abap.Classes[name] !== undefined) {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
throw new abap.Classes[name]();
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
throw `Global class ${name} not found`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
6
16
|
function createData(target, options) {
|
|
7
17
|
// console.dir(options);
|
|
8
18
|
if ((options === null || options === void 0 ? void 0 : options.name) && (options === null || options === void 0 ? void 0 : options.table)) {
|
|
9
19
|
// @ts-ignore
|
|
10
20
|
if (abap.DDIC[options.name] === undefined) {
|
|
11
|
-
|
|
12
|
-
return;
|
|
21
|
+
throwGlobalException("CX_SY_CREATE_DATA_ERROR");
|
|
13
22
|
}
|
|
14
23
|
// @ts-ignore
|
|
15
24
|
target.assign(new abap.types.Table(abap.DDIC[options.name].type));
|
|
16
25
|
}
|
|
17
|
-
else if (options === null || options === void 0 ? void 0 : options.
|
|
18
|
-
|
|
26
|
+
else if (options === null || options === void 0 ? void 0 : options.name) {
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
if (abap.DDIC[options.name] === undefined) {
|
|
29
|
+
throwGlobalException("CX_SY_CREATE_DATA_ERROR");
|
|
30
|
+
}
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
target.assign((0, clone_1.clone)(abap.DDIC[options.name].type));
|
|
33
|
+
}
|
|
34
|
+
else if (options === null || options === void 0 ? void 0 : options.typeName) {
|
|
35
|
+
switch (options.typeName) {
|
|
36
|
+
case "C":
|
|
37
|
+
{
|
|
38
|
+
let length = 1;
|
|
39
|
+
if (options.length) {
|
|
40
|
+
length = options.length.get();
|
|
41
|
+
}
|
|
42
|
+
target.assign(new types_1.Character({ length: length }));
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
19
45
|
case "F":
|
|
20
46
|
target.assign(new types_1.Float());
|
|
21
47
|
break;
|
|
22
|
-
case "I":
|
|
23
|
-
target.assign(new types_1.Integer());
|
|
24
|
-
break;
|
|
25
48
|
case "D":
|
|
26
49
|
target.assign(new types_1.Date());
|
|
27
50
|
break;
|
|
28
51
|
case "T":
|
|
29
52
|
target.assign(new types_1.Time());
|
|
30
53
|
break;
|
|
54
|
+
case "I":
|
|
55
|
+
target.assign(new types_1.Integer());
|
|
56
|
+
break;
|
|
31
57
|
default:
|
|
32
|
-
throw "CREATE DATA, unknown
|
|
58
|
+
throw "CREATE DATA, unknown type " + options.typeName;
|
|
33
59
|
}
|
|
34
60
|
}
|
|
35
|
-
else if (options === null || options === void 0 ? void 0 : options.name) {
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
if (abap.DDIC[options.name] === undefined) {
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
if (abap.Classes["CX_SY_CREATE_DATA_ERROR"] !== undefined) {
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
throw new abap.Classes["CX_SY_CREATE_DATA_ERROR"]();
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
throw "Global class CX_SY_CREATE_DATA_ERROR not found";
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
target.assign((0, clone_1.clone)(abap.DDIC[options.name].type));
|
|
49
|
-
}
|
|
50
61
|
else if (options === null || options === void 0 ? void 0 : options.type) {
|
|
51
62
|
target.assign((0, clone_1.clone)(options.type));
|
|
52
63
|
}
|