SAP IF ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID IF
• IF ABAP Statement

IF
Short Reference

ABAP_SYNTAX
IF log_exp1.
$[statement_block1$]
$[ELSEIF log_exp2.
$[statement_block2$]$]
...
$[ELSE.
$[statement_blockn$]$]
ENDIF.

What does it do?
These statements define a control structure that can contain multiple statement blocks statement_block of which a maximum of one is executed, depending on the logical expressions log_exp.
After IF and ELSEIF any logical expressions log_exp can be listed, while the expressions statement_block stand for any statement blocks.
The logical expressions, beginning with the IF statement, are checked from top to bottom and the statement block after the first real logical expression is executed. If none of the logical expressions are true, the statement block after the ELSE statement is executed.
If the end of the executed statement block is reached or if no statement block is to be executed, the processing is continued after ENDIF.



Latest notes:

The conditional operator COND can also be used to implement branches in operand positions that are based on logical expressions.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Transformation of a time to the 12-hour format (see also Country-Specific Formats).
ABEXA 00316
See also the example for COND .
ABAP_EXAMPLE_END

Return to menu