Hello all,
I want to analyze all duplicates which are in really huge tables like kna1, for this I did a copy (SELECT * from KNA1 into lt_kna1) into an internal table and determined the duplicates in some ABAP coding. This is not working when the kna1 is relay huge because there is a lack of memory.
My idea was to select just the potential rows of kna1 which could be duplicates. For this I build the following SELECT statement which is as well not really performant:
SELECT * FROM kna1 CLIENT SPECIFIED INTO TABLE lt_kna1 WHERE kunnr IN (
SELECT kunnr FROM kna1 CLIENT SPECIFIED GROUP BY kunnr
HAVING COUNT( DISTINCT name1 ) GT 1 ).
Is there another possibility, for example with a function module to get the row's which might be duplicates? It would be really great if you can post your ideas about this problem.
Thanks in advance
Cajus
Hi Cajus,
Thanks to the primary index, KNA1 is a sorted databases table. You can just within a select and endselect compare the current line with the previous one.
Kind regards,
John.
the KNA1 has MANDT and KUNNR, so it can have only duplicates for different
clients, for example for client copies, where it makes perfectly sense.
So possible explain your task.
I have one idea where it makes sense when you want to bring together two formerly independent clients and you must check whether there are identical KUNNR used in both clients. I would not understand the task for a higher number of clients.
This task is an inner self-join or subquery or it can also be written with for all entries.
SELECT * INTO TABLE lt_kna1 FROM kna1 CLIENT SPECIFIED WHERE mandt = mandt1 AND kunnr IN ( SELECT kunnr FROM kna1 CLIENT SPECIFIED WHERE mandt = mandt2 ).
Siegfried
Add a comment