Skip to Content

delete lines from internal table

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jul 27, 2012 at 09:03 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 27, 2012 at 09:36 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.