cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ME_INFORECORD_MAINTAIN_MULTI - DBSQL_DUPLICATE_KEY_ERROR

Antigoni_Dimou1
Explorer
0 Likes
227

I am trying to create info records with conditions using the ME_INFORECORD_MAINTAIN_MULTI function module. When I execute the function module manually via SE37, it works perfectly. However, when I run it through my report with the exact same data, I encounter an update error when BAPI_TRANSACTION_COMMIT is called.

Upon debugging, I found that the error occurs because the function module RV_KONDITION_SICHERN_V13A  is being called twice within an update task. The second call attempts to insert the same key combination into table A017 that was already inserted during the first run. Since this key combination already exists, it causes a dump.

Antigoni_Dimou_3-1746440735726.png

It's important to note that I only have one condition in my info record.

Further investigation in the debugger revealed two spots where RV_KONDITION_SICHERN_V13A is called:

  1. Inside ME_INFORECORD_MAINTAIN_MULTI, the first call happens in the ME_POST_INFORECORD  subroutine (PERFORM BUCHEN), which triggers RV_CONDITION_SAVE.

    Antigoni_Dimou_2-1746440711189.png

     

  2. After ME_POST_INFORECORD, the method post_conditions()  is called, which also triggers RV_CONDITION_SAVE in the update task.

When I execute the function module in SE37, the first call does not trigger the condition save, and 

cl_mmpur_bapi_po=>check_repid_loaded( 'ME_INFORECORD_MAINTAIN_MULTI==FT' )

 returns abap_true because ME_INFORECORD_MAINTAIN_MULTI==FT exists in the call stack. As a result, the function proceeds without entering RV_CONDITION_SAVE, where  RV_KONDITION_SICHERN_V13A is called.

Call stack from se37:

Antigoni_Dimou_1-1746440678735.png

 

Call stack from se38 (my custom report):

Antigoni_Dimou_0-1746440629360.png

 

Any ideas on how to resolve it?

 

Accepted Solutions (0)

Answers (0)