Announcement:
wanna exchange links? contact me at sapchatroom@gmail.com.
Posted by
Admin at
Question from SAPSQL_ARRAY_INSERT_DUPREC on Nov 26 at 11:46 PM Dear All, I have met a error when run job canceled. the error log:ABAP/4 processor: SAPSQL_ARRAY_INSERT_DUPREC and the SM21&ST22 message below: The ABAP/4 Open SQL array insert results in duplicate database records. Error in ABAP application program. The current ABAP program "/SAPAPO/SAPLBOM_TDPP" had to be terminated because one of the statements could not be executed. This is probably due to an error in the ABAP program. The reason for the exception is: If you use an ABAP/4 Open SQL array insert to insert a record in the database and that record already exists with the same key, this results in a termination. (With an ABAP/4 Open SQL single record insert in the same error situation, processing does not terminate, but SY-SUBRC is set to 4.) How to correct the error: Use an ABAP/4 Open SQL array insert only if you are sure that none of the records passed already exists in the database. code: CLEAR ls_tdpp. REFRESH lt_tdpp[]. ls_tdpp-versioid = i_versioid_to. LOOP AT lt_tdpp_for_copy_objs INTO wa_tdpp_for_copy_objs. ls_tdpp-objid1 = wa_tdpp_for_copy_objs-objid1. ls_tdpp-objid2 = wa_tdpp_for_copy_objs-objid2. APPEND ls_tdpp TO lt_tdpp. ENDLOOP. IF NOT lt_tdpp[] IS INITIAL. DELETE /sapapo/tdpp FROM TABLE lt_tdpp. ENDIF. * insert source version to target version on database table SORT lt_tdpp_for_copy_objs BY objid1 objid2. LOOP AT lt_tdpp_for_copy INTO wa_tdpp_for_copy. READ TABLE lt_tdpp_for_copy_objs WITH KEY objid1 = wa_tdpp_for_copy-objid1 objid2 = wa_tdpp_for_copy-objid2 BINARY SEARCH. IF sy-subrc IS INITIAL. wa_tdpp_for_copy-versioid = i_versioid_to. MODIFY lt_tdpp_for_copy FROM wa_tdpp_for_copy TRANSPORTING versioid. ELSE. DELETE TABLE lt_tdpp_for_copy FROM wa_tdpp_for_copy. ENDIF. " sy-subrc is initial objid1 and objid2 in " LT_TDPP_FOR_COPY_OBJS ? ENDLOOP. " lt_tdpp_for_copy ENDFUNCTION. please help to check the issue. and kindly advise how solved the error? thanks much BR Eva | Reply to this email to post your response. __.____._ | _.____.__ |