All files / output cl_gdt_conversion.clas.mjs

22.36% Statements 34/152
100% Branches 2/2
3.03% Functions 1/33
22.36% Lines 34/152

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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 1521x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x             1x       1x     1x                             1x     1x         1x     1x                                       1x     1x             1x     1x                           1x     1x                               1x     1x                                                 1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// cl_gdt_conversion.clas.abap
class cl_gdt_conversion {
  static STATIC_SUPER = undefined;
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CL_GDT_CONVERSION';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"LANGUAGE_CODE_OUTBOUND": {"visibility": "U", "parameters": {"IM_VALUE": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"SPRAS","ddicName":"SPRAS","description":"SPRAS"});}, "is_optional": " ", "parm_kind": "I", "type_name": "CharacterType"}, "EX_VALUE": {"type": () => {return new abap.types.Character(2, {"qualifiedName":"LAISO","ddicName":"LAISO","description":"LAISO"});}, "is_optional": " ", "parm_kind": "E", "type_name": "CharacterType"}}},
  "LANGUAGE_CODE_INBOUND": {"visibility": "U", "parameters": {"IM_VALUE": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "EX_VALUE": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"SPRAS","ddicName":"SPRAS","description":"SPRAS"});}, "is_optional": " ", "parm_kind": "E", "type_name": "CharacterType"}}},
  "AMOUNT_OUTBOUND": {"visibility": "U", "parameters": {"IM_VALUE": {"type": () => {return new abap.types.Packed({length: 1, decimals: 0});}, "is_optional": " ", "parm_kind": "I", "type_name": "PackedType"}, "IM_CURRENCY_CODE": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CLikeType"}, "EX_VALUE": {"type": () => {return new abap.types.Packed({length: 1, decimals: 0});}, "is_optional": " ", "parm_kind": "E", "type_name": "PackedType"}, "EX_CURRENCY_CODE": {"type": () => {return new abap.types.Character(3, {"qualifiedName":"ISOCD","ddicName":"ISOCD","description":"Iso"});}, "is_optional": " ", "parm_kind": "E", "type_name": "CharacterType"}}},
  "COUNTRY_CODE_OUTBOUND": {"visibility": "U", "parameters": {"IM_VALUE": {"type": () => {return new abap.types.Character(3, {"qualifiedName":"LAND1","ddicName":"LAND1","description":"LAND1"});}, "is_optional": " ", "parm_kind": "I", "type_name": "CharacterType"}, "EX_VALUE": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "E", "type_name": "CSequenceType"}}},
  "DATE_TIME_INBOUND": {"visibility": "U", "parameters": {"IM_VALUE": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "EX_VALUE_SHORT": {"type": () => {return new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});}, "is_optional": " ", "parm_kind": "E", "type_name": "PackedType"}}},
  "UNIT_CODE_INBOUND": {"visibility": "U", "parameters": {"IM_VALUE": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "EX_VALUE": {"type": () => {return new abap.types.Character(3, {"qualifiedName":"MSEHI","ddicName":"MSEHI","description":"UOM"});}, "is_optional": " ", "parm_kind": "E", "type_name": "CharacterType"}}},
  "UNIT_CODE_OUTBOUND": {"visibility": "U", "parameters": {"IM_VALUE": {"type": () => {return new abap.types.Character(3, {"qualifiedName":"MSEHI","ddicName":"MSEHI","description":"UOM"});}, "is_optional": " ", "parm_kind": "I", "type_name": "CharacterType"}, "EX_VALUE": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "E", "type_name": "CSequenceType"}}}};
  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 amount_outbound(INPUT) {
    return cl_gdt_conversion.amount_outbound(INPUT);
  }
  static async amount_outbound(INPUT) {
    let im_value = INPUT?.im_value;
    if (im_value === undefined) { im_value = new abap.types.Packed({length: 1, decimals: 0}).set(INPUT.im_value); }
    let im_currency_code = INPUT?.im_currency_code;
    let ex_value = INPUT?.ex_value || new abap.types.Packed({length: 1, decimals: 0});
    let ex_currency_code = INPUT?.ex_currency_code || new abap.types.Character(3, {"qualifiedName":"ISOCD","ddicName":"ISOCD","description":"Iso"});
    let unique1391 = im_currency_code;
    if (abap.compare.eq(unique1391, abap.CharacterFactory.get(3, 'DKK')) || abap.compare.eq(unique1391, abap.CharacterFactory.get(3, 'EUR')) || abap.compare.eq(unique1391, abap.CharacterFactory.get(3, 'USD'))) {
      ex_value.set(im_value);
    } else if (abap.compare.eq(unique1391, abap.CharacterFactory.get(3, 'VND'))) {
      ex_value.set(abap.operators.multiply(im_value,abap.IntegerFactory.get(100)));
    } else {
      abap.statements.assert(abap.compare.eq(abap.IntegerFactory.get(1), abap.CharacterFactory.get(4, 'todo')));
    }
  }
  async language_code_inbound(INPUT) {
    return cl_gdt_conversion.language_code_inbound(INPUT);
  }
  static async language_code_inbound(INPUT) {
    let im_value = INPUT?.im_value;
    let ex_value = INPUT?.ex_value || new abap.types.Character(1, {"qualifiedName":"SPRAS","ddicName":"SPRAS","description":"SPRAS"});
    abap.statements.assert(abap.compare.eq(abap.IntegerFactory.get(1), abap.CharacterFactory.get(4, 'todo')));
  }
  async unit_code_outbound(INPUT) {
    return cl_gdt_conversion.unit_code_outbound(INPUT);
  }
  static async unit_code_outbound(INPUT) {
    let im_value = INPUT?.im_value;
    if (im_value?.getQualifiedName === undefined || im_value.getQualifiedName() !== "MSEHI") { im_value = undefined; }
    if (im_value === undefined) { im_value = new abap.types.Character(3, {"qualifiedName":"MSEHI","ddicName":"MSEHI","description":"UOM"}).set(INPUT.im_value); }
    let ex_value = INPUT?.ex_value || new abap.types.Character();
    let unique1392 = im_value;
    if (abap.compare.eq(unique1392, abap.CharacterFactory.get(1, ''))) {
      const unique1393 = await (new abap.Classes['CX_GDT_CONVERSION']()).constructor_();
      unique1393.EXTRA_CX = {"INTERNAL_FILENAME": "cl_gdt_conversion.clas.abap","INTERNAL_LINE": 82};
      throw unique1393;
    } else if (abap.compare.eq(unique1392, abap.CharacterFactory.get(2, 'ST'))) {
      ex_value.set(abap.CharacterFactory.get(3, 'PCE'));
    } else if (abap.compare.eq(unique1392, abap.CharacterFactory.get(2, 'KG'))) {
      ex_value.set(abap.CharacterFactory.get(3, 'KGM'));
    } else if (abap.compare.eq(unique1392, abap.CharacterFactory.get(3, 'CDM'))) {
      ex_value.set(abap.CharacterFactory.get(3, 'DMQ'));
    } else {
      abap.statements.assert(abap.compare.eq(abap.IntegerFactory.get(1), abap.CharacterFactory.get(4, 'todo')));
    }
  }
  async country_code_outbound(INPUT) {
    return cl_gdt_conversion.country_code_outbound(INPUT);
  }
  static async country_code_outbound(INPUT) {
    let im_value = INPUT?.im_value;
    if (im_value?.getQualifiedName === undefined || im_value.getQualifiedName() !== "LAND1") { im_value = undefined; }
    if (im_value === undefined) { im_value = new abap.types.Character(3, {"qualifiedName":"LAND1","ddicName":"LAND1","description":"LAND1"}).set(INPUT.im_value); }
    let ex_value = INPUT?.ex_value || new abap.types.Character();
    abap.statements.assert(abap.compare.eq(abap.IntegerFactory.get(1), abap.CharacterFactory.get(4, 'todo')));
  }
  async date_time_inbound(INPUT) {
    return cl_gdt_conversion.date_time_inbound(INPUT);
  }
  static async date_time_inbound(INPUT) {
    let im_value = INPUT?.im_value;
    let ex_value_short = INPUT?.ex_value_short || new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    let lv_str = new abap.types.String({qualifiedName: "STRING"});
    if (abap.compare.np(im_value, abap.CharacterFactory.get(2, '*Z'))) {
      abap.statements.assert(abap.compare.eq(abap.IntegerFactory.get(1), abap.CharacterFactory.get(30, 'todo, only handles UTC for now')));
    }
    lv_str.set(im_value);
    abap.statements.replace({target: lv_str, all: true, with: abap.CharacterFactory.get(1, ''), of: abap.CharacterFactory.get(1, '-')});
    abap.statements.replace({target: lv_str, all: true, with: abap.CharacterFactory.get(1, ''), of: abap.CharacterFactory.get(1, ':')});
    abap.statements.replace({target: lv_str, all: true, with: abap.CharacterFactory.get(1, ''), of: abap.CharacterFactory.get(1, 'T')});
    abap.statements.replace({target: lv_str, all: true, with: abap.CharacterFactory.get(1, ''), of: abap.CharacterFactory.get(1, 'Z')});
    ex_value_short.set(lv_str);
  }
  async unit_code_inbound(INPUT) {
    return cl_gdt_conversion.unit_code_inbound(INPUT);
  }
  static async unit_code_inbound(INPUT) {
    let im_value = INPUT?.im_value;
    let ex_value = INPUT?.ex_value || new abap.types.Character(3, {"qualifiedName":"MSEHI","ddicName":"MSEHI","description":"UOM"});
    let unique1394 = im_value;
    if (abap.compare.eq(unique1394, abap.CharacterFactory.get(3, 'MTR'))) {
      ex_value.set(abap.CharacterFactory.get(1, 'M'));
    } else if (abap.compare.eq(unique1394, abap.CharacterFactory.get(3, 'PCE'))) {
      ex_value.set(abap.CharacterFactory.get(2, 'PC'));
    } else if (abap.compare.eq(unique1394, abap.CharacterFactory.get(3, 'KGM'))) {
      ex_value.set(abap.CharacterFactory.get(2, 'KG'));
    } else if (abap.compare.eq(unique1394, abap.CharacterFactory.get(3, 'LTR'))) {
      ex_value.set(abap.CharacterFactory.get(1, 'L'));
    } else {
      abap.statements.assert(abap.compare.eq(abap.IntegerFactory.get(1), abap.CharacterFactory.get(4, 'todo')));
    }
  }
  async language_code_outbound(INPUT) {
    return cl_gdt_conversion.language_code_outbound(INPUT);
  }
  static async language_code_outbound(INPUT) {
    let im_value = INPUT?.im_value;
    if (im_value?.getQualifiedName === undefined || im_value.getQualifiedName() !== "SPRAS") { im_value = undefined; }
    if (im_value === undefined) { im_value = new abap.types.Character(1, {"qualifiedName":"SPRAS","ddicName":"SPRAS","description":"SPRAS"}).set(INPUT.im_value); }
    let ex_value = INPUT?.ex_value || new abap.types.Character(2, {"qualifiedName":"LAISO","ddicName":"LAISO","description":"LAISO"});
    try {
      ex_value.set(await abap.Classes['CL_I18N_LANGUAGES'].sap1_to_sap2({im_lang_sap1: im_value}));
      abap.builtin.sy.get().subrc.set(0);
    } catch (e) {
      if (e.classic) {
          switch (e.classic.toUpperCase()) {
          case "NO_ASSIGNMENT": abap.builtin.sy.get().subrc.set(1); break;
          default: abap.builtin.sy.get().subrc.set(2); break;
            }
        } else {
            throw e;
        }
      }
      abap.statements.translate(ex_value, "LOWER");
      if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
        const unique1395 = await (new abap.Classes['CX_GDT_CONVERSION']()).constructor_();
        unique1395.EXTRA_CX = {"INTERNAL_FILENAME": "cl_gdt_conversion.clas.abap","INTERNAL_LINE": 144};
        throw unique1395;
      }
    }
  }
  abap.Classes['CL_GDT_CONVERSION'] = cl_gdt_conversion;
export {cl_gdt_conversion};