cancel
Showing results for 
Search instead for 
Did you mean: 

Decode Base64(Pdf) to binary

Former Member
0 Kudos

Hi all,

I have a WS - PI - File scenario.

So I get a base64 coded PDF-File and have to create a decoded binary file.

First I used an UDF. But the created document is invalid and not to open by Acrobat. After reading the forum the conclusion is, it is impossible to convert data in mapping step, is'nt it.

But what are the other possibilities?

Regards

Mathias

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

> First I used an UDF. But the created document is invalid and not to open by Acrobat. After reading the forum the conclusion is, it is impossible to convert data in mapping step, is'nt it.

You are right. It is not possible to do this task with graphical mapping.

The target of a graphical mapping is always an XML document.

You have to use Java/ABAP mapping for this task.

Former Member
0 Kudos

The library com.sap.aii.utilxi.base64.api. does not work in my case.

The pdf file is not recognized as valid

I have used the library sun.misc.BASE64Decoder in a adapter module.

I believe you can also use this library in a UDF.

BR

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi Mathias,

can this blogs help you?

[XI: Generate PDF file out of file adapter|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2072] [original link is broken] [original link is broken] [original link is broken];

[Trouble writing out a PDF in XI/PI? |http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/14363] [original link is broken] [original link is broken] [original link is broken];

Regards,

Udo

former_member181985
Active Contributor
0 Kudos

You can do this in the mapping using Base64.decode() method from SAP standard API (com.sap.aii.utilxi.base64.api.*)

Check my WIKI section for ref: [Sending Binary Data to Inbound Plain HTTP Adapter in XI and PI |http://wiki.sdn.sap.com/wiki/display/XI/SendingBinaryDatatoInboundPlainHTTPAdapterinXIand+PI] where i used encode method in HTTP client code.

You can check decode method code in the java snippet "Java Mapping - Base64 Decryption and Unzipping Code "

Edited by: Praveen Gujjeti on Jul 16, 2010 4:59 PM