cancel
Showing results for 
Search instead for 
Did you mean: 

Howto send a mail with 2 attachments

Former Member
0 Kudos

hi experts,

i have to realise the following scenario:

- a customer sends us invoice-data via webservice

- sap-pi has to copy the payload

- sap-pi adds some default-values the new payload

- at the end i have to send an email with the original payload and the modified payload

(every payload as a separate attached file)

is this possible??

could anyone describe me the steps i have to do?

thx in advance,

dieter

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

thx for your answer - we solved our problem with a bean that we implemented in the communications channel of the sender.

our next problem is that we want to rename the attachments. we made the following settings in the communications channel of the receiver:

1 localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean 1

2 localejbs/AF_Modules/PayloadSwapBean Local Enterprise Bean swap

3 localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean 2

4 sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean mail

1 Transform.ContentDescription untitled.xml

1 Transform.ContentDisposition attachment;filename="original.xml"

1 Transform.ContentType text/xml;name="original.xml"

swap swap.KeyName payload-name

swap swap.KeyValue attachment-1

2 Transform.ContentDescription invoice

2 Transform.ContentDisposition attachment;name="invoice.xml"

2 Transform.ContentType text/xml;name="invoice.xml"

the message looks like this:

<SAP:Manifest xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:wsu="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="wsuid-manifest-5CABE13F5C59AB7FE10000000A1551F7">

- <SAP:Payload xlink:href="cid:original-ID.xml">

<SAP:Name>attachment-1</SAP:Name>

<SAP:Description>attachment</SAP:Description>

<SAP:Type>ApplicationAttachment</SAP:Type>

</SAP:Payload>

- <SAP:Payload xlink:href="cid:payload-8687af70bfd611dfb3f700e000c5720c<at>sap.com">

<SAP:Name>MainDocument</SAP:Name>

<SAP:Description>Main XML document</SAP:Description>

<SAP:Type>Application</SAP:Type>

</SAP:Payload>

</SAP:Manifest>

in our mail, the payload maindocument is an attachment with the name "invoice.xml" -> this works

but the second attachment in the mail is named "untitled.xml" and it's not possible for us to rename this attachment to "original.xml"

any ideas???

thx in advance

stefan_grube
Active Contributor
0 Kudos

In PI 7.1 you can use a Java mapping as first mapping step to copy the payload and add as attachment.

In PI 7.0 you can do this with a rather complex Java mapping which builds the whole MIME stream like this:

/people/stefan.grube/blog/2007/04/17/xi-mail-adapter-an-approach-for-sending-emails-with-attachment-with-help-of-java-mapping