Sap Odata Tutorial

If you intend to reveal your SAP Data (Table or Query Data) to an external environment such as UI5/Fiori or HANA, you must push your data via API. By API, we imply that we might create a provider link utilizing OData which can be accessed via the internet and used to perform CRUD operations. SAP OData behaves similarly to any other ABAP Class in a SAP ABAP environment.By using SEGW transaction, designers can obtain the methodologies of this class. We can start writing the necessary code for manipulating data here, and once we initiate the class, the service link which we generate will function properly.

What is SAP Odata?

SAP OData is indeed a standard Web protocol for querying and updating data in SAP using ABAP, utilizing and expanding on Web technologies such as HTTP to provide access to information from a wide range of external applications, platforms, and devices.

Want to Become a Master in SAP Success Factors? Then visit here to learn SAP Success Factors Certification Course from hkrtrainings!

Architecture of SAP Odata:

In this section, we will go over the high-level architecture of SAP OData.

Architecture of SAP Odata

Why do we need SAP Odata?

SAP OData has numerous advantages. It not only allows us to expose data, but it also allows customers to access data from any location and device. If there are no OData services, the data will remain on-premise, and if a user needs to access their data, they may have to physically visit the data location, which is inconvenient for the digital world.

 Related Articles what is SAP SD !

SAP Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

Advantages of SAP Odata

Using SAP OData provides us with the following benefits:

  • It aids in obtaining human-readable results, as you can view the output data using your browser.
  • It is very simple and quick to access data.
  • It employs all web protocol standards, including GET, PUT, POST, DELETE, and QUERY.
  • It makes use of Stateless Applications: This means that the server does not save any data from the client (for example, the UI5 application) and treats each OData call as a new call.
  • It receives data in the form of related bits of information, one after the other: It is a “alert-analyse-act,” “view-inspect-act,” or “explore & act” interaction pattern.
  • As per this pattern, not all information is loaded at the same time, and a user analyzes the data and arrives at the required information after navigating. As a result, the data is loaded quickly and correctly.
SAPS, sap-odata-tutorial-description-1, SAPS, sap-odata-tutorial-description-2

Subscribe to our youtube channel to get new updates..!

SAP Odata V2 Version:

OData v2 is a set of new standards that are extensions to SAP OData V1. These are as follows:

  • Sorting and filtering on the client side
  • All requests can be batch processed.
  • In the model Automatic Message Handling, all data is cached.

SAP Odata V4 version:

OData v4 is the most recent upgrade to the SAP OData services, and it includes some new and some reduced features, such as:

  • Data binding has been simplified in the new version. The data binding parameter structure is simplified in the new OData V4 model.
  • Only asynchronous data retrieval is required for OData v4.
  • The Batch groups are defined solely through binding parameters in the new OData v4 calls, with the model's corresponding parameters set to default.
  • It allows the use of an operation binding. And it is now much easier to associate operation execution results with controls.
  • The bindings provide implicit access to Create, Read, Update, and Delete (Remove) operations.
  • The Metadata in OData v4 is only accessible viaOdata metamodel.

Now we will learn how to perform Odata query and crud operations in Odata.

Now we must learn how to read a table using an OData Query as well as perform operations on that table such as Insert, Update, and Delete. In this article, we will also learn about basic data reading queries.

In the odata there are mainly 3 phases of data transfer. They are:

  • Sending data from the frontend.

Data is sent from UI (Client) to OData (Server) in form of query

  • Taking data from the frontend

At OData we receive data from Frontend using data provider (Code implemented in CRUD Operation section)

io_data_provider->read_entry_data(IMPORTING es_data= ls_entity).

  • Sending data to frontend

After manipulating data, we send information from OData to UI using et entityset or er entity (Code implemented in CRUD Operation section)

Operations in Odata:

SAP ABAP OData provides several methods for performing CRUD operations, which are as follows:

  • GET_ENTITY method,Select operation:This method is used to read a single data based on table keys
  • GET_ENTITYSET method, Select operation:This method is used to read entire data of a table
  • CREATE_ENTITY method, Insert operation:This method is used to create/insert new data in the table.
  • UPDATE_ENTITY method, Update/Modify operation:This method is used to update an existing data in table
  • DELETE_ENTITY method, Delete operation:This method is used to delete an existing data in a table.

SAP Training

Weekday / Weekend Batches

 Querying in SAP Odata:

Throughout this section, we will look at all of the queries that can be run while reading data from OData. We learned how to read calls with GET ENTITY and GET ENTITYSET in the preceding section. Sometimes we need to filter out data based on our needs, or get the total number of data counts, or get data in a specific order. All of these SAP OData Queries are explained below:

  • $metadata :It displays the metadata for your service. By metadata, we mean that it will contain information about all of the entity sets, including their field names and attributes.
  • $FILTER It is primarily used in the Read Entity Set call. We can send some filter value to the backend during Read that can later be used in the where condition of Select queries.
  • $skip and $top: It is primarily used to display limited data in the UI when reading all of the data from a table with a large amount of data.
  • $orderby:This is used to sort the data for a specific key in ascending or descending order.
  • $format=json: This method returns data in JSON format. The output is in XML format by default.
  • $inlinecount:This function returns the number of rows of data from a table that will be displayed in the UI.
  • $expand: It is used to connect the association and navigation data.
  • $value:This is used to get the media data back.

Top 30 frequently asked SAP SD Interview Questions !


In this blog post we had discussed the sap odata, sap odata architecture, and how it works to perform various crud operations.Had any doubts please drop them in the comments section.

other articles:

Streamserve Training

Worksoft certify Training

Find our upcoming SAP Training Online Classes

  • Batch starts on 28th Sep 2023, Weekday batch

  • Batch starts on 2nd Oct 2023, Weekday batch

  • Batch starts on 6th Oct 2023, Fast Track batch

Global Promotional Image


Request for more information

Kavya Gowda
Kavya Gowda
Research Analyst
Kavya works for HKR Trainings institute as a technical writer with diverse experience in many kinds of technology-related content development. She holds a graduate education in the Computer science and Engineering stream. She has cultivated strong technical skills from reading tech blogs and also doing a lot of research related to content. She manages to write great content in many fields like Programming & Frameworks, Enterprise Integration, Web Development, SAP, and Business Process Management (BPM). Connect her on LinkedIn and Twitter.