@abaplint/runtime 2.13.25 → 2.13.26

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.
@@ -68,7 +68,6 @@ export declare class Statements {
68
68
  find: typeof find;
69
69
  unpack: typeof unpack;
70
70
  getBit: typeof getBit;
71
- readReport: typeof readReport;
72
71
  getLocale: typeof getLocale;
73
72
  getParameter: typeof getParameter;
74
73
  getRunTime: typeof getRunTime;
@@ -106,5 +105,6 @@ export declare class Statements {
106
105
  updateDatabase(table: string | ICharacter, options: IUpdateDatabaseOptions): Promise<number>;
107
106
  callFunction(options: ICallFunctionOptions): Promise<void>;
108
107
  message(options: IMessageOptions): Promise<void>;
108
+ readReport(name: ICharacter, options: Parameters<typeof readReport>[1]): Promise<void>;
109
109
  write(source: INumeric | ICharacter | FieldSymbol | string | number, options?: IWriteOptions): void;
110
110
  }
@@ -71,7 +71,6 @@ class Statements {
71
71
  find = find_1.find;
72
72
  unpack = unpack_1.unpack;
73
73
  getBit = get_bit_1.getBit;
74
- readReport = read_report_1.readReport;
75
74
  getLocale = get_locale_1.getLocale;
76
75
  getParameter = get_parameter_1.getParameter;
77
76
  getRunTime = get_run_time_1.getRunTime;
@@ -134,6 +133,9 @@ class Statements {
134
133
  async message(options) {
135
134
  return new message_1.MessageStatement(this.context).message(options);
136
135
  }
136
+ async readReport(name, options) {
137
+ return (0, read_report_1.readReport)(name, options, this.context);
138
+ }
137
139
  write(source, options) {
138
140
  return new write_1.WriteStatement(this.context).write(source, options);
139
141
  }
@@ -1,8 +1,9 @@
1
1
  import { Table } from "../types";
2
+ import { Context } from "../context";
2
3
  import { ICharacter } from "../types/_character";
3
4
  interface IReadReportOptions {
4
5
  state?: ICharacter;
5
6
  into?: Table;
6
7
  }
7
- export declare function readReport(name: ICharacter, options: IReadReportOptions): void;
8
+ export declare function readReport(name: ICharacter, options: IReadReportOptions, context: Context): Promise<void>;
8
9
  export {};
@@ -2,12 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readReport = readReport;
4
4
  const types_1 = require("../types");
5
- function readReport(name, options) {
5
+ const insert_database_1 = require("./insert_database");
6
+ async function readReport(name, options, context) {
7
+ const progname = name.get().trimEnd().toUpperCase().padEnd(40, " ");
8
+ const select = `SELECT "data" FROM ${abap.buildDbTableName("reposrc")} WHERE "progname" = ${(0, insert_database_1.toValue)(progname)} UP TO 1 ROWS`;
9
+ const { rows } = await context.defaultDB().select({ select, primaryKey: ["progname"] });
10
+ if (rows.length === 0) {
11
+ options.into?.clear();
12
+ abap.builtin.sy.get().subrc.set(4);
13
+ return;
14
+ }
6
15
  if (options.into) {
7
16
  options.into.clear();
8
- options.into.append(new types_1.String().set("ReadReportTodo-" + name));
17
+ const data = rows[0]["data"]?.toString() || "";
18
+ for (const line of data.split(/\r?\n/)) {
19
+ options.into.append(new types_1.String().set(line));
20
+ }
9
21
  }
10
- // TODO
11
22
  abap.builtin.sy.get().subrc.set(0);
12
23
  }
13
24
  //# sourceMappingURL=read_report.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.13.25",
3
+ "version": "2.13.26",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",