OData is an Open Data Protocol used in web technologies. OData is used by SAP to make SAP data accessible to other platforms so that the non SAP users can also access this data to develop web applications, websites, mobile apps, etc.
OData is used to create RESTful APIs.
OData is first introduced by Microsoft now it is being used for web applications, mobile applications etc.
OData fetches the data from one or many database and tables with the help of select, insert, delete or modify statements. It is based on the HTTP framework. In other words in the application layer, we have an internal table and that internal table data is passed out through OData to HTTP.
In a single HTTP request, you can get both the data and metadata or table structure and you can also do CRUD-Q operations which mean that you can Create the data on the database, Request the data, Update the data, Delete the data or you can perform various Queries operations on the database over the internet.
What is REST?
REST means REpresentational State Transfer. It is a kind of software architecture for the World Wide Web.
What is the need for Odata service in SAP?
OData service is used in the SAP gateway to connect with non SAP platforms.
There are three types of OData services
- OData ABAP services -> For ODATA ABAP services the backend server is SAP ECC/CRM/SRM.
- OData HANA services-> For ODATA HANA services the backend server is SAP HANA.
- OData External services-> For OData External services the backend server is Non SAP servers /External servers.
What are the uses of Odata services?
The job of ODATA services is to fetch data from the database and table to OData services through SQL Statements,
And from ODATA services the data is displayed on the front end application screen like SAP UI5 or FIORI screen in the form of some screen elements like Tables, Graphs, Dropdowns, Radio buttons Checkboxes etc.
The front end services like SAP UI5 or FIORI screen will be the same for all ODATA services whether it is ODATA services for ABAP or HANA or External services.
What is SAP Netweaver Gateway?
SAP Netweaver Gateway is a technology that offers connectivity to SAP applications using any programming language or model without the need for SAP knowledge by using REST services and OData protocols.
In other words, SAP Netweaver is a technology which helps devices, environments or platforms to access SAP using OData services. It converts the internal table into OData format. In other words, SAP Gateway is like a medium for the outside world to connect with SAP and transfer data to or from SAP.
What is SAP Gateway Service Builder?
SAP Gateway Service Builder or Transaction Code SEGW is used for creating OData services.
How to create OData services?
There are two ways to develop OData services:
- By using Mapping Technique: OData service can be developed by using mapping techniques such as BAPI/RFC.
- Without using Mapping Technique.
What is the latest OData version?
V4 is the latest OData version.
Step by Step procedure to create OData services:
Step1: Goto T.Code SEGW.
Step2: On the SAP Gateway Service Builder screen press the Create Icon.
Step3: In the SAP Gateway Service Builder screen a pop window for Create Project appears fill all the required information as shown below:
Description: OData service for testing
Select the packages or Local Object and press the tick button.
Now the new Project Z_ODATA created. Press the Save button.
Step4: In the SAP Gateway Service Builder screen expand Z_ODATA project node which we created.
Select Data Model node. Right click-> Import->DDIC Structure
Give a suitable name for Entity type:
In the Create an Entity Type or Complex Type tab type the name of the Entity.
In the Import from ABAP Structure tab select the ABAP structure.
ABAP Structure: VBAK
And press Next button.
Check the required fields and press the Next button.
Select VBLEN as a key field in the table and press the Finish button.
Click the “Generate” button.
Then Model Provider Class and Data Provider Class will be generated automatically by the system.
Press the Tick button.
Step5: Go to Transaction code /N/IWFND/MAINT_SERVICE
Step6: Click on Add Service button.
Step7: On the Add Selected Services screen fill in the required information.
System Alias: LOCAL
Technical Service Name: Z_ODATA_SRV
External Service Name: Z_ODATA_SRV
And press the Get Services button.
Step8: In the Add Selected Services screen check the service and press the Add Selected Services button.
Step9: Now the Add Services screen comes, select the package or just use the Local object and press the tick button.
An Information message will be shown where it will confirm about the service is created and metadata loaded successfully
Step10: In the Activate and Maintain Services Screen press SAP Gateway Client button.
Step12: In the SAP Gateway Client press the Execute button.