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

delete entries from internal table.

Rushikesh_Yeole
Contributor
0 Likes
2,451

i have 2 internal tables ITAB1 and ITAB2 with different entries.

data: ITAB2 type table of TAB2.

TAB2 is standard database table.

i have to delete entries from ITAB1 where TAB2-FIELD is not blank.

Please suggest the code.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,333

Press F1 on Delete syntax

i have 2 internal tables ITAB1 and ITAB2 with different entries.

data: ITAB2 type table of TAB2.

TAB2 is standard database table.

i have to delete entries from ITAB1 where TAB2-FIELD is not blank.

Please suggest the code.

6 REPLIES 6
Read only

Former Member
0 Likes
1,334

Press F1 on Delete syntax

Read only

Rushikesh_Yeole
Contributor
0 Likes
1,333

i have 2 internal tables ITAB1 and ITAB2 with different entries.

data: ITAB2 type table of TAB2.

TAB2 is standard database table.

i have to delete entries from ITAB1 where TAB2-FIELD is not blank.

TAB2-FIELD is not present in TAB1.

Please suggest the code.

Read only

0 Likes
1,333

hi.

there has to be atleast something common.

the 2 database tables fromm where you populated the internal table has to have something common betweeen them.

Read only

0 Likes
1,333
DELETE ADJACENT DUPLICATE ENTRIES FROM TAB1 COMPARING
Read only

0 Likes
1,333

Hi,

You will need common fields in table itab1 and itab2. As per my understanding, table itab2 is having structure of standard tble tab2. And internal table itab1 is of some different structure.

So, in order to delete entries from itab1 based on itab2-field i.e. tab2-field, you need releation between two tables. There must be some common fields in itab1 and itab2. You will have to loop at table itab2 and read table itab1 with the key fields and then use

if itab2-field is blank.

delete itab1 index sy-tabix.

endif.

Thanks,

Archana

Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
1,333

Hi,

There must be some link between the two tables..

If primary key of table TAB2 is present in TAB1

Then you can go ahead like this:

SELECT common_field<preferably primary key> INTO

table itab3 FROM TAB2

WHERE TAB2-FIELD NE space.

LOOP AT ITAB3 into wa_itab3.

DELETE ITAB1 WHERE common_field EQ wa_itab1-common_field.

ENDLOOP.