Explain service definition and service binding in RAP. What is the difference between a UI service and a Web API, and what does publishing do?
Say your answer out loud first.
Practise another way
The service definition says which CDS entities I expose, and it is independent of protocol. The service binding ties that definition to a protocol and a scenario: OData V2 or V4, as UI service or Web API, plus InA and SQL.
A UI service carries the annotations a Fiori elements app needs; a Web API is for any other consumer. Publishing in the binding registers the local endpoint in that system, which is for testing and not a transport.
Two objects, two jobs. The service definition models what is exposed. The service binding decides how.
Service definition
It is an ABAP repository object (SRVD) that lists the CDS entities to expose, with an optional alias:
@EndUserText.label: 'Travel service'
@ObjectModel.leadingEntity.name: 'ZR_Travel'
define service ZUI_Travel {
expose ZC_Travel as Travel;
expose ZC_Customer as Customer;
}
It does not know about OData versions. The optional leading entity annotation marks the root in the binding editor. Abstract entities can only be exposed if they come from service consumption proxies, otherwise publishing causes a dump.
Service binding
SAP's documentation lists the binding types: OData V2, OData V4, InA (analytical models, UI only) and SQL (Web API only). The second choice is the scenario:
- UI service: adds Fiori elements UI capability, so the metadata carries UI annotations. Supported for OData and InA.
- Web API: for any other consumer, not for UIs. Supported for OData and SQL.
One definition can sit behind several bindings, for example a V2 UI binding and a V4 UI binding, without re-implementation. Service version is raised by adding another service definition to the binding.
Publishing
- The binding must be active first.
- The Publish button triggers task lists that enable the endpoint for the current system only. On premise, the binding and its generated artifacts cannot be transported. For quality or production you unpublish locally and use the Gateway tools (activate and maintain service for V2, the V4 service group administration for V4).
- V4 registers a service group; V2 registers a service in the Gateway catalog.
- Preview: Fiori elements preview starts from the binding.
Naming
Binding names conventionally use UI or API in the name and a version suffix, as SAP training material shows.
Interview point: the split is the clean-core idea in miniature. Business logic stays in the BO; protocol choices live in a binding you can swap.
Explains the protocol-independent definition versus protocol-specific binding, UI versus Web API in terms of annotations, and that publish is local and not transportable on premise.
Says the service binding 'creates the OData service' and does not distinguish UI from Web API or mention the transport limitation.
Believing publish is a transportable activation. On premise it only enables the local endpoint; the transportable step is service activation through the Gateway tools.
- How does the service get from your dev system to quality?
- Can you add a second entity to a published service without breaking consumers?
- When do you expose something as Web API instead of UI service?
3 official pages and 3 prep guides. Confidence: high. Checked 21 Nov 2026.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.