Skip to Content
avatar image
Former Member

Pop up or alet to confirm the user request.

Dear All,

I have a requirement in WDA.In my screen when user clicks on submit button I need to show a pop up or alert saying "Do You Want to Continue?" .

and Two buttons 1.Yes 2.No.

If the user clicks on button yes I need to move to next screen or If the user clicks on button NO I need to stay in the current page only.

Please suggest how can I achieve this.

Thanks in advance,

Reddy.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jun 06, 2011 at 05:10 AM

    HI,

    Define action handler methods for the pop up buttons in the view.

    In the Yes action method fire plug to the respective view and in No action method just close the pop up.

    Regards,

    Madhu

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 06, 2011 at 05:31 AM

    Hi sudhir,

    For confirmation, you can use POPUP TO CONFIRM window. try below code.

    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 lo_view_controller type ref to if_wd_view_controller.
      data :  lt_text TYPE string_table,
              ls_text TYPE string.
    
      ls_text = 'You want to cancel changes...Are you sure?'.
      INSERT ls_text INTO TABLE lt_text.
    
    * Get Window manager
      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 = lt_text
      button_kind     = if_wd_window=>co_buttons_yesno
      message_type    = if_wd_window=>CO_MSG_TYPE_WARNING
      window_title    = 'Information to Confirm...'
      window_position = if_wd_window=>co_center ).
    
      lo_view_controller = wd_this->wd_get_api( ).
    
    * creating ok button
      lo_window->subscribe_to_button_event(
                 button = if_wd_window=>co_button_yes
                 action_name = 'YES'
                 action_view = lo_view_controller
                 is_default_button = abap_false ).
    
      lo_window->subscribe_to_button_event(
                 button = if_wd_window=>co_button_no
                 action_name = 'NO'
                 action_view = lo_view_controller
                 is_default_button = abap_true ).
    
    * Set the height and width here
      lo_window->set_window_size( width = '40%' height = '5%' ).
    
      lo_window->open( ).

    Create two Actions with name YES and NO. In onaction of YES fire outbound plug for next view

    wd_this->fire_out_plg( ).

    Cheers,

    Kris.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi sudhir,

      window_position = if_wd_window=>co_center ). // insted of this we have CO_RIGHT and CO_TOP. try that.

      and you can change widnow size by setting height and widths.

      lo_window->set_window_size( width = '40%' height = '5%' ).

      You can also use set_window_position( ) also.

      Cheers,

      Kris.