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 ▾
Layer: Services & APIs
Open the architecture map →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)
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
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)
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
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,$topand$skiplet 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:
- The app starts. The app descriptor names the OData service the app uses as its data source.
- 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. - Business logic runs. The service implementation — CDS views, RAP behavior or SEGW-based code — applies validations and data authorizations.
- 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 V2 | OData V4 | |
|---|---|---|
| Status | Older version, still very widespread in delivered SAP Fiori apps | Newer version of the protocol |
| SAPUI5 model | sap.ui.model.odata.v2.ODataModel | sap.ui.model.odata.v4.ODataModel |
| Operations | Function imports | Actions and functions |
| SAP Fiori elements | Supported, with smart controls | Supported, with building blocks |
| ABAP publishing (on-premise) | Per service, /IWFND/MAINT_SERVICE | Per 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?
- 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.
- Over-fetching. Lists without
$selector with deep$expandmove far more data than the screen shows; check the requests in the browser developer tools. - Ignoring `$batch` when debugging. The browser shows one batch call; the failing operation is inside its response body.
- 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.
- 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?
| OData | Released APIs | |
|---|---|---|
| What it is | A protocol for exposing and changing data over HTTP | A stability promise SAP makes for specific objects or services |
| Question it answers | How does a client read or write the data? | Can I rely on this object across upgrades? |
| Scope | Any OData service, including internal UI services | Selected APIs (OData, SOAP, CDS views, classes) with a release state |
| Typical consumer | SAP Fiori apps and other HTTP clients | Integrations, 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
- SAPUI5 SDK: OData V4 Model
- SAPUI5 SDK: OData V2 Model
- SAP Help Portal: Service Binding (ABAP Cloud) — OData V2/V4, UI and Web API
- SAP Help Portal: ICF Services for OData V2 and V4 (SAP Gateway Foundation)
- SAP Help Portal: Working with ABAP for Cloud Development and Released APIs
- Applies to
- SAP S/4HANA on-premise · SAP S/4HANA Cloud Private Edition · SAP S/4HANA Cloud Public Edition · SAP BTP
- Last reviewed