cancel
Showing results for 
Search instead for 
Did you mean: 

Get referrence of message manager in a view ...

Former Member
0 Kudos

Hi,

    I have many actions & methods in my application. In those if I need to display any message I have to get the ref of message manager.

like below :-

 

   * 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

  Isi it possible to get the value of   'lo_message_manager'  once in a method ( like wddoint) and kept it in a attribute.

  then use the attribute every where.

  Or If I can get the referrence by using any attribute in a view.

  This will certainly minimize some lines of code.

  Thanks & regards,

  Monishankar Chatterjee

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Yes definitley,

Just create an attribute of type IF_WD_MESSAGE_MANAGER in the attributes section of component controller and it wddoinit method write the code you wrote above and pass the message manager to the attribute created in Attributes Tab.

You can use this message manager now in all the views.

you can also create a global variable of TYPE REF TO if_wd_message_manager in your assistance class. Write the code you wrote above in wddoinit of component controller and pass the message manager to this global variable..

Now use this everywhere. In your assistance class, component controller as well as all views.

Answers (1)

Answers (1)

chengalarayulu
Active Contributor
0 Kudos

Yes moni,

you are absolutely right, go ahead.