cancel
Showing results for 
Search instead for 
Did you mean: 

check_mandatory_attr_on_view bugs with subscribe_to_button_event

AlexGiguere
Contributor
0 Kudos

It seems I found I bug in web dynpro for abap.

When using the method subscribe_to_button_event in the wddoinit of a view to register your event handler for a popup window,

if you call the method cl_wd_dynamic_tool=>check_mandatory_attr_on_view on the method in the WDDOBEFOREACTION, it seems to deregister the event action, so the event handler method for the actions are not called, if I remove the call to the cl_wd_dynamic_tool=>check_mandatory_attr_on_view, it works fine!

Alex

Accepted Solutions (0)

Answers (2)

Answers (2)

AlexGiguere
Contributor
0 Kudos

Ok, finally I found it. The problem was that I forgot to change the parameter CLOSE_IN_ANY_CASE to false in the creation of the popup window, this parameter has a value of true by default.

Alex

AlexGiguere
Contributor
0 Kudos

I have 2 windows & 2 views

W_DEFAULT

V_DEFAULT

W_MAINTAIN (POPUP)

V_MAINTAIN

In my component controller, I have a method to call the popup window (W_MAITAIN)

METHOD popup_window.

  DATA: lr_window_manager TYPE REF TO if_wd_window_manager,
        lr_api_component  TYPE REF TO if_wd_component.

  lr_api_component = wd_this->wd_get_api( ).

  lr_window_manager = lr_api_component->get_window_manager( ).

  wd_this->mr_window = lr_window_manager->create_window( window_name          = 'W_MAINTAIN'
                                                         title                = im_window_title
                                                         message_display_mode = if_wd_window=>co_msg_display_mode_selected
                                                         button_kind          = if_wd_window=>co_buttons_okcancel
                                                         message_type         = if_wd_window=>co_msg_type_none
                                                         default_button       = if_wd_window=>co_button_ok ).

  wd_this->mr_window->open( ).
ENDMETHOD..

In the view V_MAINTAIN, here is my code


METHOD wddobeforeaction.

  DATA: lr_view_controller TYPE REF TO if_wd_view_controller,
        lr_action          TYPE REF TO if_wd_action.

  lr_view_controller = wd_this->wd_get_api( ).
  lr_action = lr_view_controller->get_current_action( ).

  IF lr_action IS BOUND.
    CASE lr_action->name.
      WHEN 'SAVE'.
        cl_wd_dynamic_tool=>check_mandatory_attr_on_view( view_controller = lr_view_controller ).
    ENDCASE.
  ENDIF.

ENDMETHOD..

METHOD wddoinit.

  DATA lr_view_controller TYPE REF TO if_wd_view_controller.

  CHECK wd_comp_controller->mr_window IS BOUND.

  lr_view_controller = wd_this->wd_get_api( ).

  wd_comp_controller->mr_window->subscribe_to_button_event(
             button            = if_wd_window=>co_button_ok
             button_text       = 'Save'
             action_name       = 'SAVE'
             action_view       = lr_view_controller
             is_default_button = abap_true ).

  wd_comp_controller->mr_window->subscribe_to_button_event(
             button            = if_wd_window=>co_button_cancel
             button_text       = 'Cancel'
             action_name       = 'CANCEL'
             action_view       = lr_view_controller
             is_default_button = abap_false ).

ENDMETHOD.