All files / src/objects _dynpros.ts

100% Statements 38/38
90% Branches 9/10
100% Functions 1/1
100% Lines 38/38

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 381x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 47x 47x 47x 47x 1x 1x 1x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 47x 47x
import {xmlToArray} from "../xml_utils";
 
export type DynproField = {
  name: string,
  type: string,
  length: number,
};
export type DynproHeader = {
  number: string,
  description: string,
  nextScreen: string,
  fields: DynproField[],
};
export type DynproList = DynproHeader[];
 
export function parseDynpros(parsed: any): DynproList {
  const dynpros: DynproList = [];
  const xmlDynpros = parsed.abapGit?.["asx:abap"]?.["asx:values"]?.DYNPROS;
  if (xmlDynpros !== undefined) {
    for (const d of xmlToArray(xmlDynpros.item)) {
      const fields: DynproField[] = [];
      for (const f of xmlToArray(d.FIELDS?.RPY_DYFATC)) {
        fields.push({
          name: f.NAME,
          type: f.TYPE,
          length: f.LENGTH,
        });
      }
      dynpros.push({
        number: d.HEADER.SCREEN,
        description: d.HEADER.DESCRIPT,
        nextScreen: d.HEADER.NEXTSCREEN,
        fields: fields,
      });
    }
  }
  return dynpros;
}