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

100% Statements 16/16
100% Branches 0/0
100% Functions 1/1
100% Lines 16/16

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  1x 1x 1x     1x       153x 153x 153x 153x 153x 153x 153x 153x   153x   153x     153x           153x      
import {IStatement} from "./_statement";
import {verNot, str, seq, opt, alt, per} from "../combi";
import {FormName, Source, FunctionParameters, FunctionName, Destination, MethodName, SimpleSource2} from "../expressions";
import {Version} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
 
export class CallFunction implements IStatement {
 
  public getMatcher(): IStatementRunnable {
 
    const starting = seq("STARTING NEW TASK", SimpleSource2);
    const update = str("IN UPDATE TASK");
    const unit = seq("UNIT", Source);
    const background = seq("IN BACKGROUND", alt("TASK", unit));
    const calling = seq("CALLING", MethodName, "ON END OF TASK");
    const performing = seq("PERFORMING", FormName, "ON END OF TASK");
    const separate = str("AS SEPARATE UNIT");
    const keeping = str("KEEPING LOGICAL UNIT OF WORK");
 
    const options = per(starting, update, background, Destination, calling, performing, separate, keeping);
 
    const dynamic = seq("PARAMETER-TABLE", Source,
                        opt(seq("EXCEPTION-TABLE", Source)));
 
    const call = seq("CALL",
                     alt("FUNCTION", verNot(Version.Cloud, "CUSTOMER-FUNCTION")),
                     FunctionName,
                     opt(options),
                     alt(FunctionParameters, dynamic));
 
    return call;
  }
 
}