cancel
Showing results for 
Search instead for 
Did you mean: 

How to Add actions to popup screen buttons in webdynpro

Former Member
0 Kudos

How to give action to popup screen button such as cancel(X) button in top right..

Tell as a sample code...........

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Prabhu,

Here is your sample code.


   method ONACTIONPOPUP .

  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 l_api             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( ).
  lo_window         = lo_window_manager->create_window(
                     window_name            = 'POPUP_WIN'
*                    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_ok
                     message_type           = if_wd_window=>co_msg_type_none
                     default_button         = if_wd_window=>co_button_ok
                     ).

   l_api = wd_this->wd_get_api( ).

  CALL METHOD lo_window->subscribe_to_button_event
    EXPORTING
      button            = if_wd_window=>co_button_ok
*      button_text       =
*      tooltip           =
      action_name       = 'OK'
      action_view       = l_api
*      is_default_button = ABAP_FALSE
      .


  lo_window->open( ).

endmethod.
                

Then create an action with name OK in your view and write the required code into it.


method ok.
.
.
.

endmethod.
 

former_member184578
Active Contributor
0 Kudos

Hi prabhu,

For registering action for cancel button , use SET_ON_CLOSE_ACTION method of if_wd_window.

data lr_view_controller type ref to if_wd_view_controller.

lr_view_controller = wd_this->wd_get_api( ).

* call window manager and use method create_popup_to_confirm to open popup

* Registering action for close button
lo_window->set_on_close_action(
 
view = lr_view_controller
ACTION_NAME = 'CLOSE'  " You have to create an action in actions tab and give that name here.

).

For other buttons like yes, no .. you have to use SUBSCRIBE_TO_BUTTON_EVENT . check this help docu for reference

http://help.sap.com/saphelp_erp60_sp/helpdata/en/43/c2283b2320332ce10000000a11466f/content.htm

Hope this helps u.,

Thanks & Regards,

Kiran.

Former Member
0 Kudos

Hi,

In webdynpro we have a code genarator by using that you can genarate a pop-up window.By using "subscribe_to_button_event" method we can pass actions.

Example :

lo_window->subscribe_to_button_event(

EXPORTING button = if_wd_window=>co_button_yes

action_name = 'UPDATE'

action_view = l_api ).

Thanks ,

Lavanya .