cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in web dynpro while closing the browser

Former Member
0 Kudos

Hi ,

i am currently working on web dynpro . my issue is i want to show popup massage while closing browser.

please suggest me.

Thanks & Regards,

Venkat.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member199125
Active Contributor
0 Kudos

What kind of popup?

You mean, you want to display some custom message while close window?

if yes, create a button , in that button action first call the pop up for message then if he press yes then try to close the window by getting self reference to window then close it.

Regards

Srinvias

Former Member
0 Kudos

Hi srinivas,

yes, i want to display custom massage that should be display while closing the browser.

Regards,

venkat

former_member199125
Active Contributor
0 Kudos

hmm. hope you are looking for sample code, pls check below one for the same

Create a button in the button action

    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.

  LO_API_COMPONENT  = WD_COMP_CONTROLLER->WD_GET_API( ).
  LO_WINDOW_MANAGER = LO_API_COMPONENT->GET_WINDOW_MANAGER( ).

  DATA LT_TEXT TYPE STRING_TABLE,
          LS_TEXT TYPE STRING.

  LS_TEXT = 'Are you sure want to Approve the Request'.
  INSERT LS_TEXT INTO TABLE LT_TEXT.

  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 = '40PX' HEIGHT = '50PX' ).

  LO_WINDOW->OPEN( ).

Now again create two action with names  YES and NO.

in yes action write below code to close the window.

      data lv_wc type ref to if_wd_window_controller.
    data lv_view type ref to if_wd_view_controller.
    data lo_window  type ref to if_wd_window.

    lv_view = wd_this->wd_get_api( ).
    lv_wc = lv_view->get_embedding_window_ctlr( ).

    lo_window lv_wc->get_window( ).

    lo_window->close( ).

Thanks And Regards

Srinivas

Former Member
0 Kudos

Hi,

I think this question has been asked before on SDN and I am guessing that there is no solution for this.