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.
1. Log in to the Sap ECC system
2. Type sew in the command box
3. Create a new project
4. Provide the following properties for the project
Click Continue, green tick button. This will be shown as under
5. CLICK ON SAVE How to Develop OData REST API - SAP ERP
6. This will as for the transport request number, click on create new button as shown below
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
The next step is to define the 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.
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.
4. On the next screen select all and 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
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.
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.
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.
1. Click on the button shown below
2. Enter the Package Name. In our example it is ZIB. Click Save button
1. Double click on file under the Service Maintenance folder and then click on Register Button as shown below
2. This will open a window type LOCAL and click continue as given below
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
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!
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.
Mastering Document Splitting in SAP Central Finance: Essential Ins...
Why is Group Reporting Critical for SAP Central Finance? Masterin...
SAP inventory management is an in-demand skill set from large companie...
Accounting professionals often need to upload multiple journal entries...
In a previous article, we learned about outline agreement creation in ...
A Purchase Requisition is a request raised by a person or department to the...