Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Former Member


This document illustrates How to create OData Service using Service Builder Tool (SEGW). This tool is installed via IW_BEP component in backend system.

Follow the steps to create and configure OData Service.

1.       Login to Gateway System -> Go to transaction SEGW -> click on New Project

2.    Give Name and Description. Select ‘Generation Strategy’ as ‘Standard’ and save it as a local object.

3.       A new blank project will be created as below

4.    Right Click on the data model and Click on Import and choose DDIC Structure

5.    Select any existing ABAP Structure, provide object name, Mark at least one property as Key and click ‘Continue’

6.      It creates an entity ‘Request’. Expand node to navigate to various properties.

7.      Create ‘Entity Set’ as below

8.      Give Entity Set name as ‘Requests’, select Entity Type from F4 Help and click ‘Continue’

9.      Click on ‘Entity Sets’ and check the properties Creatable, Updatable and Deletable

10. Getaway Model will appear as below

11. Click on Generate Runtime Objects button, on the top menu. This will generate runtime artifacts for the OData Service

A dialog box will pop up with pre-defined class names and service names.  Click on OK.

Add these objects in Local Objects

12.  After generation, you should find the following objects getting added to your project, under Runtime Artifacts node.

13. The ZCL_ZTEST_MPC class has the generated definition of the OData Service. The additional code has to be written in ZCL_ZTEST_MPC_EXT class. Right click on ZCL_ZTEST_MPC_EXT and select on Workbench option.

14.  This will open Class ZCL_ZTEST_MPC_EXT in ABAP Workbench. Enter Change Mode, Select ‘Define’ method and click on ‘Redefine’

Enter Below code

data : lo_property type ref to /iwbep/if_mgw_odata_property,
type ref to /iwbep/if_mgw_odata_entity_typ.

super->define( ).

lo_entity_type = model->get_entity_type(
lo_entity_type->set_creatable( abap_true ).
lo_entity_type->set_updatable( abap_true ).
lo_entity_type->set_deletable( abap_true ).
lo_entity_type->set_addressable( abap_true ).
lo_property = lo_entity_type->get_property( iv_property_name =
'Requestnumber' ).
lo_property->set_filterable( abap_true ).

Save and Activate the Class.

15.  Right click on ZCL_ZTEST_DPC_EXT and select on Workbench option.

16.  This will open Class ZCL_ZTEST_DPC_EXT in ABAP Workbench. Enter Change Mode, Select ‘REQUESTS_GET_ENTITYSET’ method and click on ‘Redefine’

Enter below Code. Save and Activate.

  DATA: ls_request LIKE LINE OF et_entityset,
TYPE zsdmreq_list.

SELECT * FROM zsdmreq_list_tab INTO TABLE lt_requests.

LOOP AT lt_requests INTO ls_req.
CLEAR ls_request.
    ls_request-requestnumber = ls_req-requestnumber .
    ls_request-requestname = ls_req-requestname .
    ls_request-status = ls_req-status .
    ls_request-priority = ls_req-priority .
    ls_request-contactdetails = ls_req-contactdetails .
    ls_request-summary = ls_req-summary .
    ls_request-requestdesc = ls_req-requestdesc .
    ls_request-usercomments = ls_req-usercomments .
    ls_request-additionaldtls = ls_req-additionaldtls .
    ls_request-requestorid = ls_req-requestorid .

APPEND ls_request TO et_entityset.

Save and Activate it.

17. Similarly, other methods can be implemented.

18. Register OData Service with Gateway system

Go to transaction /IWFND/MAINT_SERVICE. Service maintenance screen will be displayed. Click on add service to add a service from Backend system.

Give Backend System Alias and Technical Service name (in our case ZTEST_SRV) and press ‘Enter’

19. Click on Technical Service Name and provide package as $TMP

Click ‘Continue’ and you will get below successful message:

Click Back button and verify that the newly created service is added to the list.

20. Test OData Service

Select ‘ZTEST_SRV’ and click ‘Call Browser’. This will open Service definition in browser.



0 Kudos


Former Member
0 Kudos

Hi Gaurav,

There is something wrong at step14. There should be no need to redefine the "define" method in MPC_EXT. There should be a 'define_<entity_name>'  sub-method generated in the MPC for each entity, and 'define' calls these. What version of IWBEP is this installed with?

You do not need to set any of the attributes in step 9 (they currently have no real impact on the model or data providers) and they should be set on a 'by case' basis anyway. If you do set them, they are added to the generated code that step 14 is carrying out.

These settings may have more importance with SAPUI5 tools integration - "addressable" certainly does.



Former Member
0 Kudos

Thanks. Helpful document.

Former Member
0 Kudos

very informative

Former Member
0 Kudos

Thanks for the very useful and informative document.

Former Member
0 Kudos

Thanks for the useful and informative document.

0 Kudos

Thanks for this document, very useful

Creation of OData Service using Service Builder Tool

Former Member
0 Kudos

Thanks. Helpful document.

Labels in this area