Skip to Content

Detailed step by step procedure for Creating Gateway Service with all the CRUD Operations and testing them in Service Explorer Part1

In this blog I will explain Creating Gateway service with all CRUD operations  Before starting, I am expecting that you have basic idea of gateway service and gateway service builder i.e SEGW

1. Create service in Gateway system with all the CRUD operations.(Create Read Update Delete)

Create project in SEGW (Gateway Service Builder).

Our Project looks as below.


Now we need to build our Data model, for that first Create the Entity type by importing an RFC Interface.

Give the Entity type name, RFC destination and name of the RFC to be imported and click on next


Select the required properties for the entity type.

Set key property for the entity type, here we will make Material as key then click on Finish.

Our Entity type MATR and its properties look as below.

Give appropriate Entity set name and select the necessary Entity type then click on continue.

Our Project looks as below.

After creating Entity set Service implementation also created with empty CRUD operations which needed to be implemented by mapping with RFC/BOR interface.

Save the changes.

Runtime artifacts are generated and looks as below.

Now click on propose mapping, the system will do mapping automatically or else we can do it manually for required fields. Here no need to map all the properties of the entity type; we will map only the required properties. We will do the mapping by drag drop from Function Module onto data source parameter of the Service operation.

Note: In READ operation all key fields should have input mapping, here in our example Material is key.

QUERY: Right click on Query and choose Map to data source option.

Note: In Query operation all key fields should have output mapping. Here we can also map ranges directly to pass range value for selection.

Give the required RFC and do the mapping as below. Here we are mapping with BAPI_MATERIAL_GETLIST

Here we will map MatlDesc property with appropriate Function field and our key property Material with range table, for that just drag drop that filed on to the data source field. Click on ok in the below screen.

Our mapping looks like below.

With this we have successfully created a gateway service with implementing all CRUD operations.

In the next part Detailed step by step procedure for Creating Gateway Service with all the CRUD Operations and testing them in Service Explorer Part2

we will maintain our service and test it in Service Explorer

You must be Logged on to comment or reply to a post.
  • Hey Nagesh,

    Question for you about when you created the Data Model using the RFC BAPI_MATERIAL_SAVEDATA.

    Would you recommend use the save/create BAPI's when creating the Data Model, or is there a time when using the *GETDETAIL etc might be better?

    I followed your document example and it worked well, a great walk through.


    • Mike,

      we can use any of those while creating data model, it is just for creating data model and nothing to do with it further..



    • Hey Nagesh ... one more question.

      When you did your POST method, is there a way to have a return (exporting) parameter sent back. I see there was a status code of 201 and reason of "Created" ... I am working on a GW Service with a POST method and it would be handy to have a return message sent back as well.  The Export params of the BAPI I have mapped to my POST method do not seem to populate in the response. Thoughts?


      • Hello Mike,

        After create you have to perform a Read operation. Service builder it self will throw a warning saying Create without Read will cause problem during RunTime .

        GW looks for Read after Create or else it will dump.



  • Hello Nagesh,

    Good Work 🙂

    When you are passing values for Ranges as shown below will the GW allows to send the same Property multiples times ?? i mean property ' Material ' is sent twice in the below.

    http:// <hostname>:<port>/sap/opu/odata/sap/ZBPS_MATR_DEMO_SRV/matrset?$filter=Material ge '000000000000000023' and Material le '000000000000000053'

    But i tried this way and GW is not allowing. Technical exception is being thrown.

    Can you please check again by executing the above URL ?

    Just want to confirm will GW allows this way.



  • Hi Nagesh,

    I'm using trial system SAP EHP 2 for SAP NetWeaver 7.0 with SAP Gateway SP04.

    In my system I do not have in attribute's section Generation Strategy field on "Create project" windows:


    Also while I tried to create Entity Type I do not have RFC/BOR interface option.


    Any chance I can proceed further?



    • Hi Martin,

      In that case either use the option "DDIC structure" to import the BAPI structure fields or enter the fields manually like creating a structure in SE11 data dictionary.



  • Hello Nagesh,

    I have just begun to learn Odata, & precisely your blog is the first thing that I came across, now, I need you to elucidate a few things for me if it is not too much to ask.

    1) As visible in the blog do we essentially need to add input parameters + Output parameters of the BAPI while importing Entity Type & Sets?

    2) What if I have to create separate entity for each tables parameter mentioned in the BAPI for example





    How do we tackle with that? Do we create input parameters while creation of each entity or we are required to create all tables parameter in the single entity as you did.

    Kindly respond.



  • Hello Nagesh,

    I followed your steps to create a ODdata services, but when i tried to test the delete function, there is some problem: the delete action completed with return code 204, which is same with you. But i checked the data base and found that this material is still there. Would you help?