Skip to Content
Author's profile photo Denis Tislenko

Dynamic entity structure in the Odata service

Most of the time you will need a flexible Odata entity structure. For example, for adding customer fields or providing only fields which would be displayed in customer scenario.

I found this example from Aron for Media Links: http://scn.sap.com/docs/DOC-44864

But if you need it not for Stream media, but for old good abap tables, please have a look at some additional steps below:

1. You have to perform all steps as described by Aron (except redefining Model and Data provider class methods).

In our example, we will create model with two fields (CARRID and PLANETYPE) from SFLIGHT table:

2. Redefine method Define of model provider class as shown below:

/wp-content/uploads/2016/07/001_996111.png

3. Redefine method GET_ENTITYSET of Data provider class as shown below:

/wp-content/uploads/2016/07/002_996112.png

Now execute your service adding /Flights and you will see flights data:

Flights.PNG

With this, you could already build flexible Odata structure. Enjoy!

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.