cancel
Showing results for 
Search instead for 
Did you mean: 

Refresh Message Area to repopulate the new messages

Former Member
0 Kudos

HI All,

I am populating messages in WDmodify, wDdoinit and other methods of a ZWDcomponent in message area with errors, warnings and success messages.

I used below method

lo_message_manager->report_error_message(

    message_text              = l_msg ).

The main problem.

It is populating duplicate messages how to check do the message exist.

Any method to clear the existing message in the message area (not messages)

I used CLEAR_MESSAGES of IF_WD_MESSAGE_MANAGER . It is clearing all the messages in the instance. I need to clear the existing messages in message area and repopulate new messages into message area.

I tried to use some logic but it is not working when we some methods are called like modify it is becoming complicated logic.

Any suggestions are welcomed.

Thanks

Gopal

Accepted Solutions (0)

Answers (4)

Answers (4)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

You can use IS_EMPTY method. If there are messages, then it will be initial. Otherwise, it will have X.

** get message manager

DATA lo_api_controller     TYPE REF TO if_wd_controller.

DATA lo_message_manager    TYPE REF TO if_wd_message_manager.

data lv_bool type abap_bool.

data lt_messages type if_wd_message_manager=>ty_t_messages.

lo_api_controller ?= wd_this->wd_get_api( ).



CALL METHOD lo_api_controller->get_message_manager

  RECEIVING

    message_manager = lo_message_manager

    .DATA lv_message            TYPE string.

DATA lv_message_type       TYPE i.



lv_message_type = if_wd_message_manager=>co_type_standard.

* report message

CALL METHOD lo_message_manager->report_success

  EXPORTING

    message_text              =  'Success'.


* report message

CALL METHOD lo_message_manager->is_empty

  RECEIVING

    empty  = lv_bool

    .
if lv_bool eq 'X'.

....

endif,

If you comment report_sucess method, you will find the difference.

former_member197475
Active Contributor
0 Kudos

Hi Gopal,

As Kiran said, it is always best to use report_attribute_error_message( ) method, as it highlights the error field that makes an user for better clarification.

BR,

RAM.

former_member184578
Active Contributor
0 Kudos

Hi,

You can use, remove_message( ) method, to remove the message. Or use, get_messages( ) method first to get all the messages, then loop the message and check if the message already exists. IF it already exists don't raise message again, else report message.

hope this helps u,

Regards,

Kiran

Former Member
0 Kudos

HI Kiran,

I have tried it is becoming complicated, do we not have any option like once any error message is triggered into message area it will not allow to navigate to any action further  until the error is resolved.So that I can solve my problem.  just like ABAP reports.

Thanks

Gopal

former_member184578
Active Contributor
0 Kudos

Hi,

Then, Instead of report_error_message( ) method, use  report_attribute_error_message( ) which will not show duplicate messages.

Regards,

Kiran

Former Member
0 Kudos

Hi Gopal,

As  said use the report_attribute_error_message. In this case webdynpro highlights the Field attribute on the screen with Red Color.

Regards,

Ravikiran.k

former_member210252
Contributor
0 Kudos

Hi Gopal,

Can you please be specific about what you mean by duplicate messages.

Also please share the scenarios like what exactly you are looking for.

Regards,

Rafi