cancel
Showing results for 
Search instead for 
Did you mean: 

How to control external window from the webdynpro application

Former Member
0 Kudos

Hi

I have two applications to be running and from my first application on click of a button, I am invoking the second through this piece of code

-


IWDWindowInfo windowinfo = wdComponentAPI.getComponentInfo().findInWindows("WdAppl1view2");

IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow("http://.../local/testappltoappl/Appl2?SAPtestId=14","second",false);

window.setWindowPosition(WDWindowPos.CENTER);

window.setWindowSize(300,200);

window.open();

-


The second application is opening in new window fine, but my requirement is when I click on the next time I need to open the it in the same second window and is it possible to identify/know whether already the second window is open before invoking it ? do we have some way of getting that window instance ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Satya

Declare a window instance context attribute and store the window instance.

When ever you try to open check if the window instance is available in context.

if it is availabe get the window instance and open that.

Hope this should work.

Rgds

NagaKishore

Answers (3)

Answers (3)

Former Member
0 Kudos

Satya

Do you know how to destroy the main window ie the application ,something like window.close in java script.

The problem is one can get an instance of the external window but not of the main window.Even getting the application instance doesnt help.

Thanks

Harsh Chauhan

Former Member
0 Kudos

To add up to the above post

You can always get the window instance...Proceed as follows

Create a value attribute of type IWDWindow.

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI

.getComponentInfo().findInWindows("Name of the Window");

IWDWindow window = wdComponentAPI.getWindowManager()

.createWindow( windowInfo, true);

//To save window instance

wdContext.currentContextelement().set"Name of the attribute"(window);

Do get back for further clarifications.

Hope this helps you.

Regards,

Vijith

Former Member
0 Kudos

Hi guys

Thanks a lot for your inputs, it works fine a create window option, getting the instance..etc, but for external window,I worked around in a different way to resolve it.

thanks

sathya

Former Member
0 Kudos

Hi Sathya,

I am not sure how to get the insyance of external window.

But you can try the following.

Create a normal window instead of external window.

But you need to place a IFrame Control in the View under window "WdAppl1view2".

IFrame control can be bound to your second app URL.

Now You can use following code

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

IWDWindow window = wdComponentAPI.getWindowManager().createWindow(windowInfo, true);

wdContext.currentPopupElement().setWindowInstance(window);

window.setWindowPosition(300, 150);

window.open();

wdContext.currentPopupElement().setWindowInstance(window);

How to Destroy the popup ?

You can write an event in the calling view and componentcontroller place the following code in the view eventHandler.

IWDWindow window = wdContext.currentPopupElement().getWindowInstance();

window.destroy();

In the view that contians IFrame place a button and when you click on the button it should fire componentcontroller event so that it will destroy the window.

Regards, Anilkumar