cancel
Showing results for 
Search instead for 
Did you mean: 

Show messages after popup

Former Member
0 Kudos

Hi all,

I have the following problem;

In my web dynpro i have a button 'Save' when the user push it is displayed a popup with the typical question: 'Are you sure to continue?' (Yes/No)'.

Then if the user press 'Yes' an action is triggered and i begin to save the data. In this moment may be i want to display messages, but if i use the message_manager the messages are not displayed.

I think that aren't displayed because when you press this buttons the window is closed automatically, and the standard is trying to display the messages in it...

I want to display the messages in the view wich call the popup.

I've tried to create a message table in the context and check if is fill in the method modifyview in order to show it, but happens the same the messages are not displayed...

Do you know how I can do?

Thank in advance !

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

With the method window_manager->create_popup_to_confirm and a Message_area is working fine.

Baskaran, thanks for this useful tip.

Madhu2004
Active Contributor
0 Kudos

HI,

Place the action handler method of YES action for the pop up in the view from where you are calling the Pop up.

In the method first close the pop up window using Close( ) method of the IF_WD_WINDOW and later on call the save method ,

and trigger report_error_message if you have any errors.

Regards,

Madhu

Former Member
0 Kudos

Thanks, but don't works...

i've created an attribute on my view with the type IF_WD_WINDOW.

I do this;

wd_this->gr_window->close( ).

before to report_error_message, but any messages are displayed...

Former Member
0 Kudos

Simply use plugs... Navigate from popup window to the view.. display the message.

Sharathmg
Active Contributor
0 Kudos

view-> create the window and set the window to context attribute -> also, subscribe the window actions Yes & No appropriate methods in the view-> call the window using window->open( ) -> User clicks on Yes -> In the method Yes of parent view/controller retrieve the window attribute from context -> close the window using window->close() -> use the message manager and display the message.

Now, these are standard steps and it should ideally work.

Also, put a message manager in the parent view.

Regards,

Sharath

Former Member
0 Kudos

I created a new WebDynpro only for try it;

I have two windows: MAIN and W_POPUPS, and two views MAIN and POPUP.

In the MAIN view i've created an attribute called W_WINDOW type ref to IF_WD_WINDOW.

I have a button in my MAIN view for display the popup, in its action i put the following code:

DATA lo_window_manager TYPE REF TO if_wd_window_manager.
  DATA lo_api_component  TYPE REF TO if_wd_component.
  DATA lo_window         TYPE REF TO if_wd_window.
  DATA: lr_view_controller TYPE REF TO if_wd_view_controller.

  lo_api_component  = wd_comp_controller->wd_get_api( ).
  lo_window_manager = lo_api_component->get_window_manager( ).
  wd_this->w_window = lo_window_manager->create_window(
                     window_name            = 'W_POPUPS'
*                    title                  =
*   close_in_any_case      = abap_true
    message_display_mode   = if_wd_window=>co_msg_display_mode_selected
*   close_button           = abap_true
    button_kind            = if_wd_window=>co_buttons_yesno
    message_type           = if_wd_window=>co_msg_type_none
    default_button         = if_wd_window=>co_button_yes
                     ).

  lr_view_controller = wd_this->wd_get_api( ).

* subscribe to event:
  wd_this->w_window->subscribe_to_button_event(
  button = if_wd_window=>co_button_yes
  button_text = 'Yes'
  action_name = 'YES'
  action_view = lr_view_controller ).

* Open the window;
  wd_this->w_window->open( ).

In the action called 'YES' i've put the following code;

DATA lo_api_controller     TYPE REF TO if_wd_controller.
DATA lo_message_manager    TYPE REF TO if_wd_message_manager.

* Close the windows
wd_this->W_WINDOW->close( ).

lo_api_controller ?= wd_this->wd_get_api( ).

CALL METHOD lo_api_controller->get_message_manager
  RECEIVING
    message_manager = lo_message_manager.

* Show the message
CALL METHOD lo_message_manager->report_success
  EXPORTING
    message_text              = 'Hello'.

In the layout of my MAIN view i added a IU elment MessageArea, but I don't know if I have to do something with it or simply add it...

I run the application but does not work.

Former Member
0 Kudos

Hi ,

I feel the problem is that , your popup view and main view are in two different windows and hence when you raise the message , it does not find any messageArea in the view as your pop-up is in different window and main is in different window.

Is it deliberately done (creating the views in different windows??)...

Thanks,

Aditya.

Madhu2004
Active Contributor
0 Kudos

HI,

I have created a demo component in the same as you created,and it works fine for me.

Only chance of error would be Did you create a action(YES) in actions tab of MAIN view and write the code in ONACTIONYES method of the MAIN view.

Because If you have created a method with name YES, that method will not trigger, however the POPUP closes because CLOSE_IN_ANYCASE is defaulty abap_true.

Regards,

Madhu.

Former Member
0 Kudos

I have to be doing something wrong because still not working.

YES action is created in the MAIN view, this action is triggered, i put a breakpoint there and it stops...

I added the following line of code in the call to the popup;

close_in_any_case = abap_false

But still not working...

Madhu2004
Active Contributor
0 Kudos

Finally in create_window method ,try below code

message_display_mode   = if_wd_window=>co_msg_display_mode_all

Former Member
0 Kudos

I don't understand, still not working...

0 Kudos

Hi All,

I think the problem was caused by the new version of NWs.

I have the same problem in my development currently, the SAP_ABA is 701, level 0007; SAP_BASIS is 701, level 0007; BUT, in the old version of these components, the same codes work perfictly~

I'm trying to get a solution too.

Former Member
0 Kudos

hi ,

See my recent reply in the forum discussion

[|]

some thing like below

The trick is to supply the view name. Then you will get message only in that view.

lo_message_manager->report_success(
    message_text              = 'Test message'
*    params                    =
*    msg_user_data             =
*    is_permanent              = ABAP_FALSE
*    scope_permanent_msg       = CO_MSG_SCOPE_CONTROLLER
      view                      = 'MAIN'
*    show_as_popup             = 
*    controller_permanent_msg  =
*    msg_index                 =
*    cancel_navigation         =
*    enable_message_navigation =
       ).

if it is still not working then apply the sap Note 1456186 - WDA: Message is not displayed

Edited by: Baskaran Senthivel on Dec 5, 2010 11:25 AM

Former Member
0 Kudos

hi ,

Since you want to display messages in the view , add a messageArea UI element in the view and try to raise a message in the event handler of the "yes" button of your raised pop-up .(as in during the process of saving things , may be you can raise a message).

Cheers,

Aditya.

Former Member
0 Kudos

Thanks for your answer.

I've tried what you said, but doesn't work