ERPClimb logoERPClimb
SAP technical topicObjectOData V2 versus OData V4 for SAP developersModuleRAP_CDS_ODATA

Choosing Between OData V2 and V4

OData V2 and V4 are distinct protocol versions with different metadata models and capabilities. RAP supports OData V4 natively and new RAP/Fiori Elements V4 scenarios often prefer V4, while V2 remains supported for existing Gateway/Fiori consumers and can also be exposed from RAP. Do not assume V4 means JSON batch: SAP Gateway V4 batch processing commonly uses multipart/mixed requests as documented.

This page compares OData V2 and OData V4 as they show up in day-to-day SAP development, focused on the practical differences that break code and UIs rather than the protocol specification. It covers where each version sits in the RAP and Gateway stack, a worked coexistence scenario, and the decision points an architect should walk through before picking one over the other.

Reviewed by an ERPClimb SAP consultant on 20 Sept 2026· 967 words

Esta página aún no está disponible en español.

What it is

OData V2 and V4 are different versions of the OData protocol with different metadata vocabularies, payload details, query behavior and client expectations. In SAP, classic Gateway/SEGW services are strongly associated with V2, while RAP service bindings support modern V2 and V4 exposure patterns and Fiori Elements V4 is designed around OData V4. The important correction is that batch format is not a simple 'V2 uses multipart, V4 uses JSON' distinction in SAP Gateway: SAP's OData V4 batch documentation and current S/4HANA APIs commonly use multipart/mixed batch requests and changesets. Likewise, deep create is not unique to V4—classic SAP Gateway V2 services can implement deep insert through the OData Channel. V4 brings a newer standardized metadata/capability model and is the strategic fit for many new RAP scenarios, but feature selection must be based on the actual SAP service/runtime and consumer.

When to use it

Use OData V4 when building new RAP services/Fiori Elements V4 applications and when the consumer supports the V4 contract and capabilities you need. Use V2 when maintaining existing SEGW/Gateway services, when a current Fiori/UI5 or third-party consumer is contractually tied to V2, or when the target SAP application exposes only V2. RAP can also expose services through V2 bindings where required, so protocol choice is a consumer/runtime contract decision rather than a judgment that one version is 'legacy-only'. Before migration, compare metadata annotations, batch/change-set behavior, draft support, client library compatibility and error payloads rather than assuming wire formats are interchangeable.

How it fits the stack

Below the protocol sit CDS view entities and, for V4 services, RAP behavior definitions and implementations; for V2 services the equivalent layer is the DPC and MPC classes generated by SEGW, or a CDS view exposed through a projection with sap: annotations. Above the protocol sits the service binding, which is where the choice between V2 and V4 is actually made in a RAP scenario, followed by the consuming UI: Fiori Elements V2 templates and older freestyle SAPUI5 apps speak V2, Fiori Elements V4 templates and RAP-native draft UIs speak V4. OData V4 with RAP effectively supersedes the SEGW plus OData V2 combination for new development, though it does not remove V2 from the stack, both protocols coexist on the same gateway and can even expose the same underlying CDS data through separate bindings.

A worked example

A team builds a new RAP approval app and chooses an OData V4 UI service binding because the target Fiori Elements floorplan supports V4 and RAP draft/action semantics fit naturally. A separate external consumer still expects an established V2 metadata contract, so a V2-compatible service is retained for that consumer. During testing, a developer assumes the V4 batch request should be JSON and hand-builds a JSON batch payload; the SAP Gateway endpoint rejects it because that service expects multipart/mixed batch syntax. The fix is to follow the service's documented batch contract, not an internet generalization about OData versions.

How to choose

  • For new RAP/Fiori Elements V4 work, V4 is normally the first option to evaluate.
  • Retain V2 when an existing consumer/service contract depends on it and migration value does not justify breaking that contract.
  • Check the actual SAP service binding/API documentation for batch and deep-create behavior; do not infer wire format solely from protocol version.
  • Validate metadata annotations, draft/actions, ETags, navigation/query behavior and client-library support before migration.
  • Running V2 and V4 side by side can be valid, but each contract needs independent regression testing and lifecycle ownership.

Common pitfalls

  • Claiming SAP OData V4 batch is always JSON; SAP Gateway V4 commonly documents multipart/mixed batch processing.
  • Claiming deep insert exists only in V4; classic Gateway V2 supports deep entity creation as well.
  • Porting V2-specific annotations/error parsing directly to V4 and assuming identical metadata/wire semantics.
  • Switching protocol without retesting clients, batch/change sets, ETags, navigation queries and error handling.
  • Treating V2 as unsupported simply because V4 is strategic for new RAP development.

ECC, S/4HANA and clean core

OData V4 with RAP/Fiori Elements V4 is a strategic direction for new S/4HANA development, while OData V2 remains supported and widely used in existing Gateway and application APIs. S/4HANA can therefore contain both versions for valid reasons. Clean-core guidance is primarily about consuming released business services and avoiding unsupported core coupling; it does not require a blanket immediate replacement of every V2 service. Migrate when the target protocol/consumer benefits justify the contract change.

Whose problem this is

The developer decides which service binding type to generate and writes the corresponding behavior implementation or DPC/MPC logic. The architect sets the protocol strategy for the landscape and decides how long V2 coexistence is tolerated. The functional consultant flags which Fiori floorplan or external integration constraint is driving the choice, since that requirement usually determines the protocol before any code is written.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-technical-topics/odata-v2-versus-odata-v4-for-sap-developersERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.