08-07-2007 11:12 AM
I have 2 itabs with the following struc
itab1 - f1 f2 f3
itab2 - f1 f3 f2
now i want to find the records in itab1 which are not in itab2. How can we do this... is there any funcs available ?
08-07-2007 11:16 AM
Loop at itab1.
read table itab2 with key field1 = itab1-field1
itab1-field2
itab1-field3.
If sy-subrc ne 0.
append fileds of itab1 to itab3.
endif.
endloop.
08-07-2007 11:16 AM
Hi,
try this
sort itab2 by field.
loop at itab1.
read table itab2 with key field = itab1-field binary search.
if sy-subrc eq 0.
same record exists.
else.
same record doesnot exists
endif.
endloop.
reward points if helpful
thanks & regards,
venkatesh
08-07-2007 11:22 AM
Hi Suresh,
There is no function module avialable for this requirement but you can achieve this using LOOP...ENDLOOP with READ statement combination.
Check this code.
itab1 - f1 f2 f3
itab2 - f1 f3 f2
itab1_only - f1 f2 f3
SORT ITAB2 BY F1 F2 F3.
LOOP AT ITAB1.
READ TABLE ITAB2 WITH KEY F1 = ITAB1-F1 F2 = ITAB1-F3 F3 = ITAB1-F2.
IF SY-SUBRC = 0.
APPEND ITAB1 TO ITAB1_ONLY.
ENDIF.
CLEAR ITAB1.
ENDLOOP.
Thanks,
Vinay
08-08-2007 3:06 AM
hi babu,
i have send you the code and the logic to your is hope it is useful for you.
run that code in se38 you will understand the logic.
give points if it is useful.