cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Firing PlugExit

Former Member
0 Kudos

Hi all,

Surfing trough SDN I found this post

Unfortunally this didn’t do the work for me, I mean I could shut down my wd app but couldn’t close the window or even redirect the page to any URL. Any Ideas?

Regards,

Orlando Covault

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Orlando,

Do the following

1. First create a outbound plug of type exit say CloseWindow in your interface view controller with parameter Url of type string.

2. Create a html file say close.html with following code

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

Place this file in src/mimes/componenets/<Your component>/close.html

3. Add the interface view controller to your view controller.

In your view controller say u have created a action closeWindow.

In this acction method write code as below

try{

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

wdThis.wdGet<Webdynpro Comp>InterfaceViewController().wdFirePlugCloseWindow(Url);

}

catch(WDURLException WDURLe){

}

This should work for u.

Reward points if helpful

Thanks

Former Member
0 Kudos

Hi Shriram,

I still got the same problem; I use the server log to print the value of

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

Put the string in my browser and close my window as I want it to. But it didn’t work in my wd app, it seems that my exit plug didn’t redirect to the html file. Any idea of what could be wrong?

I put the code in an action inside my view and the action is assign to my button, I don’t know if I should put it somewhere else, maybe in the interface view or anywhere else.

Regards,

Orlando Covault

sid_sunny
Contributor
0 Kudos

Hi orlando,

Try what I had posted it will surely work for you. just give it a try.

Regards

Sid

Former Member
0 Kudos

Hi Siddharth,

Same results, the WD app shuts down, the jsp close the window with a confirmation dialog box (using the string printed in the log), but doesn’t shuts down the wd app and close it directly.

Regards,

Orlando Covault

sid_sunny
Contributor
0 Kudos

Hi Orlando,

What do you mean by closes the window but does not shuts down the WD application I dint understand that properly.

Regards

Sid

Former Member
0 Kudos

Hi Sid,

In one of my previous post I said: "I use the server log to print the value of

String Url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"close.html");(now I am using your jsp)

Put the string in my browser and close my window as I want it to. But it didn’t work in my WD app, it seems that my exit plug didn’t redirect to the html file."

And regarding the WD app shutting down, I known that the WD shuts down because I hit the button the first time and doesn’t redirect but when I hit it for the second time I got this:

"The Web Dynpro Application 'MyWDApp' has expired. Please restart the application either with the refresh button or click the following link MyWDApp"

Regards,

Orlando Covault

sid_sunny
Contributor
0 Kudos

Hi Orlando,

I guess you want that when the user clicks on a button then the browser window should get close with a confirmation. Is this right?

Let me know what happen when you click this button in your WD application. Did you get the window closing warning or not.

Regards

Sid

Former Member
0 Kudos

Hi Sid,

I don’t want the confirmation dialog box, but what is happening right now is that when I click the button I don’t get the window closing warning and the window doesn´t closed.

Regards,

Orlando Covault

Message was edited by:

Orlando Covault

sid_sunny
Contributor
0 Kudos

Hi Orlando,

I dont know where are you going wrong but if you want then I can send you the complete project file, try running that.

If interested give me your Email ID.

Regards

Sid

Former Member
0 Kudos

Hi Sid,

ocovault@gmail.com

Regards,

Orlando Covault

sid_sunny
Contributor
0 Kudos

Hi Orlando,

Mail sent. Do reward points if it works.

Regards

Sid

Answers (2)

Answers (2)

Former Member
0 Kudos

The problem was that the parameter of the exit plug should be "Url"

Former Member
0 Kudos

Instead of create a html file, is it possible to use webdynpro class?

https://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/services/session/api/IWDWindow.h...

In a page, I have a Exit button, which will close a current open window.

So, I try to use IWDWindow.hide() but seems not really work.

By the way, how to search the example use by the class, e.g.IWDWindow.

Thanks all.

sid_sunny
Contributor
0 Kudos

Hi Orlando,

First create a exit plug in your windowInterfaceController with a parameter "Url" of string type. After that create a jsp file say close.jsp in your mimes -> components -> under your package folder write this in your JSP.

<html>

<body onload=window.close()>

</body>

</html>

Now in your onAction of the button write following:

String URL = "";

try {

URL = WDURLGenerator.getWebResourceURL(wdComponentAPI.getDeployableObjectPart(), "close.jsp");

} catch (WDURLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

try {

wdThis.wdGetPortalppAppCompWindowInterfaceViewController().wdFirePlugExitToHTML(URL);

} catch (RuntimeException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

Do reward points if it helps.

Regards

Sid