admin管理员组文章数量:1406052
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.
本文标签: abapRAP Action update Entity even on failStack Overflow
版权声明:本文标题:abap - RAP Action update Entity even on fail - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744963505a2634799.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论