Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Delete records from an Itab comparing with another without using loop.

Former Member
0 Likes
1,752

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,206

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

4 REPLIES 4
Read only

Former Member
0 Likes
1,207

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

Read only

Former Member
0 Likes
1,206

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 ?

Read only

0 Likes
1,206

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

Read only

0 Likes
1,206

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.