SAP ITAB INS DEL WITHIN LOOP
Get Example source ABAP code based on a different SAP table
ARTICLE
Inserting and/or Deleting Table Lines Within
If you are processing an internal table
these changes automatically become effective on the next loop pass.
To understand how insert/delete operations in loop processing work, imagine an internal table as a concatenated list of table lines:
If, for example, you are in the 47th loop pass and insert a new line before line 48, the next (that is 48th) loop pass will first process the newly inserted line as line 48 and leave processing of the old line 48 (that is the line before which you inserted the new line) until the next (that is 49th) loop pass when it becomes line 49. In the next loop pass,
If, for example, you are in the 47th loop pass and delete line 48, the next (that is 48th) loop pass will process the old line 49 (that is the line following the deleted line) as the new line 48. In the next loop pass,
If, for example, you are in the 47th loop pass and insert a new line before lines 17, 24 and 33, the next (that is 48th) loop pass will process the old line 48 (that is line 48 before the three insert operations) as the new line 51. In the next loop pass,
If, for example, you are in the 47th loop pass and delete the lines 17, 24 and 33, the next (that is 48th) loop pass will process the old line 48 (that is line 48 before the three delete operations) as the new line 45. In the next loop pass,