SAP Knowledge Base Article - Public

2575790 - Error "Instance with the same key (XYZ..) already exists" While Importing Marketing Attributes in Data Workbench

Symptom

You are importing Business Attribute Assignments (Marketing Attributes) to Accounts using Data Workbench using the same External Key assignment to different Business Partners in your files and you want to know why the import works for some Business Partners and not for others, some resulting in the error message:

"Instance with the same key (XYZ..) already exists" (XYZ represents the unique identifier ID from the Business Attribute instance in backend)

Environment

SAP Hybris Cloud for Customer 1711 and higher.

Reproducing the Issue

  1. Go to Data Workbench work center;
  2. Click Import view;
  3. Click Individual Objects;
  4. Select Attribute Assignment object and click Download Metadata;
  5. Fill the template and use the External Key number range from 1 to 20, then repeat the same external key number range assignment to different Business Partner IDs in a second template;
  6. Click Next and upload the file;
  7. See the first file will be imported successfully and will have Marketing Attributes assigned, but the second file will have some records with error "Instance with the same key (XYZ..) already exists".

Cause

Data Workbench Individual Import works as an upsert on External Key. If the External Key does not exist for that Business Object and node, then an instance will be created, else the existing instance will updated (only those properties will be updated which are marked as updatable in the OData service). In this case Business Partner ID is not updatable, so for the Business Partners that already had the Marketing Attributes assignment present the error message "Instance with the same key (XYZ..) already exists" will be generated.

For the Business Partners using a repeated External Key (that was used before in another template for Business Attribute Assignment) and did not contain Marketing Attribute assigned no error message will be raised, but the Business Partner will not be updated.

Resolution

External Key assignment should be unique for each Object in Data Workbench, so it is recommended that all External Key assignment information is saved on a separate file for future reference.

Another way to keep track of Business Attribute Assignments external keys is to perform a query in the BusinessAttributeAssignmentCollection either using the OData Console (marketingattribute service) or in the internet browser, using filter with 'BusinessPartnerID', as seen in the example below:

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/marketingattribute/BusinessAttributeAssignmentCollection?$filter=BusinessPartnerID eq 'XYZ123'

Keywords

data, workbench, businessattributeassignment, marketing, attributes, import, instance, already, exists, account, business, partner , KBA , LOD-CRM-INT-DWB , Data Workbench , Problem

Product

SAP Cloud for Customer add-ins all versions ; SAP Cloud for Customer core applications all versions