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 entries from one internal table comparing another without loop.

0 Likes
18,301

Hi All,

Is there any way, we can remove entries of one table comparing the entries from another?

For Example.

Table 1 (Ref)

DATA 1

DATA 2

DATA 3

DATA 4

Table 2 (Main)

DATA 2

DATA 3

My requirement is to remove the entry DATA 2 and DATA 3 from Table 1, with out using loop .

Is there any 7.4 based queries?

Thanks in Advance.

1 ACCEPTED SOLUTION
Read only

abo
Active Contributor
13,511

You mean using FILTER ?

10 REPLIES 10
Read only

abo
Active Contributor
13,512

You mean using FILTER ?

Read only

0 Likes
13,511

Yes Andrea, can we achieve using Filter?

Read only

abo
Active Contributor
13,511
Read only

0 Likes
13,511

Thanks Andrea.

I think that will do the job.

Really appreciate your time.

Read only

pfefferf
Active Contributor
13,511

You can use a FILTER expression using a filter table.

Read only

0 Likes
13,511

Thanks Florian, let me try.

Read only

13,511

table1 TYPE SORTED TABLE OF XXX WITH UNIQUE KEY key1 key2 ....
SORT table1 BY key1.
LOOP AT table2 assigning field-symbol(<ls_table2>).
DELETE table1 WHERE key1 = <ls_table2>-key (key2 = <ls_table2>-key2) ....
ENDLOOP. 

why don't you go for that? Would it not be the quickest way and most performant one?

Correct me if I am wrong 🙂

did anyone tracked the performance of filter?

Read only

0 Likes
13,511

Thanks Igor, Agreed.

I was concerned about the performance, as we were querying on millions of data.

And am currently inside a child program -> loop -> perform - (here) - wanted to remove the loop here.

Read only

0 Likes
13,511

is it not possible to reduce outside the first loop?

For me, ofter it is tough to find the real root for the problem. Sometimes it can be already solved before it comes to the complicated, logical part 🙂

Read only

13,511

I will definitely try that.

Thanks for your time in helping.