Explain the interaction phase, the save sequence and the transactional buffer. Why must you not write COMMIT WORK in a behavior implementation?
Say your answer out loud first.
Practise another way
In the interaction phase, requests change instances in a transactional buffer, never the database. A commit starts the save sequence: the early phase runs finalize and check_before_save, and can still hand control back with errors.
The late phase assigns numbers, writes via save, and cleanup clears the buffer. RAP owns the transaction, so it does the one commit. A COMMIT WORK of your own would split the transaction and breaks consistency and draft.
Transactional buffer. The place where RAP keeps changed instances in memory during a transaction. In managed BOs the framework supplies it. In unmanaged BOs you build it. It is not kept across stateless OData requests, so each request rebuilds what it needs.
Interaction phase
- Calls to
create,update,delete, actions, determinations on modify, and validations on modify. - Only the buffer changes. No database writes.
Save sequence (triggered by COMMIT ENTITIES, or implicitly by the RAP runtime in OData)
Early save phase
finalize: last calculations. In managed BOs, determinationson saverun here.check_before_save: consistency checks. Validationson saverun here.- If anything fails,
cleanup_finalizeruns, the late phase is skipped, and you return to the interaction phase so the user can fix the data.sy-subrcis 4 afterCOMMIT ENTITIES.
Late save phase (point of no return)
4. adjust_numbers: final keys (late numbering only).
5. save or save_modified: write the buffer to the database. The final COMMIT WORK happens here, done by RAP.
6. cleanup: clear the buffer and locks.
Why no COMMIT WORK in your code
- RAP is the transaction owner. In handlers and savers, commit and rollback statements are not allowed.
- Database modifications are only allowed in the late phase, because earlier the data is potentially inconsistent. Writing earlier would produce several database transactions and break the SAP LUW.
- A
COMMIT WORKoutsideCOMMIT ENTITIESstill triggers the save sequence, but if it finds errors you get a runtime error instead of a return to the interaction phase. - Update function modules and bgRFC are allowed only in the late phase, and
CALL TRANSACTION,SUBMITand dynpro statements are forbidden. - Legacy code with
PERFORM ON COMMITsignals poor integration and needs checking, especially with draft.
The rule of thumb: change the buffer with EML in the interaction phase, change the database only in save and save_modified, never commit yourself.
Failure path: ROLLBACK ENTITIES calls cleanup, so the buffer and locks are released.
Draws the phases in order, knows the early phase can fail and return, and gives the transaction-ownership reason.
Says 'RAP saves automatically so COMMIT WORK is not needed' with no mention of phases or why it breaks things.
Calling `COMMIT WORK` or `CALL FUNCTION ... DESTINATION` from a validation to 'make sure it is saved'. It either dumps or leaves a half-written object.
- What is the difference between the early and late save phase?
- Where do you call an update function module?
- What does cleanup_finalize do?
- How is statelessness handled in OData?
1 official page, 1 prep guide and 1 technical reference. Confidence: high. Checked 21 Nov 2026.
- Official page Backs the answer.
- Technical reference Backs the answer.
- Prep guide Gives the question.