[WHEN operand1 [OR operand2 [OR operand3 [...]]].
Case Distinction These statements define a control structure that can contain multiple statement blocks
statement_blockn, of which no more than one is executed depending of the value in the operand
Starting with the first
WHEN statement, the content of the operand in
operand is compared with the content of one of the operands
operand2, ... from the top down. The statement block is executed after the
first identical instance is found. If no matches are found, the statement block is executed after the statement
operand2, ... are enhanced
functional operand positions alongside which all
functional methods and all
predefined functions which have exactly one unnamed argument can be specified.
If the end of the executed statement block is reached or no statement block is executed, processing continues after
The contents are compared as illustrated in the following logical expression:
operand = operand1 [OR operand = operand2
[OR operand = operand3 [...]]]
For the comparison, the comparison rules for comparisons between any operands apply, depending on the data types of the operands involved.
A statement cannot be placed between the statement
CASEand the first statement
WHEN. In classes, this produces a syntax error; outside classes, obsolete syntax of this type produces a syntax warning.
operand, the current value is used in every comparison. This may differ from the starting value if
operandis a variable that is changed in a functional method specified after a
CASEcontrol structure is somewhat faster than a semantically equivalent
Branches the program flow depending on the function code in system field
CASE sy-ucomm. WHEN 'BACK'. LEAVE TO SCREEN 100. WHEN 'CANCEL'. LEAVE SCREEN. WHEN 'EXIT'. LEAVE PROGRAM. WHEN OTHERS. MESSAGE '...' TYPE 'E'. ENDCASE.