cancel
Showing results for 
Search instead for 
Did you mean: 

Open View or Window in a external window (popup)

Former Member
0 Kudos

Hi experts!

I have the following issue:

- I know how to open a external window from a given URL, but my problem is that I want this new external window to open and show one of my own windows and I don't know how to get the window's URL. Any Idea???

Please help or redirect me to some doc or post. Thanks.

Osvaldo Silva

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Are you saw this tutorial? https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/903fed0d-7be4-2a10-cd96-91367073...

If I understood you question, I think it can help you, if no, let me know.

Best regards

Answers (5)

Answers (5)

Former Member
0 Kudos
Former Member
0 Kudos

Hi experts,

sorry for my delay!!!

All of your sugestions are good ones BUT they don't answer my question.

I'll rephrase it: Is it possible to know the URL of the views or windows defined in my WD Java app so that I can use it to open the view or window using the wdComponentAPI.getWindowManager().createNonModalExternalWindow() method??

Thanks.

Osvaldo Silva

Former Member
0 Kudos

Hi,

If you want the url of the another window in your WD Component. As per my knowledge you need to have a seperate application to be created for this window also.

For Example you have Window1 (View1 is embeded in this window) and Window2(View2 is embeded in this window). Now you need the url of the Window2.

So for this purpose you need to create two applications for this WD Component.

For example App1 (Created for Window1InterfaceView) and App2 (Created for Window2InterfaceView).

Now use this below code to open the Window2 URL in a sepearate window.



// Get name of deployable object this component belongs to
String deployableObjectName =
wdComponentAPI.getDeployableObjectPart().getDeployableObjectName();

Map urlParameters = new HashMap();

// If there are any application parameters you need to pass to App2 you can set those in urlParameters
// as urlParameters.put("key","value");

try {

// Get deployable object part of target application.
// Precondition: assume, that other application belongs to the same
// Web Dynpro Project (Deployable Object)
WDDeployableObjectPart deployableObjectPart =WDDeployableObject.getDeployableObjectPart(
deployableObjectName,"App2",WDDeployableObjectPartType.APPLICATION);
// Get target URL based on deployable object part and URL parameters
String urlToTargetApp =WDURLGenerator.getApplicationURL(deployableObjectPart, urlParameters);

//Open this urlToTargetApp in external window.

IWDWindow window = wdComponentAPI.getWindowManager(.createNonModalExternalWindow(urlToTargetApp,"Window2");
 window.show();

} catch (WDURLException e) {
messageMgr.reportException(e.getLocalizedMessage(), false);
} catch (WDDeploymentException ex) {
messageMgr.reportException(ex.getLocalizedMessage(), false);
}

Note:/Warning: We are opening another window using another WebDynpro application.

Here it creates a seperate WDComponent instacne. You can't access Window1(View1)'s existing context data in Window2(View2). The only way is you can pass some data using app/url parameters.

Apart from this as per my knowledge there is no other way to get the url for a Window.

Regards,

Charan

Former Member
0 Kudos

I know one way, might not be the prettiest, but you can use the "webdynpro/dispatcher/" - url that you get when launching the application from from within Eclipse.

The url is something like http://yourservermachine:57800/webdynpro/dispatcher/packagename/component~appname

This way your not "in" the portal, so there is no authentication. But its still in the same Javastack.

/Björn

Former Member
0 Kudos

Hi and thanks for your sugestions.

Maybe I was not clear enough in my question. I know how to create and open my windows in the modal way, but I don't know how to do it in the non modal way.

Anyway, thanks Isaias and Pravesh.

Jithin, I'll try to follow the thread you suggested and soon will post my results.

Once again, thank you.

Osvaldo Silva

Former Member
0 Kudos

Hi,

The code mentioned below will help you to create a Modal Window. If you want to create a Non modal window, plesae refer this thread.

[;

  IWDWindowInfo customerWindowInfo = this.wdComponentAPI
				.getComponentInfo().findInWindows(
						"Customersearch_newcustWindow");
		IWDWindow customerWindow = wdComponentAPI.getWindowManager()
				.createModalWindow(customerWindowInfo);
		customerWindow.setWindowPosition(WDWindowPos.CENTER);
		customerWindow.setWindowSize(600, 200);
		customerWindow.setTitle("Customer Search");
		customerWindow.show();
		wdContext.currentContextElement().setVa_customerSearchWindowAttr(
				customerWindow);

Va_customerSearchWindowAttr is an attribute of type IWD window.

Hope this helps.

Jithin

pravesh_verma
Active Contributor
0 Kudos

Hi Osvaldo,

You can use this code in the onaction event:



// Call the add roles screen
	  IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("YOUR WINDOW NAME"); 
//	  NewWindow should be the name pointing to a new window created statically 
	  IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
	  window.setTitle(wdThis.wdGetAPI().getComponent().getTextAccessor().getText("WHATEVER TITLE YOU WANT TO SET FOR WINDOW"));
	  wdContext.currentWindowLocalsElement().setPopupWindow(window);
	  window.setWindowSize(800, 600);
	  window.setWindowPosition(300, 300);
	  window.show(); 

I hope this solves your issue.

Thanks and Regards,

Pravesh