How can you use parallel or asynchronous processing together with a RAP business object without breaking its transaction?
Say your answer out loud first.
Practise another way
First I ask what is needed. To speed up reads or calculations inside a request, I run read-only parallel tasks with CL_ABAP_PARALLEL in the interaction or early save phase, never writing data.
For follow-up work after the save, I register a bgPF process in save_modified and let RAP commit, so it starts only after a successful save. For mass changes, a job splits keys into packages and each parallel task runs its own MODIFY ENTITIES and COMMIT ENTITIES.
The rules first. In a RAP transaction, RAP owns the commit. SAP's phase table says:
- Database changes only in the late save phase.
- aRFC (
STARTING NEW TASK, Standard ABAP only) is allowed in the interaction and early save phases, for parallelization. The application must keep it consistent: read-only access, a two-phase commit if needed, and error handling. It is not allowed in the late phase. - bgRFC and update function modules only in the late phase. No
COMMIT WORKin handlers or savers.
1. Faster work inside one request. In ABAP Cloud, use the released CL_ABAP_PARALLEL: a worker class implements IF_ABAP_PARALLEL (method do), you pass instances to run_inst and read results from p_out_tab.
Each task runs outside your RAP transaction, so treat it as read-only or pure calculation and hand it the data it needs; never let it write or commit.
2. Follow-up work after the save: bgPF. The background processing framework, the successor of bgRFC, is the cloud-ready way. Use managed with additional save and register the process in save_modified:
METHOD save_modified.
" late save phase: register follow-up work, no commit
IF create-book IS INITIAL.
RETURN.
ENDIF.
TRY.
DATA(process) = cl_bgmc_process_factory=>get_default( )->create( ).
process->set_name( `Notify catalog` ).
process->set_operation( NEW zcl_book_notify( create-book ) ).
process->save_for_execution( ).
CATCH cx_bgmc INTO DATA(error).
" log the error; never COMMIT or ROLLBACK here
ENDTRY.
ENDMETHOD.
ZCL_BOOK_NOTIFY implements IF_BGMC_OP_SINGLE (transactional control). RAP issues the commit, and the process starts only after it, so a failed save never triggers the follow-up. In execute, the modify phase is active: switch with cl_abap_tx=>save( ) before any database write.
3. Mass processing. A job splits the keys into packages by root key (so two tasks never fight over the same lock master) and starts parallel tasks.
Each task is its own RAP consumer: MODIFY ENTITIES, COMMIT ENTITIES, then logs FAILED and REPORTED. One bad package then cannot roll back the others.
Decoupled consumers that need not run in your system at all are better served by a RAP business event raised in the save sequence.
Separates the three needs and quotes the phase rules (aRFC not in late save, DB writes only in late save, no own commit). Names CL_ABAP_PARALLEL, bgPF with IF_BGMC_OP_SINGLE and per-task COMMIT ENTITIES.
Suggests calling a function module STARTING NEW TASK from a determination to save data faster, or adding COMMIT WORK so the background task sees the data.
Starting parallel tasks that write to the database, or adding `COMMIT WORK` so a background task 'can see the data'. It splits the SAP LUW, can dump, and leaves half-saved objects.
- Why must bgPF be registered in the save sequence and not in an action?
- What does cl_abap_tx=>save( ) do inside a bgPF operation?
- How do you avoid lock conflicts when parallel tasks change the same business object?
- When would you use a RAP business event instead of bgPF?
3 official pages and 1 prep guide. Confidence: medium. Checked 2 Dec 2026.
- Prep guide Gives the question.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.