cancel
Showing results for 
Search instead for 
Did you mean: 

subcribe to popup box button in component controller

siongchao_ng
Contributor
0 Kudos

Hi all,

Normally I used popup box in view controller. No, due to the program flow, I have to do it in component controller instead. Refer to my codes below, how do I subscribe to the popup box button? There is no action tab in component controller. How?

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.

DATA lt_message TYPE string_table.

DATA lw_message TYPE string.

CLEAR lt_message.

CONCATENATE 'Username' sy-uname 'is currently logging on the system. Do you want to continue?'

INTO lw_message SEPARATED BY space.

APPEND lw_message TO lt_message.

CLEAR lw_message.

lo_api_component = wd_this->wd_get_api( ).

lo_window_manager = lo_api_component->get_window_manager( ).

CALL METHOD lo_window_manager->create_popup_to_confirm

EXPORTING

text = lt_message

button_kind = if_wd_window=>co_buttons_yesno

message_type = if_wd_window=>co_msg_type_none

  • CLOSE_BUTTON = ABAP_TRUE

window_title = 'Confirmation'

  • WINDOW_LEFT_POSITION =

  • WINDOW_TOP_POSITION =

  • WINDOW_POSITION =

  • WINDOW_WIDTH = '10'

  • WINDOW_HEIGHT = '10'

default_button = if_wd_window=>co_button_no

RECEIVING

result = lo_window.

  • Adds an action to the popup screen buttons

  • lr_view_controller = wd_this->wd_get_api( ).

wd_this->wd_get_api( ).

lo_window->subscribe_to_button_event(

button = if_wd_window=>co_button_yes

button_text = 'Yes'

action_name = 'SUBMIT_YES_DUPLICATE'

action_view = lr_view_controller ).

lo_window->subscribe_to_button_event(

button = if_wd_window=>co_button_no

button_text = 'No'

action_name = 'SUBMIT_NO_DUPLICATE'

action_view = lr_view_controller ).

  • open window

lo_window->open( ).

Accepted Solutions (0)

Answers (2)

Answers (2)

siongchao_ng
Contributor
0 Kudos
  • The only way is to do it in View Controller

Edited by: Siong Chao on Oct 18, 2010 11:12 AM

Former Member
0 Kudos

hi, Siong:

You just want to Subscribe to your buttons in Pop-up, just like "YES","NO"...

In fact, you can subscribe these buttons in COMPONENT CONTROLLER...

Because, you use the "Confirmation Pop-up" named "popup_to_confirm" which is one attribute of "Window" when you use "Confirmation Pop-up"...

Here, the coding is not as you wrote :


lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_no
button_text = 'No'
action_name = 'SUBMIT_NO_DUPLICATE'
action_view = lr_view_controller ).

Instead, use the following:


lo_window->popup_to_confirm->subscribe_to_button_event(
            controller         = lo_api_component
            handler_name       = 'HNDL_SAVE_YES'
            button             = if_wd_window=>co_button_yes
            tooltip            = 'Yes' ).

Now, you can add the event handler "HNDL_SAVE_YE" in your component controller...

Best wishes.

Former Member
0 Kudos

Hi,

One soloution may be to put the message you want to display in a seperate view and the view in a window and raise the window as a pop-up using create_window() method of if_wd_window_manager.

You can then subscribe the buttons in the WDOINIT method of the view.

Cheers,

Aditya.

siongchao_ng
Contributor
0 Kudos

Hi Aditya,

You mean to say that the chunck below here cannot be used in the component controller?

lo_window->subscribe_to_button_event(

button = if_wd_window=>co_button_yes

button_text = 'Yes'

action_name = 'SUBMIT_YES_DUPLICATE'

action_view = lr_view_controller ).

I cannot put the 'SUBMIT_YES_DUPLICATE' in the events tab instead in the component controller?

What about the action_view? Anyone out there know how to use a popup box in the component controller?