cancel
Showing results for 
Search instead for 
Did you mean: 

Reading of OData metadata/field labels in UI5

aldimitrov14
Explorer
0 Kudos

Hello, I am currently exploring UI5 and I'm trying to read the labels from the OData metadata of an RAP Service in a Fiori freestyle application. Currently I have a two page setup that serves as a List Report & Creation (Object) Page. The reason I am using a freestyle application is that the creation/object page has to have a lot of custom ui5 features. 

In the List Report page I am using a Smart Table + a Smart Filter to work with the entity, but in the creation (object) page I am using non-smart controls. For the non smart controls, I would like to access the labels directly from the OData metadata. 

I would accomplish that by doing so:

        <Label text="{/#Entity/Property/@sap:label}" labelFor="someField" />

In the case where I start from the List Report ( e.g. open the app, use the creation button to navigate to the object/creation page ) this label is loaded. This is not the case if I load the object (creation) page directly ( e.g. by navigating to the object/creation page with the URL ), then I get the error that the Entity is not a valid EntityType.

I would assume the following: Since the smart controls preload the data from the Entity I want to use, then in the object page, these labels are already present from being loaded from the List Report, but since I do not use Smart Controls on the object/creation page, I should handle the data load from the entity.

What I've also checked is that the metadata on the object page is loaded correctly, it's just that the annotations for the entity are not present for a reason unknown to me.

I would ask, what is the correct way to handle this, in cases where I have to create an new object and I do not have anything to load?

Maybe that's the not correct approach, so what I would like to do is just access the labels, but not preload any data in the page.

Accepted Solutions (0)

Answers (0)