cancel
Showing results for 
Search instead for 
Did you mean: 

Closing a Window.

Former Member
0 Kudos

Hi ,

My requirement is such that,i have a Button in my View Layout.On Click of that Button the Window should be closed.

I have gone through the forum and tried out various combinations,but i could not get it solved.

Can i have step by step approach for the same.

Thanks and regards,

Chandrashekar.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

On Button Action Use

U can Get the instance of window

Then use window.close();

Edited by: Kanwalpreet on Dec 17, 2007 11:55 AM

Former Member
0 Kudos

Hi Kanwalpreet,

I dont want to Logoff the Application,i want the entire application window to be closed on click of a button.

Thanks and regards,

Chandrashekar.

former_member751941
Active Contributor
0 Kudos

Hi Chandrashekar,

Chek this threads.

Regards,

Mithu

Former Member
0 Kudos

Hi Mithu,

According to the links you had provided I have followed the similar steps as given.

But what i find on running the application is that the entire application is being logged of or closed .

But my requirement is such that the window must be closed and not the browser being logged off.

Thanks and regards,

Chandrashekar.

former_member751941
Active Contributor
0 Kudos

Hi chandrashekar,

Try this.It will only close the external window.

1> Take a button say(Close) inside the externalview layout.Create an external window embed the external view.

2> Take a WindowInstance context attribute of type <b>com.sap.tc.webdynpro.services.session.api.IWDWindow</b>

when you are opening the external window save the window instance

IWDWindowInfo windowInfo =(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(

"Put Window Name here");

// create the Modal Window

IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);

// Display window in center

window.setWindowPosition(WDWindowPos.CENTER);

window.setTitle("PopUp window");

window.setWindowSize(100,100);

// Save WindowInstance in Context

<b>wdContext.currentContextElement().setWindowInstance(window);</b>

// and show the window

window.show();

Inside the action of external window close button use this code.

IWDWindow window = wdContext.currentContextElement().getWindowInstance();

window.destroyInstance();

Regards,

Mithu

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Experts,

My requirement is yet to be solved.

I have tried all possible ways for closing a window on click of a Button.

I am able to logoff the application successfully but i need to close the Window completely according to my requirement.

Please do help me out in this regard if atall there is any Possibilty to close a Window on Click of a Button in the view Layout.

Thanks and regards,

Chandrashekar.

Former Member
0 Kudos

wdContext.currentContextElement().getWindow().close();

wdContext.currentContextElement().getWindow().destroy();

or try

IWDWindow window = wdContext.currentContextElement().getWindow();

window.close();

window.destroy();

Former Member
0 Kudos

Hi Kanwalpreet,

I even tried the possibilities you had given me,but still i am unable to close the Window.

Please let me know if there is anyother alternative in this regard.

Thanks and regards,

Chandrashekar.

Former Member
0 Kudos

Close IE?

You can define an action to fire exit plug.

If not, following the above two.

Former Member
0 Kudos

Hi,

You should destroy the window instance you have created. This will close the window.

IWDWindow window =wdContext.<windowinstanceelement>..getWindowInstance();

window.destroy();

Regards,

Saravanan K

Former Member
0 Kudos

Hi Saravanan,

Can u explain me in detail plz.

Thanks and regards,

Chandrashekar.

Former Member
0 Kudos

Hi,

Have a look at these threads,

Kind Regards,

Saravanan K

Former Member
0 Kudos

Hi,

Do you want to close the pop up window or the parent window?

If it's pop up window then you can save an instance of the window while window creation and then close it in OnAction even of the button using

<windowinstance>.close();

If you want to close the parent window then I think you need to write the javascript for that in some jsp page and using that close the parent window.

Regards,

Murtuza

Former Member
0 Kudos

Hi Murtuza,

Its not closing a Pop-Up window,its Closing of the Application Window on Click of the Button.

Please let me know the step by step approach for the same.

Thanks and regards,

Chandrashekar.