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: 

how to delete a record from an internal table based on two internal fields.

Former Member
0 Kudos

Hi all,

I have selected some data from WITH_ITEM table into internal table t_with_item.

Now i want to delete those record where t_with_item-belnr EQ t_with_item-augbl .

Please suggest how to do this.

Regards,

Amit.

6 REPLIES 6

Former Member
0 Kudos

Hello,

Do like this.


loop at t_with_item.
if t_with_item-belnr EQ t_with_item-augbl.
delete t_with_item.
endif. 

Hope this code will helps you.

Regards,

Vasanth

Former Member
0 Kudos

Hi,

loop at t_with_item.

delete t_with_item

where augbl eq with_item-belnr.

endloop.

regards

NIcole

Former Member
0 Kudos

Hi Amit,

Try this one.Follow the below logic ok,

loop at with_item.

delete table with_item where t_with_item-belnr EQ t_with_item-augbl.

endloop.

or

loop at with_item where t_with_item-belnr EQ t_with_item-augbl.

delete table with_item index sy-tabix.

endloop.

Reward points if helpful

Kiran Kumar.G.A

Former Member
0 Kudos

Hi,

Try it

loop at t_with_item.

if t_with_item-belnr EQ t_with_item-augbl.

delete t_with_item.

endif.

endloop.

L.Velu

Former Member
0 Kudos

Hi Amit,

instead deleting internal table.. why can't you put cond. in SELECT statment itself..



SELECT <fld1> <fld2>... INTO CORRESPONDING FILEDS OF TABLE t_with_item
FROM WITH_ITEM
WHERE <cond> AND
belnr NE augbl.

Former Member
0 Kudos

Thanks a lot for all your replies...