cancel
Showing results for 
Search instead for 
Did you mean: 

DBSQL_DUPLICATE_KEY_ERROR CX_SY_OPEN_SQL_DB SAPLCKMS CKMLCP

10086
Explorer
0 Kudos
245

执行CKMLCP过账步骤过程中DUMP,请问这要怎么解决。

ST22查看信息如下

类别 ABAP 编程错误

运行时错误 DBSQL_DUPLICATE_KEY_ERROR

异常 CX_SY_OPEN_SQL_DB

ABAP 程序 SAPLCKMS

应用组件 CO-PC-ACT

短文本
Open SQL array insert produces duplicate records in the database.

发生了什么?
Error in the ABAP application program.

The current ABAP program "SAPLCKMS" had to be terminated because it found a
statement that could not be executed.

我能做什么?
Note which actions and entries caused the error to occur.

Consult your SAP administrator.

Using transaction ST22 for ABAP dump analysis, you can view, manage,
and retain termination messages for longer periods.

 

错误分析
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 occurring was:
When an Open SQL array insert is performed, trying to insert a record
into the database table "CKMLPP" 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.)

如何更正此错误
COMMIT WORK processing cannot be interrupted. If the exception cannot
be prevented, "CX_SY_OPEN_SQL_DB" must be caught when processing the COMM
WORK. 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
"SAPLCKMS" bzw. LCKMSU33
"CKMS_BUFFER_POST_DYN"
If you cannot solve the problem yourself, please send the following
information to SAP:

1. The description of the problem (short dump)
To do this, choose System -> List -> Save -> Local File (unconverted)
on the screen you are in now.

2. The relevant 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).

3. If these are programs of your own, or modified SAP programs: The
source text of the programs
To do this, please choose
"Other Utilties -> Upload/Download -> Download".

4. Details regarding the conditions under which the error occurred or
which actions and input caused the error.

源代码提取

行 代码

1 FUNCTION ckms_buffer_post_dyn.
2 *"--------------------------------------------------------
3 *"*"Verbuchungsfunktionsbaustein:
4 *"
5 *"*"Lokale Schnittstelle:
6 *" IMPORTING
7 *" VALUE(T_DYN_CKMLPP) TYPE CKMLPP_SORTED
8 *" VALUE(T_DYN_CKMLCR) TYPE CKMLCR_SORTED
9 *"--------------------------------------------------------
10 *4.6C
11 *CS ALRK238430 230999 neu angelegt
12
>>>>> INSERT ckmlpp FROM TABLE t_dyn_ckmlpp.
14 IF sy-subrc <> 0.
15 MESSAGE x099 WITH 'CKMS_BUFFER_POST_DYN' '1' space.
16 ENDIF.
17 INSERT ckmlcr FROM TABLE t_dyn_ckmlcr.
18 IF sy-subrc <> 0.
19 MESSAGE x099 WITH 'CKMS_BUFFER_POST_DYN' '2' space.

20 ENDIF.
21 REFRESH: t_dyn_ckmlpp, t_dyn_ckmlcr.
22
23 ENDFUNCTION.

 

Accepted Solutions (0)

Answers (1)

Answers (1)

BobShen
Product and Topic Expert
Product and Topic Expert
0 Kudos

To resolve the DBSQL_DUPLICATE_KEY_ERROR during CKMLCP posting, consider the following steps:

  1. Check SAP Notes: Review the following SAP Notes specifically related to this issue:

    • 2473645
    • 2772534
    • 2682969 [1]
  2. Analyze the error: The error occurs during COMMIT WORK processing when trying to insert a record into the CKMLPP table that already exists

  3. Possible solutions:

    • Ensure that the Open SQL array insert is only used when you are certain no duplicate records exist in the database
    • Implement exception handling for CX_SY_OPEN_SQL_DB during COMMIT WORK processing
    • If the error occurs in an unmodified SAP program, search the SAP Notes system using keywords: "DBSQL_DUPLICATE_KEY_ERROR", "CX_SY_OPEN_SQL_DB", "SAPLCKMS", "LCKMSU33", "CKMS_BUFFER_POST_DYN"
  4. Prevent SQL Injection:

    • Use static open SQL statements where possible
    • If dynamic SQL is necessary, use class CL_ABAP_DYN_PRG to implement input checks and escape the input for dynamic clauses [2]
  5. Consult SAP administrator: If the issue persists, involve your SAP administrator for further investigation and potential system-specific solutions

Remember to document the actions and entries that caused the error to aid in troubleshooting and prevention of future occurrences.

10086
Explorer
0 Kudos
这个问题很奇怪,执行一半中断后,执行过账冲销后,再次重新执行却又可以成功。