Is a projection layer mandatory in RAP? Can you expose the interface (R_) view directly in the service definition, and do you even need a behavior definition for a read-only app?
Say your answer out loud first.
Practise another way
Technically neither is mandatory. For a read-only app I can expose plain CDS view entities with no behavior definition at all, and SAP's own read-only reference scenario does exactly that. For a transactional BO, exposing the root view with its BDEF directly also works.
I still build a projection because it keeps UI annotations, value helps and consumer-specific restrictions out of the base BO, and lets one BO serve several services with different behavior.
Read-only: no BDEF required
SAP's Flight reference scenario (branch ABAP-platform-2025) has a read-only package with no behavior definition at all. Its service definition exposes ordinary view entities and views for value help:
define service /DMO/FLIGHT_R {
expose /DMO/C_Connection_R as Connection;
expose /DMO/C_Flight_R as Flight;
expose /DMO/I_Carrier_StdVH as Airline;
}
/DMO/C_Flight_R is define view entity ... as select from /DMO/I_Flight_R, not even a projection. Bound as OData, the query engine serves reads, filtering, paging and search. A BDEF only becomes necessary when you need transactional behavior.
Transactional: the base BO can be exposed, but should it? Exposing the root view with its BDEF activates and runs. What you lose:
- One consumer contract only. The cheat sheet's example: group A gets the full UI, group B the same BO without delete. With projections you write a second projection BDEF with fewer
usestatements; without them you would copy the BO. - Annotation pollution. UI annotations, value helps, search and text elements end up in the base view that other code also reads.
- Stability. Renaming or hiding a field for one app changes the base model for everyone.
- Release path. Stable consumption by other components goes through a BO interface (
provider contract transactional_interface); UI services go throughtransactional_queryprojections.
projection;
strict ( 2 );
define behavior for ZC_Travel_Approver alias Travel
{
use update;
use action accept;
}
That projection gives approvers update and one action, nothing else, on the same base BO.
Rules once you project
- The root of a projection BO must be a CDS projection view of the base root; the service then exposes the projection, and child projections must redirect their compositions.
- The keyword documentation says leaving out the provider contract is possible but not recommended.
How to answer in an interview: "Not mandatory; read-only needs no BDEF at all. For transactional apps I always project, because the projection is the per-consumer contract and the base BO stays clean." Then give the approver example.
Separates read-only from transactional, cites that a read-only service needs no BDEF, admits direct exposure works, and explains with an example what the projection buys.
Says 'it will not activate without a projection' or 'you always need a BDEF', or cannot give a concrete reason for the projection beyond 'best practice'.
Claiming a projection or BDEF is technically required. It is not; the real argument is separation per consumer, and interviewers test whether you know the difference.
- How would you give two user groups different operations on the same BO?
- What does a provider contract say about a projection view?
- Where do you put UI annotations if you skip the projection?
4 official pages and 3 prep guides. Confidence: high. Checked 2 Dec 2026.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.