Learn ABAP (4)

Logic Statement
IF statement
-------------
report zifstatement.

data:
begin of data1,
f1 value 'a',
f2 value 'b',
end of data1.

if data1-f1 = data1-f2.
write / 'the same'.
else.
write / 'different'.
endif.

CASE statement
----------------
report zcasestatement.

parameters p1 type i default 5.

case p1.
when 5. write / '5'.
when others. write / 'not 5'.
endcase.


Loop Statement
DO statement
--------------
report zdostatement.
do 13 times.
write sy-index.
enddo.


WHILE statement

-----------------

report zwhilestatement.

while sy-index <>

write sy-index.

endwhile.






All SAP products are trademark of SAP AG. This blog is not affiliated with nor endorsed by SAP AG.