SAP Knowledge Base Article - Public

3482393 - Error: Instance with the same key already exists

Symptom

Error when uploading the CBO generated ODATA service.

Environment

SAP MARKETING CLOUD

Reproducing the Issue

Error message: 'Instance with the same key already exists' while uploading the CBO generated ODATA.

Cause

The uniqueness condition was violated for the entries.

Resolution

You should always make sure that when you are creating new instances via POST requests, no instance already exists for the given values of the key fields.

See Also

What might also be helpful is the SAP_UPSERT action which is generated for CBOs:
https://help.sap.com/viewer/0f69f8fb28ac4bf48d2b57b9637e81fa/latest/en-US/07b1d8e18d924f5ba8bf5275e40a3ee4.html

Blog:
https://community.sap.com/t5/crm-and-cx-blogs-by-sap/usage-of-odata-service-of-custom-business-object/ba-p/13309767

Keywords

Instance with the same key already exists; 400 Bad Request , KBA , CEC-MKT-EXT-CBS , Custom Business Objects in Segmentation , BC-SRV-APS-EXT-BO , Custom Tables and Nodes , Problem

Product

SAP S/4HANA Cloud Public Edition all versions ; SAP S/4HANA Cloud all versions