cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP CDS Hierarchy - Service Binding error

muthuhana37
Explorer
0 Kudos
2,398

Hello Team,

I have been following this documentation to create Employee hierarchical list report (in ABAP trail version) but getting below error while creating Service Binding.

https://help.sap.com/docs/abap-cloud/abap-rap/implementing-hierarchical-view

Issue while creating service Binding:

@AbapCatalog.viewEnhancementCategory: [#NONE]<br>@AccessControl.authorizationCheck: #NOT_REQUIRED<br>@EndUserText.label: 'Consumption view for Hierarchy'<br>@Metadata.ignorePropagatedAnnotations: true<br>@ObjectModel.usageType:{<br>    serviceQuality: #X,<br>    sizeCategory: #S,<br>    dataClass: #MIXED<br>}<br>@Metadata.allowExtensions: true<br>@OData.hierarchy.recursiveHierarchy:[{ entity.name: 'ZI_EMPHIERARCHY_CONF1' }]<br>define view entity ZC_EMPHIERARCHY1<br>  as select from ZI_EMPHIERARCHY1<br>  association of one to many ZC_EMPHIERARCHY1 as _Manager on $projection.Manager = _Manager.Employee<br>{<br>  key Employee,<br>      Manager,<br>      /* Associations */<br>      _Manager <br>}

Thanks a lot.

Best Regards,

Muthu

Accepted Solutions (0)

Answers (1)

Answers (1)

dhegde
Participant

Hi Muthu

error says there is no "parent" association. Within your CDS Hierarchy definition, what is the parent association used? Is that association also exposed on your C view where you added this annoation

@OData.hierarchy.recursiveHierarchy:

I have noted down my learnings and some issues I have faced while trying out hierarchies on BTP Trial account on this page. Hope that helps -

Fiori Elements with CDS Hiearchy and OData V4

thank you,

muthuhana37
Explorer
0 Kudos

Hello dhananjayhegde

I don't have any compositional relationship just tried to use recursive Hierarchy like below

@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Configuration for Employee Hierarchy'
define hierarchy ZI_EMPHIERARCHY_CONF1
as parent child hierarchy(
source ZI_EMPHIERARCHY1
child to parent association _Manager
start where
Manager is initial
siblings order by
Employee ascending
)
{
key Employee,
Manager
}

@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Interface view for Employee Hierarchy'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}
define view entity ZI_EMPHIERARCHY1
as select from zemphierarchy1
association of one to many ZI_EMPHIERARCHY1 as _Manager on $projection.Manager = _Manager.Employee
{
key employee as Employee,
manager as Manager,
_Manager
}

@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Consumption view for Hierarchy'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}
@Metadata.allowExtensions: true
@OData.hierarchy.recursiveHierarchy:[{ entity.name: 'ZI_EMPHIERARCHY_CONF1' }]
define view entity ZC_EMPHIERARCHY1
as select from ZI_EMPHIERARCHY1
association of one to many ZC_EMPHIERARCHY1 as _Manager on $projection.Manager = _Manager.Employee
{
key Employee,
Manager,
/* Associations */
_Manager
}

dhegde
Participant

Hi muthuhana

by parent association I meant the _Manager association in your example. It looks fine. Only thing I would change would be:

in ZC_EMPHIERARCHY1, comment the below line:

association of one to many ZC_EMPHIERARCHY1 as _Manager on $projection.Manager = _Manager.Employee

and then change the assoication exposure to

_Manager : redirected to ZC_EMPHIERARCHY1

see if that helps

Cheers!

muthuhana37
Explorer
0 Kudos

Hi dhananjayhegde ,

"redirected" syntax is applicable for Projection views only and If I create projection view then I need to have a compositional relationship with _Manager

Sanket_2411
Newcomer
0 Kudos
Hi Muthu , I am aslo facing the same error while creating service binding. If you have solved please share the solution. Thanks in Advance.