3

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)

enter image description here

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
BalajiB
  • 326
  • 6
  • 29

2 Answers2

0

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.
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • I have already included MULTIPLE PARENTS ALLOWED in the CDS hierarchy view to have multiple parents. And I'm able to get the data in the backend from the query SELECT * FROM HIERARCHY_ANCESTORS.... Only while I'm showing it in the app, it's dumping with that error message – BalajiB Mar 20 '23 at 05:05
0

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.

BalajiB
  • 326
  • 6
  • 29