cancel
Showing results for 
Search instead for 
Did you mean: 

Capture user action from method cl_wd_popup_factory=>popup

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

rainer_liebisch
Contributor
0 Kudos

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

Former Member
0 Kudos

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( ).

Answers (1)

Answers (1)

rainer_liebisch
Contributor
0 Kudos

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

Former Member
0 Kudos

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