@abaplint/runtime
Version:
Transpiler - Runtime
24 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.readReport = readReport;
const types_1 = require("../types");
const insert_database_1 = require("./insert_database");
async function readReport(name, options, context) {
const progname = name.get().trimEnd().toUpperCase().padEnd(40, " ");
const select = `SELECT "data" FROM ${abap.buildDbTableName("reposrc")} WHERE "progname" = ${(0, insert_database_1.toValue)(progname)} UP TO 1 ROWS`;
const { rows } = await context.defaultDB().select({ select, primaryKey: ["progname"] });
if (rows.length === 0) {
options.into?.clear();
abap.builtin.sy.get().subrc.set(4);
return;
}
if (options.into) {
options.into.clear();
const data = rows[0]["data"]?.toString() || "";
for (const line of data.split(/\r?\n/)) {
options.into.append(new types_1.String().set(line));
}
}
abap.builtin.sy.get().subrc.set(0);
}
//# sourceMappingURL=read_report.js.map