Question:
All,
I have two huge (~2 500 000) ddic table - let's call them A and B. A is somehow smaller. My task is to remove from B rec's that are not in A - in other words make B have only records that are in A.
I need suggestion how to make it work as fast as possible.
So far I do it like this:
first I load whole records of A to it_a and whole records of B to it_b (but I load ONLY key fields - matnr and meinh - in order to save memory). Next sort it_a and it_b. Than:
LOOP AT it_a.
DELETE it_b
WHERE matnr = it_a-matnr
AND meinh = it_a-meinh.
ENDLOOP.
LOOP AT it_b.
DELETE FROM b
WHERE matnr = it_b-matnr
AND meinh = it_b-meinh.
ENDLOOP.
And this first loop works horribly long.
Every suggestion is welcome
_________________
best regards
Jan
Answer:
Instead of deleting from ITAB with a WHERE clause,
- READ FROM it_b WITH KEY blah = blah TRANSPORTING NO FIELDS BINARY SEARCH.
- DELETE it_b INDEX sy-tabix.
WHERE clause scans the entire ITAB (millions of times in your case).
Also, avoid the second loop and delete DB table records in one shot using FROM TABLE itab.
_________________
Sudhi Karkada
Answer:
Thanks!
Performance improvement is unbelievable.