Thursday 21 September 2017

ABAP: IF statement

IF statement is used to execute block of statements only the given condition is true.

Syntax
IF condition.
         * Block of statements
ENDIF.

IF statement must terminated by ENDIF statement. The statements between IF and ENDIF are executed only the condition is true.

Z_HELLO_WORLD
*&---------------------------------------------------------------------*
*& Report Z_HELLO_WORLD
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Z_HELLO_WORLD.

DATA var1 TYPE I VALUE 10.
DATA var2 TYPE I VALUE 20.
DATA var3 TYPE I VALUE 30.

IF var1 > 10.
  Write 'var1 is > 10'.
ENDIF.

IF var2 > 10.
  Write / 'var2 is > 10'.
ENDIF.

IF var3 > 10.
  Write / 'var3 is > 10'.
ENDIF.




Previous                                                 Next                                                 Home

No comments:

Post a Comment