cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP CDS Annotation for Hierarchy Fiori Elements UI application - S4HANA OP System

muthuhana
Explorer

Hello Experts,

I am trying to create Hierarchy report using CDS annotation & Fiori Elements. I found this documentation where below annotation has been used to refer Hierarchy CDS view definition but seems only works for cloud.

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

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

Is there any similar kind of annotation available to refer the Hierarchy CDS view in S4HANA OP system ? if not, is there any other way we can achieve this behavior ?

Thanks a lot.

Accepted Solutions (0)

Answers (3)

Answers (3)

dominik_ee
Advisor
Advisor

Hierarchy capabilities are only available since the 2311 cloud release. For OP 2023 (7.58) this was not yet available and will only be available in newer OP releases starting with the next OP release. 

In older releases the only way to achieve this functionality would be a custom implementation. You would have to define an unmanaged query and annotate the CDS entity on header level with the @OData.hierarchy.recursiveHierarchy Annotation and define all hierarchy properties over there (except the entity.name sub-annotation). With this annotations you define the metadata of the service in order to be interpreted correctly by the UI. The framework however is not providing any hierarchical functionality and you would have to implement everything in the unmanaged query implementation yourself (which is quite extensive and cumbersome). 

TharinduW
Explorer
0 Kudos
Thank you for the swift response @dominik_ee ! Much appreciated. I will try the unmanaged query approach to see how it goes!
TharinduW
Explorer

I can relate to what Muthu is saying. I am currently on S/4HANA on-premise 2023 version and am getting the following error on eclipse. I am quite confident that the underlying hierarchy implementation, consumption/interface views etc are following the correct annotations etc. I even tried implementing the CDS views/hierarchies/SD/SBs from Dominik Eira Elias's session on Hierarchy Support in RAP to the letter. 

Error during compilation. See next line for details.Error in entity 'XXXX(CDS)': Hierarchy for view XXXX is not supported

If it helps, these are the software component versions on my on-prem system 

SAP_BASIS 758
SAP_ABA 75I
SAP_GWFND 758
SAP_UI 758

Perhaps @Andre_Fischer or @dominik_ee could comment 🙂 

Regards,
Tharindu W

dominik_ee
Advisor
Advisor
Hi Tharindu, thanks for the hint. For everybody interested in the session here's the link: https://www.youtube.com/watch?v=DgodfEHV_W0
dhegde
Participant

Hi Muthu

Yes, Hierarchy support for Fiori Elements with OData V4 is available since S/4 HANA Cloud 2208. For OP, I think, it is OP 2023 release, but I am not quite sure. This is read-only hierarchy support.

For Fiori Elements with OData V2, it is not supported out of the box via CDS Hierarchy. Instead you will need to achieve it through custom Query Implementation class to build the hierarchy, as far as I know.

Hope this helps.

Regards

Dhananjay

muthuhana
Explorer
0 Kudos

Hello dhananjayhegde

Thanks for your inputs! I was able to define the CDS Hierarchy in S4HANA OP 2022 system but unable to link that in my C'view.

Do we have any annotation in the CDS view level for this or we will have to add it in the UI end only ?

dhegde
Participant
0 Kudos

as far as I know, the annotation

 @Odata.hierarchy.recursiveHierarchy

works only for OData V4.

The CDS Hierarchy itself has been supported since long but it is the native support of hierarchy feature in OData v4 which utilizes CDS hiearchy and this is available in S/4 HANA OP release 2023.

Before S/4 HANA OP 2023, if you want to display hierarchical data on Fiori Elements app, then only option for you is to use OData v2 and then implement a query class on consumption layer. No out-of-the-box support through annotations. It requires ABAP coding to build the hierarchy.

With OData v4, from OP 2023, this can be achieved with a simple annotation - no ABAP coding required to show hierarchy on Fiori Elements.

muthuhana
Explorer
0 Kudos

Hello dhananjayhegde

Before S/4 HANA OP 2023, if you want to display hierarchical data on Fiori Elements app, then only option for you is to use OData v2 and then implement a query class on consumption layer. No out-of-the-box support through annotations. It requires ABAP coding to build the hierarchy.

I have tried Custom Entity but unable to get the data in hierarchal manner. Am I missing anything else from the Backend ?

Could you please share if you have any references for this scenario.