on 08-31-2005 1:54 PM
Hi,
I want to send the Message-Content as a mail attachment with a specific Filename (e.g. 2005-08-31.csv). The content is a CSV File, not a XML
In the scenario an IDOC is sent to the XI mapped in a CSV-File (via Java-Mapping) and should be send as a Mail Attachment.
Is this possible and how?
Thank you for your help
Thomas
Hi Thomas,
You can influence the filename with the ModuleTransformBean. You need at least SP9 for this feature.
In the Mail Receiver Channel got to tab "Module"
As first module (before the mail module) enter:
localejbs/AF_Modules/MessageTransformBean as Local Enterprise Bean with any key
For this module key you can use in the module configuration following entries:
Transform.ContentDisposition inline|attachment;filename=<filename>
Transform.ContentDescription <Filename>
Transform.ContentType <MimeType>/<SubType>;name="<filename>"
If you want to send an attachment, use:
Transform.ContentDisposition attachment;filename="MyFile.csv"
Transform.ContentDescription MyFile
Transform.ContentType text/plain;name="MyFile.csv"
If you use the Mail Package, you can set the file name that way:
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<Subject>Hello</Subject>
<From>sender@sender.com</From>
<To>receiver@receiver.com</To>
<Content_Type>text/plain;name="MyFile.csv"</Content_Type>
<Content>Here comes the CSV Data</Content>
</ns:Mail>
Hope that helps,
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefan,
I tried the Mail Package method and have one problem. The mail is send correctly, with the csv as an attachment, but the file name is...
payload-7bfa60a11ab511da87b100096b1a234f@sap.com.txt
instead of MyFile.csv.
The Payload contains the following XML...
<?xml version="1.0" encoding="UTF-8"?>
<p2:Mail xmlns:p2="http://sap.com/xi/XI/Mail/30">
<Subject>My Invoice</Subject>
<From>xi@mail.com</From>
<To>me@mycompany.com</To>
<Content_Type>text/plain;name="MyFile.csv"</Content_Type>
<Content>123;A49;aaa</Content>
</p2:Mail>
Thank you for your help
Thomas
In my latest tests in SP13 I used following element in the Mail Package:
<Content_Type>text/plain;charset="ISO-8859-1";name="xyz.txt"</Content_Type>
This worked only, when ContentDescription in the module configuration was not set (but ContentDisposition has to be used).
In this case you can use dynamic attachment names, when when assign the name in the mapping.
There might be some issues in lower releases, so the best would be, if you patch to SP13.
Regards
Stefan
Message was edited by: Stefan Grube
Hi,
I wrote my one bean to add the payload as an attachment to the Email with a dynamic name. But I am not able to change the ContentType to "text/comma-separated-values". As a result my attachment has the correct name (a timestamp) but the ending is always .txt or .bin. In the Interface definition of the Interface Message (com.sap.aii.af.ra.ms.api) is described, that the attachment type can be XML, text or binary. I think that's the problem.
@Stefan
I will try your solution via the Mail Package.
Maybe I can influence the Content Type there...
Thank you for your help
Thomas
PS: we now have SP14
The ContentType text/csv is too new to be considered in the mail adapter.
http://www.rfc-editor.org/rfc/rfc4180.txt
According to the specification, all unknown sub types of text are treated as text/plain.
http://www.ietf.org/rfc/rfc2046.txt
Therefore you are not able do define a suffix .csv at the moment. The only way is, adding the name of the attachment to the ContentType:
text/csv;charset="utf-8";name="myFile.csv"
Regards
Stefan
Hmm it doesn't work. My payload was the following...
<?xml version="1.0" encoding="UTF-8"?>
<p2:Mail xmlns:p2="http://sap.com/xi/XI/Mail/30"><Subject>Invoices from Endress&Hauser GmbH & Co KG</Subject><From>xxx@xxx.com</From><To>yyy@yyy.com</To><Content_Type>text/csv;charset="utf-8";name="myFile.csv" </Content_Type><Content>A1,A2,A3,A4,A5,A6,A7,A8,A9,
B1,B2,B3,B4,B5,B6,B7,B8,B9,
</Content></p2:Mail>
As the Message-Protocol I choose XIPAYLOAD. At Mail-Attribute I checked Use Mail-Package and Keep Attachments. Coding was base64
I received a mail with the csv data (A1,A2,...) as an attachment but the name still was...
payload-cc6f03303a6b11da888000096b1a234f@sap.com.bin
Thomas
PS: In this test I don't use any additional Module
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.