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

  • j1wu

    Thanks Peter, this is exactly what I’m looking for ! I followed each step carefully twice, but when I test things out in /IWFND/GW_CLIENT, I keep getting 403 as HTTP response, “No service found for namespace , name ZWJ_USERS_SRV, version 0001”, ZWJ_USERS_SRV is the technical service name, and /sap/opu/odata/sap/ZWJ_USERS_SRV is the URI requested.

    Another information, after I completed all the steps described here, I went to /IWFND/MAINT_SERVICE – Activate and Maintain Services, and I couldn’t find ZWJ_USERS_SRV in the service catalog, was I missing anything?

    I’m still very new to this, thanks for your patient and help 🙂

  • j1wu

    Found the fix, you will need to go to /IWFND/MAINT_SERVICE to add the service 🙂

  • Venkatesh

    HI,

    As I am beginner to SAP. I am learning SAPUI 5 and I had setup the environment for developing SAPUi 5 front end using Eclipse.

    But I need to write my own oData service and consume that service in my practice application.

    For this purpose , What is the environment ( i mean backend ) do I need ? and also please suggest whether their is any free environment for practice?

    Please guide me on this.

  • Malli

    Hi Peter,
    thank you so much….. Really good one for learning OData Services…

  • sujit kumar nayak

    thank u peter

  • sujit kumar nayak

    thank u peter