cancel
Showing results for 
Search instead for 
Did you mean: 

Howto use / pass context in NonModalExternalWindow?

bernd_speckmann
Contributor
0 Kudos

Hi everybody,

I want to open a webdynpro Component, which contains an Interactive Form in a NonModalExternalWindow. The PDF should contain data which is generated in the root component.

My problem is not to open the external window, but to pass the data from one component to the component which contains the interactive form.

I open the external window this way:

String url ="";
	  String depObjectName =
	  wdComponentAPI.getDeployableObjectPart().getDeployableObjectName();
	  try {
	  WDDeployableObjectPart depObjectpart=WDDeployableObject.getDeployableObjectPart(depObjectName,"SecondApp",WDDeployableObjectPartType.APPLICATION);
	  url = WDURLGenerator.getApplicationURL(depObjectpart) ;
	  } catch (Exception e) {
		  wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage());
	  }
	  IWDWindow win = wdComponentAPI.getWindowManager().createNonModalExternalWindow(url);
	  win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
	  win.removeWindowFeature(WDWindowFeature.MENU_BAR);
	  win.removeWindowFeature(WDWindowFeature.STATUS_BAR);
	  win.removeWindowFeature(WDWindowFeature.TOOL_BAR);
	  win.show();

How can I use the data from the first component in the other one?

Or is there any other way to open the generated pdf in another browser window?

Thanks ahead,

Bernd

Accepted Solutions (1)

Accepted Solutions (1)

former_member185086
Active Contributor
0 Kudos

Hi

Use the following code

// chunk contains the binary data coming form bacend
byte[] chunk= wdContext.currentOutput_PrintInvoiceElement().getPrintData();

//Set these chunks into local context with property type as PDF
wdcontext.currentContextElement..sePint(WDResourceFactory.createCachedResource(chunk, "Data" + "<Title of the PDF>", WDWebResourceType.PDF));



// Finally call this code at action which open PDF in new window 

//this the resource which u set in previous step
IWDResource resource= wdContext.currentContextData.getPrtint(); //

		window= wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()), "Browser-description");
		window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
		window.removeWindowFeature(WDWindowFeature.MENU_BAR);
		window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
		window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
		window.setWindowSize(780, 430);
		window.setWindowPosition(20, 140);
		window.show();

Hope remaining coding are clear to you.

Best Regards

Satish Kumar

bernd_speckmann
Contributor
0 Kudos

Hi,

first thanks for your answer.

It's the following situation:

Comp1 --> Context Nodes containing the data (e.g. Name, Company, ...)

View --> Button "Generate Ouput" --> should open the view of Comp2

Comp2 -->

View with interactive form element which should display the data from Comp1 in such a NonModalExtermalWindow as you discribed above.

But I don't know how to get my context data into a pdf chuck...

If I am right I need to generate the PDF in Comp1 and pass the binaray data of this pdf to Comp2. But I want to generate the PDF in Comp2 and use the required context data of Comp1.

Thanks

Bernd

former_member185086
Active Contributor
0 Kudos

Hi

PDF chumk is a binary data , What is fromat of the data r u getting ? what is the source of the data .

try to convet it in byte from , and then try it out.

Other thing are just a navigation of the context data ,it depends where and how you want to diplay it.

If across the component then do the context mapping .

Best Regards

Satish Kumar

bernd_speckmann
Contributor
0 Kudos

The data source are several context attributes of Comp1 (String values, int values, ...)

But your solution presumes, that the PDF has been already generated and then passed as binary data to the nonModalExternal window.

My problem is, that I cannot access the context of Comp1 from Comp2 when it is openend in a nonModalExternal window.

Best Regards,

Bernd

former_member185086
Active Contributor
0 Kudos

Hi

PDF is generated with those data which is passed to it through context , It could be xls or plain text file also.

Just have a look in previous code , I have set the value which will generate the PDF, second once this NonModalExternalWindow will open it will not open in webdynpro View but will use IExplorer to display the PDF.so once after it opening you dont have any control to get set the data from this PDF,

To Context of Comp1 will we accessible to Comp2 by Interface Controller , You have to define the uses relationship of the component.

[Please have a look on these threads for context mapping |http://www.sdn.sap.com/irj/scn/advancedsearch?query=context+mapping]

Best Regards

Satish Kumar

bernd_speckmann
Contributor
0 Kudos

>

> To Context of Comp1 will we accessible to Comp2 by Interface Controller , You have to define the uses relationship of the component.

Yes, I know and it works well. But when I open the other component in a NonModalExternalWindow, the context is not accesible, isn't it?

Regards,

Bernd

Answers (0)