Control Statements in ABAP

To execute different program parts in connection with certain conditions or to combine recurring statement sequences as  loops, you can use standard keywords like IF, CASE, DO, and WHILE in the flow control of a program.

IF condition.
......
ELSE.
......
ENDIF.
IF condition-1.
......
ELSEIF condition-2.
.....
ELSEIF condition-3.
.....
ELSEIF condition-n.
....
ELSE.
ENDIF.
CASE variable.
WHEN value-1.
.....
WHEN value-2.
.....
WHEN value-3.
.....
WHEN OTHERS.
.....
ENDCASE.
DO n TIMES.
  statement_block.
ENDDO.
WHILE log_exp.
   statement_block.
ENDWHILE.

Statements which can be used optionally in loops…

  1. EXIT.                to come out of a loop suddenly
  2. CONTINUE.   to start the next iteration from middle of the loop
  3. CHECK.           to start the next iteration when condition fails.