cancel
Showing results for 
Search instead for 
Did you mean: 

SAP UI5 Tree using directly CDS

02-01-2021 2:21 PM
1846 views 2 comments
0 Likes
SAP Managed Tags
Subscribe

Hi, I'm trying to develop an UI5 screen using a TreeTable(hierarchical) whose data I want to deliver using a CDS. After spending several hours learning about the ways to develop this I came to the conclusion that this would be impossible without using this CDS as 'Reference Data Source' and manage the proper tree-annotations there. I would like to know if that's true and if there's someway to make this annotations directly in the CDS in order to avoid this step of creating a 2nd Odata and make there the annotations.

Thank you in advance.

Best regards

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

geert-janklaps
SAP Mentor
SAP Mentor
0 Likes

Hi,

I think you should be able to create a tree table just using annotations in your CDS view.

You'll need to use the ODataTreeBinding model:

https://ui5.sap.com/#/api/sap.ui.model.odata.v2.ODataTreeBinding#overview

With the hierarchy annotations:

https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/7.5.17/en-US/23473e6a8b1c4da2b0ba5be4f3...

I don't have an example at hand, but I guess this might point you in the right direction.

Best regards,

Geert-Jan Klaps

0 Likes

Hi,

the point is that I have to put this annotations:

sap:hierarchy-node-for,

sap:hierarchy-parent-node-for,

...

in the metadata of my CDS without using another oData using the CDS as Reference Data and after write this annotations in the method define() of MPC_EXT class. Other possibility could be write them in the navigation properties of my UI5 app like it's shown in the first link that you wrote but if you look this method is deprecated and in my case didn't work. So the only way that there could be possible is with some annotation in the CDS Metadata extension or something like this.

Edit: It could be even a solution if I could be able to use a local file as metadata and oData/CDS only for the data provider but I didn't find the way to do this.