cancel
Showing results for 
Search instead for 
Did you mean: 

Processing pdf files using file name as email address

0 Kudos

Hi Experts,

I have a requirement where i need to process the PDF files from FTP location to Email.

Sender system will place a file (with the name itself consists email address) in a ftp location.

SAP PI need to pick this pdf file and send it to the same person as an email with the pdf as an attachment.

For ex: the pdf file name as abc@gmail.com

Now SAP PI need to pick this file and send it as an attachment to abc@gmail.com.

Is there any way I can attain this scenario.

Thanks & regards,

Praveen.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Praveen,

You can do this using a Java mapping. Following should be done

1. Read the input file name and parse the email id in which the mail needs to be sent.

2. Choose adapter specific attribute of receiver mail adapter and set the dynamic mail address.

    Header field name is 'THeaderTO' and adapter namespace is http://sap.com/xi/XI/System/Mail

3. Set the PDF file as attachment. The sample java code can be found in the discussion

4. In the receiver mail adapter choose the option keep attachment.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Praveen,

This should be possible. Couple of things:

1. By checking Adapter-Specific Message Attributes(ASMA) in file sender, you can already get the fileName

2. You can use java mapping to set the pdf file as attachment and then create another payload as a body.

3. In the java mapping, use dynamicConfiguration to set the email receiver.

4. ASMA and Variable Transport Binding should both be checked in your SOAP Receiver CC (type SMTP)

Hope this helps,

Mark

iaki_vila
Active Contributor
0 Kudos

Hi Praven,

You should to divide your scenario in steps, divide and conquer .

First of all you need to pass the pdf file to a mail. Here you have an example: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0a27c01-26b0-2c10-bd8a-94498efa7...

Later you would need to set you mail destination dynamically, you can access to the file name with dynamic configuration and to use file name to be mapped to the mail endpoint structure pointed in the below document. (Check Shabarish example to get the filename )

Regards.