cancel
Showing results for 
Search instead for 
Did you mean: 

error in popup_to_confirm

former_member574106
Participant
0 Kudos

Hi friends,

I am new to WD ALV. In my WD ALV, I have created a POPUP TO CONFIRM with Yes and NO button. The POPUP_TO_CONFIRM is coming perfectly correct. Next , i have created manually yes and NO action . But when i am writing the code inside YES and No action, it is not getting executed. PFA. What is the error ?

Please check.

Regards,

Saurav Lahiry

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Saurav,

Attached error message is not displaying properly, I'm not sure what type of error message you are getting but please check below code with bold letters.may be you are missing while coding.

Please ensure below two points have to be there in code for execution of buttons on POP UP window

  1. Did you called the current view controller where you have written your  action "YES " and "NO".
  2. its mandatory to called the method subscribe_to_button_event  method

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

DATA: lt_string TYPE TABLE OF string,

      ls_string like LINE OF lt_string.

ls_string = 'Do want proceed for next step???'.

APPEND ls_string to lt_string.

CALL METHOD lo_window_manager->create_popup_to_confirm

  EXPORTING

    text                 = lt_string

    button_kind          = IF_WD_WINDOW=>CO_BUTTONS_YESNO

    message_type         = IF_WD_WINDOW=>CO_MSG_TYPE_INFORMATION

    close_button         = ABAP_TRUE

    window_title         = 'test pop up confirm window'

*    window_left_position =

*    window_top_position  =

*    window_position      =

*    window_width         =

*    window_height        =

*    default_button       =

  receiving

    RESULT               = lo_window

DATA lo_api_v_main TYPE REF TO if_wd_view_controller.

  lo_api_v_main = wd_this->wd_get_api( ).

CALL METHOD lo_window->subscribe_to_button_event

  EXPORTING

    button            = IF_WD_WINDOW=>CO_BUTTON_YES

*    button_text       = 'yes'

*    tooltip           =

    action_name       = 'YES_PROCEED'

    action_view       = lo_api_v_main

*    is_default_button = ABAP_FALSE

    .

CALL METHOD lo_window->subscribe_to_button_event

  EXPORTING

    button            = IF_WD_WINDOW=>CO_BUTTON_NO

*    button_text       = 'yes'

*    tooltip           =

    action_name       = 'NO_PROCEED'

    action_view       = lo_api_v_main

*    is_default_button = ABAP_FALSE

Thanks

Nidhi

former_member574106
Participant
0 Kudos

Hi Nidhi,

Thanks a lot for the tips. My issue is that the code inside buttons YES and NO in FM POPUP_TO_CONFIRM is not getting triggered. I have created two manual actions YES and NO.

Please check my attachment in my earlier blog. My FM POPUP_TO_CONFIRM is coming perfectly correct. Here is my 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( ).

How do i write the code so that YES and NO buttons get triggered. Please check my attachment also.

Regards,

Saurav Lahiry

former_member574106
Participant
0 Kudos

Hi,

Solved it myself.

Regards,

Saurav Lahiry

Answers (0)