ERPClimb logoERPClimb

SAP RAP / CDS / OData Managed RAP Interview Questions

Managed RAP is a standard block in SAP RAP / CDS / OData interviews. It is rarely asked as a definition; it is asked as a situation you have to talk your way through.

Master managed RAP where the framework owns the transactional buffer and standard persistence for custom business objects. Learn CRUD, numbering, locking, validations, determinations, actions, draft options and the limits of direct managed persistence.

This page carries 10 reviewed SAP RAP / CDS / OData managed rap interview questions, each with a complete written answer and no sign-in required. The set breaks down into 1 foundational, 5 mid-level and 4 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.

Treat the answers as a starting structure, not a script. Interviewers in SAP RAP / CDS / OData rounds follow up on whatever you sound least certain about, so the value is in being able to keep going after the first answer.

10 Managed RAP questions with answers

easyManaged RAP

1. Walk me through the layers of a RAP application, from the database table to the Fiori app. What is the job of each layer?

A RAP application is built in layers, each with one job: 1. Database tables — store the data (e.g. a header and an item table with UUID keys and admin fields). 2. CDS data model — root and child view entities that give the data its business shape; composition and association to parent define the tree. 3. Behavior definition (BDEF) — the transactional contract: which operations exist (create, update, delete, actions), locking, ETag, authorization, numbering, determinations and validations. 4. Behavior implementation (behavior pool, ZBP_ class) — ABAP code for the non-standard parts: validations, determinations, actions, authorization and feature control. 5. Projection layer (ZC_ views + projection BDEF) — what one consumer may see and do, plus UI annotations via metadata extensions. 6. Service definition — which projected entities form one service and their external names. 7. Service binding — protocol and purpose (OData V4 UI or Web API), publishes the endpoint. 8. Consumer — a Fiori Elements app or an API client. The key idea: the business object (layers 1–4) is built once and reused; each consumer gets its own projection and service.
mediumManaged RAP

2. In managed RAP, what exactly does the framework do for you, and why must a behavior implementation never contain COMMIT WORK or direct INSERT/UPDATE statements on its own tables?

In managed RAP the framework implements the standard transactional work: create, update and delete; the transactional buffer; locking via lock master; ETag checks; filling admin fields annotated with @Semantics (created/changed by/at); draft tables if draft is on; and writing to the persistent table and committing at save. Every request goes through two phases. In the interaction phase, changes go into the transactional buffer only. In the save sequence, RAP runs on-save determinations, then validations, and only if all pass does it write to the database and commit. A COMMIT WORK in a handler would persist data before validations ran, breaking all-or-nothing behavior, and could commit half of a multi-instance request. Direct INSERT/UPDATE bypasses the buffer, so validations, ETags and determinations do not see the change and admin fields are not maintained. The developer's job is to declare the contract in the BDEF (persistent table, mapping, operations) and implement only business logic.
mediumManaged RAP

3. Two users open the same purchase request. User B saves a change first; user A saves later from a stale screen. Which RAP mechanisms prevent A from overwriting B, and how do locks and ETags differ?

Two mechanisms work together: • Locking (pessimistic): lock master on the root. When a change starts, RAP sets an exclusive lock on the root key (children are covered by lock dependent). A second user trying to change the same instance at the same time gets a lock error. With draft, the lock is held for the whole draft editing session. • ETag (optimistic): etag master LocalLastChangedAt. The client receives the ETag with every read and sends it back with the change (If-Match). If the stored value differs because B already saved, RAP rejects A's change (HTTP 412) and A must reload. Locks protect a running transaction; ETags protect the time between reading and changing. In the scenario, A and B did not edit at the same moment, so only the ETag catches it. In managed RAP the ETag field is updated automatically when annotated with @Semantics.systemDateTime.localInstanceLastChangedAt. With draft, a total etag on the root also protects the active data during draft editing.
mediumManaged RAP

4. Classify each requirement as a determination, validation, action, feature control or authorization: (1) status is New when a request is created, (2) description is mandatory, (3) manager clicks Approve, (4) Approve is only possible when status is Submitted, (5) only buyers may create requests. Explain why.

(1) Determination on modify { create; } — the system sets a value automatically; it must run regardless of channel (UI or API) and be idempotent. (2) Validation on save — a rule that must block the save; it reports FAILED plus a REPORTED message with %element so the field is highlighted. (3) Action — an explicit business step triggered by a user or API; implemented with MODIFY ENTITIES IN LOCAL MODE and returning the instance (result [1] $self). (4) Instance feature control — depends on the state of the data, not on the user; get_instance_features returns enabled/disabled, which greys out the button in Fiori and rejects API calls. (5) Global authorization — depends on the user and does not need an instance; checked in get_global_authorizations with AUTHORITY-CHECK. Rule of thumb: automatic = determination, blocks save = validation, button = action, state-based availability = feature control, user-based permission = authorization. Putting these in the wrong place causes classic bugs, e.g. rules skipped for API calls or support teams chasing missing roles that are really status problems.
mediumManaged RAP

5. Implement a Submit/Approve/Reject workflow in a managed RAP object. What do you declare in the BDEF, and how does the approve action implementation look in principle?

BDEF declarations on the root: • action ( features : instance ) submit result [1] $self; and the same for approve and reject. • update ( features : instance ); delete ( features : instance ); so editing can be blocked after approval. • field ( readonly ) Status; so nobody changes the status directly. • determination setInitialStatus on modify { create; } to set status N. Implementation of approve: 1. MODIFY ENTITIES OF the BO IN LOCAL MODE ... UPDATE FIELDS ( Status ) WITH VALUE #( FOR key IN keys ( %tky = key-%tky Status = 'A' ) ). 2. READ ENTITIES ... ALL FIELDS for the keys and return them in result with %param, so the UI refreshes. get_instance_features enables submit only in status N, approve/reject only in status S, and disables update/delete once approved. Submit can also refuse: it reads items by association and, for requests without items, returns FAILED and a message. IN LOCAL MODE is needed so the action can change the read-only Status field without being blocked by feature control. All code processes the full keys table, not a single key.
mediumManaged RAP

