Application Development 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: 

delete lines from internal table

k_gjergja
Participant
0 Kudos

Hi ,

Please let me know what is the best  choice ( betwen two below )

I have some douts about first one, I am wondering could it make a mess with indexes.

Thanks

Chris

1)

Loop at itab into wa

   if itab-f1 = 1.

   delete itab from wa

endloop.

2) delete itab[] where f1 = a

Moderator Message: Please read SAP help documentation for more details

Message was edited by: Kesavadas Thekkillath

2 REPLIES 2

yogendra_bhaskar
Contributor
0 Kudos

hi ,

If you insert or delete lines in the statement block of a LOOP , this will have the following effects:

  • If you insert lines behind the current line, these new lines will be processed in the subsequent loop passes. An endless loop can result.

  • If you delete lines behind the current line, the deleted lines will no longer be processed in the subsequent loop passes.

  • If you insert lines in front of the current line, the internal loop counter is increased by one with each inserted line. This affects sy-tabix in the subsequent loop pass.

  • If you delete lines in front of the current line, the internal loop counter is decreased by one with each deleted line. This affects sy-tabix in the subsequent loop pass.

regards ,

Yogendra Bhaskar

MariaJoãoRocha
Contributor
0 Kudos

Hi,

I prefer the seconde one, is simpler. Relatated to the performance I suppose it's better also, at least at network level, but only if your table is too big there is a motive for concerning. Altough is important to have good pratices,

Using sy-tabix is safer, as mentioned.

Regarsd,

Maria João Rocha