The save sequence is a separate step
An EML modify operation changes the RAP transactional state. In an ABAP consumer program, COMMIT ENTITIES triggers the BO’s save sequence; it is not the same as immediately writing a row with ABAP SQL.
Capture commit responses
COMMIT ENTITIES
RESPONSE OF ZR_PURCHASE_REQUEST
FAILED DATA(failed)
REPORTED DATA(reported).
IF sy-subrc <> 0.
"Handle a failed save outcome.
ENDIF.
Inspect sy-subrc, FAILED, and REPORTED according to the BO contract. A successful modification response before commit does not guarantee persistence. COMMIT ENTITIES includes commit-work behavior, so do not casually combine it with direct COMMIT WORK.
The RAP runtime commits automatically for native service requests such as an OData interaction. This explicit statement is for an ABAP EML consumer scenario; it cannot be used from behavior implementations. Confirm transaction ownership and release-specific forms in the target system.
Sources
Developer practice · ABAP
Practice: inspect commit outcome
Call COMMIT ENTITIES for the request BO, capture FAILED and REPORTED, and set result to the commit system status.
This choice changes the output pattern checked here: WRITE belongs in a classic executable report, while out->write( ) uses the supplied output reference in an ABAP Cloud class-run method. It does not switch the language version of the other code; check release and API availability in your target system.
Complete the task and include the output statement shown for your selected environment. Variable names can differ if you use them consistently. This browser checker checks structure only; it does not compile or run ABAP.
0 required structures detected · 0 checks
Write your solution, then check its structure.
One possible solution
COMMIT ENTITIES
RESPONSE OF ZR_PURCHASE_REQUEST
FAILED DATA(failed)
REPORTED DATA(reported).
DATA(result) = sy-subrc.
WRITE result.out->write( result ).These are context-specific output examples. In your own program, use the result variable from your solution and the output mechanism available in that program.
Debug this code
Assume ZR_PURCHASE_REQUEST exposes the shown EML operation. The change was sent, but this consumer program never starts the save sequence; add that transaction step.
Edit the code, then check for the expected repair. This is a structure check, not an ABAP compiler.
Find the issue, repair it, and check your change.
Diagnosis and repair
Diagnosis: A successful EML modify request updates the RAP transactional state; the consumer must call COMMIT ENTITIES to trigger the save sequence. Native service requests have their own runtime transaction handling.
MODIFY ENTITIES OF ZR_PURCHASE_REQUEST
ENTITY Request
UPDATE FIELDS ( Status )
WITH VALUE #( ( RequestId = 'PR-2203' Status = 'APPROVED' ) ).
COMMIT ENTITIES.