I have the following scenario:
Database table, let's call it ZDBX
with primary keys:
MATNR, LIFNR, ZART
In a report i have internal table lt_table TYPE TABLE OF ZDBX
DELETE ADJACENT DUPLICATES FROM lt_table
COMPARING matnr lifnr zart fact_code.
DELETE FROM ZDBX.
INSERT ZDBX FROM TABLE lt_table.
The INSERT
statement will lead to a short dump because there are rows in the internal table with identical primary keys, but different fact_code
.
Now, I know that the obvious solution is to only compare primary keys in the DELETE ADJACENT DUPLICATES
statement, but this does not work in my case, because the user wants to decide which fact_code
will be deleted.
For now, my solution is to export the local table (right before INSERT
) into a excel and find the duplicates and ask the user which fact_code
he wants.
Can I find out (trough a system variable or in ST22
) at which line the INSERT crashed?
(So I dont have to do all the excel work)
My ideal solution would be to put the INSERT into a TRY-CATCH
, find the duplicate row, and write a message into the Job-Log with the duplicate data.
Is it possible ?
(Also, setting the column fact_code
as primary key is not a solution that the user agrees with)