‎2012 Feb 23 6:49 AM
Hi Gurus,
Is there syntax to compare two internal tables and delete records which are not available in the compared internal table . I know this could be achieved by looping the internal table and by using delete syntax inside it but i dont want to use that logic in my code as it will be time consuming when there are thousands of records in each internal table. i'm searching for some syntax which satisfies my requirement in one syntax.
‎2012 Feb 23 6:56 AM
hi,
instead of using two loops , you will have to use main loop. inside that you can use read itab where <condition>. Hope this resolves you performance issue.
Regards,
Vinod Pakath
‎2012 Feb 23 6:56 AM
hi,
instead of using two loops , you will have to use main loop. inside that you can use read itab where <condition>. Hope this resolves you performance issue.
Regards,
Vinod Pakath
‎2012 Feb 23 7:07 AM
Thanks for immediate reply vinod. I generally delete the records by using the method that u have mentioned i.e loop -> read -> delete. I'm getting 4000 records in itab1 and 1000 records in itab2. I felt looping 4000 records and deleting it will affect the performance. Dont we have any syntax in ABAP to delete the non identical 3000 records from itab1 using one line syntax ?
‎2012 Feb 23 7:18 AM
Well you will have to certailnly use loop for comparing. But one thing you could again use is
1. Sorting both the internal tables.
2. Then use the syntax using binary search for eg. Loop at itab using binary seacrh.
This would again improve performance.
Regards,
Vinod Pakath
‎2012 Feb 23 7:29 AM
Hi,
If the 2 internal tables are having atleast one common field ..
Then go for all entries .. It is better option..
otherwise..declare one more internal table and append the 2 internal tables records.
sort the 3 internal table.
delete adjacent duplicated from 3_it by comparing 1 2 ( here 1 & 2 are fields ).
Regards,
PraVeen.