‎2006 Nov 07 3:15 PM
Hello Experts,
I have to delete some of the itab records based on a condition. There are 2 internal tables.
ITAB1:
EBELN EBELP MATNR LIFNR
45001 00010 10044 10101
45002 00010 10044 10101
45003 00010 10044 10222
45004 00020 10044 10222
45005 00030 10044 10350
45006 00040 10044 10350
ITAB2:
EBELN EBELP MATNR LIFNR
000000 00000 10044 10101
000000 00000 10044 10222
now i have delete the records of ITAB1 where <b>ITAB1-LIFNR <> ITAB2-LIFNR.</b>
Can you please suggest me the way.
Thanks a lot for the help.
‎2006 Nov 07 3:18 PM
SORT itab2 BY lifnr.
LOOP AT itab1.
READ TABLE itab2 WITH KEY lifnr = itab1-lifnr
BINARY SEARCH.
IF sy-subrc <> 0.
DELETE itab1.
ENDIF.
ENDLOOP.
‎2006 Nov 07 3:17 PM
LOOP AT ITAB2.
DELETE ITAB1 WHERE LIFNR <> ITAB2-LIFNR.
ENDLOOP.Message was edited by: Matt Nagel
‎2006 Nov 07 3:18 PM
SORT itab2 BY lifnr.
LOOP AT itab1.
READ TABLE itab2 WITH KEY lifnr = itab1-lifnr
BINARY SEARCH.
IF sy-subrc <> 0.
DELETE itab1.
ENDIF.
ENDLOOP.
‎2006 Nov 07 3:18 PM
Hi Sey,
Loop at ITAB1 into wa_itab1.
loop at i_tab2 into wa_itab2 where ITAB2-LIFNR <> ITAB1-LIFNR.
delete i_tab1 from wa_itab1.
endloop.
endloop.
reward points if this helps.
Manish
‎2006 Nov 07 3:20 PM
sort itab1 by lifnr.
sort itab2 by lifnr.
Loop at itab2.
read table itab1 where lifnr = itab2-lifnr.
if sy-subrc <> 0.
delete from itab1 where index = sy-index.
endif.
endloop.
‎2006 Nov 07 3:21 PM
Hi,
sort itab2 by ebeln ebelp matnr lifnr.
Loop at itab1.
gv_index = sy-tabix.
read table itab2 with key ebeln = itab1-beeln
ebelp = itab1-ebelp
matnr = itab1-matnr
lifnr = itab1-lifnr.
if sy-subrc <> 0.
delete itab1 index gv_index.
endif.
endloop.
Hope this will help you.
Regards,
Satya.
‎2006 Nov 07 3:23 PM
Hi,
LOOP at itab1 into lw_itab1.
read table itab2 into lw_itab2
with key lifnr = lw_itab1-lifnr.
If sy-subrc<> 0.
delete itab1.
endif.
ENDLOOP.
If helpful pl reward.
Cheers.
‎2006 Nov 07 3:26 PM