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
-
Go to Data Workbench work center;
-
Click Import view;
-
Click Individual Objects;
-
Select Attribute Assignment object and click Download Metadata;
-
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;
-
Click Next and upload the file;
-
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:
Keywords
data, workbench, businessattributeassignment, marketing, attributes, import, instance, already, exists, account, business, partner , KBA , LOD-CRM-INT-DWB , Data Workbench , Problem