All files / src/abap/2_statements/statements modify_entities.ts

100% Statements 42/42
100% Branches 1/1
100% Functions 1/1
100% Lines 42/42

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 421x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x
import {IStatement} from "./_statement";
import {alt, altPrio, opt, optPrio, per, plus, plusPrio, seq, ver} from "../combi";
import {AssociationName, NamespaceSimpleName, SimpleName, Source, Target} from "../expressions";
import {IStatementRunnable} from "../statement_runnable";
import {Version} from "../../../version";
 
export class ModifyEntities implements IStatement {
 
  public getMatcher(): IStatementRunnable {
    const withh = seq("WITH", Source);
    const fieldsWith = seq("FIELDS (", plus(SimpleName), ")", withh);
    const by = seq("BY", AssociationName);
    const operation = alt(
      seq("UPDATE SET FIELDS WITH", Source),
      seq("CREATE SET FIELDS WITH", Source),
      seq("UPDATE", fieldsWith),
      seq("DELETE FROM", Source),
      seq("CREATE", opt(by), "FROM", Source),
      seq("EXECUTE", SimpleName, "FROM", Source),
      seq("CREATE", opt(by), optPrio("AUTO FILL CID"), altPrio(withh, fieldsWith)));
 
    const failed = seq("FAILED", Target);
    const result = seq("RESULT", Target);
    const mapped = seq("MAPPED", Target);
    const reported = seq("REPORTED", Target);
    const from = seq("FROM", Source);
    const execute = seq("EXECUTE", NamespaceSimpleName);
 
    const entities = seq("ENTITIES OF", NamespaceSimpleName,
                         opt("IN LOCAL MODE"),
                         plusPrio(seq("ENTITY", SimpleName, plus(operation))),
                         optPrio(per(failed,
                                     result,
                                     mapped,
                                     reported)));
 
    const entity = seq("ENTITY", NamespaceSimpleName, execute, from, mapped, failed, reported);
 
    return ver(Version.v754, seq("MODIFY", alt(entities, entity)));
  }
 
}