‎2007 Aug 01 11:14 AM
Hi frnds,
I have two internal tables it1,it2.
it1 has 50 records,it2 has 20 records. These 20 record are common for both the tables.But i don't know the order of the fields . I need the records of table it1 other than that 20 records.i.e.,I need only the remaining 30 records.Please give the logic for this requirement.
Thanks in advance
‎2007 Aug 01 11:17 AM
hi,
go to the following link
Surely help u.
https://www.sdn.sap.com/irj/sdn/advancedsearch?query=comparing%20two%20internal%20tables&cat=sdn_all
<b>plz reward if useful.</b>
Swati
‎2007 Aug 01 11:17 AM
Let both it1 and it2 be internal tables with header lines(work area)
loop at it1.
read table it2 with key field1 = it1-field2......
if sy-subrc = 0.
delete it1.
endif.
endloop.
Now it1 will contain you required data
......................
for the read stmt u must give the all fields in the table.
Reward if useful
Message was edited by:
Arjun Puthuruthy
‎2007 Aug 01 11:17 AM
hi,
loop at it1 into workarea1.
read table it2 into workarea2 where it2-fld1 = it1-fld1.(COMMON RECORD)
IF SY-SUBRC NE 0.
APPEND workarea1 to it3.
endif.
endloop.
Regards,
Srinivas
‎2007 Aug 01 11:18 AM
Hi
SORT the both internal tables by the key fields and read the it2 table with the linking fields of it1
data l_tabix like sy-tabix.
loop at it1.
l_tabix = sy-tabix.
read table it2 with key f1 = it1-f2 and f2 = it1-f4.
if sy-subrc = 0.
delete it1 index l_tabix.
endif.
endloop.
Now it1 will have those 30 records which are not there in it2.
<b>Reward points for useful Answers</b>
Regards
Anji