CONTINUE statement in ABAP loops

CONTINUE statement in ABAP is used for terminating the current loop iteration and start the next iteration. This statement can only used with the loops like

  • DO … ENDDO Loops
  • WHILE … ENDWHILE loops
  • LOOP … ENDLOOP loops
  • SELECT … ENDSELECT loops

See the following sample code and its result for better understand.

DO 10 TIMES.

IF SY-INDEX >= 0 AND SY-INDEX <= 6.    CONTINUE.

WRITE: SY-INDEX, ‘ ‘.

ENDIF.

ENDDO.

 

Its output will be:

7 8 9 10

(You can see that all other iteration with the values between 0-6 are terminated before WRITE statement.)

Also Read : View Other ABAP Keywords & Syntax -> ABAP Transaction codes