cancel
Showing results for 
Search instead for 
Did you mean: 

webdynpro message manager posting error messages twice.

Former Member
0 Kudos

Hi All,

I have a portal webdynpro application. In one of the methods I am getting the reference to message manager and am using the method report_attribute_error_message function to display my error on the screen.

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_attribute_error_message

EXPORTING

message_text = 'my message'

element = ' my element'

attribute_name = ' my attribute'

RECEIVING

message_id = lv_msgid.

But when I run the application, the messages are being displayed twice. I tried to debug the application by looking at the message manager object, but everything looks good. How can I avoid displaying the same message twice.

Please help me.

Thanks

Aditya

Accepted Solutions (0)

Answers (2)

Answers (2)

MarcinPciak
Active Contributor
0 Kudos

In one of the methods I am getting the reference to message manager...

Which method is that? Is it an event handler method like onaction_name_of_action ? Make sure that this method is not called twice during one cycle.

Also the case might be not clearing the messages before adding new ones


"make sure variables are local not global ones (defined as controller's attributes)
      DATA: 
            lr_wd_api     TYPE REF TO if_wd_view_controller,
            lr_mess_man   TYPE REF TO if_wd_message_manager.  

      lr_wd_api = wd_this->wd_get_api( ).
      lr_mess_man = lr_wd_api->get_message_manager( ).
      "clear before adding new one
      lr_mess_man->clear_messages( ).
      lr_mess_man->report_error_message(
          message_text = 'message text' ).

Regards

Marcin

Former Member
0 Kudos

Make sure you are not calling that error method in any other methods. Further define the message as a string and clear the content before calling.

Former Member
0 Kudos

I am calling the method only once and I am using string for my message. Also I am clearing the content before calling.

Former Member
0 Kudos

I didn't find any wrong in your code.. hopefully you may find more answers if you post in [Web Dynpro ABAP|; section