ELSE (ABAP Keyword)

ELSE (ABAP Keyword) introduction & syntax details

ELSE

Basic
form
ELSE.

 

Effect
Within an ” IF … ENDIF ” processing block,
precedes the code to be executed if the logical expression specified by IF
fails.

Example

DATA: RESULT TYPE I,
OP1 TYPE I,
OP2 TYPE
I.

RESULT = OP1 – OP2.
IF RESULT > 0.
WRITE / ‘Result greater
than zero.’.
ELSE.
WRITE / ‘Result less or equal
zero.’.
ENDIF.

Depending on the value of RESULT , both different
texts are output.
Related IF , ELSEIF , CASE

More References