on 10-13-2009 7:53 AM
Hi all,
i am doing a receiver mail scenario (PI 7.1). my requirement is like this :
Receiver file need to be send in receiver mail attachment and attachment name should be dynamic
format for the attachment name should be like this
R+value from a particular field in payload +Timestamp
for example my file name should be like this R001_510815021009062532.xml
which is R+ 001_510815 + 021009062532 + .xml
can anybody suggest me how to go for this requirement? is ther any UDF or should i go for adapter module developement?
Thanks
sandeep sharma
Edited by: sandeep sharma on Oct 13, 2009 8:55 AM
Have a look at this WiKi too..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
after importing Mail.xsd as external definition you will find a field Content_Disposition and the value we pass to this field should be of following format.
Format: "attachment;filename="<filename>"",
so in the wiki http://wiki.sdn.sap.com/wiki/display/stage/DynamicEmailAttachmentnameforReceivedMails
the value to be passed is formatted using message mapping standard function cancat.
<filename> is the name of the attachment you want.In the wiki he has used Dynamic configuration to get the file name and want the same as the attchment name but in you want attachment name as
R+value from a particular field in payload +Timestamp
so create a UDF as
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","SourceFileTimestamp");
String timestamp = conf.get(key);
String fname="R"+"a"+timestamp;
a is the partcular field in the payload
and the mapping as
a(source Field)----> UDF--------> Content_Disposition
and pass application/xml constant value to Content _Type field in the Mail xsd(used as target Message type).
and While configuring the receiver mail adapter choose Use mail package and keep attachment
let me know if you have further doubts
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi K Fatima,
I read your solution.I have a similar requiement but I need to send the entire output payload as an attachment,so I am using XSLT to send the payload as an attachment.
I am creating the file name through dynamic configuration in XSLT but the name of attachment is not as required but its any random generated name:
*code used:*
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:map="java:java.util.Map"
xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration"
xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">
<xsl:output method="xml" version="1.0" encoding="UTF-8" />
<xsl:output indent="yes" />
<xsl:param name="inputparam"/>
<!-- mail parameters -->
<xsl:template match="*">
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<xsl:variable name="new-value" select="Shipment/InternalShipmentNum"/>
<Subject>Mail</Subject>
<From>xyz</From>
<To>abc</To>
<xsl:variable name="dynamic-conf"
select="map:get($inputparam, 'DynamicConfiguration')" />
<xsl:variable name="dynamic-key"
select="key:create('http://sap.com/xi/XI/System/File', 'Directory')" />
<xsl:variable name="dynamic-value"
select="dyn:get($dynamic-conf, $dynamic-key)" />
<xsl:variable name="new-value"
select="concat($dynamic-value, 'subfolder\')" />
<xsl:variable name="dummy"
select="dyn:put($dynamic-conf, $dynamic-key, $new-value)" />
<!--Content type -->
<Content_Type>application/xml</Content_Type>
<!Content Description>
<Content_Disposition>attachment;filename "<xsl:copy-of select="$new-value"/>"</Content_Disposition>
<!--Content Disposition -->
<Content_Description><xsl:copy-of select="$new-value"/></Content_Description>
<Content>
<xsl:copy-of select=".">
<xsl:apply-templates/>
</xsl:copy-of>
</Content>
</ns:Mail>
</xsl:template>
</xsl:stylesheet>
Please suggest ! I need the value in "Shipment/InternalShipmentNum" as name of attachment.
Thanks in advance!
Indu Khurana
Hi Sandeep
Yes ..you can give dynamic name in Attachment in Receiver mail Adapter
Pls go through the following Links
1) Dynamic name in the mail attachment
https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3202
2) sending emails with attachment with help of Java mapping
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/6321
Regards
Abhijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
refer this
http://wiki.sdn.sap.com/wiki/display/stage/DynamicEmailAttachmentnameforReceivedMails
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
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.