cancel
Showing results for 
Search instead for 
Did you mean: 

To create buttons on the popup or another window

Former Member
0 Kudos

hi,

My requirement is to validathe the contents on the web dynpro page which has the SUBMIT button, after submitting if the fields are blank then a warning message " do you want to continue " is to be displayed,

the window should have two buttons "yes" and " no " if i click yes than an email is to be sent and if no than continue.

How can i create two buttons on the secondary window or popup.

Thanks,

Nishant

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Refer this code :

Data: context_node type ref to if_wd_context_node.

  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_POPUP'  "Name of the window 
  TITLE               = 'Please enter all information'
  CLOSE_BUTTON        = ABAP_TRUE
  BUTTON_KIND         = if_wd_window=>CO_BUTTONS_YESNO
  MESSAGE_TYPE        = if_wd_window=>co_msg_type_error
  CLOSE_IN_ANY_CASE   = ABAP_TRUE
*MESSAGE_DISPLAY_MODE = MESSAGE_DISPLAY_MODE
  ).

* Adds an action to the popup screen buttons
* lr_view_controller = wd_this->wd_get_api( ).

** lr_popup->subscribe_to_button_event(*
** button = if_wd_window=>co_button_yes*
** button_text = 'Yes'*
** action_name = 'SUBMIT'*
** action_view = lr_view_controller ).*

  lr_popup->open( ).

Similarly create event for other button NO.

Submit is name of Action which you have to create manually and code there acc to your req.

novartis

Edited by: Saurav Mago on Dec 8, 2009 6:19 PM

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

I had the same requirement last year.

you can use the same given below.

DATA: l_api TYPE REF TO if_wd_view_controller,

lo_window_manager TYPE REF TO if_wd_window_manager,

lo_api_component TYPE REF TO if_wd_component,

lo_window TYPE REF TO if_wd_window,

lo_api_component = wd_comp_controller->wd_get_api( ).

lo_window_manager = lo_api_component->get_window_manager( ).

lo_window = lo_window_manager->create_popup_to_confirm(

text = 'give your text'

button_kind = if_wd_window=>co_buttons_yesno ).

  • To set popup window size ------> OPTIONAL

CALL METHOD lo_window->set_window_size

EXPORTING

width = 100

height = 50.

  • open popup window

lo_window->open( ).

l_api = wd_this->wd_get_api( ).

  • subscribe action for NO button

lo_window->subscribe_to_button_event(

button = if_wd_window=>co_button_no

action_name = 'NO'

action_view = l_api

is_default_button = abap_true ).

  • subscribe action for YES button

lo_window->subscribe_to_button_event(

button = if_wd_window=>co_button_yes

action_name = 'YES'

action_view = l_api

is_default_button = abap_true ).

This will work very well

Former Member
0 Kudos

Hi,

Is it possible to use the code for single view or you need another view to successfully execute the code.

Thanks,

Nishant

Former Member
0 Kudos

hi ,

for the POP up , u need to create another view

regards,

amit

Former Member
0 Kudos

For create_popup_to_confirm method , no other view or window is required.

This will open a pop up for you by its own.

Former Member
0 Kudos

how can i send a mail when i click On the "yes" button on the popup screen.

Former Member
0 Kudos

Have you created the action for YES button or not..

for sending the mail you can refer the same forum as it was already discussed.

Have you created another view and window for this..

If yes, then it is not required.. you can just just popup_to_confirm method of if_wd_window_manager..

cerating other view, window is again a little overhead...

Former Member
0 Kudos

HI lekha,

how can i use popup_to_confirm method of if_wd_window_manager to create a pop up ?

Thanks,

nishant

Former Member
0 Kudos

Hi,

Refer this code :

data: l_cmp_api          type ref to if_wd_component,
        l_window_manager   type ref to if_wd_window_manager,
        l_popup            type ref to if_wd_window,
        l_text             type string_table,
        l_api              type ref to if_wd_view_controller.
 
 
  l_cmp_api        = wd_comp_controller->wd_get_api( ).
  l_window_manager = l_cmp_api->get_window_manager( ).
  insert `Data where changed` into table l_text.    "#EC *
  insert `Do you want to save?`        into table l_text.    "#EC *
 
  l_popup = l_window_manager->create_popup_to_confirm(
                text            = l_text
                button_kind     = if_wd_window=>co_buttons_yesnocancel
                message_type    = if_wd_window=>co_msg_type_question
                window_title    = 'Test: Popup to confirm'
                window_position = if_wd_window=>co_center )."#EC *
 
 
 
  l_api = wd_this->wd_get_api( ).
 
  l_popup->subscribe_to_button_event(
               button            =  '07' "if_wd_window=>co_button_yes
               action_name       = 'YES'
               action_view       = l_api
               is_default_button = abap_true ).
 
  l_popup->subscribe_to_button_event(
               button            = '08' "if_wd_window=>co_button_no
               action_name       = 'NO'
               action_view       = l_api
               is_default_button = abap_false ).
 
  l_popup->subscribe_to_button_event(
               button            = '06' "if_wd_window=>co_button_cancel
               action_name       = 'CANCEL'
               action_view       = l_api
               is_default_button = abap_false ).
 
  l_popup->open( ).

Former Member
0 Kudos

hi

refer this code to generate a POPUP


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.
 
  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          = 'W_POPUP'
    message_display_mode = if_wd_window=>co_msg_display_mode_selected
    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
    ).
  DATA:  l_api TYPE REF TO if_wd_view_controller.
 
  l_api = wd_this->wd_get_api( ).
" Subscribe to  button event
  lo_window->subscribe_to_button_event(
               button            = if_wd_window=>co_button_yes
               action_name       = 'ON_YES' " create method with this name in the Methods tab
//write ur logic there
               action_view       = l_api
               is_default_button = abap_true ).
 
  lo_window->open( ).

regards,

amit

Former Member
0 Kudos

HI,

Is this a modal popup or are you using a create popup to confrim method of if_wd_window_manager.

popup_to_confirm method has the buttons combination where you can give the button kind ..

Regards,

Lekha.