All files / output zcl_abapgit_function_module.clas.mjs

25.92% Statements 14/54
100% Branches 2/2
25% Functions 1/4
25.92% Lines 14/54

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 541x 1x 1x 1x 1x 1x 1x 1x 1x             1x       1x                                                               1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_function_module.clas.abap
class zcl_abapgit_function_module {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_FUNCTION_MODULE';
  static IMPLEMENTED_INTERFACES = ["ZIF_ABAPGIT_FUNCTION_MODULE"];
  static ATTRIBUTES = {};
  static METHODS = {};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async zif_abapgit_function_module$function_exists(INPUT) {
    let rv_exists = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    let iv_function_module_name = INPUT?.iv_function_module_name;
    let lv_function_module_name = new abap.types.Character(30, {});
    let lv_exists = new abap.types.String({qualifiedName: "STRING"});
    lv_function_module_name.set(iv_function_module_name);
    lv_exists.set(abap.CharacterFactory.get(15, 'FUNCTION_EXISTS'));
    try {
      try {
        if (abap.FunctionModules[lv_exists.get().trimEnd()] === undefined) { if (abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()] === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_FUNC not found"; } else { throw new abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()]();} }
        await abap.FunctionModules[lv_exists.get().trimEnd()]({exporting: {funcname: lv_function_module_name}});
        abap.builtin.sy.get().subrc.set(0);
      } catch (e) {
        if (e.classic) {
            switch (e.classic.toUpperCase()) {
            case "FUNCTION_NOT_EXIST": abap.builtin.sy.get().subrc.set(1); break;
            default: abap.builtin.sy.get().subrc.set(2); break;
              }
          } else {
              throw e;
          }
        }
        rv_exists.set(abap.builtin.boolc(abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))));
      } catch (e) {
        if ((abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'] && e instanceof abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'])) {
          rv_exists.set(abap.builtin.abap_false);
        } else {
          throw e;
        }
      }
      return rv_exists;
    }
  }
  abap.Classes['ZCL_ABAPGIT_FUNCTION_MODULE'] = zcl_abapgit_function_module;
export {zcl_abapgit_function_module};