cancel
Showing results for 
Search instead for 
Did you mean: 

How to raise exception message with details

0 Kudos

Dear Experts,

I want to raise exception and put custom error message within "Show Details" message dialog as below picture.

I can't find the way to put custom message to "Show Details" section.

I'm using message container and "/iwbep/cx_mgw_busi_exception" for raise an exception.

RAISE EXCEPTION type /iwbep/cx_mgw_busi_exception

         EXPORTING

           textid  /iwbep/cx_mgw_busi_exception=>business_error

           message = lv_message.



I tried so many attribute but It didn't work.

Is it possible to make this kind of dialog (Message dialog with "Show Details") with custom error message?


Best Regards,


Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor

Hello Choktananan,

Please use the below code and check which can be used to send back all your custom messages as part of the exception.

data: ls_return_msg TYPE BAPIRET2.

data: lt_return_msg TYPE BAPIRET2_T

data: lo_message TYPE REF TO /IWBEP/IF_MESSAGE_CONTAINER.

data: lx_bus_ex TYPE REF TO /IWBEP/CX_MGW_BUSI_EXCEPTION.

  LO_MESSAGE = MO_CONTEXT->GET_MESSAGE_CONTAINER( ).

  LO_MESSAGE->ADD_MESSAGES_FROM_BAPI( IT_BAPI_MESSAGES = LT_RETURN_MSG ).

  create OBJECT lx_bus_ex

  exporting

    message_container = LO_MESSAGE.

    raise EXCEPTION lx_bus_ex.

Where LT_RETURN_MSG is a table containing all your custom messages.


Regards,

Ashwin

0 Kudos

Hi Ashwin,

Many thanks for the prompt reply.

but It's still showing single message without "Show Details".

Best Regards,

AshwinDutt
Active Contributor
0 Kudos

Please check in the UI side what code is written to display/show those messages.

Check if any modification is needed in the UI code.

0 Kudos

Hi Ashwin,

My problem is solved. At first, I thought I could change type of message box from back-end by put some parameters. (After I saw standard error can call this kind of message box) I checked my UI code and realized It's completely different.

Best Regards,   

Answers (0)