Symptom
When saving a production order which contains external subcontracting operation, the error message "Open SQL array insert produces duplicate records i" occurs. At the same time, a dump with the runtime error "DBSQL_DUPLICATE_KEY_ERROR" can be found in ABAP Runtime Errors app.
Also same error may occur in any other document
Environment
SAP S/4HANA Cloud Public Edition
Cause
This is a data inconsistency and may happen in any document.
The production order contains external subcontracting operation, so the purchase requisition will be generated when saving the order. Checking in configuration activity 105616 - Define Number Ranges for Purchase Requisitions, the current number range status for purchase requisition, which means the last purchase requisition number generated in the system and whose next number will be the new generated purchase requisition number, is smaller than the highest number of the existing purchase requisitions. As a result, when creating a new purchase requisition, the system may use a number that has already existed in the system, which will cause the duplicate key error.
To check the highest number of the existing purchase requisitions, go to Manage Purchase Requisitions - Professional app and sort the Purchase Requisition column in descending order.
Resolution
- Open the effected documents number range BC Activity
- Check mark to select the respective number range
- Click on' change number range status 'button
- Change the current number range status value to the next number of the highest existing document (like purchase requisition or Purchase order etc) number in the system.
Keywords
duplicate records, number range, purchase requisitions, production order, Define Number Ranges for Purchase Requisitions, EBAN , KBA , PP-SFC-2CL , Production Orders (Public Cloud) , MM-PUR-REQ-2CL , Purchase Requisitions (Public Cloud) , Problem
SAP Knowledge Base Article - Public