cancel
Showing results for 
Search instead for 
Did you mean: 

popup_to_confirm and popup_to_inform in webdynpro

Former Member
0 Kudos

Hi all,

My requirement is when a user clicks on 'DELETE' button I need to show a confirmation message having options 'yes' & 'No' similar to using function module 'popup_to_confirm'.

I know how to display normal error/success messages but not sure how to do it.

I have checked message manger methods but there is no such type of message.

I have tried calling function module 'popup_to_confirm' directly but it is not working.

Also, once user clicks on Yes/No, I need to show and information message in small popup

( similar to message i000 with 'text to be shown' )

I have tried calling popup_to_inform for this but it is going for short dump.

Please suggest me how can I achieve these functionalities in webdynpro.

Note: I have searched forums but could not get solution for my requirement.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

krishnendu_laha
Active Contributor
0 Kudos

Please follow below sample code:

DATA:
    lrf_component                  TYPE REF TO if_wd_component,
    lrf_window_manager       TYPE REF TO if_wd_window_manager.


  lrf_component      = wd_this->wd_get_api( ).
  lrf_window_manager = lrf_component->get_window_manager( ).


  IF wd_this->rf_popup_info IS INITIAL.

    wd_this->rf_popup_info = lrf_window_manager->create_window(
             window_name   = 'W_POPUP_INFO'
             title         = lh_text
             button_kind   = if_wd_window=>co_buttons_okcancel
             message_type  = if_wd_window=>co_msg_type_none
             close_button  = abap_false ).

    wd_this->rf_popup_info->subscribe_to_button_event(
      button            = if_wd_window=>co_button_ok
      action_name       = ih_action_yes
      action_view       = irf_view_api
      is_default_button = abap_false ).

    lh_text = 'text'.

    wd_this->rf_popup_info->subscribe_to_button_event(
      button            = if_wd_window=>co_button_cancel
      action_name       = ih_action_no
      action_view       = irf_view_api
      button_text       = lh_text
      is_default_button = abap_true ).

    wd_this->rf_popup_info->set_remove_on_close( abap_false ).
    wd_this->rf_popup_info->set_window_position( position = if_wd_window=>co_center ).

  ENDIF.

  wd_this->rf_popup_info->open( ).

HERE: RF_POPUP_INFO TYPE REF TO IF_WD_WINDOW and declared in attributes.

You W_POPUP_INFO an window.

You can follow the same approach but method would be "create_popup_to_confirm" with an input if table

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Vasu,

In your DELETE button Action write following code. and create two Actions with names YES and NO. In YES Action write code

to display T100 Messages. In NO if you want to do any perticular action write that code, or just leave it empty.

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

Cheers,

Kris.