cancel
Showing results for 
Search instead for 
Did you mean: 

Encoding Binary Attachments in Adapter Module

vk_k3
Participant
0 Kudos

Hi Experts,

I want to Encode outgoing attachments with base64 in an Adapter Module.

I am using Receiver RNIF 2.0 Adapter.

My Scenario is :

ABAP Proxy sends multiple attachments with the payload to PI.

In the Receiver Adapter, PI has to Encode all the attachments with base64 encoding.

--- Is there any limit on number of Attachments in an RNIF 2.0 receiver adapter? (I am not sure but I have heard two as of now


--- Can you please help in the proper syntax in Adapter module in order to read the attachments which are a

    a physical PDF Files (Binary) and then Encode all the attachments into a base64 and return the same.

Regards,

VkJoat

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

Would it be an option to encode the attachments in ABAP before you send the message?

For example with function module SCMS_BASE64_ENCODE.

vk_k3
Participant
0 Kudos

HI Stefan,

Yes, right now it is encoded in ABAP already but maybe without using the above FM.

But the problem is the trading partner is receiving double encoded  string of the attachment.

Even after they perform the decode, they have a text file which contains a base64 string again which inturn is producing the PDF file after the 2nd Decode.

So, I want to Encode in PI instead of ABAP.

You have any suggestion on this problem ?

stefan_grube
Active Contributor
0 Kudos

SAP provides an adapter module example which you find in SAP note 1004000.

This sample module shows how to work with attachments.

base64 handling can be done with following classes:

sun.misc.BASE64Decoder;

sun.misc.BASE64Encoder;

I recommend to fix the ABAP code.

vk_k3
Participant
0 Kudos

Hi Stefan,

I have fixed the Issue though there is a strange thing happening.

Though ABAP was encoding the attachment only once somehow RNIF was encoding it again thus legacy system was receiving double encoded attachment.

I am sending the attachment directly without encoding it from the source itself then the legacy system is able to decode successfully and receive the attachment.

It implies RNIF adapter is encoding it.

Regards,

Vkjoat

Answers (0)