Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Statement to break the loop

Former Member
0 Likes
35,262

Hi All,

I want to know which statment is used to break the loop after perticular situation is fullfilled.

1 ACCEPTED SOLUTION
Read only

Former Member
12,624

HI,

use EXIT. command.

Regards,

V.balaji

7 REPLIES 7
Read only

Former Member
12,625

HI,

use EXIT. command.

Regards,

V.balaji

Read only

Former Member
12,624

Hi,

Use CONTINUE to skip that record.

Use EXIT to exit the loop.

Regards,

CS

Read only

Former Member
0 Likes
12,624

hi,

EXIT command can be used.

regards,

pavan t.

Read only

Former Member
0 Likes
12,624

Hi,

Use Exit statement.


loop at itab.

if itab-field1 = 'ABC'.
exit.
endif.

endloop.

Using exit statement once itab-field1 contains ABC then it will come out of the loop without processing the other records in the internal table.

Use continue.


loop at itab.

if itab-field1 = 'ABC'.
  delete itab.
  continue.
endif.

endloop.

Using continue statement it will process the other records also.

Thanks,

Sriram Ponna.

Edited by: Sriram Ponna on Mar 19, 2008 12:45 PM

Read only

Former Member
0 Likes
12,624

Hi ,

Go through the below link u can clearly understand

http://help.sap.com/saphelp_46c/helpdata/en/fc/eb3564358411d1829f0000e829fbfe/frameset.htm

Thanks,

Ramya.R

Reward point if useful

Read only

Former Member
0 Likes
12,624

HI,

use exit command

EXIT

If you use the EXIT statement within an event block but not in a loop, the system stops processing the block immediately.

Before and during selection screen processing, the next event in the prescribed sequence is always called. From the START-OF-SELECTION event onwards, the system starts the list

processor directly when the EXIT statement occurs, and displays the list.

If the EXIT statement occurs in a loop using DO, WHILE, or LOOP, it is the loop that terminates, not the processing block.

regards

mano

Read only

Former Member
0 Likes
12,624

you should find the EXIT, CHECK and CONTINUE commands useful