cancel
Showing results for 
Search instead for 
Did you mean: 

How to send incoming XML as mail-attachment

Former Member
0 Kudos

Hi Experts,

I have the following scenario: an incoming XML-file should be send as attachment of a mail. Now, I have defined incoming message with the structure of the xml-message and outgoing message as mail-package. In the message mapping I fill the nessesary mail-fields. In my receiver comm.channel (mailadapter) I checked "Use mail package" and "Keep attachment".

Result is that the mail is created and send ok, but without attachment....what am I doing wrong here?

Regards,

William

Accepted Solutions (1)

Accepted Solutions (1)

vijay_b4
Active Contributor
0 Kudos

Hi JWD,

You should configure the mail adapter with 'use the mail adpater' and 'keep attachments'.

Create an XML file conform the XML structure provide by SAP

The mail package should look like this:

<?xml version="1.0" encoding="utf-8"?>

<ns:MT_Mail_Sent xmlns:xi="http://sap.com/xi/XI/Mail/30">

<xi:Mail>

<Subject>Item</Subject>

<From>MAIL ADDRESS</From>

<To>MAIL ADRESS</To>

<Content_Type>multipart/mixed; boundary="AaBb--984dfgeSSd3532"</Content_Type>

<Content_Disposition>attachment</Content_Disposition>

<Content>

AaBb984dfgeSSd3532

Content-Type: text/plain

this is sample data.

AaBb984dfgeSSd3532

Content-Type: text/plain;name="CSV_data.csv"

Order number;Item number;description<xsl:text> </xsl:text>

<xsl:for-each select="Article_line">

<xsl:value-of select="Ord_nmbr"/>;<xsl:value-of select="Item_nmbr"/>;<xsl:value-of select="Description<xsl:text>

</xsl:text></xsl:for-each>

AaBb984dfgeSSd3532

Content-Type: text/plain;name="TXT_data.txt"

Order number;Item number;description<xsl:text> </xsl:text>

<xsl:for-each select="Article_line">

<xsl:value-of select="Ord_nmbr"/>;<xsl:value-of select="Item_nmbr"/>;<xsl:value-of select="Description<xsl:text> </xsl:text></xsl:for-each>

AaBb984dfgeSSd3532

.

</Content>

</xi:Mail>

</ns:MT_Mail_Sent>

In the above example you should have some content and 2 attachments (1 csv file and 1 txt file).

After each break (AaBb984dfgeSSd3532) specify again the 'Content-Type'.

*When you want to send a message payload as described, you have to set in the mail receiver channel the parameter Content Encoding to None and uncheck Keep Attachments.

The last boundary AaBb984dfgeSSd3532 should be omitted, as the mail adapter sets that border itself (tested with SP16)*

Reward points if this helps

Regards

Pragathi.

Answers (7)

Answers (7)

Former Member
0 Kudos

hi

Just go thru this document~

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6d967fbc-0a01-0010-4fb4-91c...

Can you just go through the below urls and configure your mail adapter:

/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure

/people/sap.user72/blog/2005/06/08/sending-attachments-in-mails

/people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems

/people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter

Note: reward points if solution found helpfull

Regards

Chandrakanth.k

former_member556603
Active Contributor
0 Kudos
former_member187563
Contributor
0 Kudos

hi,

1.Have you imported xsd for mail attributes.

2.then in mapping test the scenario using TO,FROM AND CONTENT.

3.save that xml file.

4.in receiver adapter SELECT MAIL PACKAGE and KEEP ATTACHMENT,the content should go as attachment.

regrds,

ujjwal kumar

Former Member
0 Kudos

Hi Ujjwal,

thanks, but how should I fill the mail-content node?

Regards

William

former_member187563
Contributor
0 Kudos

hi,

After importing the xsd,you place that in sender and receiver message mapping structures,and do one to one mapping between them.

Then directly put your data(what you want to send ) in content and part of xml and send that,a attachment will be created.

And if you are not getting attachment then

You can select

message protocol :XIPAYLOAD

and dont use mail package

write TO,FROM IN XI

and select keep attachment.

regards,

ujjwal kumar

prateek
Active Contributor
0 Kudos

The config u showed is ok. Make ur u have activated the communication channel after changes. Also make sure u have selected proper message and transport protocols

Regards,

Prateek

vijay_b4
Active Contributor
0 Kudos

Hi JWD,

May i know the attachment you said is a URL link or a link to the TCODE or any other office document.

Because there are different way of handling this there things.

your e-mail is the result of a SendMail step in a workflow?

If so, the standard solution doesn't have any support for attachments as far as I know. Attachments, e.g. to enter SAP Business Workplace or display the work item, is something that the work item notification report adds to the mail messages.

If your e-mail is the result of work item notification, make sure you have selected the attachment options if you are using RSWUWFML2, or that your customizing specifies inclusion of attachments if you are using the extended work item notification solution in more recent releases.

You definitely need RSWUWFML2. Look at notes:

691774

688712

Reward points if this helps

Regards

Pragathi.

aashish_sinha
Active Contributor
0 Kudos

Hi,

Can you just go through the below urls and configure your mail adapter:

/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure

/people/sap.user72/blog/2005/06/08/sending-attachments-in-mails

/people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems

/people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter

also with this

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6d967fbc-0a01-0010-4fb4-91c...

Regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos

Hello,

You can use localejbs/AF_Modules/MessageTransformBean

You have to set the parameter :

Transform.ContentDisposition as

attachment;filename=”myFileName.xml”>

*********Reward points if found sueful

Former Member
0 Kudos

Hi,

thanks for the quick response! I added this line to my CC but no result.. Maybe this has something to do with my mapping? How do I have to map the content of my target mail-message? Let me describe the source-file...

inputfile:

<MT_name>

<header>

<...>

<...>

<Item>

<...>

<...>

At the moment I did not map the MT_name to the mail-content....

Regards

William

Former Member
0 Kudos

Hi,

Have a glance at the blog.........hope it may solve your problem.....

/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step

Thanks,

Madhu