cancel
Showing results for 
Search instead for 
Did you mean: 

Runtime Errors: DBSQL_DUPLICATE_KEY_ERROR with Except: CX_SY_OPEN_SQL_DB in Z program

former_member739183
Discoverer

The error is occuring in FM : CASH_FORECAST_SD_ORDER_UPD_3

in below line of code:

insert fds2 from table t_fds2_ins.

i know its trying to insert duplicate record in FDs2 but what is the solution for this

What can you do? Note down which actions and inputs caused the error. To process the problem further, contact you SAP system administrator. Using Transaction ST22 for ABAP Dump Analysis, you can look at and manage termination messages, and you can also keep them for a long time. Error analysis During COMMIT WORK processing, an exception has occurred that could not be intercepted during processing. To avoid inconsistencies, this situation causes the session to abort, regardless of whether or not there is an exception handler outside the COMMIT WORK statement. The reason for the exception is: When an Open SQL array insert is performed, trying to insert a record into the database table "FDS2" causes the function to terminate if a record with the same key already exists. (When an Open SQL individual record insert is performed, this situation does not cause the function to terminate. SY-SUBRC is set to 4 instead.)

How to correct the error COMMIT WORK processing cannot be interrupted. The exception (in class 'CX_SY_OPEN_SQL_DB') must therefore either be prevented or handled in the COMMIT WORK processing. To prevent the exception, note the following: Open SQL array insert should only be used if it is certain that none of the records specified already exists on the database. If this cannot be guaranteed, exception CX_SY_OPEN_SQL_DB should be intercepted, and the error must be resolved. If the error occurs in a non-modfied SAP program, you might be able to find a solution in the SAP Notes system. If you have access to the SAP Notes system, check there first using the following keywords: "DBSQL_DUPLICATE_KEY_ERROR" CX_SY_OPEN_SQL_DB "SAPLFDSD" bzw. LFDSDU03 "CASH_FORECAST_SD_ORDER_UPD_3" If you cannot solve the problem yourself, please send the following information to SAP: 1. This description of the problem (short dump) To do this, choose System -> List -> Save -> Local File (unconverted) on the screen you are in now. 2. A suitable system log To do this, call the system log in transaction SM21. Restrict the time interval to ten minutes before the short dump and five minutes after it. In the display, choose System -> List -> Save -> Local File (unconverted).

Accepted Solutions (0)

Answers (1)

Answers (1)

tom_wan
Contributor
0 Kudos

Hello

There isn't enough information for trouble-shooting. Please clarify how do you use the FM.eg

Regards

Tom