Skip to Content

Read entitysets of odata-sources in sap ui5

Nov 27, 2017 at 07:40 PM


avatar image
Former Member

Hi everybody,

i'm trying to learn how dynamically I can use OData in SAP UI5 Applications.
My scenario is the following: I have an unknown number of OData-Sources defined in manifest.json. I want to get the metadata of the sources and read all available entitysets to have them as a list in a table.


odata_srv1 has the entitysets "businesspartners" and "loans"

odata_srv2 has the entitysets "cars" and "bikes

the table I want to have:





I want a table that lists all the entitysets of the defined odata-services, no matter if there is one or five services defined. Is this even possible?
Is there a method to get the defined data-sources in the manifest.json? Is there a method to read the entitysets from the sources?

Thank you so much!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Arjun Biswas Nov 28, 2017 at 07:36 AM

Hi Sidney Weiher,

How are you reading your service data. Is it from the manifest or the component file or from the controller itself. In any case you can use the getServiceMetadata() method with your model reference object, or you can use the $metadata query parameter to access all your service metadata.

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hello Arjun,

i tried the getServiceMetadata and it worked, but i dont know how to instantiate the dataSources dynamically. they are defined in my manifest as destinations. is there something like a method "get all defined destinations from manifest"?

thanks for your help!


Hi Sidney Weiher,

Could you try with :

this.getOwnerComponent().oModels  // inside your controller's init method

As per my experimentation, you get an object which contains all the models defined in your manifest file.

Hope this helps,


Former Member

Thats what i needed. Thanks so much!

Joseph BERTHE Nov 27, 2017 at 09:18 PM

You can read the metadata loaded from your services, then you will be able to look for entitisets (look at this Link)

10 |10000 characters needed characters left characters exceeded