Data & Services

OData

OData (Open Data Protocol) is an open, REST-based protocol for querying and changing data over HTTP, and the standard channel through which SAP Fiori apps read and write business data in SAP S/4HANA and on SAP BTP. SAP uses two versions, OData V2 and OData V4, which differ in features, tooling and app support.

Quick facts

Type
Data access protocol (REST over HTTP, JSON or XML)
Layer
Services & APIs
Versions in SAP
OData V2 and OData V4
Built with
RAP service bindings, SEGW projects, CDS-generated services (ABAP); CAP (SAP BTP)
Administered with
/IWFND/MAINT_SERVICE (V2), /IWFND/V4_ADMIN (V4) on-premise
Who works with it
SAP Fiori and ABAP developers, basis teams, integration architects
Applies to
SAP S/4HANA (all deployment options), SAP BTP
Layer: Services & APIsWhere it sits ▾
Where it sits: L4 · Services & APIsLayer: Services & APIs.L1L2L3L4L5L6BTP

Layer: Services & APIs

Open the architecture map →
What happens when a user clicks a tile
Step 4 of 4: The application startsHighlighted: L3 · UI applicationsL1L2L3L4L5L6BTP
  1. The matching target mapping starts the target: a SAPUI5 or SAP Fiori elements app, an SAP GUI for HTML transaction, a Web Dynpro ABAP application or a URL.

    Related:Target Mapping · SAP Fiori Elements · SAP GUI for HTML (Web GUI)

  2. A SAPUI5 or SAP Fiori elements app requests data from an OData service. SAP Gateway checks that the user may start the service (authorization object S_SERVICE) and routes the request to the backend.

    Related:OData · SAP Gateway · PFCG and SAP Fiori Roles

  3. The service is implemented by CDS views and, for transactional apps, by RAP business-object behavior or older SEGW-based Gateway projects. Authorization checks on the business data run here.

    Related:ABAP CDS Views · ABAP RESTful Application Programming Model (RAP)

  4. Data is read from or written to the business document in SAP S/4HANA. If the change needs approval, a workflow starts in one of the places shown in the Process & workflow overlay, and a task appears in My Inbox.

    Related:Flexible Workflow · My Inbox · SAP Business Workflow

Step 4 of 7See the full trace on the architecture map →

How does OData work?

OData describes business data as entity sets that clients address through URLs, with standard HTTP verbs for each operation:

  • GET reads an entity set or a single entity, for example the purchase orders of Cedar Office Supply.
  • POST, PATCH/PUT and DELETE create, change and remove entities.
  • System query options such as $filter, $select, $expand, $orderby, $top and $skip let the client ask the server to filter, sort and page the data.
  • `$metadata` returns the service's data model: entity types, properties, keys, associations and annotations.
  • `$batch` bundles several requests into one HTTP call.

Because the model and the operations are standardized, a generic client such as the SAPUI5 OData model can bind controls to any compliant service without custom request code. OData is therefore a contract about how data is exposed, not a piece of business logic.

What happens when an SAP Fiori app calls an OData service?

Once the SAP Fiori Launchpad has resolved a tile and started the app, data access follows the same path for every SAPUI5 or SAP Fiori elements app:

  1. The app starts. The app descriptor names the OData service the app uses as its data source.
  2. The app calls the service. The SAPUI5 OData model sends requests, often grouped in a $batch, to the service URL. On SAP S/4HANA, SAP Gateway checks that the user may start the service (authorization object S_SERVICE) and routes the request.
  3. Business logic runs. The service implementation — CDS views, RAP behavior or SEGW-based code — applies validations and data authorizations.
  4. The record is read or written. The response returns the data, or the change is saved to the business document, which can trigger follow-on processing such as a workflow.

A broken step shows up differently: a missing start authorization appears in SU53, while a service-side error appears in /IWFND/ERROR_LOG or /IWBEP/ERROR_LOG on-premise. Every data-driven SAP Fiori screen is, underneath, a sequence of OData requests.

What is the difference between OData V2 and OData V4?

Both versions coexist in SAP landscapes, and the version decides which tools and models apply:

OData V2OData V4
StatusOlder version, still very widespread in delivered SAP Fiori appsNewer version of the protocol
SAPUI5 modelsap.ui.model.odata.v2.ODataModelsap.ui.model.odata.v4.ODataModel
OperationsFunction importsActions and functions
SAP Fiori elementsSupported, with smart controlsSupported, with building blocks
ABAP publishing (on-premise)Per service, /IWFND/MAINT_SERVICEPer service group, /IWFND/V4_ADMIN

RAP can expose the same business object as OData V2 or V4, and some newer SAP Fiori elements features are evaluated only with OData V4, while many delivered apps continue to run on V2. Choosing an OData version is a decision about tooling and app support, not only about protocol features.

