cancel
Showing results for 
Search instead for 
Did you mean: 

Close window in web dynpro abap

former_member361003
Participant
0 Kudos

Hi,

I have a web dynpro application for a workflow. When a user clicks on the workitem in UWL, a window opens with task description and two button on it. When the user clicks on one of the button, my requirement is: I want to close that window. How could I achieve that? any snippets of code will be highly appreciated.

Thanks.

Bijay

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Well normally you would fire an Exit Plug and set the CLOSE_WINDOW parameter:

wd_this->fire_to_exit_plg( url = url close_window = close_window ).

The only problem is that you said this was from UWL, so you must be running in the portal. There is a limitation that this method only works in the portal if the portal is 7.1 (which isn't released yet).

[http://help.sap.com/saphelp_nw70/helpdata/EN/45/1bc575ba064574e10000000a114a6b/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/EN/45/1bc575ba064574e10000000a114a6b/frameset.htm]

I'm not sure if that limitation applies if you opened the application in a secondary portal browser instance. You might just have to experiment with it. Also this method doesn't work in Firefox.

Answers (7)

Answers (7)

former_member210296
Participant
0 Kudos

Hi Experts !

I have an issue. I am calling a URL in an external Window from a Webdynpro Component.

I need to close the Parent Application, once  the External window is opened in with URL Passed.

I am calling the exit plug of the Parent Application to close the parent window after calling create_external_window() method. The application however, closes the Parent Application but the external window does not open. Could anyone let me know is it possible?

Former Member
0 Kudos

Hi

I am facing problem with 2 buttons one is SAVE and One is Close.

For Close Button i have added below code its giving the popup with yes and no buttons, Its closing when i press Yes but its giving error like " Application terminated you can close the window " , Please help how can i sove this one.

Sorry to disturb you.. Thanks in advance.

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'.

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'

parameters = l_parameter_list ).

For Save button...

I wrote below code in component controller method , but its not populating any window or any pop-up please help in this also.

DATA:

lo_cmp_api TYPE REF TO if_wd_component,

lo_window_manager TYPE REF TO if_wd_window_manager,

popup_title TYPE string.

  • wdw_variant TYPE string VALUE 'WDW_TEMPLATE_POPUP'.

CALL METHOD cl_wd_utilities=>get_otr_text_by_alias

EXPORTING

alias = 'PAOC_HAP_PA_CASC_GOALS_UI/TEMPLATE'

RECEIVING

alias_text = popup_title.

  • Calling the POPUP

lo_cmp_api = wd_this->wd_get_api( ).

lo_window_manager = lo_cmp_api->get_window_manager( ).

CALL METHOD lo_window_manager->create_window

EXPORTING

window_name = 'ZH_GOALS'

title = popup_title

close_button = abap_true

close_in_any_case = abap_false

button_kind = if_wd_window=>co_buttons_okcancel

default_button = if_wd_window=>co_button_ok

RECEIVING

window = wd_this->lo_window.

wd_this->lo_window->open( ).

alejandro_bindi
Active Contributor
0 Kudos

I'm not sure this will be useful given your scenario but just in case:

Blog: How to close parent window in Webdynpro applications?.

Regards

Former Member
0 Kudos

I had the same problem. I resolved it by putting the code on button click action.

method ONACTIONON_COMPLETE .

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'.

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.

Former Member
0 Kudos

can youexplain that event handler method what that doing

Former Member
0 Kudos

Hi,

Edited by: ravidanda on Mar 9, 2011 10:31 AM

prathamesh_gandhi
Participant
0 Kudos

Hi Sharad Agrawal,

The code you have provided is working fine. but i have few questions

* I have tried it on the two different servers--on 1 server it is perfectly working but on the second server it comes with a std windows popup with message "The webpage you are viewing is trying to close window".

"Do you want to close this window"? if i click YES then the window is properly close. but if i click on NO then the window remains open with messsage "Application was terminated,you can close the window ".

So i want to know reason behind it..if you have any idea about this will you please share.

Thanks In Advance

P$G

former_member361003
Participant
0 Kudos

I switch the idea of closing window to showing message in the screen.

Former Member
0 Kudos

Hi,

create an attribute mo_close type if_wd_window.(in component controller)

call on button mo_close->close().

former_member361003
Participant
0 Kudos

Thanks Thomas Jung.

I did tried your approach but it did not work. Any other workaround idea ?

Thanks.

Bijay

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

That is pretty much what I expected since it was in the portal environment. You won't have any offical way to do it directly from Web Dynpro until Portal 7.1 or that feature of the portal gets backported. The only thing I would suggest is that you still fire an exit plug, but you instead navigate to a BSP application. That BSP application could contain the necessary JavaScript to close the browser window.



thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Beautiful, the forum content filters won't let me post the code example of the JavaScript even when within the code tag. Oh well here is one of many sites on the Internet that have this sample:

[http://www.boutell.com/newfaq/creating/closebrowserwindow.html|http://www.boutell.com/newfaq/creating/closebrowserwindow.html]