Skip to Content
author's profile photo Former Member
Former Member

Capture user action from method cl_wd_popup_factory=>popup

Hi There,

Just wondering if anyone can explain to me how i capture what button a user pressed when using the method 'cl_wd_popup_factory=>popup' and how I perfor different methods/ functionality depending on what they pressed.

At the moment i can create the popup using the code below but it is not displayed untill the current method has been completed, at this point it seems too late to allow me to control of the code.

call method cl_wd_popup_factory=>popup

EXPORTING

component = lr_component_api

view_name = 'VIEW2'

button_kind = if_wd_window=>CO_BUTTONS_YESNO

message_type = if_wd_window=>CO_MSG_TYPE_QUESTION

IMPORTING

POPUP_WINDOW = window

COMPONENT_USAGE = comp_usage.

Any ideas would be much appreciated

Regards

Martin

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jan 09, 2008 at 03:52 PM

    Hi Mart,

    the source code for open_popup in the component controller is:

    data:

    lr_api_comp_controller type ref to if_wd_component,

    lr_window_manager type ref to if_wd_window_manager.

    lr_api_comp_controller = wd_this->wd_get_api( ).

    lr_window_manager = lr_api_comp_controller->get_window_manager( ).

    e_popup = lr_window_manager->create_window(

    • MODAL = ABAP_TRUE

    window_name = i_popup_name

    • TITLE = TITLE

    • CLOSE_BUTTON = ABAP_TRUE

    BUTTON_KIND = i_button_kind

    MESSAGE_TYPE = i_message_type

    • CLOSE_IN_ANY_CASE = ABAP_TRUE

    • MESSAGE_DISPLAY_MODE = MESSAGE_DISPLAY_MODE

    ).

    e_popup->open( ).

    Regards,

    Rainer

    Edited by: Rainer Liebisch on Jan 9, 2008 4:59 PM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Rainer,

      That has worked a treat, i used the CREATE_WINDOW method directly rather than using it viw the OPEN_POPUP method but should not make any different should it? see code below

      Thanks again

      Regards

      Martin

      data: lr_popup type ref to if_wd_window,

      lr_view_controller type ref to if_wd_view_controller.

      data:

      lr_api_comp_controller type ref to if_wd_component,

      lr_window_manager type ref to if_wd_window_manager.

      lr_api_comp_controller = wd_comp_controller->wd_get_api( ).

      lr_window_manager = lr_api_comp_controller->get_window_manager( ).

      lr_popup = lr_window_manager->create_window(

      MODAL = ABAP_TRUE

      window_name = 'WND_TEXT'

      TITLE = 'TITLE '

      CLOSE_BUTTON = ABAP_TRUE

      BUTTON_KIND = if_wd_window=>co_buttons_okcancel

      MESSAGE_TYPE = if_wd_window=>co_msg_type_none

      CLOSE_IN_ANY_CASE = ABAP_TRUE

      *MESSAGE_DISPLAY_MODE = MESSAGE_DISPLAY_MODE

      ).

      lr_view_controller = wd_this->wd_get_api( ).

      lr_popup->subscribe_to_button_event(

      button = if_wd_window=>co_button_ok

      button_text = 'ok_text'

      action_name = 'SUBMIT'

      action_view = lr_view_controller ).

      lr_popup->open( ).

  • Posted on Jan 09, 2008 at 03:10 PM

    Hello Mart,

    don't use the deprecated method of CL_WD_POPUP_FACTORY. The recommended way is:

    data:

    lr_popup type ref to if_wd_window,

    lr_view_controller type ref to if_wd_view_controller.

    wd_comp_controller->open_popup(

    exporting

    i_popup_name = 'WND_TEXT'

    i_button_kind = if_wd_window=>co_buttons_okcancel

    i_message_type = if_wd_window=>co_msg_type_none

    importing

    e_popup = lr_popup ).

    lr_view_controller = wd_this->wd_get_api( ).

    lr_popup->subscribe_to_button_event(

    button = if_wd_window=>co_button_ok

    button_text = 'ok_text'

    action_name = 'MY_ACTION'

    action_view = lr_view_controller ).

    lr_popup->subscribe_to_button_event(

    button = if_wd_window=>co_button_cancel

    button_text = 'cancel_text'

    action_name = 'MY_ACTION'

    action_view = lr_view_controller ).

    lr_popup->set_on_close_action( view = lr_view_controller action_name = 'MY_ACTION' ).

    Regards,

    Rainer

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Rainer thanks very much for the response,

      When I implement the code I get the following error message:

      Method "OPEN_POPUP" is unknown or PROTECTED or PRIVATE.

      WD_COMP_CONTROLLER is declared in the attributes as ref to IG_COMPONENTCONTROLLER

      Any idea how i can fix this?

      Regards

      Martin

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.