ERPClimb logoERPClimb

SAP RAP / CDS / OData RAP Business Objects Interview Questions

RAP Business Objects 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.

Learn RAP Business Objects as transactional aggregates with root and child entities, behavior, actions, validations, determinations, locks, authorization and save handling. The focus is designing one coherent business transaction rather than exposing database tables as CRUD.

This page carries 10 reviewed SAP RAP / CDS / OData rap business objects interview questions, each with a complete written answer and no sign-in required. The set breaks down into 2 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.

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 RAP Business Objects questions with answers

easyRAP Business Objects

1. What is a RAP business object, and how do you decide which entities belong in its composition tree?

A RAP BO is a tree of CDS entities (a root plus composition children) with a behavior definition; it is one transactional boundary — locked, checked and saved together. The root carries lock, ETag and authorization master; children depend on it. An entity belongs in the tree if it has no lifecycle of its own and must be consistent with the root in the same transaction (e.g. request items). Entities with their own lifecycle or editors (customer, product, time entries) are separate BOs and only referenced via associations. Large or independently edited children in the tree cause lock contention and heavy drafts, so keep the tree as small as consistency requires.
easyRAP Business Objects

2. Explain the difference between authorization, feature control and CDS access control in RAP, with an example of each.

Authorization decides WHO may do something, based on the user's roles: global authorization for create and static actions, instance authorization for update, delete and instance actions ("only buyers may create requests"). Feature control decides WHEN something is possible, based on the instance state: static (readonly, mandatory in the BDEF) or instance (get_instance_features) — "approve only in status Submitted"; Fiori greys out buttons and RAP rejects calls. Access control (CDS DCL) decides WHICH rows a user can read: "managers see only their sales organization". Mixing them causes errors: a state rule as authorization produces misleading "not authorized" messages; DCL does not protect changes.
mediumRAP Business Objects

3. Walk through the four RAP implementation types and give one example scenario for each.

Managed: new custom object with its own tables, e.g. a purchase request app — framework does CRUD, buffer, locks, ETag, draft and writes tables. Managed with additional save: same, plus extra persistence in the same LUW, e.g. writing a change log or an outbox table in save_modified. Managed with unmanaged save: an existing API must write the data but editing is standard, e.g. a pricing maintenance app whose posting goes through an existing function — framework handles interaction, you persist in save_modified. Unmanaged: legacy code must control reads, locks or in-memory state during editing, e.g. wrapping a legacy application with its own buffer — you implement buffer, CRUD, read, lock, numbering and saver. In all types: business logic, services and consumers are the same, and RAP owns the LUW.
mediumRAP Business Objects

4. Explain the RAP transaction model: what happens between a user's change and the database commit?

Interaction phase: requests (create, update, actions) run the framework operations and your handlers; changes go to the transactional buffer only. Determinations on modify, feature control and authorization apply here. Save sequence, triggered by commit (Save/Activate, OData change set, COMMIT ENTITIES): finalize (on-save determinations), check_before_save (validations — any failure stops the save, buffer kept, cleanup_finalize runs), adjust_numbers (late numbering), save (write — must not fail), framework commit, cleanup. RAP owns the LUW: no COMMIT WORK or direct DML on BO tables in behavior code, no errors in save, no synchronous remote commits during save. Outside the BO, programs use COMMIT ENTITIES and evaluate its response.
mediumRAP Business Objects

5. Explain locks, ETags and the total ETag in RAP. Which problem does each one solve?

Locks (lock master / lock dependent) are pessimistic: they prevent two transactions from changing the same BO at the same time; RAP sets an exclusive lock on the root key. With draft, the lock on the active instance is held for the whole draft session. ETags (etag master) are optimistic: the client sends back the value it read (If-Match); if the data changed in between, RAP rejects the change (HTTP 412). They solve the stale-screen problem that locks cannot. The total ETag (root, draft only) is checked at draft activation, ensuring the active data was not changed while the draft was edited. Managed RAP maintains ETag fields automatically via @Semantics annotations; unmanaged code must set them and return them from the read method.
mediumRAP Business Objects

6. How do you design RAP messages so that users understand what went wrong and messages disappear once the problem is fixed?

Every rejected instance gets a FAILED entry (with %fail-cause) and a REPORTED message for the same %tky. Messages come from a message class (new_message with id, number, severity, variables) so they are translatable and consistent. %element marks the fields so Fiori highlights them. Validations use %state_area: first append an empty message with the state area to clear earlier messages, then the error — so in draft the message disappears when the user fixes the field. Unbound messages go to %other. Use severities correctly (only errors block) and add success messages for important actions.
mediumRAP Business Objects

7. Support tickets say 'no authorization to change the request', but users have the right roles. Investigation shows the rule is 'approved requests cannot be changed'. What is wrong and how do you fix it?

A state-dependent rule was implemented in get_instance_authorizations, so RAP reports it as an authorization failure. Users and support look for missing roles. Fix: move it to instance feature control — declare update ( features : instance ) (and delete/actions as needed) and return fc-o-disabled for approved requests in get_instance_features. Fiori then hides or disables Edit, API calls are rejected with a feature-control failure, and optionally a clear message explains why. Keep get_instance_authorizations for real role checks (AUTHORITY-CHECK). Add tests for both.
hardRAP Business Objects

8. A 'Project' BO contains WBS elements, tasks, time entries and documents as compositions. Project managers constantly get lock errors. How would you redesign it?

Every time entry or document change locks the whole project, because composition children are locked through the root. Time entries and documents have their own lifecycle and different editors, so they should not be in the tree. Redesign: keep in the project BO only what must be consistent with the project in one transaction (WBS elements, tasks); make time entries and documents separate BOs with an association to the project. Cross-BO rules (e.g. no time entries on closed projects) become validations that read the project, or are enforced via EML calls. Result: fewer locks, smaller drafts, faster saves.
hardRAP Business Objects

9. An action calls a legacy function module that ends with COMMIT WORK. What can go wrong, and how do you integrate it correctly?

The internal commit persists data in the middle of the RAP transaction. If a later validation fails or another instance in the same request fails, RAP rolls back its own changes, but the function module's data is already committed — partial saves and orphan records. Correct integration: remove the commit from the flow — split the function into a check part (called in a validation or check_before_save) and a posting part called IN UPDATE TASK from the saver (additional or unmanaged save), so it commits with RAP's commit. Move remote calls after the commit (bgRFC, background processing framework, events). Add an ATC check for COMMIT WORK in behavior pools.
hardRAP Business Objects

10. Users sometimes get 'data has been changed by another user' immediately after their own change in an unmanaged BO. What do you investigate?

An ETag mismatch right after your own change means the value RAP compares against is not the current one. In unmanaged RAP, typical causes: the update handler does not set the ETag field (LocalLastChangedAt) on every change; the read method returns the database value instead of the buffered value; or two entities share a field that is set inconsistently. Investigate with ABAP Cross Trace/debugger: update, then check what read returns for the ETag field. Fix: set the ETag field in every handler that changes data; read method buffer-first; return the ETag in the read result. In managed RAP, check the @Semantics annotation on the ETag field instead.

Related lesson

RAP Business Objects Part 4: Locking, ETags and Concurrency Control

Related topics

Next practice step

Go deeper on this topic