‎2008 May 15 12:46 PM
Hi,
Help needed to remove this delete from within the loop.
{code
Loop at itab where <condition>.
<statements>
delete itab index sy-tabix.
Exit.
Endloop.
{code}
The functionality of the code should not be affected.
Useful help would be awarded
‎2008 May 15 12:50 PM
hi,
do this way ... take a new field(Flag) in the itab ...
Loop at itab where <condition>.
lv_tabix = sy-tabix.
<statements>
if <conditions>
itab-flag = 'X'.
modify itab index lv_tabix transporting flag.
Exit.
endif.
Endloop.
delete itab where flag = 'X'.
‎2008 May 15 12:50 PM
hi,
do this way ... take a new field(Flag) in the itab ...
Loop at itab where <condition>.
lv_tabix = sy-tabix.
<statements>
if <conditions>
itab-flag = 'X'.
modify itab index lv_tabix transporting flag.
Exit.
endif.
Endloop.
delete itab where flag = 'X'.
‎2008 May 15 12:52 PM
I don't know what <statements> you are using, but the easiest way to do this, is this:
delete itab where <conditions>.
‎2008 May 15 12:53 PM
hi akshay,
use this
DELETE itab WHERE <condition>regards,
Peter
‎2008 May 15 12:55 PM
Hi,
Never delete an internal table inside the same loop.
Rather add a flag field in the table.
In the loop at itab..mark the field = 'X 'where u want to delete.
and at the end of loop,
DELETE ITAB WHERE FLAG = 'X'
Please assign points if helpful
‎2008 May 15 12:59 PM
Delete inside loop is not required.
You can use directly the statement
DELETE itab WHERE logexp.
or
DELETE TABLE itab WITH TABLE KEY k1 = v1 ... kn = vn.
‎2008 May 15 1:01 PM
Hi,
Instead of deleting data from itab use another internal table of same type (itab1) and append it. Use itab1 data for further processing.
check below logic...
{code
Loop at itab1 into wa_itab1 where <condition>.
<statements>
if <condition>
append wa_itab1 to itab2.
exit.
endif.
Endloop.
refresh itab1.
itab1[] = itab2[].
{code}
regards,
N M Poojari.