Simple openUI5 application I. – How to create an OData model using SEGW transaction

In this first part of tutorial, I am going to show how to prepare a data model using SEGW transaction. If you got stuck, you can try to look at this official document that describes the process in more details.

Steps needed to create your first oData service

1. You need to prepare a database table that will be used for storing data. Below you can see the specific database table which is used in this example.

table

2. You need to run the transaction (t-code) SEGW and create your first project.

3. Click on Data Model > Import from DDIC structure. Follow all the steps using your created database table.  At the end you should be able to see following table. Then select relevant keys and finish this process.

import from ddic

4. Creatable, updatable, deletable and addressable parameters need to be checked for your entity.

entity_set

5. Now, you need to generate a runtime object. Select a property panel on your project by right click and choose Generate runtime action.

6. In Service implementation > UserSet > GetEntitySet click by right and choose Go to ABAP Workbench.

7. The main goal now is to redefine relevant methods in USERS_DPC_EXT class. See content of redefined methods below.

Implementation of redefined methods

USERSET_CREATE_ENTITY – CREATE odata method

USERSET_GET_ENTITY – GET odata method

USERSET_GET_ENTITYSET – GET odata method

USERSET_UPDATE_ENTITY – PUT odata method

USERSET_DELETE_ENTITY – DELETE odata method

Testing your oData service

There is a gateway client which can be used for testing running services. Just run transaction(t-code) /IWFND/GW_CLIENT and you can find out, if your service runs correctly.

gw_client

Your oData service is running, now you can start to consume your data!

 

If you miss anything in the article, let me know in the comments.

Peter Marcely

ABAP, Python, JavaScript developer