on 01-29-2006 9:38 AM
Hello all,
I have an application that attempts to read user info from the backend (based on employee id) and display it in a table. In the event that the employee id is not found in the backend, the application will close and re-divert to another web dynpro application. Unfortunately, whenever I try to close the "parent" window, I get an exception saying that "instance of interface view controller does not exist." A fellow forumer suggested that I need to create an external window beofre I can close the first one but the error is still the same. I am posting my code below and any help will be greatly appreciated.
// ========================
IWDMessageManager messageMgr = wdComponentAPI.getMessageManager();
String deployableObjectName = wdComponentAPI.getDeployableObjectPart().getDeployableObjectName();
Map urlParameters = new HashMap();
// Prepearing the parameters to be sent over as part of the URL string
try{
WDDeployableObjectPart deployableObjectPart =
WDDeployableObject.getDeployableObjectPart(deployableObjectName,
"Approval",WDDeployableObjectPartType.APPLICATION);
String urlToApproverInboxApp = WDURLGenerator.getApplicationURL(deployableObjectPart,urlParameters);
IWDWindow exitWindow = wdComponentAPI.getWindowManager().createExternalWindow(urlToApproverInboxApp,"",false);
exitWindow.open();
wdThis.wdGetTripApprovalCompInterfaceViewController().wdFirePlugApproverInbox("javascript:void(window.close())");
}catch (WDURLException e){
messageMgr.reportException(e.getLocalizedMessage(),false);
}catch (WDDeploymentException ex){
messageMgr.reportException(ex.getLocalizedMessage(),false);
}
// ========================
from
Kwok Wei
Hi Kwok,
a) As Radha suggested, opening the new application in the same window would be better for you. To achieve this :
try{
WDDeployableObjectPart deployableObjectPart =
WDDeployableObject.getDeployableObjectPart(deployableObjectName,
"Approval",WDDeployableObjectPartType.APPLICATION);
String urlToApproverInboxApp = WDURLGenerator.getApplicationURL(deployableObjectPart,urlParameters);
<b>/*IWDWindow exitWindow = wdComponentAPI.getWindowManager().createExternalWindow(urlToApproverInboxApp,"",false);
exitWindow.open();*/ Comment this part</b>
wdThis.wdGetTripApprovalCompInterfaceViewController().wdFirePlugApproverInbox(<b>urlToApproverInboxApp</b>);
//Make sure that the outbound plug 'ApproverInbox' is an exit plug.
}
This will automatically exit the parent application & open the new application in the same window
b) If you are very much particular about opening the application in a new window, this is what you can try:
1) create an attribute of type integer, for eg: 'delayAttr'
2) In layout, create a 'TimedTrigger' UI element and bind it's 'delay' property to the new attribute i.e 'delayAttr'
3) create an action for the 'onAction' event of the 'TimedTrigger' and arrange your code accordingly:
.
.
.
IWDWindow exitWindow = wdComponentAPI.getWindowManager().createExternalWindow(urlToApproverInboxApp,"",false);
exitWindow.open();
<b>wdContext.currentContextElement().setdealyAttr(1);</b>
<b>// Inside the action handler for the TimedTrigger</b>
wdThis.wdGetTripApprovalCompInterfaceViewController().wdFirePlugApproverInbox("javascript:void(window.close())");
This will open the new application in a new window and then close the parent window after 1 second. But when we try to close the browser window through program, we get a default dialog message warning us about this action. This might confuse the user.
Hope this helps,
Best Regards,
Nibu.
Message was edited by: Bertram Ganz
Passing JavaScript-Code within exit plug URL-parameters is blocked by the Web Dynpro Java Runtime in NW 04 SP 16.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kwok Wei ,
If i understand correctly,one of the solution would be to
fire exit plug from your main application to your new URL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The exit plug is already in place. I am able to navigate away to another application but unable to close the main window. Thus in the end, I am left with 2 windows on my screen.
It seems that the closing of the main window is only possible after the view is initiated on the screen. Hence examples of navigating away from the click of a button is possible (I have tried and it works). However, if I want my application to <b>automatically close</b> the main window and launch another application based on program logic (eg :and this happens in the component controller), I will either end up with 2 windows or the exception "instance of the view controleer does not exist."
from
Kwok Wei
Kwok,
If you have already exit plug, then point it to the following HTML:
<html>
<head><title>Exit MyApp</title></head>
<body onload="self.top.close()">
</body>
</html>
Valery Silaev
EPAM Systems
Hi Valery,
As mentioned in the initial post, I am sending an employee id to the backend with in turnm will return the user info and display it in a table. In the event that the userid is not found or the backend is not available, it should terminate the application and launch another WD application (designed for a generic situation when userid does not returns any information).
So far, my attempts to do the above only got as far as opening 2 windows whereby the first window will dosplay an empty table (since no info is retrieved) and the other is the newly launched WD application. My ultimate aim is to have only the second window opened, the first window (main application window) should ideally be closed since data cannot be retrieved or the backend is down.
My apologies if the initail description is not clearly described.
from
Kwok Wei
Hello Valery,
That was exactly what I initially attempted but was given the "Instance of view controller does not exist." exception. The only way that I am able to circumvent the exception is to use createExternalWindow which is not really what I wanted.
Here is the piece of code that I originally used :
wdThis.wdGetTripApprovalCompInterfaceViewController().wdFirePlugApproverInbox(urlToApproverInboxApp);
from
KwoK Wei
Hi Valery,
I can confirm and guarantee !!!! If only I can do a screen capture and paste it here.
This has been a bugging problem for me since day 1 and the only way to circumvent it is to end up with 2 windows whereby the first window will load the application with NO user data and the second window will be the exit page/another application. Any attemots to close the main application (1st window) will always result in a "Instance of view controller does not exist."
It will be fine however, if the view is first displayed and then an action were to trigger the verification process. This way, I will be able to close the main application and re-launch another application.
from
Kwok Wei
Kwok,
Could you download and run <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tutorial%20on%20inter-application-navigation%20-%2015.htm">Inter-Application Navigation</a> tutorial?
If it runs ok, check what is wrong with your code and how it differs from tutorial code.
Valery Silaev
EPAM Systems
Message was edited by: Valery Silaev
Message was edited by: Valery Silaev
Hi,
You have done it for a outbound plug ? Yes
Outbound Bound Plug is of type Exit ? Yes
It has a parameter of tyep string ? Yes
Whats the name of the String parameter of the Exit plug ?
Its "Url" of type string right ?
And you have one line in the inital post .. somewindow name.open().. YOu are not using it at present ..Are you ?
Regards
Bharathwaj
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.