Skip to Content
avatar image
Former Member

Read entitysets of odata-sources in sap ui5

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.

Example:

odata_srv1 has the entitysets "businesspartners" and "loans"

odata_srv2 has the entitysets "cars" and "bikes

the table I want to have:

bikes

businesspartners

cars

loans

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!
Sidney

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    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.

    Add comment
    10|10000 characters needed characters exceeded

  • 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)

    Add comment
    10|10000 characters needed characters exceeded