Dynamic Filename in Receiver mail adapter is it possible without module?
Hi,
I need to send the file name in email adapter dynamically.Presently iam getting the filename as untitled.xml in the email .The keep attachments is checked in the mail adapter.
I need to rename the file based on the input field name and timestamp .for example if i get the input field xxxx then the filename should be set as xxxx + timestamp .xml.I tried to use the UDF for dynamic configuration but it didnot help me out.Please help me.
Thanks
Rajesh
Use below code snippet... It should work. If you want timestamp different change accordingly. Currently I do date followed by time as per my requirement.
SimpleDateFormat simpledatFormat = new SimpleDateFormat("yyyyMMdd");
Date date = new Date();
String datewithYear = simpledatFormat.format(date);
SimpleDateFormat simpledatFormat1 = new SimpleDateFormat("HHmmss");
Date date1 = new Date();
String datewithMs = simpledatFormat1.format(date1);
DynamicConfiguration conf = ((DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION));
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File" , "FileName");
String oldFileName=conf.get(key);
String valueNew;
if( oldFileName == null){
valueNew =oldFileNamedatewithYeardatewithMs+".xml";
//set the new filename
conf.put(key, valueNew);
Similar Messages
-
Dynamic filename in receiver AS2 adapter in B2B Add-on
Hello Experts,
Can you please let me know how we can put dynamic filename in the receiver AS2 adapter for B2B Addon on SAP 7.4.
Thanks
SaurabhHi Ryan / Experts,
Let me explain you in more detail.
In the receiver AS2 Communication channel, if I keep the Filename field as blank as shown below, then in the Mendelson inbox folder, a file is generated with the name "ASJAVA_DX5" which is my business component name.
If I fill the filname field for example with "CONTRL", then in the Mendelson inbox folder, a file is generated with the name "CONTRL".
This is my requirement because, suppose i trigger this interface "first time", a file with static name (ASJAVA_DX5/CONTRL ) would be generated in the inbox folder. If I trigger this interface "second time", since the file already exists with same name, it is not overwritten and I cannot check the output of 2nd trigger . Contents are not overwritten.
To solve this problem + as a general requirement, I wish to have this name to be dynamic, atleast with date+timestamp.
Can you please help. -
Dynamic Filename on Receiver File Adapter
Hi,
I am running XI 3.0 SP 14.
The scenario is
SAP R/3 (IDOC) > XI (Receiver File Adapter)> FTP Server
There is no mapping on the XI side, we just drop the IDOC XML on to the ftp server.
I would like to configure a dynamic file name on the Receiver File Adapter where if the 'MSATZ' Field
within the E1EPD04 segment of the IDOC is populated then I would like to send a separate
Filename than the one specified on the 'File Name Scheme'.
Has anybody done this or any suggestion how I should go about this please.
Thank you.
Warm Regards,
RanjanHi Guys,
When I tried to create the User defined function as below, I got the Null value for the "StreamTransformationConstants.DYNAMIC_CONFIGURATION" object.
My code looks like this,(this is part of the debuging code)
Start
public String Create(String a,String b,Container container){
if (container.getTransformationParameters() == null)
return "conf.null";
if (container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION) == null)
return "Dynamic.null";
return b;
--End
On the output I get the value "Dynamic.null". I do not know why the object value is Null.
Any suggestion pls.
Thank you.
Warm Regards,
Ranjan -
Dynamic excel filename Receiver Mail adapter
Hi all,
May i know what is the way to dynamically set the file name of attachment in receiver mail adapter.
Can we do using DynamicConfiguraion???
If yes how?
Thanks In Advance,
H.L.BabuBut i am not using any mail package.
and also in adapter module i have written code like..
byte by[] = generateExcel(is);
xp.setName(filename);
System.err.println("The name of the file."+filename);
xp.setContentType("application/vnd.ms-excel");
xp.setContent(by);
System.err.println("After successful setting of XML Payload");
msg.setDocument(xp);
System.err.println("Message Set is successful");
But it is not getting the excact file name..
Any coments.. -
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 -
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 -
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 -
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 -
Configuring Receiver mail adapter with dynamic email addresses
Hi,
I'm a newbie to XI and I have problems in configuring the Receiver mail adapter with the "Use Mail package" option selected. I am trying pickup a file (using file adapter on Sender side, picks up a simple XML file) and after mapping in XI, send the message as an email message to dynamic email addresses.
Everything works fine if I did not select the "Use Mail Package". But when I choose that option it errors out. I followed this blog posted on SDN -
/people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
The following XML message is my source
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/Somenamespace">
<ns0:Message1>
<ns1:studentlisttest xmlns:ns1="urn:karthiksender_to_karthikreceiver">
<Student>
<studentid>1</studentid>
<lastname>Studentlastname</lastname>
<firstname>Studentfirstname</firstname>
</Student>
<Mail>
<From>[email protected]</From>
<To>[email protected]</To>
<Subject>Test mail adapter</Subject>
</Mail>
</ns1:studentlisttest>
</ns0:Message1>
</ns0:Messages>
What I want to accomplish is, I have a simple message mapping where the Studentdetails are mapped to, lets say Customer details. For convenience lets keep it simple, StudentId --> Customerid, (student)Firstname --> (customer)Firstname, (Student)Lastname --> (customer)Lastname
I would like to get the Customer details as an XML attachment or in the body of an email with from, to and subject corresponding to that specified in the <Mail> node.
I followed the instructions posted on the blog and it works fine if I don't map the studentdetails to customerdetails. I did multimapping, with one source message (the xml file I posted above) and two target messages (customerdetails and Mail, which is the external definition posted on the blog). I beleive I'm missing something here. Could somebody please guide me through this?
Thanks
Karthikhi,
I still have not found the solution for this problem. Michal, your blog works fine when my source message has got only the mail details. As per your advice, I tried modified the structure of the xsd file as follows
<xs:schema targetNamespace="http://sap.com/xi/XI/Mail/30"
xmlns:xi="http://sap.com/xi/XI/Mail/30"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!--
Mail
-->
<xs:element name="Mail">
<xs:annotation>
<xs:documentation>Mail package for XI - Mail Adapter</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Subject" type="xs:string" minOccurs="0"/>
<xs:element name="From" type="xs:string" minOccurs="0"/>
<xs:element name="To" type="xs:string" minOccurs="0"/>
<xs:element name="Reply_To" type="xs:string" minOccurs="0"/>
<xs:element name="Content_Type" type="xs:string" minOccurs="0"/>
<xs:element name="Date" type="xs:dateTime" minOccurs="0"/>
<xs:element name="Message_ID" type="xs:string" minOccurs="0"/>
<xs:element name="X_Mailer" type="xs:string" minOccurs="0"/>
<xs:element name="Content" minOccurs="0">
<xs:annotation>
<xs:documentation>any type</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="encoding" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="MailReceipt">
<xs:annotation>
<xs:documentation>Mail Receipt for XI - Mail Adaper</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Server" type="xs:string"/>
<xs:element name="Format" type="xs:string"/>
<xs:element name="UseMailPackage" type="xs:boolean"/>
<xs:element name="Encoding" type="xs:string"/>
<xs:element name="Subject" type="xs:string" minOccurs="0"/>
<xs:element name="From" type="xs:dateTime" minOccurs="0"/>
<xs:element name="To" type="xs:string" minOccurs="0"/>
<xs:element name="Date" type="xs:dateTime" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CustomerlistExternal">
<xs:annotation>
<xs:documentation>Customer List</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Customername" type="xs:string"/>
<xs:element name="Customerid" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
My source message will be something like
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<ns1:studentlisttest xmlns:ns1="urn:karthiksender_to_karthikreceiver">
<Student>
<studentid>1</studentid>
<lastname>abclname</lastname>
<firstname>abcfname</firstname>
</Student>
<Mail>
<From>[email protected]</From>
<To>[email protected]</To>
<Subject>Testing Mail adapter</Subject>
</Mail>
</ns1:studentlisttest>
</ns0:Message1>
</ns0:Messages>
I have mapped the <student></student> information to customerlist, with customerid --> studentid and customername --> firstname or lastname (for symplicity). This was a multimapping with one source and two target messages. My test mapping output is
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<ns2:Mail xmlns:ns2="http://sap.com/xi/XI/Mail/30">
<Subject>Testing Mail adapter</Subject>
<From>[email protected]</From>
<To>[email protected]</To>
</ns2:Mail>
</ns0:Message1>
<ns0:Message2>
<ns2:CustomerlistExternal xmlns:ns2="http://sap.com/xi/XI/Mail/30">
<Customername>abclname</Customername>
<Customerid>1</Customerid>
</ns2:CustomerlistExternal>
</ns0:Message2>
</ns0:Messages>
So how would I get this part of the <CustomerlistExternal></CustomerlistExternal> part of the message as an attachment to the mail address specified in the <ns2:Mail></ns2:Mail> tags.
I'm definitely not understanding it right and am missing something. Could you give me step by step instructions to acheive this. I apologize for the trouble..this would be of great help to me.
Thanks
Karthik -
How to send mails to "CC" and "BCC" using receiver mail adapter dynamically
Hi,
Due to business requirement PI need to send mails dynamically to u201CCCu201D and u201CBCCu201D using receiver mail adapter.
We have an option to send mails to u201CTou201D dynamically, but are there any option to send mails u201CCCu201D and u201CBCCu201D dynamically.
Please some help to resolve the issue. Thanks
Regards,
Sreeramulu Konjeti.Hi Sreeramulu,
As mentioned by Lucas, you can use the UDF. Inn addition to that, you need to define the Variable Headers under Variable transport binding after enabling the Adapter Specific Message Attributes.
For the Enabling ASMA, follow the below steps and check for the variable attributes.
Select the Advanced tab page.
To save adapter-specific attributes in the message header of the XI message, select Use Adapter-Specific Message Attributes and Variable Transport Binding.
The following attributes in the message header are then available for processing:
○ User: (technical name: TServerLocation)
○ Authentication key: (technical name: TAuthKey)
The following mail header fields are available for processing:
○ From: (technical name: THeaderFROM)
○ To: (technical name: THeaderTO)
○ Cc: (technical name: THeaderCC)
○ Bcc: (technical name: THeaderBCC)
○ Subject: (technical name: THeaderSUBJECT)
○ Reference to the mail that is to be replied to: (technical name: THeaderIN-REPLY-TO)
○ Reply to: (technical name: THeaderREPLY-TO)
○ Mail client program: (technical name: THeaderX-MAILER)
○ Send confirmation of receipt: (technical name: THeaderDISPOSITION-NOTIFICATION-TO)
○ Priority: (technical name: THeaderPRIORITY)
○ Importance of message: (technical name: THeaderIMPORTANCE)
To transfer further header fields, set the relevant indicator for Variable Header. The technical names for the fields are XHeaderName1, XHeaderName2, and XHeaderName3.
The parameters are included in the mail header under the names specified here.
The attribute namespace for the adapter is http://sap.com/xi/XI/System/Mail.
Thanks, -
Receiver Mail Adapter, Mail Package with Payload as Attachment
Hi Everyone,
I have spent the better part of the day today searching and testing all of the different combinations that I could think of to solve this problem, so please don't just do an SDN search for me and cut/paste in the links as there are too many contradictive answers piling up over the last year.
I am trying to use a Receiver mail adapter to send some data using the mail package, and I want to have the <content> tag be in an attachment. I am using mail package to dynamically set the mail address, but to also try and turn my data into a csv file that the recipient can open in Excel.
My mail package sets the following values:
<Content_Type>text/plain</Content_Type>
<Content_Disposition>attachment</Content_Disposition>
<Content>Sample Text</Content>
This blog is basically what I am trying to do:
<a href="/people/community.user/blog/2006/09/08/email-report-as-attachment-excelword:///people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
But no where in here is he setting ContentDisposition, and he is (potentially) not using the MessageTransformBean module.
It is unclear if I need to use the MessageTransformBean to make this work?
Questions:
1) Do I need to use the MessageTransformBean?
2) Do I need to set the ContentDisposition in the mail package?
3) Does Service Pack matter with these settings? We are on SP15 upgrading to SP18 very soon.
Thanks
PeterHi Peter,
try:
<Content_Type>text/plain;name="file.csv"</Content_Type>
<Content_Disposition>attachment;filename="file.csv"</Content_Disposition>
<Content>Sample Text</Content>
Regards
Stefan -
Change "subject" in Receiver Mail Adapter Module
Hi all,
following the "How To Guide" I developed a Module for my receiver mail adapter. Everything works fine.
Now my question: is it possible to change the content of the mail-"subject" in the module?
Your help is appreciated.
CarmenHi Stefan,
maybe I should describe my problem more detailed:
My scenario is RFC-XI-Mail. I use the mail package to determine the receiver of the mail dynamically. Another thing I want to do, is to attach a file to this mail which is located on the server. So far so good.
My problem is, that the name of the file (which I need in my adapter module) changes for every mail. So what I need is the possibility to deliver it to the adapter module.
I found out that it is possible to read the payload. So my idea was to hand it over in one of the fields like "subject". But now I want to change the subject afterwards...(delete the filename).
Maybe you have another idea?
Regards
Carmen -
In Receiver Mail Adapter ,how to ignore SOAP Header attachment
HI Folks,
Am using Receiver Mail Adapter and am getting 2 attachments.
1. one is Soap header which contains Control records
2. payload
I want only Payload as attachment and need to ignore SOAP Header(AT00001.xml).
The configuration is as below:-Trasport protocol : SMTP
Message Protocol: XIALL
Please provide Inputs.
Thanks & Regards
Ashok ReddyHi Gagandeep,
Scenario: File------>mail( Bypass scenario)
i had posted file in FTP and am getting attachment properly but aditionally am getting ATT00001.xml as SoapHeader.this i need to ignore.
PFB Module Parametrs i used:
localejbs/AF_Modules/MessageTransformBean LocalEnterpriseBean transform
Modulekey Parameterattribute value
transform Transform.ContentDisposition attachment;filename=”Pocr_860.txt”
transform Tansform.ContentType text/plain
Regards
Ashok -
Receiver Mail Adapter message with PDF attachment
Hi.
We are trying to generate emails from the mail adapter that includes the plain text in the body of the resulting email and an attached PDF file. We receive the following structure:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:newMailRequest_MT xmlns:ns0="http:/pdk/sap/TorstenTest">
<Sender/>
<Receiver/>
<BodyContent/>
<Subject/>
<Attachment/>
</ns0:newMailRequest_MT>
I have set up an interface and mail adapter to be able to produce emails with plain text in the body. I used SAP note 748024 for this.
So right now I can make XI send emails with dynamic mail addresses. My problem lies in sending attached files with the mails as well.
I have read most of the threads in here, but none of them seem to answer just how to include the attachment. Which field in the 'Mail' message type is used for the attachment??
What needs to be added to the communication channel and adapter for it to include attachments, while the body of the mail still keeps the plain text message??hi
I have used the following links to send the file as an attachement and as payload.
so it may help u.
links:
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure - Mail Adaptor options , mail attatchment
Sender mail adapter - PayloadSwapBean - Step by step - https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6d967fbc-0a01-0010-4fb4-91c6d38c5816
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken]
/people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
points if helpful.
regards
sreeni -
How to pass dynamic filename to Receiver JMS channel
Hi experts,
I want to pass the dynamic filename to receiver JMS message Properties.
for example
I am passing directory name via adapter module AF_Modules/DynamicConfigurationBean with key and value combination like below. How to pass dynamic filename value to a dynamic property ( say DCJMSMessageProperty1)
eg.
key.0 - >insert http://sap.com/xi/XI/System/JMS DCJMSMessageProperty0
value.0 - > testdirectory ( which is static value)
Note: Im have not created any ESR object . i just have to bypass the file to a jms queue. I have used AAE integrated configuration scenario ( file to jms )
Regards,
Balaji
Edited by: Balaji Pichaimuthu on Jan 27, 2011 4:45 PM
Edited by: Balaji Pichaimuthu on Jan 27, 2011 4:46 PMAlready given link for the dynamic configuration code snippet in the earlier reply... Below is the code snippet
Note: Use Adapter Specific Message Attributes for the target Communication Channel(CC).Check the indicator for filename in the advanced tab of CC
//UDF code
String filename="";
String NameSpace = "http:/"+"/sap.com/xi/XI/System/JMS";
try{
DynamicConfiguration conf = (DynamicConfiguration) param.get(
StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
// read filename value
filename = conf.get(key);
// So far we extracted filename value .. now do your logic something like this...
DynamicConfigurationKey key2 = DynamicConfigurationKey.create(NameSpace,"yourjmsvalue goes here");
conf.put(key2,filename);
} catch(Exception e){
Maybe you are looking for
-
K7N2 Delta (ILSR) incompatible with 200FSB?
Is the K7N2 Delta (Nforce2 Chipset) incompatible with 200FSB??... Ive seen many problems when trying to upgrade the CPU, and use a 200FSB in various forums. So, why does it keep hanging/crashing?? Might it be not really supported even though it speci
-
Dynamically refresh to report regions
I have a page with multiple regions. Two of the regions are report regions that I want to refresh dynamically. I am using 4.0. I created a dynamic action that fires based on an item's value changing. It contains two actions, a 'Refresh' action for ea
-
Does anyone know where to find an example of a data bound tree? The static one here(http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/tree.html) isn't very helpful. Thanks.
-
Auto Lock frequency is not long enough
I need to be able to have more than 5 minutes before an auto-lock occurs. We are using iPads to connect to a patient's Electronic Medical Record via a Terminal Server. It usually takes more than 5 minutes to see a patient and when the Auto Lock activ
-
I just bought an iMac because my HP crapped out on me, but I have a lot of files of photos on my iPhone and want to transfer them to my iMac...How do I do that?