SAP Knowledge Base Article - Public

2570287 - Instance with same keys (x) already exists

Symptom

You are performing some actions on UI and/or executing custom scripting services and you receive the error message Instance with same keys (x) already exists.

"Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental." 

Environment

  • SAP Business ByDesign
  • SAP Cloud For Customer
  • SAP Cloud Application Studio

Reproducing the Issue

1. Execute a custom script logic by pressing a button or automatically trigger by system

2. Receive the error message 'Instance with same keys (x) already exists'

Cause

You are receiving the error message Instance with same keys (x) already exists, because you are trying to create a new record on a Custom/Standard BO using a ID that already exist on your system

Resolution

1. Open Cloud Application Studio and login on your tenant

2. On Cloud Application Studio, click on button Start Tracing

3. Execute the custom script logic, that is raising the error message, by pressing a button or automatically trigger by system

4. Receive the error message 'Instance with same keys (x) already exists'

5. On Cloud Application Studio, click on button Stop Tracing

6. Go to view Trace Explorer and click on button Refresh Trace

8. Select the last trace listed and click on button Get Trace Details

10. Double click on each the custom scripts (.absl files) that was executed and raised error message

11. On view Sequence Details on tab Messages, find the error messages and who/what raised the error messages

12. Check the line where the column Description has the message Instance with same keys (x) already exists and look on the columns Service Operation, BO and BO NODE

SDK.png

- The Service Operation Column will give you details of what kind of actions was trying to get executed when backend raised the error message

- The BO Column tells you from what Business Object the error message comes

- The BO NODE column tells from what Node of the Business Object the error message comes

13. Check what Business Object raised the error message

- If the Colum BO maintained a ID, like YABCDEFG_HIJKLMNOPQ, error message is raised when you tried to create a new record on a Custom BO

- If the Colum BO maintained SAP standard Business Object namespace , like SALES_QUOTE, error message is raised when you tried to create a new record on a SAP standard BO

14. Check your logic that create records for the Business Object (listed on Column BO) and change it to don't create records using ID that already exist

15. In case you correct your logic, but you are still receiving the error message, open a SAP case providing all the details involved, steps to reproduce the issue and authorization to reproduce the same

Keywords

Instance with same keys , already exists , PDI , Custom , KBA , AP-RC-BDS-SCR , ByDesign Studio Scripting (ABSL) , Problem

Product

SAP Business ByDesign all versions ; SAP Cloud Applications Studio all versions ; SAP Cloud for Customer add-ins all versions ; SAP Cloud for Customer core applications all versions