cancel
Showing results for 
Search instead for 
Did you mean: 

email attachment to file

AntonioSanz
Active Participant
0 Kudos

Hi all, I am working on a email (with 1 attachment) to file escenario.

I have read michaels blog

http://scn.sap.com/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--...

in order to configure my system for getting the attachments.

Now the attachments are comming to my system.

I have checked on MONI and I can see 2 payloads.

Then I have configured my scenario like a file to file scenario without content conversion in order to write the attachment into a file. But my system get the first payload and not the payload related to the attachment.

How can I get the attachment payload?

Many thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184681
Active Contributor
0 Kudos

Hi,

This is actually already covered in Michal's blog. It is achieved with the PayloadSwapBean adapter module. So most probably you have just forgotten to prepare this config, or your settings are not fully correct. Especially, make sure that swap.keyValue attribute values are consistent with what you can see as the attachment name in moni. Moreover, the sequence of modules (PayloadSwapBean before the standard mail module) is also important.

Hope this helps,

Greg

AntonioSanz
Active Participant
0 Kudos

But, If i don`t know the name of the attachment? I am expecting an attachment, but I dont know the name. I just know that one attachment come and I have to process it.

It is that possible?

former_member184681
Active Contributor
0 Kudos

After a while, I think PI uses the name defined in PayloadSwapBean config. Could you please post screenshots of your adapter module config and payloads that you can see in Moni, just to confirm it? They should be helpful here.

Regards,

Greg

iaki_vila
Active Contributor
0 Kudos

Hi Antonio,

Have you tried to read the attachement with an UDF?:

GlobalContainer globalContainer = container.getGlobalContainer();

InputAttachments inputAttachments = globalContainer.getInputAttachments();

And check later the variable inputattachments.

https://help.sap.com/javadocs/pi/SP3/xpi/index.html

Regards.

AntonioSanz
Active Participant
0 Kudos

Lot of thanks Iñaki. With your aproach and the Java API now all it is working fine.