Walk me through the RAP save sequence phase by phase. For each saver method, what may your code do there, and what is forbidden?
Say your answer out loud first.
Practise another way
I split it into the early and the late save phase. In finalize I may still change data with EML; on-save determinations run there. check_before_save only checks; on-save validations run there.
If either fails, cleanup_finalize runs and we go back to the interaction phase. After that is the point of no return: adjust_numbers assigns final keys, save writes the database, and cleanup clears the buffer.
Trigger. COMMIT ENTITIES starts the save sequence. In an OData request, the RAP runtime calls it for you. Saver methods redefine methods of CL_ABAP_BEHAVIOR_SAVER.
Early save phase (can still return to the interaction phase)
finalize: last calculations and changes in the transactional buffer, for all BOs in the transaction. Managed on-save determinations run here. EMLMODIFY ... IN LOCAL MODEis fine.check_before_save: consistency checks only. Managed on-save validations run here. Report problems infailedandreported.cleanup_finalize: runs only if one of the two methods above failed. Undo whatfinalizechanged. The transaction then goes back to the interaction phase, andCOMMIT ENTITIESsetssy-subrc4.
Late save phase (point of no return: it ends in a commit or a runtime error)
4. adjust_numbers: only with late numbering. Replace preliminary keys with final ones.
5.
save (or save_modified for additional or unmanaged save in a managed BO): write the buffer to the database. An implicit COMMIT WORK follows.
6. cleanup: clear the transactional buffer.
What is allowed where (SAP's EML cheat sheet table, Standard ABAP scope):
| Statement | Interaction | Early save | Late save |
|---|---|---|---|
| Database modifications | no | no | yes |
CALL FUNCTION ... IN UPDATE TASK |
no | no | yes |
bgRFC, RAISE ENTITY EVENT |
no | no | yes |
| Commit on a secondary connection (logs) | yes | yes | yes |
| sRFC, aRFC | yes | yes | no |
COMMIT WORK, ROLLBACK WORK in RAP code |
no | no | no |
Dynpro, CALL TRANSACTION, SUBMIT, RAISE EXCEPTION out of RAP |
no | no | no |
Why it is split this way. Data may be inconsistent during the interaction phase, so writing to the database early would create extra database transactions. Errors must surface in the early phase, where the user can still fix them.
Newer detail. Save actions can name the saver method in which they may run, for example save ( finalize ) action recalc;. This has been available since ABAP Platform 2022 and SAP BTP ABAP environment 2208.
Managed BOs have no saver class by default. You add one for late numbering, additional save, unmanaged save or the cleanup methods. BDEF strict mode turns many violations into syntax or runtime errors.
Orders all six saver methods, marks the point of no return, says where determinations and validations run, and knows which statements are allowed in which phase.
Lists save and cleanup only, or says data may be written in finalize and committed with COMMIT WORK.
Treating check_before_save as a place to fix data. It should only check; changes belong in finalize, so that cleanup_finalize can undo them consistently.
- Why is an update function module allowed only in the late phase?
- What exactly must cleanup_finalize undo?
- Where would you raise a business event, and why there?
3 official pages and 2 prep guides. Confidence: high. Checked 3 Dec 2026.
- 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.