‎2008 Nov 11 9:11 AM
hi expert,
i have a requirment that i need to delete same records from two internal table without using LOOP statement..
so plz help me in solving this query.
thanks
‎2008 Nov 11 9:14 AM
‎2008 Nov 11 9:14 AM
Hi!
Use a DELETE statement with a WHERE clause for both the internal tables.
Cheers!
‎2008 Nov 11 9:14 AM
You can use one loop statement.
loop at itab1.
read table itab2 with key [[ur condition]].
if sy-subrc = 0. "If condition satisfied
delete itab1 index sy-tabix.
endif.
clear: itab1,itab2.
endloop.
Regards,
Aparna.
‎2008 Nov 11 9:17 AM
Hi,
Use like this..
SORT itab by fieldname.
DELETE ADJACENT DUPLICATES FROM itab COMPARING fieldname1 fieldname2
‎2008 Nov 11 9:17 AM
If both the internal tables are of same structure you can try as;
APPEND LINES OF itab1 TO itab2.
SORT itab2 BY col1 col2.
DELETE ADJACENT DUPLICATES FROM itab2 COMPARING col1 col2.Using the above logic will solve your problem.
Regards
Karthik D
‎2008 Nov 11 9:23 AM
‎2008 Nov 11 9:31 AM
hi i dont need to move the records from one table to another table.
‎2008 Nov 11 9:48 AM
Anyhow you want to delete the duplicate records, then do you think its possible without using LOOP as well as moving records to one table.
May we ask the reason for not using the LOOP and moving of records to one itab.
Also list what are the Dont's that are too be considered while giving you a solution.
Regards
Karthik D
‎2008 Nov 11 9:46 AM
Hi,
Try out this.
Declare the internal table of sorted type with unique key.
Doing this it will not fetch duplicate records hence no need to delete.
Hope this helps you out.
Thanks & Regards