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

abap - go back to loop iteration

Former Member
0 Likes
2,868

hi

i have developed a report in that there is a loop and inside loop there are many read statements and messages.

my querry is, whenever any message pop up i.e. when that condition fails, the loop should go to next iteration i.e. if the condition has failed in 2nd sy-tabix then immediately the loop should start and it should start from 3rd iteration.

tabix = 0.

loop at itab.

read statement

read statement

message

what should i write here stop or exit or var = x

read statement

message

what should i write here stop or exit or var = x

read statement

endloop.

from message it should go to next iteration of the loop.

thanx in adv

manoj

hi

i have developed a report in that there is a loop and inside loop there are many read statements and messages.

my querry is, whenever any message pop up i.e. when that condition fails, the loop should go to next iteration i.e. if the condition has failed in 2nd sy-tabix then immediately the loop should start and it should start from 3rd iteration.

tabix = 0.

loop at itab.

read statement

read statement

message

what should i write here stop or exit or var = x

read statement

message

what should i write here stop or exit or var = x

read statement

endloop.

from message it should go to next iteration of the loop.

thanx in adv

manoj

4 REPLIES 4
Read only

Former Member
0 Likes
1,387

Dear,

Use CONTINUE.

loop at itab.

read statement

read statement

message

CONTINUE.

read statement

message

CONTINUE.

read statement

endloop.

Regards,

Read only

Former Member
0 Likes
1,387
tabix = 0.
loop at itab.
read statement
read statement 
message 
continue.
"use continue
"what should i write here stop or exit or var = x 
read statement
message 
"continue.
what should i write here stop or exit or var = x 
read statement
endloop.
Read only

0 Likes
1,387

hi

actually these messages are inside perform statements, so inside perform there is no loop and therefore 'continue' will not work there.

manoj

Read only

0 Likes
1,387

If it is inside perform then you can use EXIT and a flag.

loop at itab.

perform check_something.
if v_flag = 'X'.
 continue.
endif.

endloop.

form check_something.
clear v_flag.

read ....
read....
message.
v_flag = 'X'.
exit.

endform.

Regards

Vijay Babu Dudla