How are OData services built in SAP?

SAP offers several ways to create an OData service, depending on platform and age of the codebase:

  • RAP (ABAP RESTful Application Programming Model): a service definition selects CDS entities, and a service binding publishes them as OData V2 or V4, with category UI (carries UI annotations for SAP Fiori elements) or Web API (no UI-specific metadata).
  • SEGW projects: the SAP Gateway Service Builder models entities and generates runtime classes for hand-written ABAP; common in older custom apps.
  • CDS with `@OData.publish: true`: generates an OData V2 service from a CDS view; still documented for on-premise and Private Edition, while RAP service bindings are the newer approach.
  • CAP on SAP BTP: service definitions in CDS served as OData, with V4 as the default and V2 available through an adapter.

The protocol on the wire is the same; the programming model behind it determines how logic, drafts and extensions are handled. A new OData service is best started in the programming model the target platform currently recommends.

What changes between SAP S/4HANA Cloud, on-premise and SAP BTP?

  • On-premise and Private Edition: administrators register and activate OData services on SAP Gateway, assign system aliases and maintain ICF nodes. The full set of Gateway transactions and logs is available.
  • Public Edition: SAP operates the services behind the delivered SAP Fiori apps. Access to administration and monitoring tools is controlled rather than open as on-premise; external consumers call released APIs through communication arrangements, and custom services come from developer or key user extensibility.
  • SAP BTP: apps call OData services on SAP BTP directly or reach on-premise services through destinations and the SAP Cloud Connector.

The OData protocol behaves the same everywhere; what changes is who activates the service and how a caller reaches it.

What are common mistakes with OData in SAP Fiori projects?

  1. Treating a UI service as an integration API. A service built for one SAP Fiori app can change with the app. Integrations belong on released APIs or on services designed as Web APIs.
  2. Over-fetching. Lists without $select or with deep $expand move far more data than the screen shows; check the requests in the browser developer tools.
  3. Ignoring `$batch` when debugging. The browser shows one batch call; the failing operation is inside its response body.
  4. Mixing versions in one app design. V2 and V4 use different SAPUI5 models and SAP Fiori elements stacks, so components rarely move between them unchanged.
  5. Blaming the UI for authorization gaps. An empty list can be a data authorization filter in the service, not a frontend bug.

Most OData problems in SAP Fiori projects are design or authorization problems that only surface as protocol errors.

OData vs. released APIs: what is the difference?

ODataReleased APIs
What it isA protocol for exposing and changing data over HTTPA stability promise SAP makes for specific objects or services
Question it answersHow does a client read or write the data?Can I rely on this object across upgrades?
ScopeAny OData service, including internal UI servicesSelected APIs (OData, SOAP, CDS views, classes) with a release state
Typical consumerSAP Fiori apps and other HTTP clientsIntegrations, extensions and ABAP Cloud code

Many released APIs use OData, but an OData service is not automatically released: the release state, not the protocol, signals upgrade stability.

FAQ

Is OData the same as REST?

OData is a REST-based protocol, but it adds conventions plain REST does not define: a standard metadata document, standard query options such as $filter and $expand, and batch requests. Those conventions let generic clients such as the SAPUI5 OData model work with any compliant service.

Should a new SAP Fiori app use OData V2 or V4?

For new SAP Fiori elements apps built with RAP on current SAP S/4HANA releases, OData V4 is the better starting point, because some SAP Fiori elements features are evaluated only with V4. OData V2 remains the right choice when extending an existing V2 app or when a required feature is only available in the V2 stack.

Do SAP Fiori apps always use OData?

SAPUI5 and SAP Fiori elements apps that work with SAP business data use OData services in almost all cases. SAP GUI for HTML transactions and Web Dynpro ABAP applications launched from the SAP Fiori Launchpad use their own mechanisms instead of OData.

Can external systems call the OData services behind SAP Fiori apps?

Technically an HTTP client can call them, but those UI services are designed for their app and are not a stable integration contract. Integrations should use released APIs, which SAP keeps compatible across upgrades, or Web API services built for that purpose.

Where do I see why an OData request failed?

On SAP S/4HANA on-premise and Private Edition, /IWFND/ERROR_LOG shows errors on the Gateway hub side and /IWBEP/ERROR_LOG shows errors in the backend service. In the browser, the response body of the failing request, often inside a $batch response, carries the error message.

Sources

Applies to
SAP S/4HANA on-premise · SAP S/4HANA Cloud Private Edition · SAP S/4HANA Cloud Public Edition · SAP BTP
Last reviewed

SAP, SAP Fiori, SAPUI5, SAP S/4HANA, SAP BTP and other SAP products and services mentioned are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. This guide is independent and is not affiliated with, sponsored or endorsed by SAP SE.