Hello T Fdo,
You can build the message object and pass that object to the exception object in the method of your DPC class.
Steps are:
1. Get the BAPI return in lt_return table of type bapiret2.
2. set the message object in the context of DPC class.
me->mo_context->get_message_container( )->add_messages_from_bapi(
EXPORTING
it_bapi_messages = lt_return " Return parameter table
).
3. Raise the exception and send the message object to exception object.
raise EXCEPTION type /IWBEP/CX_MGW_BUSI_EXCEPTION
EXPORTING
message_container = me->mo_context->get_message_container( )
.
Hope it helps.
Cheers,
Anurag.