Reputation: 356
I'm using CDS parent child hierarchy to get multiple parents of an entity.
There is no problem with the data that has a single parent.
But when I try to display the data that has multiple parents, it's dumping. There is no dump when I get the multiple parent data from the CDS hierarchy using SE38 report.
I have already specified Multiple parents allowed in the CDS hierarchy
I'm getting the following error text
Hierarchy error: The hierarchy source data contains node 00012345 having multiple parents but the hierarchy is specified to reject such nodes.: line 1 col 821 (at pos 820)
Upvotes: 3
Views: 770
Reputation: 356
I found the solution.
We need to redefine the CDS hierarchy class method (defined in @ObjectModel.query.implementedBy) IS_READ_ONLY_MULTI_PARENT_HIER to set the indicator as 'X' to support the Multiple parent scenario.
It is not supported by default.
Upvotes: 0
Reputation: 13646
MULTIPLE PARENTS NOT ALLOWED
is the CDS Hierarchy default behavior. You need to fix your CDS Hierarchy, see ABAP documentation - DEFINE HIERARCHY:
Addition 10
... MULTIPLE PARENTS {NOT ALLOWED}|{LEAVES ONLY}|ALLOWED
The optional addition MULTIPLE PARENTS specifies whether the hierarchy can have child nodes with multiple parent nodes:
NOT ALLOWED
- This is the default setting (a child node can have exactly one parent node only).
LEAVES ONLY
- Only leaf nodes can have multiple parent nodes.
ALLOWED
- All hierarchy nodes can have multiple parent nodes.
Upvotes: 0