cancel
Showing results for 
Search instead for 
Did you mean: 

Popup menu with condition buttons

Former Member
0 Kudos

Hi All,

I want to navigate from one view to another. When i click the button to navigate a popup menu should appear with two buttons Yes & No. If I click 'Yes' it should navigate to next view and if I click 'No' it should not navigate..

Can any one help me in doing this...

Thanks,

Susil..

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Now you can create two Actions in your View - One for Yes button and other for NO button.

In the Yes button , you can fire the plug to navigate to second view.

Former Member
0 Kudos

Hi Saurav

Thank you, its working.. how to reduce the size of the popup menu?

Regards,

Susil..

Former Member
0 Kudos

the following parameters of the IF_WD_WINDOW_MANAGER~CREATE_POPUP_TO_CONFIRM method also do not have any effect:

WINDOW_LEFT_POSITION

WINDOW_TOP_POSITION

WINDOW_POSITION

WINDOW_WIDTH

WINDOW_HEIGHT

So i dont think you will be able to control the size of window.

Refer the sap online help :

http://help.sap.com/saphelp_nwmobile71/helpdata/en/47/b9487601602fe2e10000000a42189d/content.htm

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

You can refer to the below thread (Thomas reply)

[;

You can not set the size directly on the popup. I know that there are attributes and methods for this; but they are ignored in the HTML rendering. They are for future usage/smart client rendering. For now in the HTML rendering you can set the size by inner content of the popup. The popup automatically resizes to its inner content. If you are reusing one of the standard SAP-Provided confirmation popups, then you really can't control the size.

Priya

Answers (1)

Answers (1)

Former Member
0 Kudos

hi sushil ,

proceed like this :

1 create a pop up


* 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_ok
    message_type         = if_wd_window=>co_msg_type_none
    default_button       = if_wd_window=>co_button_ok
    ).
  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_ok
               action_name       = 'ON_OK' " create method with this name in the Methods tab
               action_view       = l_api
               is_default_button = abap_true ).
 
  lo_window->open( ).

2 in onaction fire to the next view


wd_this->fire_out_plug
// out_plug is the name of outbound plug

3 u can not set the size of pop up

SAP note 1003826 says that it's not possible yet to programmatically set the window size.

I hope the information wud help

rgds,

amit

Former Member
0 Kudos

Thank you Amit... its working fine..