Thursday 28 September 2017

ABAP: CONTINUE: Skip the iteration of loop

CONTINUE statement skips the current iteration of loop (DO–ENDDO, WHILE-ENDWHILE)

Syntax
CONTINUE.

Z_HELLO_WORLD

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

DATA counter TYPE I VALUE -1.

* Print only Even Numbers
Write 'Even counters from 0 to 10 are'.

WHILE counter < 10.
  counter = counter + 1.
  IF counter MOD 2 <> 0.
    CONTINUE.
  ENDIF.

  Write: / 'Value of counter : ', counter.

ENDWHILE.



Previous                                                 Next                                                 Home

No comments:

Post a Comment