cancel
Showing results for 
Search instead for 
Did you mean: 

Closing web browser from a Web Dynpro (ABAP) component in it

PrasannaGunji
Participant
0 Kudos

Hi,

I am opening a Web Dynpro component in IE.

I have a requirement to close the Internet Explorer window on click of a "Close" Button in Web Dynpro (ABAP) component. I am using EXIT Outbound plug of the Main 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 IE window.

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

But when I click on "No" button, the IE 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.

Thanks,

Prasanna

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Prasanna,

Try using following

https://cw.sdn.sap.com/cw/community/docupedia/sapnetweaverabap/blog/2010/01/12/close-window-button-i...

/people/mohammed.anzys/blog/2007/06/05/how-to-close-parent-window-in-webdynpro-applications

Thanks,

Prashant

Former Member
0 Kudos

create an action 'YES','NO', 'CANCEL' in required view.

copy and paste below code in YES action

method ONACTIONYES .

data : l_view_cntr type ref to if_wd_view_controller,

l_win_cntr type ref to if_wd_window_controller,

l_window type ref to if_wd_window,

l_parameter_list type wdr_event_parameter_list,

l_parameter type wdr_event_parameter,

l_val type ref to data.

field-symbols <fs> type any.

l_view_cntr = wd_this->wd_get_api( ).

l_win_cntr = l_view_cntr->get_embedding_window_ctlr( ).

l_parameter-name = 'CLOSE_WINDOW'."'CLOSE_WINDOW'.

create data l_val type c.

assign l_val->* to <fs>.

<fs> = 'X'.

l_parameter-value = l_val.

insert l_parameter into table l_parameter_list.

l_win_cntr->if_wd_view_controller~fire_plug(

exporting plug_name = 'EXIT_PLUG'

parameters = l_parameter_list ).

endmethod.

goto your window

create plug EXIT in Window of type EXIT and chect interface checkbox

.

create a button - for example - "PUSH BUTTON"

in pushbutton action

copy and paste this code

method ONACTIONEXIT_PLG .

DATA: API TYPE REF TO IF_WD_COMPONENT,

WINMAN TYPE REF TO IF_WD_WINDOW_MANAGER,

WIN TYPE REF TO IF_WD_WINDOW,

TEXT1 TYPE STRING_TABLE,

ls_text type string,

V_API TYPE REF TO IF_WD_VIEW_CONTROLLER.

API = WD_COMP_CONTROLLER->WD_GET_API( ).

WINMAN = API->GET_WINDOW_MANAGER( ).

LS_TEXT = 'Do You Want To Close the Window'.

INSERT LS_tEXT into table text1.

win = winman->create_popup_to_confirm(

window_title = 'CONFIRM'

text = text1

button_kind = if_wd_window=>co_buttons_yesnocancel

message_type = if_wd_window=>co_msg_type_question

window_position = if_wd_window=>co_center ).

V_API = WD_THIS->WD_GET_API( ).

WIN->SUBSCRIBE_TO_BUTTON_EVENT(

BUTTON = IF_WD_WINDOW=>CO_BUTTON_YES

ACTION_NAME = 'YES'

ACTION_VIEW = V_API

IS_DEFAULT_BUTTON = ABAP_TRUE ).

WIN->SUBSCRIBE_TO_BUTTON_EVENT(

BUTTON = IF_WD_WINDOW=>CO_BUTTON_NO

ACTION_NAME = 'NO'

ACTION_VIEW = V_API

IS_DEFAULT_BUTTON = ABAP_FALSE ).

WIN->SUBSCRIBE_TO_BUTTON_EVENT(

BUTTON = IF_WD_WINDOW=>CO_BUTTON_CANCEL

ACTION_NAME = 'CANCEL'

ACTION_VIEW = V_API

IS_DEFAULT_BUTTON = ABAP_FALSE ).

WIN->OPEN( ).

endmethod.

Former Member
0 Kudos

Hi Prasanna,

you could maintain an own logoff page (tab error pages) in SICF for your WDA application. Do not use the closeWindow option in exit plug but use an explicit response page. In that page you could e.g. perform an autoclose during onload. When the popup appears and you click on "no", you can show a link to call the WDA application again.

Kind regards

Andreas