cancel
Showing results for 
Search instead for 
Did you mean: 

How to start loop iteration from the beginning after meeting some condition within the loop

ABAPer_1631
Explorer
0 Kudos
153

Hello,

I need inputs on below scenario:

I have a changing parameter in the method of a Class which is table <ch_table_name> where I would like to process records in this table. The entries in the table are of same type with different data like, every 19 entries, type of data is same but values will be different.

I would like to delete data in this table if it meets the condition. suppose, continuously for couple of times if condition is satisfied.

I will delete these entries and loop iteration HAS to start from beginning to check data again. Is it possible, if Yes, How can I achieve this?

say, 

LOOP <ch_table_name> ASSIGNING <fs_> WHERE <condition>.

IF <cond>.

<logic to check entries and set index lv_start and lv_end to delete data>.

ELSE.

DELETE <ch_table_name> FROM lv_start TO lv_end.

<logic to start iteration from beginning> . ""=> How to handle this?

ENDIF.

ENDLOOP.

Thanks in Advance!!

View Entire Topic
MBartsch71
Participant
0 Kudos

Hello,

for me personally it is bad practice to use changing parameters. Better is using importing and returning. Furthermore a delete statement is preferable over looping and deleting entries in the same time. When you use importing and returning parameters you can fill the returning table easy with the needed values.