2010 Jan 29 5:29 AM
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.
2010 Jan 29 5:30 AM
2010 Jan 29 5:30 AM
2010 Jan 29 5:32 AM
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.
2010 Jan 29 5:36 AM
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.
2010 Jan 29 5:37 AM
2010 Jan 29 5:43 AM
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
2010 Jan 29 6:03 AM
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.