cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in window closing

Former Member
0 Kudos

HI Experts,

For closing the window.

I wrote the below code but it gives me the error.

IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("VcTempEndDate");

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

window.close();

The below is the error

com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Duplicate instance exception: The interface view VcTempEndDateInterfaceView in component VcTempEndDate is already in use.

what could be the problem

Regards,

Naresh

Accepted Solutions (1)

Accepted Solutions (1)

snehal_kendre
Active Contributor
0 Kudos

HI Naresh,

Looks like your trying to close window from that window itself.

then create an close.html file and put it into mimes folder

access this file

String url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"close.html");
wdThis.wdGetViewController().wdFirePlugExit(url);

in close.html write a javascript which contains following function

<html>
<SCRPT LANGUAGE='JavaScript'>
function win_close() 
{
 window.parent.opener = top;
 window.parent.close();
 window.opener.close();
}
</SCRPT>
<body onlod='javascript:win_close()'>
</body> 
</html>

Former Member
0 Kudos

Hi Snehal,

I have created the outbound plug on interface view, with string parameter.

And added this to my view, using properties tab.

It has come till here.

wdThis.wdGetVcTempEndDateInterfaceController()

But wdFirePlugExitPlug(url); this method is not showing

Regards,

Naresh

snehal_kendre
Active Contributor
0 Kudos

Hi Naresh,

Go into properties tab of your view.

1. add interface view controller as required controller.

p.s. be sure your outbound plug is exit plug.(there is one checkbox as exit )

Former Member
0 Kudos

HI Snehal,

Thank you very much.

It solved my problem.

I gave you points.

Thanks every one....!!1

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Naresh,

If you have created the attribute of type IWDWindow then use the folloowing code:

IWDWindowInfo wininfo = wdComponentAPI.getComponentInfo().findInWindows("VcTempEndDate");

IWindow wind =(IWindow) wdComponentAPI.getWindowManager().createModalWindow(wininfo);

wdContext.currentContextElement().setWindowinstance(wind);

wind.show();

3.onActionClose

wdContext.currentContextElement().getWindowinstance().destroyInstance();

Thanks n Regards,

Jhansi Miryala

snehal_kendre
Active Contributor
0 Kudos

HI Naresh,

Check my edited reply.

You just need to make some changes in close.html

SCRPT to SCRIPT and onlod to onload.

Former Member
0 Kudos

Hi Naresh,

Inorder to close the Pop-Up window, that is opened by another view (Suppose MainView),

you can:

1. Create a context attribute of type IWDWindow in MainView

2. Map this context to the defalut View in Pop-Up Window.

3. Call the .close() or .destroy() methods on the current element of the context attribute.

Regards,

Alka.

Former Member
0 Kudos

hi,

try this way:->

For this first we make a Window and Embedd the desired View in this window.

Now Make a method by which we can open the desired window.

Here the method is openWindow

And closeWindow for closing window.

(These methods are inside component controller)

Make a value attribute(windowInstance) inside component controller of type IWDWindow.

public void OpenWindow( ) {

IWDWindowManager winMgr= wdThis.wdGetAPI().getComponent().getWindowManager();

IWDWindowInfo winInfo=wdThis.wdGetAPI().getComponent().getComponentInfo().

findInWindows("FormatWindow");//put your window name here

IWDWindow changeFontWindow=winMgr.createModalWindow(winInfo);

changeFontWindow.setWindowPosition(WDWindowPos.CENTER);

changeFontWindow.setTitle("Change Font Format-Title");

changeFontWindow.show();

//here set the attribute

wdContext.currentContextElement.setwindowInstance(changeFontWindow);

}

public void CloseWinDow( ) {

IWDWindow ins=wdContext.currentContextElement.getwindowInstance();

ins.destroyInstance();

}

IT WILL WORK.

Regards

Trilochan

former_member197348
Active Contributor
0 Kudos

Hi Naresh,

How many windows you have?

IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("VcTempEndDate");

I think you have one window VcTempEndDate and you are calling VcTempEndDate in itself.

You can not call a window in itself. You need create another window and call it.

regards,

Siva

Former Member
0 Kudos

Hi Siva,

Yes, I have only one window.

In a View I have close button which closes the window.

On action close, I wrote that code.

Then, how can i close this window when i have only one window

Regards,

Naresh.

Former Member
0 Kudos

Hi,

To close the existing window using this code is not possible.

Regards

Ayyapparaj

Former Member
0 Kudos

HI Ayyapparaj,

Thanks for the immediate reply.

Can you explain me how to close existing window, how to do ?

And the code as well.

Regards,

Former Member
0 Kudos

Hi,

Its a bit tricky you have to call the window.close() java script in your plug.

Regards

Ayyapparaj

former_member197348
Active Contributor
0 Kudos

Hi Naresh,

If you have only one window you can not close it. Exactly what is your requirement? If you close the window then what you want to show then or where you want to navigate?

If you want to show blank screen do like this.

Embed an empty view in your window (double click on your window, in the right panel you have option to embed view ) and on action close just navigate to that view

regards,

Siva

Former Member
0 Kudos

HI Siva,

Its the confirmation screen view.

It will just just display the details in read mode .

I have close window button on it.

Once it is clicked , i just want to close the window.

I am not going to navigate to any where else.

Its the end of my application.

Ayyapparaj: can you explain me how to do this with java script.

And clear steps to do it.

Regards

Naresh

Former Member
0 Kudos

Hi Ayyapparaj,

Can you please explain me, with clear steps.

Regards,

Naresh

Former Member
0 Kudos

Hi,

Pl go through this thread

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

Can you explain where this code is placed. Is this written in wdDomodify?

Regards

Ayyapparaj