cancel
Showing results for 
Search instead for 
Did you mean: 

External Window

Former Member
0 Kudos

Hi Experts,

How can we Create an External Window means i have two components and i want to show one view of first component as an external window(Not Model Window) in second component after passing some input from second component to first componet,so my problem is What will be the url and how the input parameters will be passed from second compont to show the view.

Thanks And Regards

Trilochan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

What will be the url and how the input parameters will be passed from second compont to show the view.

You need to create an application that points to your view. You can use the url of the application

Append parameters at th end of the URL and access them from the DC using WDProtocolAdapter class getRequest.get method.

Regards

Ayyapparaj

Former Member
0 Kudos

Thanks Ayyapparaj KV ,

can u please describe it how we can pass parameters means i have to pass some input from second componet by which it excute some query and show the first component view which is in external window i m able to open this window but not able to understand how we pass the required input as paramter with url.

Thanks and Regards

Trilochan

Former Member
0 Kudos

Hi,

If you want to pass parameters using url then just append it in the url that we got above strUrl;

eg strUrl+="?parameter1=value1&parameter2=value2";

In the newly opened window, just read these parameters in the wdDoInit() method:

String value1 = (String)wdProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("parameter1"):

String value2 = (String)wdProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("parameter2"):

Regards,

Murtuza

Former Member
0 Kudos

hi,

i have written this pice of code in a button action by which i want to show external window.

try{

String inputValue=wdContext.currentContextElement().getInput();

String strURL = WDURLGenerator.getApplicationURL("sap.com/", "Win1");

strURL+="?parameter1=inputValue";

IWDWindow window = wdComponentAPI.getWindowManag().createNonModalExternalWindow(strURL,"My Second Window");

window.setWindowPosition(100,100);

window.setWindowSize(650,600);

window.show();

}catch(Exception e){

wdComponentAPI.getMessageManager().reportException("Exception in onActionShow()"+e.getLocalizedMessage(),false);

}

and in wdDoInit() method of requried view which is shown in external window of second component (application) i have written this pice of code

String value1 = (String)WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("parameter1");

String value2 = (String)WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("parameter2");

but i m not able to access these values here.

i m getting this exception

Exception in onActionShow()Failed to generate URL to deployable object 'sap.com/', application 'Win1'.

how i can resolve this.

Regards

Trilochan

Former Member
0 Kudos

Hi,

It means that the path and the window name that you are specifying is incorrect:

String strURL = WDURLGenerator.getApplicationURL("sap.com/", "Win1");

String strURL = WDURLGenerator.getApplicationURL("sap.com", "Win1");

Also, to pass value you need to change

strURL+="?parameter1=inputValue"; to

strURL="?parameter1="inputValue;

Try this and let me know whether it worked or not.

Regards,

Murtuza

Former Member
0 Kudos

Hi

As per the doc the precondition for this method is

Precondition: There must be a deployable object part of type

WDDeployableObjectPartType.APPLICATION with the given

applicationPartName within the deployable object with name

deployableObjectName.

Regards

Ayyapparaj

Answers (2)

Answers (2)

Former Member
0 Kudos
Former Member
0 Kudos

Hi,

For data transfer between the 2 windows you can use cache.

Here is the code for data transfer as well as opening up an external window.

Assuming below is the name of your dc

/TRACK_NAMEaabbccxx.company.com

Change the parameters in the code according to the name of your DC

try{

ICacheService putcache = (ICacheService) PortalRuntime.getRuntimeResources().getService(ICacheService.KEY);

putcache.put("Node", wdContext.nodeNode1(), true);

String strURL = WDURLGenerator.getApplicationURL("xx.company.com/aabbcc", "<application name>");

IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(strURL,"Title");

window.setWindowPosition(100,100);

window.setWindowSize(650,600);

window.show();

}catch(Exception e){

e.printStackTrace();

}

Now, in the wdDoInit() method of the view that is to be opened in the external window, you need to read the cache and set the parameters:

ICacheService putcache = (ICacheService) PortalRuntime.getRuntimeResources().getService(ICacheService.KEY);

IWDNode Node1 = (IWDNode)putcache.get("Node");

WDCopyService.copyElements(Node1,wdContext.nodeNode1());

Regards,

Murtuza

Former Member
0 Kudos

Hi Murtuza,

How can we access ICacheService interface?

I am not able to import package for this service classes in my webdynpro application.

Do we need to add any external package or jar in my application?

If we have to so please tell me from were i can get that?

Thanks & Regards

Trilocahn

gill367
Active Contributor
0 Kudos

Hi ,

You can show one view of one component as an external window in another component by creating two applications one for each component.

Then in the first component's view controller write the code in the event handler of any action(button click etc.) to create an external window.

and here give the url of the second application.

the URL of the second application can be found by

using the function -


>

*String url = WDURLGenerator.getApplicationURL(deployableObjectPart, urlParameters);*

where deployableObjectPart is found for the second aaplication by the method

String deployableObjectName =

wdComponentAPI.getDeployableObjectPart().getDeployableObjectName();

WDDeployableObjectPart deployableObjectPart =

* WDDeployableObject.getDeployableObjectPart( deployableObjectName,"TargetApp",WDDeployableObjectPartType.APPLICATION);*

where TargetApp is the name of the second application.

Urlparameter is used to pass the parameters to the second component's view

use the following code to map the parameters.

Map urlParameters = new HashMap();

urlParameters.put("Pname","Pvalue");

here Pname is the key for the parameter passed and Pvalue is the value of the parameter.

give the same name(Pname) to the parameter for start plug of the second application.

thats it now

write the code to create the external window and give "url" as its url.

To access the parameter in the second window use the interface view of the target component.

there you will find one eventhandler with name onPlug<start plug name>.

In this method you can access that particular parameter and store it in some context attribute in the controller's context and then in the target view you can access this context attribute of the controller.

that's it.

hope it will sort out your problem.

Regards,

Sarbjeet Singh

Former Member
0 Kudos

Thanks Sarbajeet. Your suggestion helped me to pass parameters.

I am sorry I am not the originator of this question, so I can't give any points.

But, one more question - the parameter that's getting passed is not encrypted. Is there any way to encrypt or made invisible in the URL?

Thanks.

MSR.