6. What is the difference between a composition and an association in a RAP business object, and how do you create a header with items in one EML call?

A composition expresses ownership: the child belongs to the parent and cannot exist without it. It is declared in the root (composition [0..*] of ZR_PurchReqItem as _Item) and in the child (association to parent ZR_PurchReq as _Request). The whole tree then shares lifecycle (delete cascades), locking (lock dependent by _Request), authorization (authorization dependent by _Request), draft and one transaction. A normal association is just a reference to another object (e.g. supplier or material) with its own lifecycle. Children are only created through the parent: association _Item { create; } in the BDEF, CREATE BY \_Item in EML. In one call: • CREATE the header with %cid = 'REQ1'. • CREATE BY \_Item with %cid_ref = 'REQ1' and %target containing the items, each with its own %cid. %cid_ref links the items to the header before its real key exists. MAPPED returns the final keys for all %cids. To add items to an existing header, use its key/%tky instead of %cid_ref. Outside the BO, COMMIT ENTITIES triggers the save.
hardManaged RAP

7. Design the numbering for a purchase request business object: users need a readable, sequential request number, but drafts are often abandoned. Which RAP numbering options exist and which would you choose?

Use two identifiers: • Technical key: a UUID with managed early numbering (field ( readonly, numbering : managed ) RequestUUID). The framework generates it on create; it never changes and is never shown to users. • Semantic key: a RequestID drawn from a number range object in a determination on save. Drawing it at save time means abandoned drafts and failed creates never consume a number, so the sequence has few gaps. Other options and when to use them: unmanaged early numbering (earlynumbering_create) when you must assign keys yourself during interaction; late numbering (adjust_numbers in the saver) when the final key may only be assigned once the save is certain, e.g. strictly gap-free document numbers or numbers returned by a legacy API; external numbering when the consumer supplies the key. I would avoid drawing the semantic number on modify or at draft creation, and avoid using the UUID as the user-visible number.
hardManaged RAP

8. After enabling draft on a working managed RAP object, one determination fails and the object page behaves oddly. What do you check?

Checklist for a draft enablement: 1. BDEF: with draft; draft table for every entity (generated via quick fix and regenerated after field changes); total etag LastChangedAt on the root; draft actions Edit, Activate, Discard, Resume and draft determine action Prepare with the relevant validations. 2. Associations: with draft on both association _Item { create; with draft; } and association _Request { with draft; }. 3. Handler code: every method must use %tky, not the plain key. %tky contains %is_draft; code using %key or only the key fields reads or writes the active instance instead of the draft — the most common cause of a determination suddenly failing. 4. READ/MODIFY inside the BO must use IN LOCAL MODE. 5. Projection BDEF: use draft; and use action Edit/Activate/Discard/Resume/Prepare, plus with draft on associations. 6. Nobody writes to draft tables directly. 7. Clear the metadata cache and check $metadata: keys now include IsActiveEntity. In practice point 3 explains most such incidents; replacing key with %tky fixes it without other changes.
hardManaged RAP

9. A mass approval of 2,000 purchase requests through OData times out, although single approvals are fast. How do you analyze and fix it?

Analysis: reproduce with a realistic batch, then use the SQL trace (ST05) or ABAP profiler (SAT) to find repeated statements. Typical causes in RAP handlers: • SELECT SINGLE or READ ENTITIES inside a LOOP over keys — one database round trip per instance. • MODIFY ENTITIES called once per key instead of once with a table. • Determinations with broad triggers (every field) that re-read all items and cascade into further determinations. • Helper logic (e.g. cost center or approver lookup) reading master data per key. Fix: • One READ ENTITIES for all keys, one MODIFY ENTITIES with a table. • Read additional data once for all keys (join, or FOR ALL ENTRIES after checking the driver table is not empty). • Narrow determination triggers to the relevant fields. • Keep result building set-based. Prevention: an ABAP Unit test that runs the action with hundreds of keys, and performance checks in code review. Handlers always receive sets of keys; code written for one instance is the root cause.
hardManaged RAP

10. You inherit a managed RAP business object before a go-live. What would you review, and which findings would block production?

Review areas: 1. Layering: services expose ZC_ projections, not ZR_ base views; separate projections for UI and API; UI annotations in metadata extensions. 2. Transaction safety: no COMMIT WORK, ROLLBACK or direct DML on own tables in handlers; strict ( 2 ) active. 3. Concurrency: lock master, etag master with an automatically maintained field, total etag if draft. 4. Rules in the right place: defaults in determinations, checks in validations with messages, state rules in feature control, user rules in authorization; read restrictions in DCL. 5. Code quality: %tky everywhere, IN LOCAL MODE inside the BO, set-based READ/MODIFY, no SELECT in loops. 6. Tests: EML-based ABAP Unit for validations, actions and feature control; tests isolated from real data. 7. Clean core: only released SAP APIs in ABAP Cloud code, no direct changes to SAP tables. Blocking findings: commits in handlers, missing authorization, services on base views, missing ETag, validations that can be bypassed via API, and per-key database access in mass-capable operations.

Related lesson

Managed RAP Part 5: Projection Layer, Testing, Performance and Clean Core

Related topics

Next practice step

Go deeper on this topic