Preface – This post is part of the SAP ABAP OData Tutorial series.
Table of Contents
If you plan to expose your SAP Data (Table or Query Data) to external environment like UI5/Fiori or HANA, then you need to push your data in a form of API. By API we mean, using OData we will generate a service link that can be accessed via internet and can be used to perform CRUD operations. SAP OData in SAP ABAP environment is just like another ABAP Class. We can access the methods of this class using SEGW transaction. We can write our required code here for the data manipulation and once we activate the class, the service link that we generate will act accordingly.
SAP OData is a standard Web protocol used for querying and updating data present in SAP using ABAP, applying and building on Web technologies such as HTTP to provide access to information from a variety of external applications, platforms and devices.
In SAP, we use SEGW transaction code to create an OData Service. SEGW stands for Service Gateway.
Architecture of SAP OData
Here, we will discuss about the High level architecture of SAP OData.
Why we need ODATA
SAP OData comes with multiple advantages. It not only helps us to expose data but also helps a customer to access data from anywhere and any device. If there will be no OData services, then the data will remain on premise and in case a user needs to access their data, they might have to visit the data location, which is uncomfortable for the digital world.
Advantages of an ODATA
Using SAP OData provides us following advantages:
- It helps to obtain human readable results i.e. you can use your browser to see the output data
- It is very easy and relatively fast to access data
- It uses all the standards of web protocols i.e. GET, PUT, POST, DELETE, and QUERY
- It uses Stateless Applications: It means Server does not save any data of Client (e.g. UI5 Application) and treats every OData call as a new call
- It receives data in form of related pieces of information, one leading to another: It is an interaction pattern known as “alert-analyse-act”, “view-inspect-act”, or “explore & act”. According to this pattern not all data are loaded together, and a user analyses a data and reaches its required information after navigation. In this way the data loads quickly and correctly.
SAP OData V2 (Version 2)
OData v2 is a set of new standards which are add-ons to SAP OData V1, and these are as follows:
- Client-side sorting and filtering
- All requests can be batched
- All data is cached in the model
- Automatic Message handling
You can read more about SAP OData v2 vs OData v1 here.
SAP OData V4 (Version 4)
OData v4 is the latest upgradation to the SAP OData services which comes with some addition and some reduction of features, such as:
- The new version brings simplification in terms of data binding. The new OData V4 model simplifies the data binding parameter structure.
- OData v4 requires only asynchronous data retrieval.
- The Batch groups are solely defined via binding parameters in the new OData v4 calls with the corresponding parameters on the model as default.
- It supports use of an operation binding. And now it is much easier to bind operation execution results to controls.
- Create, Read, Update and Delete (Remove) operations are available implicitly via the bindings
- In OData v4, the Metadata is only accessed via ODataMetaModel
You can read more about SAP OData v4 vs OData v2 here.