Skip to Content
avatar image
Former Member

Confirmation dialog in a popup window

Hi All,

I'm new to Webdynpro for ABAP. My requirement is to display confirm dialog box over a popup window and to return to the popup window if cancel is pressed and to return to the main window if no or yes is pressed.could anyone help me on this.

I called the method create_popup_to_confirm in the popup window and subscribed to the actions yes,no and cancel.

But when i write code in the onactioncancel method it's resulting in error: Controller for View, Window, Interface, and Configuration Cannot Be Created .Could anyone help me

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 02, 2008 at 11:34 AM

    can you post your code here.

    also check this code you might miss this one.

    data:l_api type ref to if_wd_view_controller.

    l_api = wd_this->wd_get_api( ).

    l_popup->subscribe_to_button_event(

    button = if_wd_window=>co_button_cancel

    action_name = 'CANCEL'

    action_view = l_api

    is_default_button = abap_false ).

    Thanks

    Suman

    Edited by: suman kumar chinnam on Sep 2, 2008 1:42 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      This is the standard code you find in any document.I only included the actions in my view controller

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

      lv_text = 'data is changed'.

      INSERT lv_text INTO TABLE l_text. "#EC *

      CLEAR lv_text.

      lv_text = 'do you want to save'.

      INSERT lv_text INTO TABLE l_text. "#EC *

      CLEAR lv_text.

      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 = 'Confirm'

      window_position = if_wd_window=>co_center ). "#EC *

      l_api = wd_this->wd_get_api( ).

      l_popup->subscribe_to_button_event(

      button = 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 = 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 = if_wd_window=>co_button_cancel

      action_name = 'CANCEL'

      action_view = l_api

      is_default_button = abap_false ).

      l_popup->open( ).

  • avatar image
    Former Member
    Sep 02, 2008 at 11:55 AM

    hi,

    To have the ok and cancel button to be functional , we should subscribe to the event of the buttons,so that the event handlers associated with the buttons can be triggered..

    the code below will explain u ,

    data: lt_text type string_table.
    data: mr_popup_window type ref to if_wd_window.
    ** pop a confirmation window for display purpose
    data: l_window_manager type ref to if_wd_window_manager,
    l_cmp_api        type ref to if_wd_component,
    l_window         type ref to if_wd_window.
    l_cmp_api        = wd_comp_controller->wd_get_api( ).
    l_window_manager = l_cmp_api->get_window_manager( ).
    append 'do u wanna navigate ??' to lt_text.
    
    
    
    
    
    *CALL METHOD l_window_manager->create_popup_to_confirm
    *   EXPORTING
    *    text                 = lt_text
    *    button_kind          = if_wd_window=>CO_BUTTONS_YESNOCANCEL
    **    default_button       =  if_wd_window=>co_button_no
    *RECEIVING
    *    result               =    mr_popup_window      .
    *
    *
    *** associated the action handling methods with the window
    *DATA: view_controller TYPE REF TO if_wd_view_controller.
    *view_controller = wd_this->wd_get_api( ).
    *CALL METHOD mr_popup_window->subscribe_to_button_event
    *   EXPORTING
    *     button            = if_wd_window=>co_button_yes
    *     action_name       =  'ON_DELETE_POPUP_YES'
    *     action_view       =  view_controller      .
    *
    *CALL METHOD mr_popup_window->subscribe_to_button_event
    * EXPORTING
    *  button            = if_wd_window=>co_button_no
    *  action_name       = 'ON_DELETE_POPUP_NO'
    *  action_view       =  view_controller
    *  is_default_button = abap_true    .
    
    mr_popup_window->open( ).
    
    
    

    Revert if u still have issues in this...

    WR,

    Arjun.G

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I encountered the same error when I used a popup on a view and then switched to another view after the popup was displayed. So for example I was showing a popup on my detail view that said "Do you want to update the profile" but by the time the popup rendered and the user answered the question on the popup I had moved the user to the overview screen.

      When the user answered the question WebDynpro couldn't access the controller of the view that had created the popup and it couldn't route the event to the right handler so it threw an error.