ERPClimb logoERPClimb

SAP RAP / CDS / OData Service Definitions Interview Questions

Service Definitions comes up in SAP RAP / CDS / OData interviews because it is one of the few areas where an interviewer can tell, in two questions, whether you have worked with the process or only read about it.

Learn RAP service definitions as the explicit list of projection entities exposed by one business service. Focus on keeping the public contract minimal, naming entities clearly and separating consumer-facing projections from internal CDS models.

This page carries 11 reviewed SAP RAP / CDS / OData service definitions interview questions, each with a complete written answer and no sign-in required. The set breaks down into 3 foundational, 5 mid-level and 3 advanced questions, so you can start at the top for a first interview or skip ahead to the scenario-based items for a senior round.

The fastest way to use this page is to read the question, answer it yourself, and only then read the answer. The gap between your version and the written one is your actual revision list for service definitions.

11 Service Definitions questions with answers

easyService Definitions

1. What is a RAP service definition, and how does it differ from a service binding?

A service definition (define service … { expose … as …; }) lists which CDS entities — normally projections — a service exposes, with aliases that become entity set names. It contains no behavior, UI or protocol. The service binding defines how the service is offered: OData V2 or V4, UI or Web API, and publishes it (URL, versions). One definition can have several bindings, e.g. V4 UI and V2 UI. Exposed entities must be projections, not base views or tables.
easyService Definitions

2. Write a service definition for an order app with header, items and a customer link, and explain each line.

define service ZUI_ORDER { expose ZC_Order as Order; expose ZC_OrderItem as OrderItem; expose ZC_CustomerRO as Customer; } ZC_Order is the root projection (entity set Order); ZC_OrderItem is the composition child, redirected in ZC_Order as composition child so _Item navigation and deep create work; ZC_CustomerRO is a read-only projection the order's _Customer association is redirected to, so navigation to customer details exists. Aliases are business names used by clients. Then bind as OData V4 – UI, publish and check $metadata.
easyService Definitions

3. Describe the complete path from a RAP business object to a running OData service.

1. Base BO: tables, R_ CDS views, BDEF and behavior pool. 2. Projections: ZC_ CDS projection views (provider contract transactional_query) with redirects, and a projection BDEF with "use" statements (and use draft for UI). 3. UI annotations in metadata extensions of the projections. 4. Service definition: expose projections with aliases. 5. Service binding: choose OData V4 – UI (or Web API/V2), activate, publish. 6. Test with the preview and $metadata; assign roles/authorizations; transport all objects together.
mediumService Definitions

4. How do you decide which entities go into a service definition?

Design services per business capability and consumer type (buyer app, approver app, integration API). Expose the root projection, the composition children the consumer needs, read-only targets needed for navigation, and value-help entities that are not otherwise reachable. Avoid "everything" services: they couple consumers, increase regression effort and $metadata size. Use business aliases and verify entity sets and navigation in the binding and $metadata.
mediumService Definitions

5. A developer renamed a field in an API projection and an external import failed overnight. What process changes do you introduce?

Roll back the rename immediately. Then: define API projections and services as contracts owned by a named team; add a "compatible or breaking?" check to pull requests/transport reviews; allow only compatible changes in place; handle breaking changes via a new service version with a migration period; document consumers and contacts per API; keep UI and API projections separate so UI changes cannot alter API contracts; add automated $metadata comparison or API tests before transport.
mediumService Definitions

6. $expand on a supplier association fails in a RAP service, although the association exists in the projection. What is the cause?

Navigation properties exist only when the association target is exposed in the same service. If the supplier entity (or the projection it is redirected to) is not exposed in the service definition, RAP drops the navigation, so $expand fails. Also check the association is in the projection element list. Fix: expose a lean read-only supplier projection (redirect _Supplier to it) or the target entity, activate, refresh/publish the binding and verify NavigationPropertyBinding in $metadata.
mediumService Definitions

7. An action exists in the base BDEF and works in DEV tests, but it is missing from the service metadata. What do you check?

Check the projection BDEF contains "use action <name>;" — base behavior is not exposed automatically. Then: projection BDEF activated; correct projection is the one exposed in the service definition; binding refreshed/published and the correct service version checked; $metadata contains the action. If $metadata has it but the button is missing, check @UI #FOR_ACTION annotations; if the button is disabled, check feature control and authorization. In QAS, check that the projection BDEF was transported.
mediumService Definitions

8. How do you expose related master data and value helps in a RAP service without bloating it?

For navigation to related master data, create a lean read-only projection (only needed fields, no behavior), redirect the association to it and expose it. For value helps, build small dedicated value-help views with a key, text and @Search annotations, reference them via @Consumption.valueHelpDefinition, and expose them if not reachable otherwise. Avoid exposing full master-data projections with all their associations; they enlarge $metadata and expose unnecessary data. Verify navigation bindings and value helps in $metadata and the app.
hardService Definitions

9. Which changes to a consumed RAP service are breaking, and how do you handle them?

Breaking: removing or renaming entity sets, fields, keys, navigation or actions; making optional fields mandatory or writable fields read-only; changing types, lengths, action parameters or semantics. Compatible: adding optional fields, new entities, navigation, actions, and validations that accept previously valid data. Breaking changes on APIs: create a new service definition, add it as a new service version to the binding (where supported), keep the old version during migration, communicate and retire later. UI services consumed only by your own app can often change together with the app.
hardService Definitions

10. Should a Fiori app and an external integration share one RAP service? Explain your design.

No, by default. Keep one base BO with all behavior, but create separate projections, projection BDEFs, service definitions and bindings: UI (ZC_ projections, use draft, metadata extensions, OData V4 – UI binding) and API (ZA_ projections, no draft, only needed operations, OData V4 – Web API binding, technical users). Reasons: draft complexity for API clients, contract stability vs UI change frequency, different authorization and release cycles. Business logic stays in one place.
hardService Definitions

11. You inherit several RAP services. What do you review in their service definitions?

Check: only projections exposed (no base views); one service per capability and consumer type; UI and API services separated; business aliases and naming conventions; all composition children and required navigation targets exposed, but no unnecessary entities; value-help entities reachable; versions for breaking changes; @EndUserText labels; consistency with projection BDEFs (actions used); $metadata size and content; documentation of consumers.

Related lesson

Service Definitions Part 5: UI vs Integration APIs — Reuse or Separate?

Related topics

Next practice step

Go deeper on this topic