1/19/2022 by Michael Management Posted in SAP

The most popular way to establish SAP Connectivity with Non SAP System is via OData REST API. It provides you seamless connectivity and it’s a low-cost solution, which is why preferred by the majority of SAP users. Using REST API you can pass SAP Data to Non SAP Systems as well Push non-SAP Systems data to SAP as well.

In this blog, our focus will be that how we can pass data from SAP to non-SAP Systems.

It's been a few years since the SAP Gateway was enabled to provide RFC interfaces and ABAP functions in REST API. REST has additional functionality as compared to SOAP, although they have similar technology. They both are function call via HTTP protocol. However, REST transfers pure easily readable data by humans in XML or JSON; it can quickly call from other platforms faster, thus saving resources.

An object is accessed via REST but it is not is a method. The passed parameters can change the stated of the object in REST access. Whereas a frequent application is the connection of the REST interface.


Steps to create O data service in SAP ECC

1. Log in to the Sap ECC system

2. Type sew in the command box

3. Create a new project

SAP Gateway Service Builder


4. Provide the following properties for the project

SAP Create Project


Click Continue, green tick button. This will be shown as under

Create Project


5. CLICK ON SAVE How to Develop OData REST API - SAP ERP

SAP Gateway Service Builder


6. This will as for the transport request number, click on create new button as shown below

Transport Request Number


7. Enter a description and click on the save button a new number will be generated automatically and note that number for future transport purposes



8. DEVK938428 click on the continue button to proceed further as given below

Request Number


The next step is to define the Structure/ Data Model for your web service.


How to define Structure / Data Model for your web service

1. We will import the structure of our data model from the bapi as this will be used for data display How to Develop OData REST API - SAP ERP

2. Click on the Data Model folder under the newly created project and choose RFC/BOR interface inside the Import Menu as shown below.

Data Model Folder


3. Add Details. The Entity Type Name could be anything, whereas the Type must be Remote Functional Call (we are using RFC based) and Name is the name of the BAPI, and click next.

Create Entry Type from Data Source


4. On the next screen select all and click next

Click Next


5. On the next screen you have to specify a key column as in OData service created by net weaver gateway. A primary key is mandatory. In our example, there is no key but we can select any column to be treated as a key column. In fact, this column is used when you perform a read operation on a single row of the resultant table and click Finish, as shown in the below image

Specify Key ColumnSpecify Key Column


So far we have created schema/structure for the service in the above steps, now we are going to specify the data source for the web service.


Service implementation

1. Expand Service Implementation Folder. Right-click on GetEntitySet(Query) and choose Map to Data source.

Note: There are multiple operations under this folder. If you want to add support for full CRUD operation you have to implement all operations for read purposes we have two operations GetEntity (Used for one-row reading) and EntitySet (to get set of rows). If your BAPi is returning any Table then you will perform the following operation i.e. read entity set otherwise you only need to implement the Read Operation.

2. After clicking Map to Data Source, the following window will be displayed. Select Type (Remote Functional Call), and name it using the BAPI name of your bapi (ZBAPI) as shown below and click Continue.

Map to Data Source


3. Following this, the mapping screen will be displayed as shown below. Click on the purpose mapping button as highlighted. To map Key attributes you have to click on the Insert Row button. From the left-side list of columns, select Key by double-clicking in the newly inserted row blank area. From the right-side area drag the input parameter file, which is to be mapped as the input parameter.

Mapping Key AttributesMapping of Operation GetEntity (Read for ZBAP


How to Generate Run Time artifacts

1. Click on the button shown below

Generate Run Time Attributes


2. Enter the Package Name. In our example it is ZIB. Click Save button

Package Name


Service Registration

1. Double click on file under the Service Maintenance folder and then click on Register Button as shown below

Service Maintenance Folder


2. This will open a window type LOCAL and click continue as given below

Select System Alias


3. Type the Package name in the newly opened window as shown below. In our example it is ZIB. Click on continue

4. Finally a green indicator shows your web registered and active as given below

Green Indicator


5. Click on the SAP Gateway Client button next to Error Log as in the image above to launch the testing client

6. Specify URL and click on the execute button to see the.

Your REST API is ready to use!


Learn More

Want to take a deeper dive and take your ABAP skills to the next level? Check out the OData courses in our SAP course library.

You can also play and practice in a real SAP system using our Live SAP Access plans.


Author Photo

Michael Management Corporation (MMC) is an award-winning provider of hands-on SAP training simulations for global enterprises, government agencies and medium-sized businesses. MMC enables organizations to maximize business performance and minimize financial reporting errors through a combination of SAP eLearning content and SAP sandbox systems.
More Blogs by Michael Management:
Accelerating Your Learning through Organized Training

Ongoing learning has become a cornerstone value of many companies throughout the world. An ongoing learning program — whether it’s sponsored by a company or fulfilled by an individual employee ...

excel vs sheets
Excel vs. Google Sheets: How to Choose

The business world practically runs on spreadsheets, whether they’re used in recognizable CSV formats or custom-coded interfaces like those you may find in SAP. In the world of spreadsheets, ...

training remote workers
4 Ways to Keep Employees Learning while at Home

With remote work increasingly becoming the new norm, companies that previously had their entire staff in one building, committing to the same location and workhouse every day, now work in a dispersed ...