cancel
Showing results for 
Search instead for 
Did you mean: 

Recursive Hierarchy in CAP

thomasnelissen
Participant
0 Kudos
1,370

Hi CAP friends,

I have been struggeling with implementing a recursive hierarchy view in my CAP application.

I have a database table HierachyNode which represents an organisational hierarchy:

Customer Center 1->* Sales Organisation 1->* Country 1->* Customer.

Every node in the hierarcy can have 0...* functionalities, and when we read a node, we want to inhert all functionalities defined in the parnent nodes.

entity HierarchyNodes {<br>    key id                 : String;<br>        name               : String;<br>        parent             : Association to one HierarchyNodes;<br>        level              : Integer;<br>        lineage            : String;<br>        type               : String enum {<br>            CC;<br>            SALESORG;<br>            COUNTRY;<br>            CUSTOMER<br>        };<br>        virtual drillstate : String enum {<br>            expanded;<br>            Leaf;<br>        };<br>        functionalities    : Association to many NodeFunctionalities<br>                                 on functionalities.node = $self;<br>}<br>entity NodeFunctionalities {<br>    key node          : Association to one HierarchyNodes;<br>    key functionality :  String;<br>    key value         : String;<br>}

I found the following blog online about recursive CDS views in ABAP: https://blogs.sap.com/2020/01/13/abap-cds-recursive-association-using-hierarchy/

Is something similar possible in CAP? The annotations used in the blog are throwing errors. Are there examples available?

Happy holidays!

Thomas

Accepted Solutions (1)

Accepted Solutions (1)

OliverKlemenz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Answers (0)