Service Bindings Part 4: UI vs Web API, OData V4 vs V2
Preview · a free account unlocks the full lesson
Choose the right binding for each consumer: what really differs between UI and Web API bindings, when OData V2 is still justified, and how to build a separate non-draft API service on the same business object.
In this lessonShow sectionsHide sections
Explanation
There's already a UI service for the Purchase Request, ZUI_PURCHREQ_O4. Now a second consumer appears: an external procurement system that needs to read requests and approve them automatically. Should it use the same service? This part answers that question.
A UI binding and a Web API binding actually differ in several concrete ways. In purpose, a UI binding feeds a Fiori Elements or SAPUI5 app used by people, while a Web API binding feeds another system or program — A2A, B2B, integration flows.
In UI annotations, a UI binding publishes @UI annotations (line items, facets, field groups, header info) in $metadata so Fiori Elements can build screens, while a Web API binding doesn't expose these at all, since they're meaningless to a program.
In draft behavior, a UI binding treats draft as the normal editing model, with keys containing IsActiveEntity and creates producing drafts that must be activated, while a Web API binding should use a non-draft projection instead, since programs send a complete change in one request and draft would just force them through Edit/Activate calls for no benefit.
In contract stability, a UI binding ships together with its app, so fields can change alongside it, while a Web API binding is built against by other teams, so changes must stay backward compatible, with breaking changes requiring a new service version.
In cloud access, a UI binding uses an IAM app, a business catalog and a business role for human users, while a Web API binding uses a communication scenario, a communication arrangement and a communication user for systems.
The rule that follows from this is to keep separate projections and services per consumer type: the UI service definition should never simply be bound as a Web API too.
Instead, build a second projection layer on the same business object — ZA_PurchReq and ZA_PurchReqItem as an API projection containing only the fields the API contract actually needs, no UI annotations, no draft; an API projection BDEF declared with "projection;" and no "use draft", exposing only the allowed operations, such as read, create and approve, but not delete; and a service definition ZAPI_PURCHREQ with a binding ZAPI_PURCHREQ_O4 of type OData V4 – Web API.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.