Google Search - Blog...........

Branching with IF statement in sap abap

The IF statement allows you to divert the program flow to a particular statement block, depending on a condition. This statement block consists of all the commands which occur between an IF statement and the next ELSEIF, ELSE, or ENDIF statement.

Syntax

IF

ELSE

ENDIF

If the first condition is true, the system executes all the statements up to the end of the first statement block and then continues processing after the ENDIF statement.

To introduce alternative conditions, you can use ELSEIF statements. If the first condition is false, the system processes the following ELSEIF statement in the same way as the IF statement. ELSE begins a statement block which is processed if none of the IF and ELSEIF conditions is true. The end of the last statement block must always be concluded with ENDIF.
IF .

ELSEIF .

ELSEIF .

ELSE.

ENDIF.
ABAP/4 allows unlimited nesting of IF – ENDIF statement blocks, but they must terminate within the same processing block. In other words, an IF – ENDIF block cannot contain an event keyword.

No comments:

Post a Comment