Application Development and Automation 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: 
Read only

Deleteing from itab......

Former Member
0 Likes
1,278

Hi Experts,

I have records in itab. For. e.g.

Order No. Vornr Qty.

123 0010 15

123 0010 2

123 0020 3

123 0030 13

123 0030 12

123 0030 9.

I want to delete Vornr = 0010 and 0020 from itab. Only 0030 i want to keep.

There are multiple orders with multiple aufnr vornr.

Pl. guide me......

Yusuf

Hi Experts,

I have records in itab. For. e.g.

Order No. Vornr Qty.

123 0010 15

123 0010 2

123 0020 3

123 0030 13

123 0030 12

123 0030 9.

I want to delete Vornr = 0010 and 0020 from itab. Only 0030 i want to keep.

There are multiple orders with multiple aufnr vornr.

Pl. guide me......

Yusuf

13 REPLIES 13
Read only

former_member156446
Active Contributor
0 Likes
1,254

delete from itab where Vornr NE 30

Read only

0 Likes
1,254

Hi Jack,

This is not so simple that u were explaining.

There are multiple vornr and aufnr

Like vornr upto 120 in some of same order.

Yusuf

Read only

0 Likes
1,254

Create a range and fill all values of VORNR you want to delete in LOW and then use

delete itab where vornr in r_vornr.

" Here r_vornr is range

Read only

former_member194669
Active Contributor
0 Likes
1,254


delete itab where Vornr = 0010 or Vornr = 0020.

Read only

Former Member
0 Likes
1,254

delete from itab where vornr != 0030

Read only

Former Member
0 Likes
1,254

hi.,

use following command after fetching the data into internal table.

delete itab where vornr NE 0030.

Reward points if useful

Edited by: Chandrasekhar Velpula on Dec 20, 2007 6:43 AM

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,254

if ur requirement is to delete 0010 and 0020

just go for delete itab where vornr = 0010 and vornr = 0020.

or u r requirement is something else ???

Read only

Former Member
0 Likes
1,254

DELETE TABLE itab WITH TABLE KEY vornr = '0010'.

DELETE TABLE itab WITH TABLE KEY vornr = '0020'.

OR

DELETE Itab WHERE vornr ne '0030'.

Read only

former_member386202
Active Contributor
0 Likes
1,254

Hi,

Do like this

Loop at itab.

if ( itab-vornr eq '0010' ) or

( itab-vornr eq '0020' ).

delete itab.

endif.

endloop.

Regards,

Prashant

Read only

Former Member
0 Likes
1,254

DELETE itab WHERE VORNR NE '0030'.

Read only

Former Member
0 Likes
1,254

Hi,

delete itab where Vornr NE '0030'

Read only

Former Member
0 Likes
1,254

Hi,

To delete more than one line using a condition, use the following statement:

DELETE <itab> WHERE <cond>.

In your case:

DELETE itab WHERE Vornr NE 0030.

Regards,

Bhaskar

Read only

Former Member
0 Likes
1,254

Hi,

how many values u have doesnt matter,

say u have 10 vornr values, populate all vornr into A range like below

r_vornr-option = 'I'.

r_vornr-sign = 'EQ'.

move '0030' to r_vornr-low.

append r_vornr.

clear r_vornr-low.

r_vornr-option = 'I'.

r_vornr-sign = 'EQ'.

move '0050' to r_vornr-low.

append r_vornr.

clear r_vornr-low.

.

.

.

sort itab.

loop at itab where vornr in r_vornr.

move itab to itab_new.

append itab_new.

clear itab_new.

endloop.

now itab_new will contain required values alone