cancel
Showing results for 
Search instead for 
Did you mean: 

How to EXIT from the window?

former_member202077
Participant
0 Kudos

Hi,

We are publishing our Web Dynpro ABAP component in SAP Portal pages.

I have a requirement to close the window on click of a "Close" Button in Web Dynpro (ABAP) component, am placing this CLOSE option as a push button on the WDA screen. I am using EXIT Outbound plug of the Window to perform the same.

In the EXIT plug I am setting "CLOSE_WINDOW" parameter to ABAP_TRUE.

On click of the "Close" button a pop-up dialog box (with "Yes" and "No" buttons) appears asking me whether I really want to close the window.

If I click on "Yes" button of the dialog box, the window gets closed without any issues.

But when I click on "No" button, the window shows up a blank screen. I want the control to come back to the calling Web Dynpro component's screen.

Appreciate any help/guidance in the above issue, mo code as bleow.

  DATA lo_wda TYPE REF TO ig_wda.

  lo_wda =   wd_this->get_wda_ctr( ).

  lo_wda->fire_toexit_plg(
    close_window = 'X'
  ).

  DATA lo_api_component TYPE REF TO if_wd_component.
  DATA lo_portal_manager TYPE REF TO if_wd_portal_integration.

  lo_api_component = wd_comp_controller->wd_get_api( ).
  lo_portal_manager = lo_api_component->get_portal_manager( ).

  CALL METHOD lo_portal_manager->fire
    EXPORTING
      portal_event_namespace = 'urn:com.sapportals:navigation'
      portal_event_name      = 'historyNavigate'
      portal_event_parameter = '-1'.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi MSR ,

   Check the above suggetion these may work to resolve your issue.

Also check the below link once :-

1. http://help.sap.com/saphelp_nw73/helpdata/en/9b/65e04ea1ae4d9d8cfd329afa43e869/content.htm

Regards,

Monishankar

former_member222068
Active Participant
0 Kudos

Hi MSR,

  Use this logic to close window, when button is pressed

Data :

      lo_view_ctrlr TYPE REF TO if_wd_view_controller,
     lo_win_ctrlr  TYPE REF TO if_wd_window_controller,

      lr_window                TYPE REF TO if_wd_window,

    lo_componentcontroller   TYPE REF TO ig_componentcontroller,
      lt_parameter_list        TYPE wdr_event_parameter_list,
      ls_event_parameter       TYPE wdr_event_parameter,
      lr_val                   TYPE REF TO data.

   lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).

   lo_view_ctrlr = wd_this->wd_get_api( ).
   lo_win_ctrlr lr_istep_crud_view_ctrlr->get_embedding_window_ctlr( ).
   ls_event_parameter-name = 'CLOSE_WINDOW'.
   CREATE DATA lr_val TYPE c.
   ASSIGN lr_val->* TO <fs>.
   <fs> = 'X'.
   ls_event_parameter-value = lr_val.
   INSERT ls_event_parameter INTO TABLE lt_parameter_list.

   lo_win_ctrlr->if_wd_view_controller~fire_plug(
                                         EXPORTING plug_name = 'TO_CLOSE'
                                                   parameters = lt_parameter_list ).

Thanks & Regards,

Sankar Gelivi

former_member199125
Active Contributor
0 Kudos

Other way,

in button action, try to get the control of embedded window then close it.

And as per your code , it looks like after firing plug you are navigating to some other url, so even if you say no, it will navigt...

Rgards

Srinivas

kmoore007
Active Contributor
0 Kudos

One way to accomplish this is to subscribe to a button event(s).  The user clicks 'Close'.  Popup asks, 'Are you sure, Yes/No'.  Clicking 'Yes', fires close plug.  Clicking 'No' does nothing.  You have to create the 'Yes' action and logic.

Example:

   *---- Popup to confirm
    DATA:
      l_api_main            TYPE REF TO if_wd_view_controller,
      l_cmp_api             TYPE REF TO if_wd_component,
      l_window_manager      TYPE REF TO if_wd_window_manager,
      lt_text               TYPE string_table,
      ls_text               TYPE string.

    l_api_main = wd_this->wd_get_api( ).
    l_cmp_api = wd_comp_controller->wd_get_api( ).

    ls_text = 'You have not saved your data!'.
    APPEND ls_text TO lt_text.

    ls_text = ' '.
    APPEND ls_text TO lt_text.
    APPEND ls_text TO lt_text.

    ls_text = 'Do you want to proceed?'.
    APPEND ls_text TO lt_text.

    l_window_manager = l_cmp_api->get_window_manager( ).
    wd_this->popup = l_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
                close_button           = abap_true
                window_title           = 'Information to confirm...'
                window_position        = if_wd_window=>co_center ).

    wd_this->popup->set_remove_on_close( abap_true ).
    wd_this->popup->subscribe_to_button_event(
            button             = if_wd_window=>co_button_yes
            action_name        = 'BTN_YES'
            action_view        = l_api_main
            is_default_button  = abap_true ).

    wd_this->popup->open( ).