These statements define a control structure which can contain several statement_block statement blocks; depending on the logical expressions log_exp, maximally one of the blocks is executed.
After IF and ELSEIF, any number of logical expressions log_exp can be specified, while the expressions statement_block represent any kind of statement blocks.
The logical expressions are checked from top to bottom, startingwith the IF statement, and the statement block after the first true logical expression is executed. If none of the logical expressions is true, then the statement block after the ELSE statement is executed.
If the end of the executed statement block is reached or if no statement block was executed, then the processing is resumed after ENDIF.
Converting a time output into Anglo American notation
DATA time TYPE t.
time = sy-uzeit.
IF time < '120000'.
WRITE: / time, 'AM' .
ELSEIF time > '120000' AND
time < '240000'.
time = time - 12 * 3600.
WRITE: / time, 'PM' .
WRITE / 'High Noon'.