Symptom
Using PUST for archiving:
After calling the program RP_PA_ARCH_PERNR_SEL, the functional module HRPY_PUST_FILL_ST gets runtime error
Category ABAP Programming Error
Runtime Errors DBSQL_DUPLICATE_KEY_ERROR
Except. CX_SY_OPEN_SQL_DB
ABAP Program SAPLHRST
Application Component PY-XX-TL
----------------------------------------------------------------------------------------------------
|How to correct the error |
| The exception must either be prevented, caught in procedure |
| "HRPY_PUST_FILL_ST" "(FUNCTION)", or |
| the possibility of it occurring must be declared in the RAISING clause |
| in the procedure. |
| 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-modified 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 |
| "SAPLHRST" or LHRSTU32 |
| "HRPY_PUST_FILL_ST" |
| If you cannot solve the problem yourself, please send the following |
| information to SAP: |
| |
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|Information on where terminated |
| The termination occurred in ABAP program "SAPLHRST", in "HRPY_PUST_FILL_ST". |
| The main program |
| was "RP_PA_ARCH_PERNR_SEL". |
| |
| In the source code, the termination point is in line 61 of (Include) |
| program "LHRSTU32". |
| The termination is due to exception "CX_SY_OPEN_SQL_DB" occurring in procedure |
| "HRPY_PUST_FILL_ST" "(FUNCTION)". |
| This exception was not handled locally or declared in the RAISING |
| clause in the procedure's signature however. |
| The procedure is in program "SAPLHRST". The source code begins in line 1 of |
| (include) program "LHRSTU32". |
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|Source Code Extract |
----------------------------------------------------------------------------------------------------
|Line |SourceCde |
----------------------------------------------------------------------------------------------------
| 31| stepid EQ space. |
| 32| LOOP AT p_index. |
| 33| READ TABLE p_pernr WITH TABLE KEY pernr = p_index-low |
| 34| TRANSPORTING NO FIELDS. |
| 35| IF sy-subrc NE 0. |
| 36| CLEAR: ist. |
| 37| ist-pernr = p_index-low. |
| 38| ist-processid = p_processid. |
| 39| ist-stepid = space. |
| 40| ist-status = pernr_status-initial. |
| 41| APPEND ist. |
| 42| ENDIF. |
| 43| |
| 44| ENDLOOP. |
| 45| FREE p_pernr. |
| 46| ELSE. |
| 47| REFRESH ist. |
| 48| LOOP AT p_index. |
| 49| CLEAR: ist. |
| 50| ist-pernr = p_index-low. |
| 51| ist-processid = p_processid. |
| 52| ist-stepid = space. |
| 53| ist-status = pernr_status-initial. |
| 54| APPEND ist. |
| 55| ENDLOOP. |
| 56| CHECK sy-subrc EQ 0. "WOGL9CK014241 |
| 57| ENDIF. |
| 58| DESCRIBE TABLE ist LINES p_count. "WOGL9CK04719 |
| 59| IF p_count GT 0. "! |
| 60|*-----Urmenge sichern/ save basic selection----------------------------* |
|>>>>>| INSERT t52st FROM TABLE ist. |
| 62|*-----Counter erhöhen/ increase counter--------------------------------* |
| 63| SELECT SINGLE FOR UPDATE * FROM t52sp "! |
| 64| WHERE processid = p_processid. "! |
| 65| IF sy-subrc IS INITIAL. "! |
| 66| ADD p_count TO t52sp-sel_pernr. "! |
| 67| UPDATE t52sp. "! |
| 68| ENDIF. "! |
| 69| ENDIF. "! |
| 70| COMMIT WORK. |
| 71| |
| 72|ENDFUNCTION. |
----------------------------------------------------------------------------------------------------
Read more...
Keywords
KBA , PY-XX-TL , Tools , Problem
About this page
This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).Search for additional results
Visit SAP Support Portal's SAP Notes and KBA Search.