cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying error message with context attribute values?

Former Member
0 Kudos

Hi,

I need to display the error message with the context value.

I am using the following method to display error message

CALL METHOD LO_MESSAGE_MANAGER->RAISE_T100_ERROR

        EXPORTING

          MSGID         = 'ZHR_MESSAGE' " Message Identification

          MSGNO         = '019'

          MSGTY         = 'E'" Message Type

          P1            = LV_WORKED_DATE.

Context value is not displaying along with error message.

Could you please help me tol solve this.

Thanks,

Sathish GS

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

First you have to read the attribute, if this is a table or something like that you have to use loop statement,  Lets suppose that it is  a table;

DATA lo_nd_main_node TYPE REF TO if_wd_context_node.

   DATA lt_main_node TYPE wd_this->Elements_main_node.

   DATA ls_main_node TYPE wd_this->Element_main_node.

* navigate from <CONTEXT> to <MAIN_NODE> via lead selection

   lo_nd_main_node = wd_context->get_child_node( name = wd_this->wdctx_main_node ).

   lo_nd_main_node->get_static_attributes_table( importing table = lt_main_node ).

data: i TYPE sy-tabix.

i = sy_tabix.

loop at lt_main_node INTO ls_main_node.

   i = i + 1.

   READ TABLE lt_main_node INTO ls_main_node.

*   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

       .

   data: ls_message TYPE string.

   ls_message = ls_main_node-[enter_your_attribute_here]

*   report message

   CALL METHOD lo_message_manager->REPORT_WARNING

     EXPORTING

       MESSAGE_TEXT              = ls_message

     RECEIVING

       MESSAGE_ID                = ls_message

       .

   ENDLOOP.

Former Member
0 Kudos

Hello Sathish,

Read the parameter's(Which you want to show them along with the error message) and try to pass the same while calling report_t100_error method.

For your understanding, in the below snap shot,Im showing the values of 3 dropdown's in the error message.

Here, i'm reading the three dropdown values into some local variables

  lv_param1  = first dropdown value(Read the value from code wizard).

  lv_param2  = second  dropdown value(Read the value from code wizard).

  lv_param3  = third dropdown value(Read the value from code wizard).

   *   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.

   CALL METHOD lo_message_manager->report_t100_message
            EXPORTING
              msgid = 'MESSAGE CLASS"  " Message Identification
              msgno = MESSAGE NO( Should have place holders)   " Message Number ( in the above example, it is No values found for selected criteria '&1' '&2' '&3')
              msgty = 'E'   " Message Type
              p1    = lv_param1    " 1st parameter
              p2    = lv_param2    " 2nd parameter
              p3    = lv_param3" 3rd parameter

For the above scenario,i'm using report_t100_message( ) and passing the three values into p1,p2,p3.

Follow the above mentioned steps,It will resolve your problem.

Thanks

Katrice

nagarjun_kalletla
Participant
0 Kudos

Hi,

Use REPORT_ATTRIBUTE_EXCEPTION of message manager.

Provide value  : ATTRIBUTE_NAME

 

Regards,

Nagarjun

former_member184578
Active Contributor
0 Kudos

Hi,

Use Report_attribute_error_message of message manager.

First get the value of the attribute using get_attribute message, then concatenate the message with the attribute value and then pass it to the message manager method.

Regards,

Kiran

Former Member
0 Kudos

First you have to read the attribute, if this is a table or something like that you have to use loop statement,  Lets suppose that it is  a table;

DATA lo_nd_main_node TYPE REF TO if_wd_context_node.

   DATA lt_main_node TYPE wd_this->Elements_main_node.

   DATA ls_main_node TYPE wd_this->Element_main_node.

* navigate from <CONTEXT> to <MAIN_NODE> via lead selection

   lo_nd_main_node = wd_context->get_child_node( name = wd_this->wdctx_main_node ).

   lo_nd_main_node->get_static_attributes_table( importing table = lt_main_node ).

data: i TYPE sy-tabix.

i = sy_tabix.

loop at lt_main_node INTO ls_main_node.

   i = i + 1.

   READ TABLE lt_main_node INTO ls_main_node.

*   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

       .

   data: ls_message TYPE string.

   ls_message = ls_main_node-[enter_your_attribute_here]

*   report message

   CALL METHOD lo_message_manager->REPORT_WARNING

     EXPORTING

       MESSAGE_TEXT              = ls_message

     RECEIVING

       MESSAGE_ID                = ls_message

       .

   ENDLOOP.