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 | 1x 1x 1x 1x 1x 1x 1x 1x 20x 20x 20x 20x 20x 20x 20x 20x 20x 225x 225x 20x 20x 4x 4x 4x 4x 4x 20x 20x 20x 20x 22x 22x 22x 20x 20x 38x 38x 38x 38x 38x 38x 38x 38x 13x 13x 13x 5x 5x 38x 6x 6x 6x 6x 6x 25x 19x 2x 19x 2x 17x 2x 2x 2x 2x 2x 15x 9x 9x 9x 9x 9x 13x 4x 4x 38x 38x 38x 38x 20x 20x 20x 20x 38x 18x 18x 20x 20x 20x 20x 38x 4x 4x 16x 16x 38x 38x 38x 38x 38x 38x 20x 20x | import {AbstractObject} from "./_abstract_object"; import {AbstractType} from "../abap/types/basic/_abstract_type"; import * as Types from "../abap/types/basic"; import {IRegistry} from "../_iregistry"; import {DDIC} from "../ddic"; import {IObjectAndToken} from "../_iddic_references"; import {AnyType, DataReference, GenericObjectReferenceType} from "../abap/types/basic"; export class TableType extends AbstractObject { private parsedXML: { rowtype?: string, rowkind?: string datatype?: string leng?: string decimals?: string} | undefined = undefined; public getType(): string { return "TTYP"; } public getAllowedNaming() { return { maxLength: 30, allowNamespace: true, }; } public getDescription(): string | undefined { // todo return undefined; } public setDirty(): void { this.parsedXML = undefined; super.setDirty(); } public parseType(reg: IRegistry): AbstractType { this.parseXML(); const ddic = new DDIC(reg); const references: IObjectAndToken[] = []; let type: AbstractType; if (this.parsedXML === undefined) { type = new Types.UnknownType("Table Type, parser error", this.getName()); } else if (this.parsedXML.rowkind === "S") { const lookup = ddic.lookupTableOrView(this.parsedXML.rowtype); type = new Types.TableType(lookup.type, {withHeader: false}, this.getName()); if (lookup.object) { references.push({object: lookup.object}); } } else if (this.parsedXML.rowkind === "E") { const lookup = ddic.lookupDataElement(this.parsedXML.rowtype); type = new Types.TableType(lookup.type, {withHeader: false}, this.getName()); if (lookup.object) { references.push({object: lookup.object}); } } else if (this.parsedXML.rowkind === "L") { const lookup = ddic.lookupTableType(this.parsedXML.rowtype); type = new Types.TableType(lookup.type, {withHeader: false}, this.getName()); if (lookup.object) { references.push({object: lookup.object}); } } else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "OBJECT") { type = new Types.TableType(new GenericObjectReferenceType(), {withHeader: false}, this.getName()); } else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype === "DATA") { type = new Types.TableType(new DataReference(new AnyType()), {withHeader: false}, this.getName()); } else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype !== undefined) { const lookup = ddic.lookupObject(this.parsedXML.rowtype); type = new Types.TableType(lookup.type, {withHeader: false}, this.getName()); if (lookup.object) { references.push({object: lookup.object}); } } else if (this.parsedXML.rowkind === "") { if (this.parsedXML.datatype === undefined) { type = new Types.UnknownType("Table Type, empty DATATYPE" + this.getName(), this.getName()); } else { const row = ddic.textToType(this.parsedXML.datatype, this.parsedXML.leng, this.parsedXML.decimals, this.getName()); type = new Types.TableType(row, {withHeader: false}, this.getName()); } } else { type = new Types.UnknownType("Table Type, unknown kind \"" + this.parsedXML.rowkind + "\"" + this.getName(), this.getName()); } reg.getDDICReferences().setUsing(this, references); return type; } //////////////////// private parseXML() { if (this.parsedXML !== undefined) { return; } this.parsedXML = {}; const parsed = super.parseRaw2(); if (parsed === undefined || parsed.abapGit === undefined) { return; } const dd40v = parsed.abapGit["asx:abap"]["asx:values"].DD40V; this.parsedXML.rowtype = dd40v.ROWTYPE ? dd40v.ROWTYPE : ""; this.parsedXML.rowkind = dd40v.ROWKIND ? dd40v.ROWKIND : ""; this.parsedXML.datatype = dd40v.DATATYPE; this.parsedXML.leng = dd40v.LENG; this.parsedXML.decimals = dd40v.DECIMALS; } } |