Dynamic Subjet in Mail Adapter

Hi everybody,
Landscape: I would like to fill dynamically the "Subject" field in a Mail Adapter. We receive data from a JMS Adapter and if no rule match the condition, it will send an email with the DCJMSCorreleation in the subject or in the body. In addition, we can receive flat or xml files.
I tried to use an Mail Package, with a XSLT mapping but it doesn't run with a flat file (XML Parser error in Integration Engine). Then, I tried to use a SOAP adapter but we encountered the same issue with the flat file.
Is someone can help me?
-> How to allow flat file handling in XSLT or SOAP Adapter?
-> How to get value from the SOAP Document?
Many thanks in advance,
Regards,
Landry

Many thanks for your help!
With a Java Mapping (or UDF), it works perfectly. Here the code of the Java Mapping used in order to fill the DCJMSCorreleationID in the mail's subject:
// Retrieve the DCJMSCorreleationID
               trace = (AbstractTrace) param
                         .get(StreamTransformationConstants.MAPPING_TRACE);
               DynamicConfiguration attrib = (DynamicConfiguration) param
                         .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
               DynamicConfigurationKey fileKey1 = DynamicConfigurationKey.create(
                         "http://sap.com/xi/XI/System/JMS", "DCJMSCorreleationID");
               DynamicConfigurationKey fileKey2 = DynamicConfigurationKey.create(
                         "http://sap.com/xi/XI/System/Mail", "THeaderSUBJECT");
// Set the mail subject with the DCJMSCorreleationID
               attrib.put(fileKey2, "Unknown DCJMSCorreleationID: "
                         + attrib.get(fileKey1));
Regards,
Landry

