cancel
Showing results for 
Search instead for 
Did you mean: 

Portal - Dynpro Java - Close-Button functionality

Former Member
0 Kudos

Hi all

I have a Web Dynpro Java iView which I call directly from a JSP-Page in the Portal as a new browser window with JavaScript (meaning I have no IWDWindow-Instance or anything else referring this window)

This iView should have a button saying Close which should close this new browser window.

I already searched the forums and found some things with ExitPlug(URL) in ViewController - but this doesn't work in Portal environment.

I also found something like IWDNavigation.navigateAbsolute(...), but since I'd like to navigate to a non-Portal-Page this doesn't work either.

I also tried createExternalNonModalWindow(url,...) where the html-file behind the url simply does window.opener.close() and window.close() and some other *.close()-things - doesn't work.

By now I simply think this Close-functionality is not intended to work, hasn't ever worked and will never work.

But: Do you have a solution to this? Or at least a confirmation that it doesn't work no matter what I try?!

Regards (+ rewards, of course)

Michael

(sorry for cross posting ;( )

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

yuo must place the webdynpro iview in a page. In the same page insert a portal component iview with a jsp

like this:

page import = "com.sapportals.portal.prt.util.*" %>

String eventURN = "urn:com.sap.wdbp";

String windowCloseEventName = "windowClose";

<mscript>

<!--

function windowCloseHandler(eventObj){

window.close();

}

EPCM.subscribeEvent(

"<%= StringUtils.escapeToJS(eventURN) %>",

"<%= StringUtils.escapeToJS(windowCloseEventName) %>",

windowCloseHandler);

//-->

</script>

when you want to close the window, from webdynpro call the EPCM event:

WDPortalEventing.fire("urn:com.sap.wdbp","windowClose",null);

Matteo

Edited by: Matteo Fusi on Nov 6, 2008 6:11 PM

Former Member
0 Kudos

Hi Matteo

Sorry, atm I don't have the time to test/implement it.

But it sounds awesome & as if it'll work.

As soon as I tested it I will post my experiences.

Regards

Michael

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello Bertram,

thanks for your post.

As soon as I switch to WDJava-CE-Development (which I prefer due to several reasons) I will use this function. Until then I suppose I'll have to live with it

As I mentioned in my initial Post I use the WebDynpro Java Application within the NW04s Portal.

Can the ExitPlug(Url) and/or ExitPlug(closeWindow) be used within a Portal environment?

To Matteo: Sorry, I still haven't tried your solution yet. But I suppose it'll work, because it sounds as if

Regards

Michael

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Michael,

in NW CE 7.1 Web Dynpro Java provides a generic window close function based on a new predefined Exit plug parameter:

Generic Exit Plug Parameters

You can define specific exit plug parameters to influence the u201Cwindow behavioru201D on client side, when the user exits a running Web Dynpro application (implies firing an exit plug on server side).

1) Exit plug parameter with name Url of type String: with this parameter the window running a Web Dynpro application navigates to an external URL, after the user has left the application.

2) >>>> Exit plug parameter with name closeWindow of type boolean: with this parameter the window running a Web Dynpro application gets automatically closed (closeWindow = true), after the user has left the application.

The defined exit plug parameters are automatically added to the signature of the generated wdFirePlug<exit plug name>(), part of the window controlleru2019s IPublic<window name> API (with a window implementing the component interface viewu2019s exit plug):

wdFirePlug<exit plug name>(String Url);

wdFirePlug<exit plug name>(boolean closeWindow);

The closeWindow parameter is not defined in NW 7.0.

Regards, Bertram

Former Member
0 Kudos

You could create a html page with only some java script code to close the window on page load and upload it to the portal. Then add it to an url iview and into a page. After that you can use portal navigation to navigate to this page which will then close your window.

Former Member
0 Kudos

bright idea. I think I will do that if there's no easier possibility.

I thought there must be some kind of .close() or .destroy() in some place I havn't looked yet...

Former Member
0 Kudos

Hi again

I tried the following:

Created a close.html which holds window.close() in its body onload

Uploaded my close.html to KM

Created a KM-document-iView which points to the close.html

In my Web Dynpro Java App I implemented in event of Cancel-Button something like:


WDPortalNavigation.navigateAbsolute("pcd:path/to/km/document/close.html", something.OPEN_IN_PLACE, something.NO_HISTORY, "");

When I click the Cancel-Button a new Window opens (although I said OPEN_IN_PALCE) with the complete Portal-Header and all which then closes by itself.

The opening WD-App-Window stays open... ;(

I also changed my JavaScript to additionally contain


window.opener.opener = top;
window.opener.close();

but this didn't help either.

So problem is not solved. I suppose this simply is not possible.

Solutions are still appreciated.

Regards

Michael