2025 Mar 06 12:14 PM - edited 2025 Mar 06 3:58 PM
I have an action in an ABAP RAP application that creates an accounting document. However, when an error occurs and I set a message in the 'reported' field, the entity's status cannot be updated with the error due to a rollback.
How can I handle an error within the action and still update the entity's data?
Example:
method action1.
... "Call BAPI
if success = abap_true.
...
else.
APPEND CORRESPONDING #( <reg> ) TO failed-zentity.
LOOP AT lt_return INTO DATA(ls_return) where type = 'E'.
APPEND VALUE #( %msg = new_message( id = ls_return-id
number = ls_return-number
severity = if_abap_behv_message=>severity-error
v1 = ls_return-message_v1
v2 = ls_return-message_v2
v3 = ls_return-message_v3
v4 = ls_return-message_v4 )
%key = <reg>-%key )
TO reported-zentity.
endloop.
endif.
....
MODIFY ENTITIES OF zentitytp IN LOCAL MODE
ENTITY zentity
UPDATE FROM VALUE #( FOR reg IN regs
( %tky = reg-%tky
belnr = reg-belnr
status = reg-status
%control-belnr = if_abap_behv=>mk-on
%control-status = if_abap_behv=>mk-on ) ).
endmethod.
Request clarification before answering.
@AbapForEver
How about commenting out the following line?
APPEND CORRESPONDING #( <reg> ) TO failed-zentity.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.