Service Definition and Service Binding in RAP
The service definition is a DDLS source that declares which CDS entities (root and, via association, child entities) are exposed together as one OData service and under what entity set names. The service binding takes that definition, ties it to a protocol (OData V2 UI, OData V4 UI, Web API, INA) and a version, and publishes it as a runnable service in the gateway framework.
This page covers the two artifacts that turn a CDS-based RAP business object into a callable OData service: the service definition, which declares the exposed entity set, and the service binding, which activates and publishes it against a specific protocol. It focuses on the practical split between defining, activating and publishing, and on the version-drift problems that follow from getting that split wrong.
Published 16 Sept 2026· 1,455 words
What it is
A service definition is a DDLS source object listing 'expose' statements: a root CDS entity given an alias, plus optionally its children reached via association, all bundled as one addressable service. It contains no protocol information at all. A service binding is a separate SRVB object that takes one service definition, attaches a binding type (OData V2 UI, OData V4 UI, Web API, or an analytical binding), assigns a version, and, once activated and published, registers the resulting service with the ICF node and the OData framework so it can actually be called. The structural fact that causes most confusion: editing the service definition never automatically updates a binding that already exists against it. Activation of the definition and publishing of the binding are two independent lifecycle events, and a stale binding will keep serving the old metadata until someone republishes it, even though the underlying CDS and behavior definition look correct in the IDE.
When to use it
Use a service definition and binding whenever a RAP business object, or a read-only CDS projection, needs to be consumed externally, whether by a Fiori elements app, a custom SAPUI5 app, or an external system calling an OData Web API. They are the standard, and now the only supported, way to expose CDS-based business logic as OData in RAP. They are the wrong tool when the requirement is purely internal ABAP-to-ABAP consumption; in that case call the CDS entity or the EML interface directly and skip the service layer entirely. They are also unnecessary for a CDS view that only feeds an analytical query or a table function consumed inside another view, where no HTTP endpoint is required. Do not create a binding just to 'test' a business object during early development if there is no consumer yet; the extra published artifact adds housekeeping (versioning, transport, catalog assignment) with no payoff until a UI or integration actually needs it.
How it fits the stack
Below the service definition sits the projection CDS view entity, usually with its own behavior definition, which itself sits on top of an interface CDS entity and a behavior implementation class. Above the service binding sits the actual protocol runtime: OData V4 UI bindings feed Fiori elements object pages and list reports directly, OData V2 UI bindings feed classic and transitional Fiori apps, and Web API bindings feed external integrations without a UI layer. INA bindings feed analytical consumers. The service definition and binding together replace the SEGW project plus its generated model classes from the classic OData V2 stack; there is no manual model class, no runtime artifact generation step, and no separate DPC/MPC implementation to maintain. Nothing sits between the binding and the transport layer other than the standard gateway registration.
A worked example
A managed RAP business object for sales quotations has an interface CDS entity, a projection view with a UI-facing alias, and a behavior definition implementing create, update and an action to convert the quotation to an order. A service definition is created exposing the projection entity as the root entity set, with its association to quotation items exposed as a dependent entity set so the object page can show line items in a table. A first service binding is created against this definition with an OData V4 UI type, version 0001; it is activated and published, and immediately available for preview, generating a working Fiori elements object page with a create form, an editable item table and the conversion action as a button. Later, a second binding is created against the same service definition with a Web API type so an external procurement system can create quotations programmatically without pulling in any UI annotations. Both bindings share the same underlying behavior logic; they differ only in protocol and consumer.
How to choose
- OData V2 UI versus OData V4 UI binding: choose V4 for any new Fiori elements development since it supports the full RAP feature set including draft handling nuances and newer annotations; choose V2 only when a specific consuming app or integration mandates it, since V2 exposure on RAP has narrower support and more workarounds.
- UI binding versus Web API binding: UI bindings pull in Fiori annotations and draft artifacts and are heavier; Web API bindings are annotation-free and lighter, appropriate for machine-to-machine integration where no UI metadata should leak into the contract.
- One service definition per business object versus several: a single definition exposing root plus all children keeps the object page and integration in sync automatically, but if UI and API consumers need genuinely different entity shapes, use separate service definitions rather than forcing one definition to serve both audiences.
- Versioning strategy: bump the service binding version, not the service definition, when the external contract must remain stable for existing consumers while a new binding version is prepared; changing the definition in place and republishing the same binding version breaks anyone caching the old metadata.
- Local test binding versus release-managed binding: a locally activated binding used only for preview during development should never be the artifact referenced by a transported Fiori catalog entry; promote a deliberately versioned binding for that purpose so the entity set names are frozen before go-live.
Common pitfalls
- Changing an alias or removing an exposed field in the service definition after the binding has been published and consumed; the binding still activates cleanly but the Fiori app or external caller referencing the old entity set name or field starts failing at runtime, not at build time.
- Assuming activation of the CDS view or behavior definition automatically refreshes a published binding; it does not, and a stale published metadata document can sit unnoticed until a tester hits an outdated field list.
- Creating multiple bindings against the same service definition for both OData V2 and V4 by mistake, when the definition itself was authored assuming a single protocol's annotation behavior, leading to draft or action buttons that work in one binding and silently disappear in the other.
- Forgetting that a Web API binding still requires the same DCL access control as a UI binding; leaving it unguarded because 'no UI is involved' exposes create and update operations to any caller with basic authorization.
- Publishing a binding in a development system, testing successfully, then discovering on transport to the next system that the binding version was never incremented, so the target system either rejects the transport or overwrites a version another consumer already depends on.
- Exposing too many child entities or deep associations in a single service definition for convenience, which increases the metadata document size and the number of navigation properties an OData client must resolve, degrading list report load times under real data volume even though it looked fine with a handful of test records.
ECC, S/4HANA and clean core
Service definitions and bindings are the standard extensibility artifact in S/4HANA and are fully aligned with clean core: they belong in the customer namespace, are transportable, and do not touch SAP-delivered objects. They are the recommended replacement for SEGW-based OData V2 projects, which are discouraged for new development on S/4HANA regardless of whether the underlying data source is a RAP business object or a plain CDS view. In key user or developer extensibility scenarios, a service definition can only expose entities released for extension, so the choice of binding type and exposed fields is constrained by the release contract of the underlying CDS views, not by what happens to compile locally.
Whose problem this is
This is developer and architect territory. The developer authors the service definition and binding as part of the business object; the architect decides protocol choice, versioning policy and whether UI and integration traffic share a definition. Handover to functional or Fiori configuration teams should include the published binding name, version, entity set names and the associated app or launchpad tile, not just the underlying CDS entity names.
Related SAP objects
Reviewed pages this object connects to in the ERPClimb knowledge graph.
Source: ERPClimb — https://erpclimb.com/sap-technical-topics/service-definition-and-service-binding-in-rapERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.