SAP ABAP - If Statement



‘IF’ is a control statement used to specify one or more conditions. You may also nest the IF control structures in an ABAP program.

The following syntax is used for the IF statement.

IF<condition_1>.
  
<Statements...>.
  
ENDIF.

If the expression evaluates to true, then the IF block of code will be executed.

Flow Diagram

If Statement

Example

Report YH_SEP_15.  
Data Title_1(20) TYPE C.
Title_1 = 'Tutorials'.  
IF Title_1 = 'Tutorials'.  
write 'This is IF statement'.  
ENDIF.

The above code produces the following output −

This is IF statement.
sap_abap_decisions.htm
Advertisements