cancel
Showing results for 
Search instead for 
Did you mean: 

reg:error messages display in wdabap

Former Member
0 Kudos

hi expert

could you please say what i need to pass the values which are mandatory in this error message coding .can you please share some the documents related to error messages display.

method ONACTIONEXECUTEACTION .

if sy-subrc ne 0 .

  • 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_ATTRIBUTE_ERROR_MESSAGE

EXPORTING

MESSAGE_TEXT = 'THE ENTERED TICID IS NOT AVAILABLE' .

ELEMENT =

  • ATTRIBUTE_NAME =

  • PARAMS =

  • MSG_USER_DATA =

  • IS_PERMANENT = ABAP_FALSE

  • SCOPE_PERMANENT_MSG = CO_MSG_SCOPE_CTXT_ELEMENT

  • MSG_INDEX =

  • CANCEL_NAVIGATION =

  • IS_VALIDATION_INDEPENDENT = ABAP_FALSE

  • ENABLE_MESSAGE_NAVIGATION =

  • VIEW =

  • RECEIVING

  • MESSAGE_ID =

  • .

else .

DATA LO_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .

LO_COMPONENTCONTROLLER = WD_THIS->GET_COMPONENTCONTROLLER_CTR( ).

LO_COMPONENTCONTROLLER->GETDATA(

).

WD_THIS->FIRE_OUTVIEW1_PLG(

).

endmethod.

endif.

thanks in advance

Deepika

Edited by: deepika_indian on Aug 18, 2010 7:32 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi deepika ,

In REPORT_ATTRIBUTE_ERROR_MESSAGE you have to pass the Msg text , context element , and attribute name of the UI element binded .

Look in to the sample code .

l_element type ref to if_wd_context_element.
l_element = wd_context->get_element( ).

 l_message_manager->report_attribute_error_message(
        message_text  = 'Error Text ''
        element = l_element 
        attribute_name = 'PERNR'   " Attribute Name of the UI binded 
*        PARAMS        =
*        MSG_USER_DATA =
           ).

Regards

chinnaiya P

Former Member
0 Kudos

hi chinnaiya

what exactly we need to pass in element what l_element mean in ur sample code.And how the attribute perner value is helpfull in displaying the error messages as i am new to the oop methods bit diffcult to understand .could u please expalin in brief.

and related to msg_id parameter what i need to pass in it.

Thanks in advance

Deepika

Edited by: deepika_indian on Aug 18, 2010 10:51 AM

Edited by: deepika_indian on Aug 18, 2010 11:05 AM

Former Member
0 Kudos

Hi Deepika,

Here for the method REPORT_ATTRIBUTE_ERROR_MESSAGE, mandotory fields are

MESSAGE_TEXT

ELEMENT

ATTRIBUTE_NAME

Here ELEMENT v need to pass lv_el_context type ref of IF_WD_CONTEXT_ELEMENT.(Context Elemet Reference).

Suppose your context having an attribute 'KUNNR'.

So, here v need to pass in the below manner to raise an exception


    DATA lo_el_context TYPE REF TO if_wd_context_element.
    DATA ls_context TYPE wd_this->Element_context.
    DATA lv_gr2_visible TYPE wd_this->Element_context-kunnr.

*   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_ATTRIBUTE_ERROR_MESSAGE
    EXPORTING
      MESSAGE_TEXT              = 'MESSAGE TEXT TO DISPLAY'
      ELEMENT                          = lo_el_context
      ATTRIBUTE_NAME           = 'KUNNR'
*      PARAMS                    =
*      MSG_USER_DATA             =
*      IS_PERMANENT              = ABAP_FALSE
*      SCOPE_PERMANENT_MSG       = CO_MSG_SCOPE_CTXT_ELEMENT
*      MSG_INDEX                 =
*      CANCEL_NAVIGATION         =
*      IS_VALIDATION_INDEPENDENT = ABAP_FALSE
*      ENABLE_MESSAGE_NAVIGATION =
*      VIEW                      =
*    RECEIVING
*      MESSAGE_ID                =      .

Kindly revert for further clarification.

Regards,

Amarnath S

Answers (1)

Answers (1)

Former Member
0 Kudos

Deepika,

Here is an example....Only mandatory field is"* message_text * " need to pass to display the error message.

  • 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 = 'text to display as an error message'

  • params =

  • msg_user_data =

  • is_permanent = ABAP_FALSE

  • scope_permanent_msg = CO_MSG_SCOPE_CONTROLLER

  • view =

  • show_as_popup =

  • controller_permanent_msg =

  • msg_index =

  • cancel_navigation =

  • enable_message_navigation =

  • receiving

  • message_id =

.

Regards,

Amarnath S