Dynamic attachment name in receiver mail adapter
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
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
Similar Messages
-
Dynamic attachment name with receiver mail adapter and use mail package
We need to send mapped XML payload as attachment (with dynamic name) to a recepient (recepient email id is part of input xml payload, but not part of the mapped XML payload).
I could probably do this using the adapter module (as per the following link),
http://wiki.sdn.sap.com/wiki/display/XI/Adapter%20Module%20PI%207.0%20Set%20Attachment%20Name?bc=true
I would like to explore if this would be feasible using Mail package and XI payload.I already have a Java mapping that is converting the input XML to required Output format. If I am using Mail package (XI Payload), how do I go about sending this Output XML from java mapping as attachment to email id available in the input payload?Hi,
1) XML payload as attachment (with dynamic name)
2) recipient (recipient email id is part of input xml payload, but not part of the mapped XML payload)
These two is possible by using Mail Package. You have a standard xsd for mail package which you can download from the SAP Note 748024.
The xml created in you java mapping which will be your attachment should be put into the <content> tag of the mail package xml structure. and the file name can be set in the <Content_Type> tag.
<?xml version="1.0"; encoding="UTF-8"?>
<p2:Mail xmlns:p2="http://sap.com/xi/XI/Mail/30">
<Subject>My Invoice</Subject>
<From>from email address<;/From>
<To>to email address</To>
<Content_Type>text/plain;name="MyFile.csv";</Content_Type> --> file name here
<Content>123;A49;aaa</Content> -> attachment xml here
</p2:Mail>
And you have to select MailPackage in the receiver mail adapter.
Regards,
Aravind -
Dynamic attachment name in receiver mail adapter for 1 attachment?
Hi,
seems to be a tricky thing....
The sender interface (file) picks up an xml file and a pdf document.
The receiver wants to get the xml file as a txt file and the pdf, both sent together by mail.
We are following this thread:
"Sending multiple attachments winthin a single Receiver Mail adapter in required format".
So far we are able to generate the txt file and send it together with the pdf to the recipient.
The txt file gets its name from the payload of the xml file.
Unfortunately the pdf should be renamed to the same name as the txt file.
And here we are stuck.
We generate the filename for the txt file in the mapping to the mail message (as usual ximail30.xsd).
But for the pdf we are only able to set a static name in the channel module page using
Transform.ContentDisposition.
Any ideas how to solve this are really welcome!!!!
(Solutions that do not talk about using a new module to be written are prefered.)
Regards
DirkHi,
seems to be a tricky thing....
The sender interface (file) picks up an xml file and a pdf document.
The receiver wants to get the xml file as a txt file and the pdf, both sent together by mail.
We are following this thread:
"Sending multiple attachments winthin a single Receiver Mail adapter in required format".
So far we are able to generate the txt file and send it together with the pdf to the recipient.
The txt file gets its name from the payload of the xml file.
Unfortunately the pdf should be renamed to the same name as the txt file.
And here we are stuck.
We generate the filename for the txt file in the mapping to the mail message (as usual ximail30.xsd).
But for the pdf we are only able to set a static name in the channel module page using
Transform.ContentDisposition.
Any ideas how to solve this are really welcome!!!!
(Solutions that do not talk about using a new module to be written are prefered.)
Regards
Dirk -
Error dynamic File Name in Receiver File Adapter
Hi all,
Dynamic file name for Receiver file Adapter Problem
my multi mapping look like this in design mode
messages
message1
SD01_E
FileName
row
message2
SD02_E
FileName
row
by processing the xml look like this:
<ns2:SD01_E xmlns:ns2="urn:lsv.de/SAP/XXX">
<FileName>L40SA939.xiConstant</FileName>
- <row>
or
<ns2:SD02_E xmlns:ns2="urn:lsv.de/SAP/XXX">
<FileName>L40SA939.xiConstant</FileName>
- <row>
in file receivere adapter i have try this but it dos not work
payload:SD01_E,1,FileName,1
Error:com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 0(:main:, row:1, col:0)
is there any way to have access to Filename in different root elements??
regards
RalfHi Ralf,
i think, you need for each XML msg (each different root element) a new adapter -> a new IF determination, new rec agreement and a new channel.
Regards,
Udo -
Dynamic File Name for Receiver File Adapter
Hi All,
How can we use dynamic name for Receiver file adapter?
Can anyone help.
Thanks in Advance
ChemmanzHi Chemmanz,
The dynamic filename generation concept is as follows.
In your filename field. just give a variable with % symbols. (eg: %file% ).
Now, under the option Variable Name Substitution, you can give how the value has to be created.
It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.
For the former, your give
message:interface_name ,etc
and for the payload part you give,
Payload: "your element root which u wanna acecss"
Just check this link out,
http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
And read the contents under variable substitution and it will help you understand the concepts better.
If you have any clarifications, do get back,
Regards,
Bhavesh -
How to set "Cc" field in Dynamic Email address in Receiver Mail adapter
I have done the configuration for setting up the dynamic email address using the XSD provided by SAP in note no 748024. It is working fine.
Michal's blog Mail Adapter (XI) - how to implement dynamic mail address. was a gr8 help in doing this.
But there is no clue of setting up of "CC" in email.
There should be "CC" in email is our bussiness requirement.
Would appreciate your helps.
with regards,
Ravi SiddamHi,
If you do not need mail package for other reasons, I suppose it is enough to provide a value in Dynamic Configuration for fields "THeaderTO" and "THeaderCC" and the select "Use Adapter-Specific Message Attributes" and "Variable Transport Binding" in receiver Mail Adapter.
see <a href="http://help.sap.com/saphelp_nw04/helpdata/en/6b/4493404f673028e10000000a1550b0/frameset.htm">SAP help</a> for more details.
Regards,
Daniele -
Email attachment name in sender mail adapter to the receiver file adapter
HI ,
Ths is regarding email to file scenario. I am trying to create file (in rceiver file adapter) with the same name as the email attachment that i read from mail sender adapter. I want ro use adapter module for this. I could find from blogs that there is module - GetAttachmentName - available that i can use for this in sender mail adapter.
Can you please let me know what whetehr i neeed to mention any module key and parameters for this.
I assume , i need to do following steps :Please confirm.
1. i can use this module - after payload swap module and before standard mail adapter module in sender mail adapter
2. select ASMA option in advanced tab in sender mail adapter
3. In receiver file adapter select ASMA option in advanced tab in sender mail adapter
4. Also select file name option in ASMA in sender mail adapter
Thanks,
VamsiHi Vamsi,
your scenario is also described here: Re: sender mail adapter - attachment name
If you use the Module getAttachmentName, which is described here,
http://wiki.sdn.sap.com/wiki/display/XI/AdapterModulePI7.0GetAttachmentName
your scenario should work as you described it.
You just need to make sure that the Attachment Name that you read in the first place, is mapped to the Filename Attribute of the
Fileadapter (http://sap.com/xi/XI/System/File/FileName).
regards,
Daniel -
Not renaming attachment xml file name in receiver mail adapter
Hi,
I receive SOAP from GRC and need send to Partner an email.
I have SOAP to MAIL scenario where an xml file is picked up and transformed and zipped into the target format in XI which has to be sent as an attachement in an email on the receiver side.
I am getting the mail with the attachement. But I would like to rename the attachment as the name "NFE.XML" and the ZIP File as the name "nfe.zip"
I am using MAIL adapter with Modules above.
Number Module Name Module Type Module Key
1 AF_Modules/PayloadSwapBean Local Enterprise Bean Transform
2 AF_Modules/MessageTransformBean Local Enterprise Bean ContentType
3 AF_Modules/PayloadZipBean Local Enterprise Bean zip
4 sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean mail
Module Configuration :
Module Key Parameter Name Parameter Value
Transform swap.keyName payload-name
Transform swap.keyValue NFE
ContentType Transform.ContentType application/xml; name="NFe.xml"
zip zip.filenameKey ContentType
zip zip.mode zip
I am using transport protocol "XIPAYLOAD" and set "KEEP ATTACHMENTS"
I have with result example above :
Name from ZIP : PayloadName.zipu200E(4KB)u200E
Name from attachment : PayloadName
Regards,
RicardoHi Shobhit,
The module tab of your mail adapter will look like this.
Processing Sequence
Module Name Type Module Key
localejbs/AF_Modules/MessageTransformBean rename LocalEnterpriseBean
sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean mail Local EnterpriseBean
Module Configuration
Module Key Parameter Name Parameter Value
rename Transform.ContentDescription File
rename Transform.ContentDescription attachement;filename="yourfilename.ext"
rename Transform.ContentType application/text;name="yourfilename.ext"
Thanks
Amitanshu -
Renaming attachment file name in receiver mail adapter
Experts,
I have a file to mail scenario where an xml file is picked up and transformed into the target format in XI which has to be sent as an attachement in an email on the receiver side.
I am getting the mail with the attachement. But I would like to rename the attachment as the name of the picked up file.
I am using Adapter specific message attributes on both sides but the attachment is named as untitled.xml.
Please advise. Can this be achieved by using the swap bean or the message transform bean?
Regards,
ShobhitHi Shobhit,
The module tab of your mail adapter will look like this.
Processing Sequence
Module Name Type Module Key
localejbs/AF_Modules/MessageTransformBean rename LocalEnterpriseBean
sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean mail Local EnterpriseBean
Module Configuration
Module Key Parameter Name Parameter Value
rename Transform.ContentDescription File
rename Transform.ContentDescription attachement;filename="yourfilename.ext"
rename Transform.ContentType application/text;name="yourfilename.ext"
Thanks
Amitanshu -
How can i get message id as file name in Receiver Mail Adapter
Hi All,
We are working on file to mail scenario. Client requirement is " Attached file name should be the message id" How can we achieve this.
Thanks & Regards,
PurshothammHi,
To have the file name as message id, I think the below blogs can help you
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii
Regards,
Vijay N -
Setting dynamic file name in Receiver file adapter - not from payload
Guys I just remember reading a weblog but can't find it now that I need it, on how to set the file name in message mapping dynamically but not using any payload field.
Please let me know if you remember this.
Thanks a lot,
Viktor Vargaalso u can check in
<a href="/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II</a>
<a href="/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14: The same filename from a sender to a receiver file adapter - SP14</a> -
Dynamic File name in Receiver File adapter
Hi,
My Scenario is Proxy to File.
I must create filename dynamically in the receiver file adapter by taking the sales order number and divison from the source.
How can i create a dynamic filename? i searched the forum, but i could not get the correct answer,
Please help me out.
Regards
SrinivasHi Srinivas,
> My Scenario is Proxy to File.
> I must create filename dynamically in the receiver file adapter by taking the sales order number and divison from the source.
public String targetFileName(String Sono, String Div, Container container) throws StreamTransformationException
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String MyFileName = sono + div + "<filename>"+".xml";
conf.put(key, MyFileName);
return MyFileName;
File name you can format according to your requirement.
And one more thing for this you have to specify the ASMA properties. For this check the below link step-1 and step-2.
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
Regards
Ramesh -
Dynamic directory name in Receiving File adapter
Hi,
In File to File senario, In receiving system i want to create directory name dynamically. In my mapping there is a field called name, the directory name in the receiving system will be value in the name field. Any one can help me how to do this one...
Thanks
RaoHello,
Please follow the below to achieve the same.
input - Store number,
UDF
String dynaname = input;
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION );
DynamicConfigurationKey key = DynamicConfigurationKey.create(
"http://sap.com/xi/XI/System/File","FileName");
conf.put(key,dynaname);
return "";
UDF mapping
Source[input] -
> UDF --> Rootnode of target structure.
Hope it helps.
best regards,
raj. -
Dynamic file name of the attachment in receiver mail adapter
Hi
I have configured a receiver mail adapter which receives the payload as an xml attachment.
Right now the file name of the attachment is hardcoded to "invoice.xml".
I want to set it to dynamic ie. instead of "invoice.xml"... i want it as "invoice<invoicenumber>.xml".
Invoice number is present in the payload.
please suggest a solution w/o the need to develop a custom adapter module.
Thanks!
Regards,
Faria MithaniHi,
Go through this thread..
Dynamic File Name for Receiver File Adapter
Regards,
Sarvesh -
Receiver Mail Adapter File Name
Hi All,
I have a scenario file to Mail.
The rquirment is that everytime the file is picked by the adapter a mail needs to be sent.
The email should just have the file name of the file that got picked up by the file adapter but there should be no attachment in the email, just the file name either in subject or in the body of the email.
No Mapping should be used.
Can this be done?
Regards,
XIerHi,
You can do the File to Mail scenario as the normal way.
For Receiver side just consider one field as payload and don't map the other fields from File.
You can get the File name with the use of Dynamic configuration. Please refer
Refer this blog. for File to Mail
/people/varadharajan.krishnasamy/blog/2007/01/09/troubleshooting-soap-message--xi
File to Mail scenario help
Refer for getting file name in mapping
How to include the file name as an XML field
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2664. [original link is broken] [original link is broken] [original link is broken]
Dynamic File Name for Receiver File Adapter
/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii
Thanks
Swarup
Maybe you are looking for
-
IMac 2013 and Windows 8.1 Connectivity
Up until I installed Yosemite, I could connect my new Windows 8.1 computer to my iMac external hard drives. ( I have 5 of them hooked up to the iMac) and could access all of my files.) without a problem. Now I can't access not 1 one of them. I can ge
-
Why do I get a "script error" from flash player when it is not installed separately? It is part of my browser--IE 11
-
For black and white images in technical manuals, which format do you prefer?
So, I'm new at this company, and the person who is training me uses the EMF format for the images on the manuals. Do you think a PNG file would be a better option for illustrations?
-
I cant sync music or photos anymore
i cant sync anymore music or photos on my ipod. everytime i tell it to sync the new playlist i have created it tells me that i cant because there is not enough free space left in the music library to do so. i only have like 100 songs on there. what i
-
Is it possible to create a Functional module dynamically?
Hello All, Does any one know whether is it possible to create a FM dynamically and write some code in it? Regards, Lisa.