Symptom
Replication of Hierarchy data using CDS view fails in SAP Datasphere:
Error: {"timestamp":"XXXX-XX-XX XX:XX:XX.XXXXXXX", "origin":"_sys_task", "message":"Could not insert into table due to a unique constraint violation.; Statement: ,INSERT INTO ...
Environment
SAP Datasphere
Cause
When importing a Remote table based on ABAP_CDS, the hierarchy is imported with only one key (HEADERID), causing the unique constraint violation error.
This is expected because replicating hierarchies is not supported in Datasphere yet. The Binary(20) is not possible as data type for parent-child hierarchies.
Resolution
The alternative for this is to replicate the SQL View for the CDS view as an ABAPTABLE instead of the CDS view.
See Also
3332010 - Error "The column definition(s) for remote table may have change" when deploying hierarchy remote table
SAP SCN Wiki BW Hierarchy Tables
SAP SCN Wiki Operational Data Provisioning - Troubleshooting
Keywords
ABAP_CDS, $H, dwc, data warehouse cloud, replicating, persisting, persist, persistance, nodeid, headerid, hier , KBA , DS-DI-RT , Remote Tables , Problem