Your action changes a second business object through EML, for example a requisition owned by another team. Its error texts must appear on your object page in your users' words. How do you pass them on, both during the interaction phase and when they arise during the save?
Say your answer out loud first.
Practise another way
During the interaction phase I take FAILED and REPORTED from my EML call. I mark my own instance in FAILED and add my own message with my %tky. I keep the foreign text only as detail if it helps.
For errors the other BO raises in its saver, I declare it as a foreign entity in my BDEF and implement map_messages. There I read %foreign and rewrite the messages for my entity.
Why mapping is needed. The UI only knows your service's entities. A message bound to another BO's key has no target on your object page. Its wording is also written for that BO's users.
1. Interaction phase: map by hand. The response of your EML call is plain data in your handler:
MODIFY ENTITIES OF zr_requisition
ENTITY Requisition EXECUTE release FROM req_keys
FAILED DATA(req_failed) REPORTED DATA(req_reported).
LOOP AT req_failed-requisition INTO DATA(rf).
DATA(order) = order_by_req[ req_id = rf-ReqID ].
APPEND VALUE #( %tky = order-%tky ) TO failed-order.
APPEND VALUE #( %tky = order-%tky
%msg = new_message( id = 'ZORDER' number = '014'
severity = if_abap_behv_message=>severity-error
v1 = rf-ReqID )
%element-RequisitionID = if_abap_behv=>mk-on ) TO reported-order.
ENDLOOP.
Keep your own mapping table from the requisition key to your order. Decide whether the foreign %msg text is useful as a second detail message or just noise.
2. Save phase: foreign entity and map_messages. Errors can also come from the other BO's saver, for example from its check_before_save, after your handler has finished. For that, declare the other BO in the BDEF header:
managed implementation in class zbp_r_order unique;
strict ( 2 );
foreign entity ZR_Requisition;
Then redefine map_messages in your saver class. RAP calls it in the early save phase when foreign entities return transition messages. The messages arrive in reported-%foreign-<entity>, typed TYPE TABLE FOR REPORTED LATE.
Insert reworded messages into your own reported and clear the foreign table if the originals should not reach the consumer. This follows SAP's example BP_DEMO_UNMANAGED_MAP_MESSAGES.
Limits
- State messages cannot be mapped in the save phase; only transition messages reach
map_messages. - The association target of a cross-BO association is included as a foreign entity automatically, unless
without responseis specified. map_messagesis optional. SAP's example clears the foreign messages so the originals do not reach the consumer. Test what your consumer receives when you skip the method.
Design hint. Keep the other BO's errors early when you can. Call its checks, or use GET PERMISSIONS, before the save, so the user gets the message while they can still act.
Maps the EML response to the own %tky in the handler. For save-phase errors, declares a foreign entity and implements map_messages with reported-%foreign, knowing state messages cannot be mapped there.
Appends the foreign REPORTED table unchanged, or assumes errors from the other BO's saver will reach the screen with the right target.
Passing the foreign REPORTED rows through untouched. They are bound to keys the UI does not know, so users see untargeted texts or nothing at all.
- Why can map_messages not turn the foreign message into a state message?
- How do you know which of your orders a foreign failed row belongs to?
- When would you call the other BO's checks before the save instead?
5 official pages. Confidence: high. Checked 3 Dec 2026.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.