cancel
Showing results for 
Search instead for 
Did you mean: 

Report Exception

Former Member
0 Kudos

hi Gurus,

I want to display the exception error if any wrong information or did not enter data in mandatory fields..

i checked the DEMO_MESSAGES component,

data: l_exc type ref to cx_wdr_demo_messages.
  create object l_exc.
*   get message manager
  DATA: l_current_controller TYPE REF TO if_wd_controller,
        l_message_manager    TYPE REF TO if_wd_message_manager.

  l_current_controller ?= wd_this->wd_get_api( ).

  l_message_manager = l_current_controller->get_message_manager( ).

*   report message
  l_message_manager->report_exception(
      message_object = l_exc
*      MSG_USER_DATA  =
*      MESSAGE_TYPE   = CO_TYPE_ERROR
         ).

in this code, i am not sure how to use the message object.... and include my custom mnessage... "Provide Sold-to Party number".

I am new to OO programming.... how can i provide my custom message in the above method?

and how to use parameters in exception error message.

Giri

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Use Code Wizard (Control + F7) to achieve this.

Select from there Generate message -> Select the method from F4 help. It will give you a list of methods and would generate the code for u.

Former Member
0 Kudos

hi

u can use the report_error_message of the message manager

go to control wizard ( CONTROL + F7) , click on radio button generate message , select the report_error_message method

the following code wud be auto generated


* get message manager
DATA lo_api_controller     TYPE REF TO if_wd_controller.
DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
 
lo_api_controller ?= wd_this->wd_get_api( ).
 
CALL METHOD lo_api_controller->get_message_manager
  RECEIVING
    message_manager = lo_message_manager
    .
 
* report message
CALL METHOD lo_message_manager->report_error_message
  EXPORTING
    message_text              =   'Error_Text' " Give your error text here.

In the parameter message_text , u can give ur error message

regards,

amit