All RAP interview questions in one place, grouped by page. Every answer uses the same business scenario – the Sales Order Approval app (requirements R1–R22 on the Start Here page). Each group is copied from the "Interview questions" part of its page – read the page when an answer needs more depth.
How to practise: cover the answer, say yours out loud in 30–60 seconds, always name the requirement (e.g. "for R7 approve…"), then compare.
01 · RAP Foundations
Q1. What is RAP?
The ABAP RESTful Application Programming Model is SAP's model for building transactional OData services (Fiori apps, Web APIs) with CDS, behavior definitions and ABAP behavior pools. It is the standard for S/4HANA and ABAP Cloud. The framework provides buffering, locking, draft and the OData plumbing, so the developer writes mainly business logic – in our app the approval rules, not the save.
Q2. Which problems of classical ABAP does RAP solve?
Classical apps mix UI and logic, and each developer builds locking, buffering and update logic differently. OData via SEGW needs hand-written classes, and CDS, SEGW and BOPF were separate frameworks. RAP gives one model with standard transactional behavior, generated Fiori UIs and released, upgrade-stable APIs.
Q3. Name the RAP layers and artifacts.
Data modeling & behavior (tables, CDS view entities, BDEF, behavior pool) → business service provisioning (projection views and projection BDEF, metadata extension, service definition, service binding) → consumption (Fiori elements app, Web API, EML). The base BO is service-agnostic; the projection is service-specific, which is how the reps' app and the approver app share one BO.
Q4. What is the transactional buffer?
The in-memory state of all instances changed in the current transaction. During the interaction phase all reads and changes work on the buffer, not on the database. The save sequence checks the buffer and writes it to the database in one step; ROLLBACK ENTITIES discards it.
Q5. Interaction phase vs save sequence?
In the interaction phase handler methods run operations, determinations on modify, feature control and authorization on the buffer. COMMIT ENTITIES starts the save sequence: early save with finalize (determinations on save), check_before_save (validations) and cleanup_finalize on failure, then the point of no return, then late save with adjust_numbers, save and cleanup.
Q6. What is the point of no return, and why does it matter?
It separates the early save, which may still reject the transaction and send the user back to the interaction phase (sy-subrc 4), from the late save, which must succeed. So every check belongs in finalize or check_before_save, and things that must not be lost or repeated – gap-free numbers in adjust_numbers, database writes, events – happen after it. A late failure gives sy-subrc 8 and needs ROLLBACK ENTITIES.
Q7. Query access vs transactional access?
Query access – lists, search, filter, paging – is translated by the framework into SQL on the CDS views; no behavior pool code runs, but access control (DCL) still filters the rows. Transactional access – create, update, delete, actions – goes through the BO runtime with authorization, feature control, locks, handlers, buffer and save sequence.
Q8. Managed vs unmanaged?
Managed: the framework handles the transactional buffer, create/update/delete, locks and the save – used for new apps on new tables, like our sales order app. Unmanaged: you implement them yourself, typically to wrap existing legacy logic with its own buffer, like the old Z order tables. Both use the same CDS model, BDEF syntax and EML.
Q9. What are additional save and unmanaged save?
Two managed variants. With additional save the framework still writes the tables and your save_modified adds work such as an audit log or a business event. With unmanaged save the framework keeps the buffer but you do the database writes yourself in save_modified, e.g. through existing update function modules.
Q10. Scenario: trace one "Approve" click from the browser to the database.
The approver app sends a $batch POST with the action call and the ETag. The OData V4 runtime finds the binding and service definition, the projection passes it to the base BO, and the RAP runtime checks authorization, feature control, lock and ETag, then calls lhc_SalesOrder→approve, which sets Status 'A' in the buffer. The save sequence follows: finalize, check_before_save (validations), the point of no return, save (managed: the framework writes zsales_hdr; with additional save also the log and the event), cleanup and commit. The response returns the new state, the new ETag and the messages. To debug I'd follow the same path: network tab, Cross Trace, breakpoint.
02 · Data Model & CDS
Q1. How do you start a RAP project – generator or by hand?
For a standard managed BO on new tables I let the ADT generator ("Generate ABAP Repository Objects → OData UI Service" or the wizard from scratch) create the stack, then adapt names, annotations and behavior. I build by hand when I wrap existing tables or logic, or when the generated structure doesn't fit. Either way I must understand every object, because I maintain it afterwards.
Q2. Which administrative fields does a RAP table need and why?
CreatedBy/CreatedAt, LocalLastChangedBy/LocalLastChangedAt and LastChangedAt, typed with the abp_* data elements and annotated with @Semantics.user.* / @Semantics.systemDateTime.*. A managed BO fills them automatically; LocalLastChangedAt is the ETag of the instance and LastChangedAt the total ETag that draft uses to detect changes to the active data.
Q3. Composition vs association?
A composition is a whole–part relation: the item cannot exist without its order, is created through it, locked via it and deleted with it, and the compositions define the BO tree. An association is a loose link to independent data such as the customer. Each composition child needs association to parent back to its parent.
Q4. Why a UUID key and a separate order number?
The UUID is drawn by the framework the moment an order is created, so the key never depends on a number range and works for drafts. The readable number SO-0000001 is a separate field (the semantic key) that can be assigned gap-free at save time with late numbering. Users see the number, RAP works with the UUID.
Q5. What do root, child and leaf mean, and what must exist for a composition to activate?
The root is the top entity (define root view entity, one per BO), a child is reached by composition, a leaf is a child without children. The root declares composition [0..*] of the child, the child declares association to parent with the ON condition on the parent key, and both are activated together.
Q6. Why CDS view entities and not DDIC-based CDS views?
DDIC-based views (define view with @AbapCatalog.sqlViewName) are obsolete: they create an extra SQL view in the dictionary, activate more slowly and cannot be created in ABAP for Cloud Development. View entities are the current CDS object type and what RAP BOs are built on.
Q7. How do you fill test data in ABAP Cloud without reports?
With a console class that implements if_oo_adt_classrun and runs with F9 in ADT. For a quick start it inserts directly into the tables; once the BO exists, I create the data with MODIFY ENTITIES and COMMIT ENTITIES, so determinations and validations run as in the app.
Q8. Which annotations belong in the base view and which in the projection?
The base view (ZR_) carries what is true for every consumer: semantic key, currency and unit references, admin field semantics, text relations and the access control check. The projection and its metadata extension carry what one app needs: search, value help, UI layout and labels. That keeps the base BO reusable for several apps and APIs.
03 · Projection, UI, Access Control & Service
Q1. Why projection views, and why several projections on one BO?
A projection gives one service its subset of fields plus UI semantics (value help, search, metadata extension); provider contract transactional_query marks it for a transactional service. The base BO stays reusable. Different roles get different projections: ZC_SalesOrder for reps with create, edit and copy, ZC_SalesOrderApv for managers with only approve and reject – each with its own projection BDEF, metadata extension and service.
Q2. Access control (DCL) vs behavior authorization?
An access control filters which rows a user may read – it adds a WHERE condition to every select on the view, e.g. only the user's sales organisation. Behavior authorization (global / instance in the BDEF) decides whether a user may change data or execute an action such as Approve. A complete app needs both.
Q3. Service definition vs service binding?
The service definition says which entities are exposed and is protocol-agnostic. The service binding adds the protocol and scenario – OData V2 or V4, UI or Web API – and is published and previewed in ADT. One definition can have several bindings, e.g. ZUI_SalesOrder_O4 for the app and a Web API binding.
Q4. Why put UI annotations in a metadata extension?
It keeps the projection readable and separates layout from data: @UI annotations for list report and object page live in their own object, layered (#CUSTOMER and others) and changeable without touching the view. The projection must allow it with @Metadata.allowExtensions: true.
Q5. How do you build a value help for the customer field?
Create a small CDS view on the released I_Customer with search annotations and a text element, then point the projection field to it with @Consumption.valueHelpDefinition. The service exposes the value-help view automatically. For few fixed values I use a dropdown (@ObjectModel.resultSet.sizeCategory: #XS).
Q6. Does a projection inherit the access control of its base view?
No. Every CDS view entity with #CHECK needs its own role. For a projection I write grant select on ZC_SalesOrder where inheriting conditions from entity ZR_SalesOrder, so the rules are maintained once in the base role.
Q7. OData V2 or V4 for a new RAP app?
V4 – it is SAP's recommendation for new transactional apps and supports draft, side effects and newer Fiori elements features fully. V2 only when a consumer cannot speak V4.
Q8. The preview returns 403 or an empty list. What do you check?
403: the user's role lacks the service – S_SERVICE in PFCG on-premise, or the service is not in an IAM app / business role in the cloud; /IWFND/ERROR_LOG helps on-premise. Empty list: first whether the tables contain data, then the access control – the user may have no authorization value for the orders' sales organisation.
Q9. How do you get from the ADT preview to a launchpad tile?
Generate a Fiori elements List Report in Business Application Studio or VS Code from the published UI service, test it with npm start, deploy it as a BSP application, then add launchpad content and a PFCG role on-premise, or an IAM app in a business catalog and business role in ABAP Cloud.
04 · Behavior Definition & Behavior Pool
Q1. What is in a behavior definition?
The header (implementation type and behavior pool, strict mode, draft), then per entity the transactional characteristics (persistent and draft table, lock master or dependent, authorization, ETag) and the body: operations, association operations, field control, actions, functions, determinations, validations, draft actions, side effects and the mapping.
Q2. What does strict ( 2 ) do?
Strict mode makes the BDEF syntax check stricter: it forbids outdated syntax and demands explicit declarations such as authorization and the draft actions. Version 2 adds further checks. New BDEFs should always use the latest strict mode; RAP extensibility even requires it.
Q3. Why can an item not be created directly, and what does with draft in the association do?
The item is a composition child: it exists only with its order. So the item has no create; – it is created by association (association _Item { create; } on the root, EML CREATE BY \_Item). In a draft BO, with draft on both association directions keeps draft items linked to the draft order.
Q4. mandatory vs mandatory : create?
mandatory only marks the field in the UI; the runtime does not reject an empty value, so you need a validation. mandatory : create is enforced: a CREATE without the field is rejected. Combined with readonly : update it gives a field that is typed once and then frozen, such as the item number.
Q5. Why release a BO through an interface BDEF?
An interface BDEF (interface; on a view with provider contract transactional_interface) is a stable facade over the BO. Consumers and extensions use the interface, so the implementation underneath can change without breaking them. SAP releases its own BOs this way, e.g. I_SalesOrderTP for EML and extension.
Q6. Approvers must approve, reps may only create and edit. How do you design it?
One base BO with all behavior and two projections with their own projection BDEFs: ZC_SalesOrder with create, update, delete and copy, ZC_SalesOrderApv with only use action approve; use action reject;, each with its own service and app. Security still lives in the base BO: instance feature control allows Approve only for status N and instance authorization checks the manager's authorization, so the rules also hold for EML and Web API callers.
Q7. What is augmentation?
In a projection BDEF an operation can be declared with augment (use create ( augment );). The projection behavior pool then enriches the incoming request with MODIFY AUGMENTING ENTITY before it reaches the base BO, for example to fill a default that only this app knows. It has no response parameters of its own and cannot set read-only fields.
Q8. Handler class vs saver class?
Handler classes (lhc_, inherit from cl_abap_behavior_handler) implement the interaction phase: actions, determinations, validations, prechecks, feature control, authorization (and all operations in an unmanaged BO). The saver class (lsc_, inherits from cl_abap_behavior_saver) implements the save sequence methods finalize, check_before_save, adjust_numbers, save / save_modified and cleanup; a managed BO needs it only for additional or unmanaged save and late numbering.
Q9. Users see "instance not found" only in the draft app. What do you check?
Whether the handlers use %key instead of %tky. In a draft BO the same key exists as draft and active, so READ, MODIFY, FAILED and REPORTED must use %tky (or CORRESPONDING #( keys ), which keeps %is_draft). I would confirm it in the debugger by looking at %is_draft in keys.
Q10. You added an action to the base BDEF but the button does not appear. Why?
Typical causes: the projection BDEF lacks use action, the projection view or metadata extension lacks the @UI.lineItem / @UI.identification entry of type #FOR_ACTION, or instance feature control disables it for that order. If the pool does not compile, the method stub is missing – Ctrl+1 creates it.
05 · Business Logic & Messages
Q1. Determination vs validation?
A determination changes data automatically when its trigger fires – on modify immediately, on save in finalize. A validation only checks, on save, and reports problems in FAILED and REPORTED; an entry in FAILED stops the save. Both must be written idempotently. Rule: if it changes data, determination; if it only checks, validation.
Q2. Determination on modify or on save?
On modify when the user should see the value at once (status N on create, the order total); on save when a value must be set exactly once just before saving, such as a number. In a draft app on-save logic runs only when the draft is activated.
Q3. Precheck vs validation?
A precheck (update ( precheck );, action ( precheck ) approve) runs before the change reaches the transactional buffer, so bad input is rejected immediately and never stored, not even in a draft. A validation runs on save on the data already in the buffer and sees the whole instance. Use a precheck to stop impossible requests early, a validation for consistency checks.
Q4. Action vs function, and which action types exist?
An action is a modify operation the consumer triggers, such as Approve; it can change data and return a result. A function is read-only. Action types: instance, static, factory (create new instances, e.g. copyOrder), internal (only callable inside the BO), with parameter (abstract entity), determine actions (run checks on demand) and draft actions.
Q5. How does a factory action return the new instance?
The caller passes a %cid per source key. The method creates the new instances with EML IN LOCAL MODE (header and, with CREATE BY \_Item and %cid_ref, the items) and copies the MAPPED result into its own mapped parameter, so the caller can map its %cid to the new key.
Q6. What is a determine action?
A named bundle of validations and on-save determinations (determine action checkOrder { validation validateCustomer; … }) that can be run on demand – by a side effect when a field changes, by a button or by EML EXECUTE. On-modify determinations are not allowed in it. draft determine action Prepare is the built-in one that Activate calls.
Q7. FAILED, MAPPED, REPORTED?
FAILED lists the instances that failed with a %fail-cause; MAPPED maps %cid to the real keys of created instances; REPORTED holds the messages with %msg, %element, %state_area and %path. Only FAILED stops an operation or a save – a message alone does not.
Q8. State messages vs transition messages?
State messages belong to the state of an instance (e.g. quantity 0) and stay until the problem is fixed; they are bound to %tky and a %state_area, which the validation clears before each check. Transition messages belong to one request (e.g. "Order approved") and are shown once.
Q9. The order total in the header does not update when an item quantity changes.
First check that the determination calculateTotal fires on the item fields Quantity and NetPrice and writes the header with IN LOCAL MODE (here through the internal action recalcTotal). If the value is correct after a refresh, the backend is fine and the UI just did not reload: add the side effect field Quantity affects field _SalesOrder.NetAmount and use side effects in the projection.
Q10. Why must determinations be idempotent?
Their triggers can fire more than once for the same instance – in a draft session, across several requests, or because another determination changed a trigger field. A determination that checks whether its work is already done (e.g. only orders without a status) gives the same result however often it runs.
06 · Feature Control, Authorization & Numbering
Q1. Static vs dynamic feature control, and feature control vs authorization?
Static feature control is fixed in the BDEF (readonly, mandatory, readonly : update); dynamic instance feature control decides per instance in get_instance_features – Approve is disabled for approved orders. Feature control depends on the state of the data, authorization on the rights of the user; both can disable a button but live in different methods.
Q2. Why can't you use instance feature control for create?
Instance feature control decides per existing instance, and before a create there is no instance to look at. Use global feature control (a business switch) or global authorization for create; for child creation use create ( features : instance ) on the association, which is decided per parent.
Q3. Global vs instance authorization, and what is privileged mode?
Global authorization is checked independent of data (may the user create orders, is the user a manager at all?); create can only be checked globally. Instance authorization is checked per record (may the user change this order of sales org 1010?). Privileged mode lets trusted callers skip certain checks: the BDEF declares with privileged mode disabling <authorization context> and the caller uses EML with PRIVILEGED; only the checks of objects listed in that context are skipped.
Q4. A rep may see and change only orders of their sales organisation (R3). How do you build it?
Read: a DCL role on the base and projection views with pfcg_auth( ZAO_SO, ZSO_VKORG, ACTVT = '03' ) on the SalesOrganization field. Modify: authorization master ( global, instance ), and in get_instance_authorizations an AUTHORITY-CHECK on ZAO_SO with the order's SalesOrganization and activity 02/06. Items follow with authorization dependent by _SalesOrder. The DCL alone is not enough, because it doesn't stop a modify request on a known key.
Q5. Only managers may approve, and only New orders (R7). Where does each half go?
"Only managers" is a user right: global authorization (activity 43 for any sales org) and instance authorization (activity 43 for the order's sales org, plus the four-eyes rule on CreatedBy). "Only New orders" is a data state: instance feature control on the approve action. Both are enforced for Fiori, Web API and EML callers.
Q6. What do IN LOCAL MODE and PRIVILEGED skip?
IN LOCAL MODE is for the BO's own behavior pool and skips the BO's authorization and feature control, e.g. when a determination writes the read-only Status. PRIVILEGED is for external trusted consumers and skips only the authorization checks listed in the privileged-mode authorization context; feature control still applies.
Q7. Scenario: managers only approve or reject, reps create and edit (R7, R11). How do you design it?
One base BO with all behavior and two projections with their own projection BDEFs: ZC_SalesOrder for reps with use create; use update; use delete;, and ZC_SalesOrderApv for managers with only use action approve; use action reject;, each with its own service and app. The projections only shape the apps; security stays in the base BO: global and instance authorization check activity 43 on ZAO_SO for approve and reject, so the rule also holds for EML and Web API callers who bypass the approver app.
Q8. Early vs late numbering, and late numbering with a number range?
Early numbering assigns the key at create: externally, managed by the framework (UUID) or unmanaged in earlynumbering_create. Late numbering assigns the final key in adjust_numbers in the late save, using a preliminary %pid until then. Drawing the number there with cl_numberrange_runtime=>number_get gives gap-free numbers, because the save can no longer fail after the point of no return.
Q9. Scenario: order numbers must be gap-free (R9). Which numbering do you choose?
Late numbering with SalesOrderID as the key and an unbuffered number range interval, drawn in adjust_numbers. Keeping a UUID key and setting SalesOrderID in a determination on save avoids numbers for discarded drafts, but a validation that fails after finalize still burns a number – fine for "no abandoned numbers", not for strictly gap-free numbering.
Q10. Why must adjust_numbers never fail, and what do you do if the number range is exhausted?
It runs after the point of no return: RAP can no longer return to the interaction phase, so FAILED is not an option. Make sure intervals are maintained and monitored; if drawing still fails, the only clean reaction is a short dump (RAISE SHORTDUMP), which rolls the whole LUW back.
07 · Locking, Draft & Side Effects
Q1. ETag vs lock?
An ETag is an optimistic check that the data has not changed since it was read; the request is rejected (HTTP 412) if it has, and with 428 if the client sent no If-Match. A lock is a pessimistic exclusive enqueue lock on the root while changing. The total ETag detects whether the active data changed while a draft existed.
Q2. Why is the lock always on the root, and what does that mean for items?
Children are lock dependent by _SalesOrder, so every item change requests the lock of its order. Two users can never change different items of the same order at the same time – the whole order is one unit of consistency.
Q3. What is draft and what do you need for it?
Draft stores unfinished work in draft tables so users can continue later, while OData stays stateless. You need with draft, a draft table per entity, a total ETag on the root, with draft on associations, the draft actions Edit, Activate, Discard, Resume and Prepare, and use draft in the projection. Handlers use %tky because the same key exists as draft and active.
Q4. What happens when a draft's exclusive lock expires?
After the default 15 minutes the draft enters the optimistic phase: it still exists but holds no lock, so another user may edit the active order. When the owner returns, Resume compares the total ETag of draft and active order; if the active order was saved meanwhile, the draft is outdated and cannot be resumed. Untouched drafts are deleted after 28 days by default.
Q5. Why do you need a draft query view?
The DCL of the active view does not cover draft rows, so restrictions such as the sales organisation would not protect drafts. A draft query view is a CDS view on the draft table with its own access control (usually inheriting the active view's conditions), named in the BDEF with draft table … query …. It is mandatory for collaborative draft.
Q6. What is collaborative draft?
Several users work on the same draft at the same time; further users are added through the draft action Share. The BDEF declares with collaborative draft; and draft action Share;, the projection use collaborative draft; and use action Share;, and a draft query view is required. Available since BTP 2508 and S/4HANA 2025 – check your release.
Q7. What are side effects?
Side effects, declared in the BDEF and enabled with use side effects in the projection, tell the Fiori UI which fields, entities, permissions or messages to reload after a field change, action, determine action or event. Example: a changed item quantity reloads the order's net amount at once.
Q8. Scenario: users see "instance not found" only in the draft app. What do you check?
Whether the handlers use %key instead of %tky. In a draft BO the same key exists as draft and active, so READ, MODIFY, FAILED and REPORTED must use %tky (or CORRESPONDING #( keys ), which keeps %is_draft). I'd confirm in the debugger by looking at %is_draft in keys.
Q9. Scenario: the order total in the header doesn't update when an item quantity changes.
First check that the determination calculateTotal fires on the item fields Quantity and NetPrice and writes the header with IN LOCAL MODE (e.g. through the internal action recalcTotal). If the value is correct after a refresh, the backend is fine and the UI just didn't reload: add a side effect field Quantity affects field _SalesOrder.NetAmount and use side effects in the projection.
08 · EML
Q1. What is EML, and what are its main statements?
Entity Manipulation Language – ABAP statements to read and change RAP BOs: READ ENTITIES, MODIFY ENTITIES (create, create by association, update, delete, execute action), COMMIT ENTITIES and ROLLBACK ENTITIES, plus GET PERMISSIONS and SET LOCKS. It works for your own BOs and SAP's released ones such as I_SalesOrderTP, and every call passes the BO's checks.
Q2. Why IN LOCAL MODE, and what are %cid, %tky, %key and %control?
IN LOCAL MODE skips feature control and authorization inside the BO's own implementation – the determination setInitialStatus may set the read-only Status. %cid is a temporary ID for a new instance within one request (children refer to it with %cid_ref); %key holds the primary key; %tky = %key + %is_draft (+ %pid with late numbering) and should be used in handlers; %control flags which fields are supplied or requested.
Q3. Where may COMMIT ENTITIES be used, and what does sy-subrc tell you afterwards?
Only in consumer code – a class, report, application job or unit test – never in a behavior pool, where the OData request or the caller commits. sy-subrc 0 = saved; 4 = the early save failed (a validation or check_before_save rejected the data, nothing saved, buffer kept – fix or ROLLBACK ENTITIES); 8 = the late save failed and the transaction was rolled back.
Q4. An EML UPDATE returns no errors but nothing changes. Why?
The %control flags were not set – neither FIELDS ( ... ) nor %control-<field> = mk-on. RAP only changes fields whose control flag is on, so it can tell "set to initial" from "not sent". Another classic: the program never called COMMIT ENTITIES, so the change stayed in the buffer.
Q5. A nightly job must approve orders. How do you build it, and what can go wrong?
An application job class (IF_APJ_RT_RUN; older pattern IF_APJ_DT_EXEC_OBJECT / IF_APJ_RT_EXEC_OBJECT) that selects candidates from the CDS view, calls EXECUTE approve through EML, then COMMIT ENTITIES with a sy-subrc check, and logs FAILED/REPORTED in the application log. Pitfalls: the job user lacks the approval authorization, orders in draft are locked by a user, orders not in status N are rejected by feature control, and unchecked responses hide all of it.
Q6. Why not update zsales_hdr directly from the program – it is faster?
A direct UPDATE skips everything the BO guarantees: determinations (status, total), validations, feature control, authorization, locks and ETags, numbering and the additional save that writes the audit log. Draft users would also overwrite each other. EML is the only supported way to change a RAP BO.
Q7. IN LOCAL MODE vs PRIVILEGED?
IN LOCAL MODE is only allowed inside the BO's own implementation and skips its feature control and authorization. PRIVILEGED is for trusted external consumers and skips only the authorization checks the BDEF lists in its privileged authorization context; feature control still runs. Without with privileged mode in the BDEF, PRIVILEGED is not possible.
Q8. What is CONVERT KEY for?
For BOs whose key is assigned by late numbering, such as I_SalesOrderTP. After MODIFY, MAPPED holds only the preliminary %pid. Between COMMIT ENTITIES BEGIN and COMMIT ENTITIES END, CONVERT KEY turns the %pid into the final key, e.g. the real sales order number.
Q9. What does READ ENTITIES return that a SELECT does not?
READ ENTITIES reads the transactional buffer, so it sees unsaved changes of the current transaction and draft instances via %tky, and it reports missing instances in FAILED. A SELECT reads only what is already committed in the database – inside handlers that is usually stale.
09 · Unmanaged Scenario & Save Variants
Q1. How do you wrap legacy code in RAP?
If the legacy code owns buffer, checks and numbering, with an unmanaged BO: the handler methods collect the changes in a buffer class (or the legacy buffer), check_before_save calls the legacy checks and the saver's save calls the existing update function module in update task. If only the posting is legacy, with managed + unmanaged save and the update module in save_modified. In both cases the legacy code must not commit – the RAP framework does.
Q2. Scenario: an unmanaged BO dumps as soon as Save is pressed. What do you check?
Most likely a called BAPI or function module executes COMMIT WORK, or the code writes the database during the interaction phase. In RAP only the framework commits. I read the dump (ST22 / Feed Reader), move the database update into the saver's save, and call the update logic without its own commit (or the BAPI variant without commit).
Q3. What must the read and lock methods of an unmanaged BO do?
read must return the buffer state first – including unsaved creates and updates, and not_found for buffered deletes – and fall back to the legacy read; otherwise Fiori shows stale data right after a change. lock calls the legacy enqueue function and reports a foreign lock in FAILED with cause locked plus a message. The lock is released when the transaction ends.
Q4. Additional save vs unmanaged save – and what does save_modified receive?
With additional save the framework writes the BO's tables and save_modified adds extra work (log, change documents, events, bgPF). With unmanaged save there is no persistent table and save_modified does the database write itself. save_modified gets create, update and delete with one table per entity; update holds only keys and changed fields with %control, unless with full data is declared.
Q5. Why may you not validate or call an external system in save_modified?
save_modified runs in the late save, after the point of no return. A failure there can no longer be shown to the user or undo the transaction cleanly. Checks belong in validations or check_before_save; external calls go into a business event or a bgPF process that runs after the commit.
Q6. What is bgPF and how do you use it from RAP?
The Background Processing Framework runs follow-up work asynchronously in its own transaction after the RAP transaction commits. An operation class implements IF_BGMC_OP_SINGLE (controlled, recommended – execute with cl_abap_tx=>modify( ) / save( )) or IF_BGMC_OP_SINGLE_TX_UNCONTR. In save_modified you create a process with cl_bgmc_process_factory, set the operation and call save_for_execution( ); the framework's commit starts it, and a rollback discards it – check your release.
Q7. How do you record change documents for a RAP BO?
On newer releases (S/4HANA 2023 / 7.58, recent BTP) with the RAP change document reuse service: a change document object plus the changedocuments setting in the BDEF, and the framework logs old and new values of persisted changes. Otherwise manually in save_modified of an additional save, calling the generated write function or class – then I must supply the before-image myself.
Q8. What is CL_ABAP_BEHAVIOR_SAVER_FAILED for?
A saver that calls legacy code in the late save can raise it to report failed instances instead of causing a dump (released BTP 2311, check your release). The transaction is rolled back and COMMIT ENTITIES returns sy-subrc 8. It is a safety net – the real checks still belong in the early save.
Q9. Where does an unmanaged BO draw its order numbers?
Early numbers in create (UUID or the legacy number function), filling MAPPED for the consumer's %cid. Gap-free numbers (R9) with late numbering: create returns a %pid and the saver's adjust_numbers draws the number after all checks have passed. Never in save.
10 · Business Events & Event-Driven RAP
Q1. What is a RAP business event, and how do you raise one?
A message declared in the BDEF (event OrderApproved …;) that the BO raises when its state changes in a business-relevant way. With a managed BO you add with additional save and call RAISE ENTITY EVENT in save_modified. It is consumed asynchronously – locally by an event handler class or remotely through an event binding and a broker such as SAP Event Mesh.
Q2. Events vs OData APIs – when do you use which?
OData when the caller needs an answer now (synchronous request/reply, e.g. the CRM creating an order). Events to notify unknown or many receivers without waiting – loose coupling, the broker buffers while a receiver is down (warehouse and e-mail service on approval).
Q3. Where can you raise an event, and why only there?
Only in a saver method of the late save (save_modified with additional or unmanaged save, save in an unmanaged BO); elsewhere a runtime error such as BEHAVIOR_ILLEGAL_STATEMENT follows. It is after the point of no return, so the event never announces data that is later rejected or rolled back, and late numbers such as the SO number are final.
Q4. How do you define the payload?
Without a parameter the payload is the key. event X parameter <abstract entity> adds %param fields; deep parameter uses an abstract BDEF with hierarchy; a derived event (managed event … on …) reads its payload from a flat CDS view entity. with full data lets save_modified fill %param without a READ.
Q5. What is a derived event?
managed event D on E parameter <view entity>; – raised automatically together with event E, with a payload read (privileged) from a flat CDS view entity whose keys match the entity. No ABAP code. Useful in BDEF extensions of SAP BOs for custom payloads (BTP 2308 / ABAP 7.58).
Q6. How do you consume an event in the same system, and can you commit there?
Global class … FOR EVENTS OF <BDEF>, local class inheriting CL_ABAP_BEHAVIOR_EVENT_HANDLER, method FOR ENTITY EVENT <param> FOR <entity>~<event>. It runs asynchronously after the commit. No COMMIT WORK / ROLLBACK WORK – use EML on other BOs (the framework saves) or call cl_abap_tx=>save( ) before own DB writes.
Q7. What is an event binding, and how does the event reach Event Mesh?
An ADT object that maps a root-entity event to a CloudEvents type namespace.object.operation.version, e.g. zsalesorder.SalesOrder.Approved.v1. Then a channel (cloud: SAP_COM_0092 with the Event Mesh service key; on-premise: /IWXBE/CONFIG), an outbound binding of the topic, and a queue subscribed to the topic. Without the binding the event cannot leave the system.
Q8. How do you consume a standard S/4HANA event such as SalesOrder Created?
Find it on the SAP Business Accelerator Hub (sap.s4.beh.salesorder.v1.SalesOrder.Created.v1) and bind its topic to a channel. Side-by-side, generate an event consumption model from the AsyncAPI file and code in the consumer extension class; on-stack, a local handler on the released BO interface if the event is exposed there.
Q9. What is idempotency and why does it matter for events?
Processing the same event twice has the same effect as once. Brokers deliver at least once and local handlers may be retried, so duplicates happen; dedupe by the CloudEvents id or upsert by business key.
Q10. What is an event-driven side effect?
An event declared for side effects and used as a trigger in side effects { event … affects … }. Raised in the saver, it makes an open Fiori page reload the affected fields when the data was changed in the background, e.g. by a job (BTP 2502, check your release).
Q11. Business event or bgPF for follow-up work?
An event when other systems or components should react and the producer need not know them. bgPF when your own code has heavy work to do once after the commit (e.g. the PDF confirmation of R21) and nobody else needs to know.
Q12. How do you monitor and troubleshoot events?
Event Monitor app (on-premise: the event monitor of your release), Event Error Log / AIF for inbound, broker queue counts, ST22 and the ADT Feed Reader for handler dumps. Typical causes: missing event or outbound binding, inactive channel, topic mismatch, missing authorization, no with full data.
11 · Files, Custom Entities & Integration
Q1. How do you handle attachments in RAP?
As large objects: a RAWSTRING field annotated with @Semantics.largeObject (pointing to a MIME type and a file name field) becomes an OData stream, and Fiori elements shows upload and download automatically. In a draft BO the draft table needs the same fields. For several files per order I model a child entity; for mass data from a file I use an action with a file parameter.
Q2. How would you build an Excel upload for order items?
An action uploadItems with a deep parameter: an abstract entity with a large-object field, described by an abstract BDEF with hierarchy. The handler reads the sheet with the released XCO_CP_XLSX API and creates the items with MODIFY ENTITIES ... IN LOCAL MODE CREATE BY \_Item, so validations, the total and draft work as for typed items. Never INSERT into the table directly. On older releases the file goes into a LOB field first and an action parses it.
Q3. What is a custom entity and what must its query provider do?
A CDS entity without SQL data source; its rows come from an ABAP class implementing if_rap_query_provider – an unmanaged query, used for remote or computed read-only data such as a carrier's delivery status. The class must handle paging, filter, sort and count itself, read paging and sort when they are requested, and count before paging.
Q4. Virtual element or calculated CDS element?
A calculated CDS element is computed by the database, so it is fast and can be filtered and sorted. A virtual element is calculated in ABAP after the read (if_sadl_exit_calc_element_read), only for OData requests – not in EML or ABAP SQL. I use a virtual element only when the logic can't be expressed in CDS.
Q5. How do you expose a RAP BO as a Web API?
A second service binding of type OData V4 – Web API (ZAPI_SalesOrder_O4) on the same or an API-specific service definition. In the cloud: a communication scenario with the service as inbound service, then a communication system, communication user and communication arrangement; the caller authenticates as that user. On-premise the service is published and protected with roles (S_SERVICE). The same validations and authorization run as for the Fiori app.
Q6. How do you call a remote OData service from RAP?
Import its $metadata into a service consumption model, which generates abstract entities and a proxy model. At runtime: destination from the communication arrangement, HTTP client, client proxy, read request with top/skip/filter, get_business_data. Typically inside a custom entity's query provider. Never with hard-coded URLs or passwords, and never in the late save.
Q7. How do you create a sales order in S/4HANA Cloud from custom code?
With EML on the released RAP BO interface I_SalesOrderTP: MODIFY ENTITIES with header and CREATE BY \_Item, check FAILED and REPORTED, then COMMIT ENTITIES BEGIN, CONVERT KEY to turn the %pid into the late-numbered order number, COMMIT ENTITIES END. BAPIs are not released for ABAP Cloud. Inside my own behavior pool I only call MODIFY and let the framework commit both BOs.
Q8. Why must a RAP BO never call a remote system in the save sequence?
After the point of no return the save must not fail, and a remote call can be slow or fail at any time; it also cannot be rolled back with the database. So I read remote data in the interaction phase (e.g. in a query provider) and send changes asynchronously – with a business event or bgPF after the commit.
12 · Extensibility & Testing
Q1. What must the owner of a BO do before anyone can extend it?
Open sockets in every layer: an extension include structure in the active and draft table, a key-only extension include view, an _Extension association and @AbapCatalog.extensibility on the R_, I_ and C_ views, and in the BDEF (strict mode) an extensible { ... } block listing what may be added, extensible on each entity, Prepare extensible and mapping ... corresponding extensible. Nothing the owner didn't open can be extended.
Q2. How do you add a field like "Delivery priority" to your own RAP app without modifying it?
In a separate package: extend type on the extension include (the column appears in the active and draft table), extend view entity on the include view, the base view (through _Extension), the interface and the projection with the UI annotations. A check goes into an extension BDEF (extension using interface ..., extend behavior for) with its own behavior pool, and into extend draft determine action Prepare.
Q3. How do you extend a released SAP BO?
If the key user app Custom Fields is enough, use it – no code. Otherwise developer extensibility in ADT: fields through the extension include views SAP ships, logic through a BDEF extension (extension using interface I_…TP) with its own behavior pool. Only objects released for extension (C0) and only what the original marked extensible can be extended.
Q4. Scenario: the business wants a "Priority" field on SAP's standard sales order in S/4HANA Cloud.
First the key user app Custom Fields: add the field to the sales document business context and enable it for UI and APIs. If logic is needed (e.g. priority H only for big orders), a developer extension: field through the extension include view, a validation in a BDEF extension of the released interface. Never a modification – that is not possible in the public cloud anyway.
Q5. Why does an extended validation have to be added to Prepare?
In a draft app the user clicks Save, which calls the determine action Prepare before Activate. Only the validations listed in Prepare run at that moment and show their messages on the draft. An extension adds its validation with extend draft determine action Prepare, which works only if the owner declared Prepare extensible.
Q6. How do you test a RAP BO?
With ABAP Unit: a test class linked to the BDEF ("! @testing BDEF:...), SQL or CDS test doubles for the data, and EML calls. For validations I assert FAILED and REPORTED of COMMIT ENTITIES; for determinations on modify and actions I read the field back; for feature control and authorization I check %fail-cause or GET PERMISSIONS. teardown runs ROLLBACK ENTITIES.
Q7. Transactional buffer double or mock EML API?
Both replace a whole BO for a class that only consumes it. The transactional buffer double (cl_botd_txbufdbl_bo_test_env) behaves like a simple in-memory BO, so I assert on the result. The mock EML API (cl_botd_mockemlapi_bo_test_env) returns configured outputs for a given input and lets me verify how often a call was made, so I assert on the call.
Q8. Why can a test of the approve action fail although the code is correct?
Because the runtime checks feature control and authorization for the test user: approve is disabled for orders that are not in status N, needs the authorization object, and the four-eyes rule rejects orders the same user created. A good test sets up the data on purpose (status N, another creator) and tests the rejections explicitly, e.g. with the ABAP Unit authority-check controller.
13 · Debugging, Best Practices, Clean Core & What's New
Q1. How do you debug a RAP app?
Follow the request: browser network tab for the $batch request, its HTTP status and messages; ABAP Cross Trace to see which RAP step (authorization, feature control, handler, save) failed; an ADT breakpoint in that handler or saver method – it stops my own user's HTTP requests; ST22 or the ADT Feed Reader for dumps and /IWFND/ERROR_LOG on-premise for gateway errors. To repeat quickly I call the same EML from a console class or a unit test.
Q2. The Approve button works for one manager but returns HTTP 412 for another. What happened?
412 means the ETag sent in If-Match no longer matches – someone changed the order after this user read it. The user must refresh and approve again. If an API client gets 428 instead, it sent no If-Match at all: it has to read the order first and send the ETag with the change.
Q3. What must not happen in the late save, and how do you report a failure there?
After the point of no return (adjust_numbers, save) the save must not fail: no MODIFY ENTITIES on the BO, no EML reads (since 2408), no FAILED entries and no commit. Checks belong in validations during check_before_save. If a legacy call inside save still fails, it is reported with CL_ABAP_BEHAVIOR_SAVER_FAILED (since 2311).
Q4. The list report is slow with 50,000 orders. Where do you look?
Measure first with an SQL trace (ST05) or the ADT ABAP Profiler. Typical causes: no default filter, virtual elements calculated row by row in ABAP, expensive joins in the projection, and SELECTs or EML calls inside loops in handlers. Fixes: selection fields with defaults, calculations in CDS, only the columns the list needs, FOR ALL ENTRIES or one bulk EML call.
Q5. How do you move a RAP app to production, and what is abapGit for?
On-premise and Private Cloud with transports (CTS) and publishing the service in each system (/IWFND/V4_ADMIN for V4); on BTP and Public Cloud with software components that test and production pull with *Manage Software Components*. abapGit moves or shares code between systems without a transport route, e.g. from a BTP trial to a sandbox, if the target release supports the objects.
Q6. How does RAP support clean core, and what level is your app?
RAP is the ABAP Cloud model: built on released APIs only, SAP's released RAP BOs consumed with EML replace BAPIs, and RAP BO extensions replace modifications – level A. In our app the only exception is the legacy part (R13): old function modules behind a self-released wrapper, level B or C depending on what they use, monitored by ATC.
Q7. How do you find out whether you may use an SAP object in ABAP Cloud?
Look at its API state in ADT (*Properties* → *API State*): C1 means released for use in cloud development, C0 released as an extension point, C2 as a remote API. ABAP Cloud projects also show a *Released Objects* node, the Business Accelerator Hub lists released APIs, and for unreleased objects ADT and ATC show the successor where SAP defined one.
Q8. Name some recent RAP features.
Collaborative draft (BTP 2508, S/4HANA 2025), default values functions (2311), editable hierarchies and event-driven side effects (2502), CDS table entities (2502), global side effects (2511), RAP recommendations for value suggestions (2602), and AI support with Joule for developers and the AI-based RAP BO generator. I check the keyword documentation of the target release before using them.
Q9. How do you use AI tools when building a RAP app?
As a fast first draft: the generator or Joule creates the stack or suggests logic and unit tests. Then I review every object – names, keys, strict mode, authorization, ETag, draft, messages – and prove it with activation, unit tests and ATC before it goes into a transport. No customer data in prompts.
Q10. What is on your go-live checklist for a RAP app?
All objects in a transportable package (none in $TMP), BDEFs in strict ( 2 ), unit tests green, ATC clean including the clean core checks, the service published in every system, Fiori apps deployed with their catalogs and roles, Web API and event bindings configured per system, and a test with a user who has only the target role – a rep must not be able to approve.