cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass message from one view to another

Former Member
0 Kudos

Hi,

I want to pass any type of message (warning, info..) from a pop up to a main view when user exit

pop up.

this is how im displaying my messages:

  • get message manage

lo_api_controller ?= wd_this->wd_get_api( ).

lo_message_manager = lo_api_controller->get_message_manager( ).

lo_message_manager->report_t100_message(

EXPORTING

msgty = 'W'

msgid = 'ZZ'

msgno = '116' ).

any ideas?

Thanks,

Abdul.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

One of the way is to do display the error message from the parent view. For that

1)you need to have the messages available to the parent view. You can easily do that by saving the error message in the controller context/attribute.

2)You need to know when the control comes back from popup window.

save the popup window reference in the component controller, subscribe to the popup button event in the parent view.

When the event comes to the parent view display the message.

0 Kudos

Hello,

I need some help to full understand this process. I don't know the difference between to process a method after an event (from main view) and to execute a method after an event from the open pop-up view.

** Main view: code after click on a button "reject

   lo_view_controller = wd_this->wd_get_api( ).
   lo_api_component  = wd_comp_controller->wd_get_api( ).
   lo_window_manager = lo_api_component->get_window_manager( ).


   wd_comp_controller->go_window_popup = lo_window_manager->create_window(
              window_name          = 'REJET_WINDOW'
              title                = 'Rejet'
*             message_display_mode = if_wd_window=>co_msg_display_mode_none
              message_display_mode = 2
*             button_kind          = if_wd_window=>co_buttons_none
              button_kind          = if_wd_window=>co_buttons_okcancel
              message_type         = if_wd_window=>co_msg_type_none
              default_button       = if_wd_window=>co_buttons_none ).

   wd_comp_controller->go_window_popup->subscribe_to_button_event(
       button      = if_wd_window=>co_button_ok
       button_text = 'Reject'
       action_name = 'REJECT'
       action_view = lo_view_controller
       is_default_button = abap_false ).

   wd_comp_controller->go_window_popup->subscribe_to_button_event(
       button      = if_wd_window=>co_button_cancel
       button_text = 'Annuler'
       action_name = 'NO_ACTION'
       action_view = lo_view_controller
       is_default_button = abap_true ).

   wd_comp_controller->go_window_popup->open( ).

** Pop-up window: Code after click on Rejet button.

wd_comp_controller->go_window_popup->close( ).

// Check the conditions.

       lo_message_manager->report_t100_message( msgid = 'test'
                                                msgno = 000
                                                msgty = 'E' ).

Is this code executed in the returned view? How do I manage to executed once the pop-up view is closed? The problem is the messages are not appearing.

Please, if you have any doubt about my questions don't hesitate to ask.

Thanks a lot.

Javier

Answers (1)

Answers (1)

0 Kudos

Hello,

I have find out that also that it's mandatory to indicate the view where you want to display your message:

       lo_message_manager->report_t100_message( msgid = ls_return-id
                                                msgno = ls_return-number
                                                msgty = ls_return-type
                                                p1 = ls_return-message_v1
                                                p2 = ls_return-message_v2
                                                p3 = ls_return-message_v3
                                                p4 = ls_return-message_v4
                                                view = if_wd_message_manager=>co_any_window ).

http://www.stechno.net/sap-notes.html?id=1458651&view=sapnote

Kind regards,
Javier