Similar Messages

  • Dynamic filename in mail adapter

    Hi,
    how can I set the filename of a mail attachment dynamically in a receiver mail adapter (also dynamically configured)?
    I had to uncheck the "keep attachment" because of our scenario.
    If I check this box I get a .xml file which I can rename with the MessageTransformBean (but not dynamically?) but I get to much files in the mail.
    Now I get a .dat file and want to rename it dynamically in e.g. dynamicName.txt.
    Can you give me some input how to do that?
    Thanks in advance
    Dominic

    Hi
    <i>isn't it possible to set the filename of the attachment in the message-mapping?</i>
    --->
    Try writing this UDF so to get the name in mapping
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    conf.put(key,a); // a - parameter given to UDF that specifies filename
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName; 
    Hope this helps

  • Content-Disposition - Dynamically set in Mail Adapter

    Hi All,
    I need to dynamically set the Content-Disposition in the receiver mail adapter so as to facilitate dynamic names for my attachment in the mail.
    In case i use messagetransform bean, I will have to hard code the name as part of the parameter value in the adapter.
    Is there any way i can utilize the ASMA and dynamic configuration here?
    The specified item was not found. - i referred the blog but instead of setting the
    attachmentXML.setName(mailFileName);
    attachmentXML.setContentType("text/xml");
    attachmentXML.setContent(by);
    I need to set the content disposition. Is there any way?
    Appreciate all help on this issue.
    Regards,
    Shabz

    Hi Vijay,
    Do have the solution for this? I also have the same requirement.
    Please forward me the solution.
    Thanks,
    Nat

  • XSLT Mapping with Dynamic Configuration for Mail Adapter

    Hi Guys,
    I am wondering if somebody can help me please.
    I have a requirement in which I need to pick up the file from FTP and email it to the user as an attachment with the same file name and content.
    I know it is possible via 3 method either by deploying adapter module or via XSLT or JAVA Mapping.
    I preferred XSLT Mapping because it is easier to use and we don't need to compile the code like JAVA Mapping.
    I have done the XSLT Mapping but the only problem I am facing is that how to copy the file name which we get it from Dynamic Configuration to the Mail ContentDisposition.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      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 indent="no" />
    <xsl:param name="inputparam"/>
    <xsl:template match="/">
    <!-- change dynamic configuration -->
        <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', 'FileName')" />
        <xsl:variable name="dynamic-value"
            select="dyn:get($dynamic-conf, $dynamic-key)" />
        <xsl:variable name="dummy"
            select="dyn:put($dynamic-conf, $dynamic-key, $new-value)" />
        <!-- copy payload -->
    I tried many option but unfortunately none of them worked.
    <Content_Disposition>attachment;filename="$inputparam"</Content_Disposition>
    <Content_Disposition>attachment;filename="$dynamic-conf"</Content_Disposition>
    <Content_Disposition>attachment;filename="$dynamic-key"</Content_Disposition>
    <Content_Disposition>attachment;filename="$dynamic-value"</Content_Disposition>
    <Content_Disposition>attachment;filename="$dummy"</Content_Disposition>
             <Content_Disposition>
                attachment;filename=
                <xsl:value-of select="dynamic-key"/>
             </Content_Disposition>
    I really appreciate if someone can please provide some guidance.
    Thanks,

    Hi,
    Yes u r correct it will show error in operation mapping.. bcoz u cannot check the DynamicConfiguration in Operation mapping...
    It will throw Exception..
    The parameter to UDF depends on ur requirement.... Let us know ur requirements exactly...
    If u r doing for file to file means no UDF required,, just check ASMA on both sides....
    Babu

  • Dynamic attachment - receiver mail adapter

    when you have the required access-key in the XML, then you can do it similar as in Michal's blog.
    If you just want to send the attachmanet without email body, you need not create a new attachment, you can just set the file name with this line:
    payload.setContentType("application/xml;name=\"" + fileName + "\"");

    You should already have the the access key in subject from the UDF on pg13. Just change the last line to "return subject" from "return xml" then concat it with -nfe.xml
    Regards
    Asif K

  • Dynamic Mail Adapter Config

    Hi All,
    We're trying to use a dynamic mail direction in the mail adapter checking the Mail Package option as it's mentioned in: /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address (excellent blog).
    But we have a mapping error in the SXMB_MONI:
    RuntimeException in Message-Mapping transformation: Cannot produce target element /ns0:Messages
    In the mapping we have one source message with the content of the mail and the direction, and two different structures for target. One with the mail package structure and the other with the target content.
    Do you have any idea why we're having this mapping error?
    Thanks in advance!

    I'm trying to use the dynamic adress for mail adapter. So I've created an external object from the file mentioned in https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1361. [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
    Then I've done a multimapping, first message with the mail payload and the second with the contents of the mail.
    In configuration, I've checked the Mail Package option and execute the interface.
    Sender adapter and mapping was right, but there is an error in the mail adapter as follows:
    error occured: [2006-05-29T14:38:31Z] unable to call the mailer; com.sap.aii.messaging.srt.BubbleException: Failed to call the endpoint [null "null"]; nested exception caused by: com.sap.aii.messaging.util.XMLScanException: expecting start tag: Mail, but found MM57_V01_COM_MONTH_MAIL_FILE at state 1
    Any idea about this?
    Thanks in advance!!!!

  • Regarding Receiver Mail adapter.

    Hi experts,
    iam looking at one off the weblog whick  Michal Krawczyk have created.
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    in this weblog michal have told to download the XSD file from service market place  and upload it in IR External definition it gives us target structure.What is the use off it, we can directly create the target structure.
    And also one more dought what is the use off checking parameter in mail Attributes use mail package.I dont have much knowledge on mail adapter please help me in this issue.
    i want to send parameters dynamically into receiver mail adapter in my project ie(TO,FROM,SUB and CONTENT) please send links and doc's on it.
    Note: Helpfull answer will be rewarded.
    Thanks & regards,
    Phani

    Hi raj,
    Once again thanks for the reply,I will explain my object,its is any 2 senarios in one object.
    1) file to proxy were i upload employee details in to infotype2010 after inserting what ever error records i will l store them in error table.
    2)ater geting error records if i get more then 25 i have to send file path and error records to receiver side. or if i get all sucess also i have 2 send sucess flag into receiver side.
    but i haveto pick data from different systems and i have to send the data into different mail ids i have to generate TO FROM CONTENT dynamically.
    onsite have prepared TS(Tecnical specs) in that spec they gave XIALL and SMTP.
    so my question is using this parameters can i post them dynamically or  not.
    if YES ? then how??
    please help me in this issue.
    if u still dont understand give me ur id  i will send my TS.
    Thanks and regards,
    phani

  • Xi 3.0: Mail adapter fails with "exception in method process"

    Hi.
    I configured the dynamic address for mail adapter following the fantastic-as-always weblog from michalgh.
    Althou everything seems to work fine (that is, i send correctly the email message) the A.F. returns an error with "exception in method process".
    I tried both async and sync case with the same result. In the sync case, the response contains:
    <!--  Call Adapter   -->
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIAdapterFramework</SAP:Category>
      <SAP:Code area="PARSING">GENERAL</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: Exception in method process.</SAP:AdditionalText>
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack />
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Any idea???

    Yes. There is also a response message in the imported structure.. it seems it should work as a kind of application ack with some info on the server that processed the mail.
    Anyway, in my server i get a 404 for the link you suggested.
    In the async case i don't get any error on the SXMB_MONI but only on the A.F.
    I attach the audit log for the async case:
    Audit Log for Message: ffb28585-3c53-0f4b-b366-7dd7a00513fc
    Time Stamp Status Thread ID Sequence No. Description
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_45 1118608026046 The message was successfully received by the messaging system. Profile: XI URL: http://CAPELAB010:50000/MessagingSystem/receive/AFW/XI
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_45 1118608026062 Using connection AFW. Trying to put the message into the receive queue.
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026093 The message was successfully retrieved from the receive queue.
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026375 The message status set to DLNG.
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026468 Delivering to channel: MAIL_RECV
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026468 Mail: message entering the adapter
    2005-06-12 22:27:06 Error SAPEngine_Application_Thread[impl:3]_34 1118608026828 Exception caught by adapter framework: Failed to call the endpoint
    2005-06-12 22:27:06 Error SAPEngine_Application_Thread[impl:3]_34 1118608026828 Delivery of the message to the application using connection AFW failed, due to: Failed to call the endpoint.
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026843 The asynchronous message was successfully scheduled to be delivered at Sun Jun 12 22:32:06 CEST 2005.
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026859 The message status set to WAIT.
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327109 The message was successfully retrieved from the receive queue.
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327125 The message status set to DLNG.
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327156 Delivering to channel: MAIL_RECV
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327171 Mail: message entering the adapter
    2005-06-12 22:32:07 Error SAPEngine_Application_Thread[impl:3]_34 1118608327250 Exception caught by adapter framework: Failed to call the endpoint 
    2005-06-12 22:32:07 Error SAPEngine_Application_Thread[impl:3]_34 1118608327250 Delivery of the message to the application using connection AFW failed, due to: Failed to call the endpoint .
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327281 The asynchronous message was successfully scheduled to be delivered at Sun Jun 12 22:37:07 CEST 2005.
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327296 The message status set to WAIT.
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627421 The message was successfully retrieved from the receive queue.
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627437 The message status set to DLNG.
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627546 Delivering to channel: MAIL_RECV
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627562 Mail: message entering the adapter
    2005-06-12 22:37:07 Error SAPEngine_Application_Thread[impl:3]_34 1118608627671 Exception caught by adapter framework: Failed to call the endpoint 
    2005-06-12 22:37:07 Error SAPEngine_Application_Thread[impl:3]_34 1118608627671 Delivery of the message to the application using connection AFW failed, due to: Failed to call the endpoint .
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627703 The asynchronous message was successfully scheduled to be delivered at Sun Jun 12 22:42:07 CEST 2005.
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627734 The message status set to WAIT.
    2005-06-12 22:42:07 Success SAPEngine_Application_Thread[impl:3]_40 1118608927734 The message was successfully retrieved from the receive queue.
    2005-06-12 22:42:07 Success SAPEngine_Application_Thread[impl:3]_40 1118608927734 The message status set to DLNG.
    2005-06-12 22:42:07 Success SAPEngine_Application_Thread[impl:3]_40 1118608927750 Delivering to channel: MAIL_RECV
    2005-06-12 22:42:07 Success SAPEngine_Application_Thread[impl:3]_40 1118608927750 Mail: message entering the adapter
    2005-06-12 22:42:07 Error SAPEngine_Application_Thread[impl:3]_40 1118608927765 Exception caught by adapter framework: Failed to call the endpoint 
    2005-06-12 22:42:07 Error SAPEngine_Application_Thread[impl:3]_40 1118608927781 Delivery of the message to the application using connection AFW failed, due to: Failed to call the endpoint .
    2005-06-12 22:42:07 Error SAPEngine_Application_Thread[impl:3]_40 1118608927796 The message status set to NDLV.
           Total: 33 Entries   1020304050 messages displayed per page; this is page 1 of  1 page(s)     

  • 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);

  • Dynamic file name of the attachment in sender mail adapter

    Hi
    I have configured a sender mail adapter which receives some attachments.
    Right now the file name of the attachment is hardcoded to "MailAttachment-1" "MailAttachment-2" using the content-description from "AF_Modules/PayloadSwapBean" module.
    I want to set it to dynamic ie. instead of "MailAttachment-1"... i want it with real name of the attach.
    please suggest a solution w/o the need to develop a custom adapter module.
    Thanks!
    Regards,
    Mariano.

    Thanks Prateek,
    Now, i can see that the name of the original file is into the content type named as  text/xml; name"name of the file.xml" when i send the email from outlook.
    If i send it from hotmail, this is not happend.
    Do you know why happend this?
    If i always would have the original name inside the content type, my problem will be solved.
    Edited by: Mariano Vidal on Feb 13, 2009 2:26 PM

  • 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.Babu

    But 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 file name as mail attachment in receiver Mail Adapter?

    Hi,
    Can any one tell the possibility of attaching file as a mail attachment without using mail Package with dynamic filename.
    Business requirement is to send error response as mail attachment with dynamic name.
    Ex: Error_Response_20110802_13.24 where 20110802 is Date and next part represents time stamp.
    File attachment name should change dynamically in Mail receiver Adapter. Thanks
    Regards,
    Sreeramulu Konjeti.

    there is no standard way.
    you will have to write a module to get this in place.
    other ways are;
    XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping - /people/stefan.grube/blog/2007/04/17/xi-mail-adapter-an-approach-for-sending-emails-with-attachment-with-help-of-java-mapping
    Dynamic name in the mail attachment - pseudo "variable substitution" :
    /people/michal.krawczyk2/blog/2006/02/23/xi-dynamic-name-in-the-mail-attachment--pseudo-variable-substitution

  • 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 Siddam

    Hi,
    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 Mithani

    Hi,
    Go through this thread..
    Dynamic  File Name for Receiver File Adapter
    Regards,
    Sarvesh

Maybe you are looking for