cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP CDS Hierarchy - Service Binding error

muthuhana
Explorer
0 Kudos

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

gregorw
Active Contributor

Hi Muthu,

please be aware of the issues with hierarcies mentioned by frankjentsch in Fiori UI for Hierarchies (Hierarchical Treeview, Recursive Hierarchy).

CU
Gregor

muthuhana
Explorer
0 Kudos

Hello gregorw ,

Thanks for your inputs.

In my case, I was not able to create service binding so not sure this is an issue with my code or global one

Is there any similar annotation we can use in the On prem system to refer the Hierarchy CDS view ?

@OData.hierarchy.recursiveHierarchy:[{ entity.name: '/DMO/I_EmployeeHN_HR' }]
dhegde
Participant
0 Kudos

Hello Gregor

The link you added throws "Access Denied" error. How do I request access to it? Could you please help?

Thank you

Dhananjay

gregorw
Active Contributor
0 Kudos

The link should work again.

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,

muthuhana
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
0 Kudos

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!

muthuhana
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