12-19-2006 6:57 AM
hi all.
i have two internal tables ITAB and ITAB1. ITAB having records which exists in ITAB1 also. now i want to delete that records from ITAB which are in ITAB1.
how can i do this?
thanks.
null
12-19-2006 6:59 AM
loop at itab1.
read table itab with key f1 = itab1-f1.
if sy-subrc = 0.
delete itab index sy-tabix.
endif.
endloop.
regards
shiba dutta
12-19-2006 6:59 AM
Hi,
Deleting is a tedious process instead use a third internal table and read all distinct values into it.
I think that will be easy.
Regards,
Amit
12-19-2006 7:00 AM
loop at p_sub.
read table intab with key locno eq p_sub-locno.
if sy-subrc eq 0.
delete intab.
ENDIF.
endloop.
kishan negi
12-19-2006 7:16 AM
try this code ,change table name accordingly but main thing is tht u shud have primary key common in both the table -
data: begin of itab occurs 0.
include structure zgill_main.
data end of itab.
data itab1 like itab occurs 0 with header line.
data wa_itab like itab.
data:i1 type i value 0.
select * from zgill_main into table itab.
select * from zgill_main into table itab1 where pernr = '11111111'.
loop at itab into wa_itab.
i1 = i1 + 1.
read table itab1 with key pernr = wa_itab-pernr.
if sy-subrc = 0.
delete itab index i1.
endif.
endloop.
12-19-2006 10:24 AM
hi,
execute the following code .
data:begin of itab occurs 0,
f1(3) type c,
f2(3) type c,
end of itab.
data:begin of itab1 occurs 0,
f1(3) type c,
f2(3) type c,
end of itab1.
itab-f1 = 'ABC'.itab-f2 = '123'.append itab.clear itab.
itab-f1 = 'ZXC'.itab-f2 = '678'.append itab.clear itab.
itab-f1 = 'HGD'.itab-f2 = '658'.append itab.clear itab.
itab-f1 = 'KDJ'.itab-f2 = '645'.append itab.clear itab.
itab1-f1 = 'ZXC'.itab1-f2 = '678'.append itab1.clear itab1.
itab1-f1 = 'KDJ'.itab1-f2 = '645'.append itab1.clear itab1.
loop at itab.
read table itab1 with key f1 = itab-f1.
if sy-subrc = 0.
delete itab.
endif.
endloop.
loop at itab.
write:/ itab-f1, itab-f2.
endloop.
if it helpful reward me.