cancel
Showing results for 
Search instead for 
Did you mean: 

Showing PDF without using InteractiveForm

Former Member
0 Kudos

Hi experts,

I receive PDF content from a RFC in the "XSTRING" format.

I can show this in an interactive form (by mapping the pdfSource property of my InteractiveForm with the Xstring), but then we need to install ACF on all the PCs of the customer.

So what I would like to do is display a PDF not included in a Web Dynpro.

I read in this forum (from Bogdan) that this could be a solution:

byte[] pdfContent={here document is created};

IWDCachedWebResource pdfResource=WDWebResource.getWebResource

(pdfContent,WDWebResourceType.PDF);

wdComponentAPI.getWindowManager().createExternalWindow(

pdfResource.getURL(),"Report View",true).open();

But how can I convert my Xstring format to byte[] ?

Thanks in advance for your answers.

Regards,

Julien

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member182294
Active Contributor
0 Kudos

Hi Julien,

We have similar kind of requirement( reading PDF from RFC through JCO and saving it as PDF file in target system). The problem we are facing is when we are using XSTRING format in RFC its not supporting. Can you please tell us how to implement this. Currently we are reading pdf data as RAWDATA into a table, and this data is appending into multiple rows of the table. When we read PDF in this format the generated PDF is corrupting. Can you please tell us how to proceed?

Thanks in advance

Regards

Abhilash

Former Member
0 Kudos

any suggestions ?

I have the same problem.

thanks in advance.

Leandro

Former Member
0 Kudos

Hi Leandro,

I managed to do what I wanted with the following code :

(in my case wdContext.currentOutputElement().getPdf_String() is the PDF content returned by the BAPI)

String key = "a unique identifier";

try {

byte[] pdfContent = wdContext.currentOutputElement().getPdf_String();

IWDCachedWebResource pdfResource = WDWebResource.getPublicCachedWebResource(pdfContent, WDWebResourceType.PDF, WDScopeType.CLIENTSESSION_SCOPE, wdThis.wdGetAPI().getComponent().getDeployableObjectPart(), key);

wdComponentAPI.getWindowManager().createExternalWindow(pdfResource.getURL(), "my window name", false).open();

}

catch (Exception e) {

msgMgr.reportException("Erreur affichage formulaire : " + e.getMessage(), true);

}

Now when the user clicks on the link, he gets either a IE window containing a PDF or a "open/download/cancel file" popup depending on the configuration of acrobat reader.

Hope it helps.

Good luck,

Julien

Former Member
0 Kudos

Hi Julien.

Yesterday I can solved it.

I found a solution in a post, and it works.

I am only coded this in the wddoInit, and I use a FileDownload UI element.

//segun nota

/* The FileDownload UI element requires: */

final IWDAttributeInfo fileAttrInfo = wdContext.nodeOutput().getNodeInfo()

.getAttribute("Bin_File");

final IWDModifiableBinaryType pdfType =

(IWDModifiableBinaryType)

fileAttrInfo

.getModifiableSimpleType();

/* In addition the FileDownload

  • UI element needs for defined resource types

*/

pdfType.setFileName( "MyPdfFile.pdf" );

pdfType.setMimeType( WDWebResourceType.PDF );

//@@end

"bin_file" is the xstring parameters that return my RFC module function.

Really I don't know the difference with your sample (I am newbbie in Java and webdynpro) but this code is the way that works in my aplication.

Thanks a lot anyway!

regards.

Leandro