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

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

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 401x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 106x 1x 1x
import {IStatement} from "./_statement";
import {seq, alt, opt, ver, altPrio, optPrio, per} from "../combi";
import {FSTarget, Target, ComponentCond, Dynamic, Source, SimpleName} from "../expressions";
import {Version} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
import {SimpleSource2} from "../expressions/simple_source2";
import {LoopGroupBy} from "../expressions/loop_group_by";
 
export class Loop implements IStatement {
 
  public getMatcher(): IStatementRunnable {
    const where = seq("WHERE", alt(ComponentCond, Dynamic));
 
    const into = seq(opt("REFERENCE"), "INTO", Target);
 
    const assigning = seq("ASSIGNING", FSTarget);
 
    const group = ver(Version.v740sp08, seq("GROUP BY", LoopGroupBy));
 
    const target = alt(seq(alt(into, assigning),
                           optPrio("CASTING")),
                       "TRANSPORTING NO FIELDS");
 
    const from = seq("FROM", Source);
 
    const to = seq("TO", Source);
 
    const usingKey = seq("USING KEY", altPrio(SimpleName, Dynamic));
 
    const options = per(target, from, to, where, usingKey, group);
 
    const at = seq("AT",
                   opt(ver(Version.v740sp08, "GROUP")),
                   alt(SimpleSource2, ver(Version.v740sp02, Source)),
                   opt(options));
 
    return seq("LOOP", opt(at));
  }
 
}