cancel
Showing results for 
Search instead for 
Did you mean: 

Close Window (Not Pop Up)

Former Member
0 Kudos

Hi All expert,

After I run an application, an IE will be pop up. Is it possible that I create an Close button? Once I click on it, the window can be close. Please be remind that it is parent Window and not a pop up windows.

I try many of the thred suggest but none of them work for me.

1.

Create Close.html/outboundPlug

This will generate an error.

com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Cannot navigate via outbound plug exitWeb of view ABCCompInterfaceView because there is no navigational link attached to it

2. Wdthis.WDGetcomponentInterveiewcontroller().WdFirePlugExit("javascript:void(window.close()");

Thanks,

Points will be reward for sure.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Yea, It is possible.

First create an html file (Say close.html) inside <b>Project\src\mimes\Components\package</b> with contents

<html>

<head>

<script langauage="javascript">

function closeWindow()

{

var currWindow = window.top;

currWindow.opener = window.top;

currWindow.close();

}

</script>

</head>

<body onload="javascript:closeWindow()">

</body>

</html>

Now open InterfaceViews-><ViewName>InterfaceView

Create an <b>Exit</b> outboundplug with parameter <b>Url</b>(use the same name in the scenario) of type String. Save all metadata.

Inside the closeAction, writhe following code

String url=WDURLGenerator.getWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"Close.html");

wdThis.wdGet<ViewName>InterfaceViewController().wdFirePlugCloseWindow(url);

Regards

Fahad Hamsa

Former Member
0 Kudos

For some reason, this doesn't work.

wdThis.wdGet<ViewName>InterfaceViewController().wdFirePlugCloseWindow(url);

It said resource navigator link not found.

Therefore, I use the moethod exist in other thread.

com.sap.tc.webdynpro.services.sal.um.api.WDClientUser.forceLogoffClientUser(Url);

and it work fine.

The rest of the step are the same.

1. Create Close.html

2. String url=WDURLGenerator.getWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"Close.html");

and use this

3. com.sap.tc.webdynpro.services.sal.um.api.WDClientUser.forceLogoffClientUser(Url);

Answers (1)

Answers (1)

Former Member
0 Kudos

as describe at Thread 3.

Former Member
0 Kudos

the above code will create a Logoff user from portal problem. Please use fowllowing code instead.

This can close the Window from Controller, and no Logoff from portal issue.

It doesn't need to create any outbound plug.

1. Create a Close.html. and it under the

src\mimes\Components\<Component package>\close.html

<html>

<head>

<script langauage="javascript">

function closeWin(){

window.close();

}

</script>\

</head>

<body onload="javascript:closeWin();"> </body></html>

2. Use the following code.

try{

String Url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"close.html");

TaskBinder.getCurrentTask().getClient.sendRedirect(Url, 0);

}

catch (Exception e)

{

e.printStackTrace();

}