cancel
Showing results for 
Search instead for 
Did you mean: 

attach an xml to a pdf using ADS

Former Member
0 Kudos

Hi all,

I have a scenario where we are sending a Base64 encoded PDF (a bill) and the corresponding xml data from SAP backend on level 4.6C to PI 7.1. In PI we should attach the xml data to the PDF. I have already succeeded to do this using iText but we have a requirement to do this with ADS instead. In Netweaver Developer Studio I created an example project where I am reading a PDF as a byte array, also reading an XML file and try to attach the XML to the PDF using the ADS api. The project successfully built in NWDS but when I am running the project it failes.

I am using standard code to attach the xml stream to the pdf, the error message is thrown when the following line is executed:

IWDPDFDocument document = context.execute();

Exception in thread "main" java.lang.ExceptionInInitializerError

at com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.impl.PDFDocumentAccessibleContextWDImpl.execute(PDFDocumentAccessibleContextWDImpl.java:99)

at com.eon.xi.dijnet.base64.PdfWithAttachment.addAttachmentWithSap(PdfWithAttachment.java:129)

at com.eon.xi.dijnet.base64.PdfWithAttachment.main(PdfWithAttachment.java:218)

Caused by: java.lang.NullPointerException

at com.sap.tc.webdynpro.services.sal.deployment.core.DeployableObjectInternal.getSystemDeployableObjectName(DeployableObjectInternal.java:53)

at com.sap.tc.webdynpro.clientserver.uielib.adobe.impl.AdobeFormHelper.<clinit>(AdobeFormHelper.java:115)

... 3 more

Is it the problem with the PDF that it is not an Interactive Form?

Or the problem is simply that I am trying to run the project on my local machine where ADS is not available?

Thanks for your help.

Pal

Edited by: Pal Somogyi on Oct 17, 2010 10:30 PM

Edited by: Pal Somogyi on Oct 18, 2010 11:44 AM

Accepted Solutions (0)

Answers (3)

Answers (3)

preethi_santhanam
Participant
0 Kudos

Hi Pal,

There is a requirement to generate an Adobe Form using SAP Interactive forms, and then, send this PDF to a non-SAP system using Base-64 encoding. The receiving system will decode this file and re-generate a PDF.

I have heard that this could be done in the PI layer, using the Conversion Agent.

Another approach which I can think of is convert PDF to binary and then use the cl_http_utility=>encode_base64 to convert binary to base64.

You have mentioned that you have had to send a base 64 encoded pdf. Could you pelase guide me through the process?

Thanks,

Preethi.

preethi_santhanam
Participant
0 Kudos

Hi Pal,

There is a requirement to generate an Adobe Form using SAP Interactive forms, and then, send this PDF to a non-SAP system using Base-64 encoding. The receiving system will decode this file and re-generate a PDF.

I have heard that this could be done in the PI layer, using the Conversion Agent.

Another approach which I can think of is convert PDF to binary and then use the cl_http_utility=>encode_base64 to convert binary to base64.

You have mentioned that you have had to send a base 64 encoded pdf. Could you pelase guide me through the process?

Thanks,

Preethi.

OttoGold
Active Contributor
0 Kudos

I am not sure what resources you could use. It is easy to do this in ABAP backend. Can you use it?

There is an example report/ a demo report, where you can see how easily you can work with attachments. Please check this program FP_PDF_TEST_16.

Regards Otto

OttoGold
Active Contributor
rpalotai
Participant
0 Kudos

Otto,

This report using ADS Java function via RFC.

To use such ADS functions, is it requires addtional licenses than normal netweaver?

BR

Richard

Edited by: Richard Palotai on Jan 20, 2011 12:16 PM