Problem in Mail Receiver attachment name

Hi all.
we are doing a interface from file to Mail (Excel file as a attachment).
we have written the adapter module to convert the  XML from PI to Excel.. which is working fine.
For the attachment name i was hardcoding the attachment name using
localejbs/AF_Modules/MessageTransformBean
and Transform.ContentDescription as Testing.xls.
The scenario works fine.
But i want the attachment name to be dynamically set like xyzddmmyyyy.xls.
I am not using any Mail package.
I want to set the attachment name dynamically. so i follwed the blog
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3414700)ID0922321550DB00664514007823519662End?blog=/pub/wlg/3202
i am getting the filename from the xmlpayload and setting it using
                        xp.setName(filename);             
                  xp.setContentType("application/vnd.ms-excel");
            xp.setContent(by);
but the problem is that now i am not getting the excel file instead a untitled.bin file which have the Contents.
in module configuration i have
localejbs/XMLToExcelConversion                                          LocalEnterpriseBean               0
sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean      LocalEnterpriseBean             1
Can you please throw some light on this problem..
Thanks in advance
Babu.

Try this:
xp.setContentType("application/vnd.ms-excel; filename=\""filename"\");

Similar Messages

  • Mail Changing Attachment Names

    Does anyone find that their Mac Mail changes attachment names into something like ??Q?documentname?=? so you are unable to open them unless you rename and save?
    I think I have narrowed it down to only happening with attachments that have a long(ish!) filename.  It only happens when a Mac computer recieves.  Doesn't matter if a Mac or Windows machine sends the mail.
    Any help appreciated as 50% of my attachments are coming through in this format.  V frustrating!

    Are you sure your RECEIVING email client isn't doing the conversion?
    Thank you for the help.
    It wasn't actually the email client at the other end, but rather a third-party photo app on my iPad - Photogene.
    I had been sending the screenshot as an email attachment from within Photogene. It seems that this app was converting it to the JPEG format. When I simply chose the image from the Camera Roll - directly in the Mail app - the PNG format was kept.
    Thanks again.

  • HT1338 Problem with MAIL, when select names that start with "E" the mail freeze. Can't fix it.

    Problem with MAIL, when select names that start with "E" the mail freeze. Can't fix it.

    Now I checked the materials that I got from AT&T Yahoo and
    port 25 is used as the outgoing mail port, 110 for incoming.
    This is for the POP type account provided by AT&T, not necessarily for an email account and SMTP server not provided by AT&T.
    Sounds like AT&T blocks using an SMTP server that is outside of their network or not provided by AT&T on Port 25.
    Try the following first.
    Go to Mail > Preferences > Accounts and under the Account Information tab for your .Mac account preferences at the SMTP server selection, select the Server Settings button below for the .Mac SMTP server.
    Enter 587 in place of 25 in the Server Port field and when finished, select OK to save the changed setting.
    If this doesn't work, we will go to plan B.

  • Sender mail adapter - attachment name

    Hi there
    We have configured a sender email adapter to receive text/csv attachments and save them to a file system. What we are having a problem with is reading the attachment name. So we are using Dynamis Configuration to create the file name using the subject line - Which is not ideal. Ideally we would like to use the same name as the origianl attachment but haven't found any way of doing that. We even tried using Content-type in the Variable Header (XHeaderName1) suing variable transport binding but it doesn't show up in the Dynamic Config part of the SOAP message.
    Is there any way of reading the name of the file attachment? We are on PI release 7.0.
    Any help would be appreciated.
    Cheers
    Salil

    Hi Vitor
    There are 2 scenarios that I can think of -
    1. You are saving the email attachment as a file. In that case use step 3 in the earlier reply to get the attachment name and save the file witht that name.
    2. You are sending the XML straight to a receiver using HTTP, IDOC, JDBC etc. in which case you would need the attachment name much earlier that step 3. For that I guess you would have to write another adapter module on the sender mail adapter(at Position 3 where position1 = payloadswap bean, 2 = custom module to get the attachment name) and add an xml tag to your incoming message. These adapter modules are really powerful and are like user exits in ABAP. In that case you would have to change the Data Type in the Integration repository to reflect that extra tag. Here is some code from a module we wrote to totally change the structure of the xml coming in. The key thing to remember is this module is that you can read the whole message byte by byte. There might be smarter ways of doing it (like using the SAP XML parser factory class) but since I'm not a Java programmer I stuck to the basics. Here's the code( you could also look at the example given in sap help where they remove (or add I'm not sure) CR(carriage return) from CRLF (CR Line feed).
    Created on Aug 8, 2007
    To change the template for this generated file go to
    Window>Preferences>Java>Code Generation>Code and Comments
    package jdbcPackage;
    import javax.ejb.CreateException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import com.sap.aii.af.mp.module.*;
    import com.sap.aii.af.ra.ms.api.*;
    @author Salil.Mehta Soltius NZ Ltd
    To change the template for this generated type comment go to
    Window>Preferences>Java>Code Generation>Code and Comments
    public class jdbcClass implements SessionBean, Module {
         private SessionContext myContext;
         public void ejbRemove() {
         public void ejbActivate() {
         public void ejbPassivate() {
         public void setSessionContext(SessionContext context) {
              myContext = context;
         public void ejbCreate() throws CreateException {
         public ModuleData process(
              ModuleContext moduleContext,
              ModuleData inputModuleData)
              throws ModuleException {
              //        put your code here
              try {
                   Message msg = (Message) inputModuleData.getPrincipalData();
                   XMLPayload payload = msg.getDocument();
                   String payEnc = payload.getEncoding();
                   byte[] payByte = payload.getContent();
                   byte[] payByteOut = new byte[payByte.length];
                   byte[] payByteTemp = new byte[payByte.length];
                   int i;
                   int j;
                   int actualCount = 0;
                   char xmlTagFound = ' ';
                   char endXmlTagFound = ' ';
                   char tagFound = ' ';
                   System.arraycopy(payByte, 0, payByteTemp, 0, payByte.length);
                   // Step 1 - Conversions 
                   // convert   "&lt; to <"    and     "&gt; to >"
                   // convert   &quot; to "
                   // This will remove any carriage returns and line feeds
                   // and the <XML* and </XML* tags plus the <row> and </row> tags
                   for (i = 0; i < payByte.length; i++) {
                        // convert   &lt; to <    and     &gt; to >
                        if (payByteTemp<i> == '&') {
                             if (payByteTemp[i + 1] == 'l') {
                                  if (payByteTemp[i + 2] == 't') {
                                       if (payByteTemp[i + 3] == ';') {
                                            payByteTemp<i> = '<';
                                            payByteTemp[i + 1] = '\n';
                                            payByteTemp[i + 2] = '\n';
                                            payByteTemp[i + 3] = '\n';
                        if (payByteTemp<i> == '&') {
                             if (payByteTemp[i + 1] == 'g') {
                                  if (payByteTemp[i + 2] == 't') {
                                       if (payByteTemp[i + 3] == ';') {
                                            payByteTemp<i> = '>';
                                            payByteTemp[i + 1] = '\n';
                                            payByteTemp[i + 2] = '\n';
                                            payByteTemp[i + 3] = '\n';
                        if (payByteTemp<i> == '&') {
                             if (payByteTemp[i + 1] == 'q') {
                                  if (payByteTemp[i + 2] == 'u') {
                                       if (payByteTemp[i + 3] == 'o') {
                                            if (payByteTemp[i + 4] == 't') {
                                                 if (payByteTemp[i + 5] == ';') {
                                                      payByteTemp<i> = '"';
                                                      payByteTemp[i + 1] = '\n';
                                                      payByteTemp[i + 2] = '\n';
                                                      payByteTemp[i + 3] = '\n';
                                                      payByteTemp[i + 4] = '\n';
                                                      payByteTemp[i + 5] = '\n';
                        // This will take in the initial xml declaration from the Byte array
                        // And we also don't want the stuff after the xml declaration till
                        // we reach the first <row> tag     
                        if (xmlTagFound == ' ') {
                             if (payByteTemp<i> == '>') {
                                  xmlTagFound = 'X';
                             payByteOut[actualCount++] = payByteTemp<i>;
                             if (xmlTagFound == 'X') {
                                  payByteOut[actualCount++] = '\r';
                             continue;
                        if (xmlTagFound == 'X') {
                             if (payByteTemp<i> == '<') {
                                  if (payByteTemp[i + 1] == 'r') {
                                       if (payByteTemp[i + 2] == 'o') {
                                            if (payByteTemp[i + 3] == 'w') {
                                                 if (payByteTemp[i + 4] == '>') {
                                                      xmlTagFound = 'Y';
                                                 } else {
                                                      continue;
                                            } else {
                                                 continue;
                                       } else {
                                            continue;
                                  } else {
                                       continue;
                             } else {
                                  continue;
                        // Carriage return and line feed
                        if ((payByteTemp<i> == '\r') || (payByteTemp<i> == '\n')) {
                             continue;
                        // <XML_*> tag
                        if (payByteTemp<i> == '<') {
                             if (payByteTemp[i + 1] == 'X') {
                                  if (payByteTemp[i + 2] == 'M') {
                                       if (payByteTemp[i + 3] == 'L') {
                                            tagFound = 'X';
                                            endXmlTagFound = ' ';
                                            continue;
                        // </XML_*> tag
                        if (payByteTemp<i> == '<') {
                             if (payByteTemp[i + 1] == '/') {
                                  if (payByteTemp[i + 2] == 'X') {
                                       if (payByteTemp[i + 3] == 'M') {
                                            if (payByteTemp[i + 4] == 'L') {
                                                 tagFound = 'X';
                                                 endXmlTagFound = 'X';
                                                 continue;
                        // <row> tag
                        if (payByteTemp<i> == '<') {
                             if (payByteTemp[i + 1] == 'r') {
                                  if (payByteTemp[i + 2] == 'o') {
                                       if (payByteTemp[i + 3] == 'w') {
                                            if (payByteTemp[i + 4] == '>') {
                                                 tagFound = 'X';
                                                 continue;
                        // </row> tag
                        if (payByteTemp<i> == '<') {
                             if (payByteTemp[i + 1] == '/') {
                                  if (payByteTemp[i + 2] == 'r') {
                                       if (payByteTemp[i + 3] == 'o') {
                                            if (payByteTemp[i + 4] == 'w') {
                                                 if (payByteTemp[i + 5] == '>') {
                                                      tagFound = 'X';
                                                      continue;
                        if ((payByteTemp<i> == '>') && (tagFound == 'X')) {
                             tagFound = ' ';
                             continue;
                        if (tagFound == ' ') {
                             if (endXmlTagFound == 'X') {
                                  continue;
                             payByteOut[actualCount++] = payByteTemp<i>;
                   byte[] payByteExp = new byte[actualCount];
                   System.arraycopy(payByteOut, 0, payByteExp, 0, actualCount);
                   payload.setContent(payByteExp);
                   msg.setDocument(payload);
                   inputModuleData.setPrincipalData(msg);
              } catch (Exception e) {
                   ModuleException me = new ModuleException(e);
                   throw me;
              return inputModuleData;

  • Mail Receiver: Attachment gets not generated

    Hi,
    AFAIK in SXMB_MONI in the MappingStep the attachment is shown, when it was created.
    My mapping does not show the attachment.
    Although my mapping is identical to former XIs where I implementes "Mail with attachment"
    We are now on NW04S_16_REL. Does anybody had the same problems?
    My field are filled as follows:
    /ns0:Mail/Subject = "BlaBla"
    /ns0:Mail/From = "xyz@xyz"
    /ns0:Mail/To = "xyz@xyz"
    /ns0:Mail/Content_Type = Constant: multipart/mixed; boundary="AaBb--984dfgeSSd3532"
    /ns0:Mail/Content_Disposition = Constant: attachment
    /ns0:Mail/Content =
    <Content>--AaBb--984dfgeSSd3532
    Content-Type: text/plain; charset=&quot;UTF-8&quot;
    some Text
    --AaBb--984dfgeSSd3532
    Content-Type: text/plain;charset=&quot;UTF-8&quot;;name=attachment.txt
    --AaBb--984dfgeSSd3532
    ThisSouldbeTheTextInTheAttachment</Content>
    Why does the attachment not be generated?
    Thanks, Regards
    Mario

    No,
    but consider:
    Befor the message enters the CC the attachment should already be seen in SXMB_MONI
    Regards
    Mario
    Edited by: Mario Müller on Apr 20, 2009 4:05 AM

  • Receiver mail with attachment name by default

    Hello all,
    I have a scenario IDOC -> PI -> MAIL.
    In my output mail, i want,for example and by default, that my attachment's name is "document1.xml".
    I've checked the case 'keep attachments' in my CC receiver mail and tried to use the Payloadswapbean to change the name of the attachment but it isn't working !
    Is it the appropriate module that i use ? Or should i use something else ?
    Thanks for your help,
    JP
    Edited by: Jean-Philippe PAIN on May 27, 2010 1:57 PM

    In my output mail, i want,for example and by default, that my attachment's name is "document1.xml".
    Check the third example shown in this blog: /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    Applicable for Message Protocol = XIPAYLOAD without Mail Package
    Regards,
    Abhishek.

  • Problem with Mail receiver adapter

    Hi,
    I have the following scenario, Proxy ABAP-XI -Mail. I have configured my scenario, and the payload is correctly sent to the email address that i have configured in the mail adapter, but in xml format, the point is that I have to send the attached message as txt format.
    I have done the following configuration in the receiving mail adapter channel, in the module section:
    <b>Processing sequence</b>
    localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean     Local Enterprise Bean     mail
    localejbs/AF_Modules/MessageTransformBean     Local Enterprise Bean     XML2Plain
    <b>Module configuration</b>
    XML2Plain     Transform.Class     com.sap.aii.messaging.adapter.Conversion
    XML2Plain     Transform.ContentDisposition     attachment;filename="Gen.txt"
    XML2Plain     Transform.ContentType     text/plain;charset=utf-8
    XML2Plain     xml.REGISTRO_CABECERA.fieldFixedLengths     52
    XML2Plain     xml.REGISTRO_DE_DATOS.fieldSeparator     ;
    XML2Plain     xml.REGISTRO_PIE.fieldFixedLengths     10
    XML2Plain     xml.addHeaderLine     0
    XML2Plain     xml.conversionType     StructXML2Plain
    XML2Plain     xml.recordsetStructure     REGISTRO_CABECERA,REGISTRO_DE_DATOS,REGISTRO_PIE
    Maybe i missed something in my configuration, or maybe this is not the right way for doing it, can anyone help me with this??
    Thanks a lot in advanced,
    Luis

    Hi,
    1. localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean XML2Plain
    l2. ocalejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean mail
    Check out the page 13 in the following URL
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/02706f11-0d01-0010-e5ae-ac25e74c4c81
    Page 8 in the following
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/99593f86-0601-0010-059d-d2dd39dceaa0

  • Problem with mailing notepad attachment

    Hi experts,
    My requirement is to send mail with notepad attachment. Im getting the attachment in mail. But half of the data is converted to junk values and half of the data is coming properly. I tried debugging and found that all the contents are in proper format in the attachment internal table. But when I debug the function module 'SO_DOCUMENT_SEND_API1', I find that inside the function module, some of the data is converted to junk. I have 75 fields to be displayed in the notepad.
    Here is my code.
    <removed by moderator>
    Any inputs on this will be greatly appreciated.
    Thanks,
    Peri.
    Moderator message: please post only relevant code parts, your post must be less than 2500 characters to preserve formatting, use code tags.
    Edited by: Thomas Zloch on Sep 7, 2010 9:07 AM

    Hello,
    As of Release 6.10, SAP recommends that you do not continue to use the
    API1 interface for sending documents, but the BCS interface instead.
    Detailed information, please refer to SAP note: 190669.
    Hope this is helpful.
    Regards,
    David

  • 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,
    Vamsi

    Hi 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

  • Problem with Mail Blog

    Hi,
    im trying this blog.
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    After sending the file to xi the mail adapter said:
    failed to send mail: com.sap.aii.messaging.util.XMLScanException: expecting start tag: Mail, but found mT_StgLocation at state 1
    Do i have to use this http://sap.com/xi/XI/Mail/30 NS ?
    Gordon

    Arvind,
    great it works.
    I have used HTTP instead of FILE Inpout.
    [s]<i>My problem: The mail received and payload is inserted but the details are missing.
    The header is filled:
    These delivries has been completed:
    Delivery Number  Order Number  Ship-To  Name  Product Code  Qty Billed  Status 
    ..  but the itemlines are missing.
    any ideas ?</i>[/s]
    [SOLVED]
    Message was edited by:
            Gordon Breuer

  • Mail receiver

    Hi,
    I have problem with Mail Receiver ComCh. When I set it up to use local SMTP server with user/pwd and CRAM-MD5, error is :
    failed to send mail: java.io.IOException: server not responding OK to AUTH; 535 5.7.0 authentication failed
    When I set Plain, error is:
    failed to send mail: java.io.IOException: server does not support PLAIN or LOGIN authentication
    Where is the problem? Any idea.....
    thx
    mario

    java.io.IOException: server not responding OK to AUTH; 535 5.7.0 authentication failed
    Receiver mail Communication Channel not configured properly....check the below two solved threads dealing with the same problem:
    Error in Receiver Mail Adaptor
    Error with mail adapter
    If you need any more info on receiver mail CC then chek this:
    http://help.sap.com/saphelp_nw04/helpdata/en/6b/4493404f673028e10000000a1550b0/content.htm
    Regards,
    Abhishek.

  • New mails received after IOS 5.0.1 update do not show graphics but instead unviewable file name and an attachment winmail.dat

    I sent out a mail, composed by outlook 2007 in HTML format this afternoon which contained graphics, to several of my friends and copied myself.  All of them had duly received the mail and were able to see the graphics in the mail in their iphones or ipads.  However, the copy that was extended to myself had only the unviewable graphic filename and also an attachment winmail.dat(which cannot be opened) from both my iphone and ipad (both updated with IOS 5.0.1).  Prior to this update, I had no problem of seeing graphics or photos in the mails received in both my ipad or iphone.  I ran couple of test mails and they all ended up the same.
    Any ideas??

    Turned out, it's the Microsoft SP3 update that caused the problem.

  • Need to get the Mail attachment name as it is to the receiver file adapter

    I am doing a Mail to File scenario. I need to get the attachment from the mail and store it on the file server. I am using the PayloadSwap bean in the sender mail adapter. My requirement is to carry forward the attachement name as it is to the receiver file adapter side and store the file with the same name.
    Did any one try doing this? I was looking at developing an adapter module but got struck as I could not find whether the attachement name is stored in the XI payload after it has got swapped using the swap bean.
    Any help would be appreciated.
    VJ

    Oops pressed the send key. Take two.
    This is becoming a damn nightmare. When I run the adapter I am getting ModuleExceptions. Can you pass your eyes over these Java config settings to see what I am doing wrong. Using NWDS CE 7.1 with PI 7.1 both at SP07. All the imports were taken from PI 7.1 after SP07 was applied. The build id of NWDS is
    SAP NetWeaver Developer Studio
    SAP NetWeaver 7.1 Composition Environment SP07 PAT0001
    Build id: 200901152336
    APPLICATION.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
    "http://java.sun.com/dtd/application_1_3.dtd">
    <application>
    <display-name>MailPOP_EAR</display-name>
    <description>EAR description</description>
    <module>
    <ejb>MailPOP_EJB.jar</ejb>
    </module>
    </application>
    APPLICATION-J2EE-ENGINE.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">
    <application-j2ee-engine>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="service">engine.security.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="library">engine.j2ee14.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="service">com.sap.aii.af.svc.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="interface">com.sap.aii.af.ifc.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="library">com.sap.aii.af.lib.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="library">com.sap.base.technology.facade</reference-target>
    </reference>
    <fail-over-enable mode="disable" />
    </application-j2ee-engine>
    EJB-J2EE-ENGINE.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">
    <ejb-j2ee-engine>
    <enterprise-beans>
    <enterprise-bean>
    <ejb-name>GetMailAttachment</ejb-name>
    <jndi-name>GetMailAttachment</jndi-name>
    <session-props/>
    </enterprise-bean>
    </enterprise-beans>
    </ejb-j2ee-engine>
    EJB-JAR.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
    2.0//EN"
    "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <description>EJB JAR description</description>
    <display-name>EJB JAR</display-name>
    <enterprise-beans>
    <session>
    <ejb-name>GetMailAttachment</ejb-name>
    <home>com.sap.aii.af.lib.mp.module.ModuleHome</home>
    <remote>com.sap.aii.af.lib.mp.module.ModuleRemote</remote>
    <local-home>com.sap.aii.af.lib.mp.module.ModuleLocalHome</local-home>
    <local>com.sap.aii.af.lib.mp.module.ModuleLocal</local>
    <ejb-class>sample.GetMailAttachment</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    SENDER MAIL ADAPTER modules
    1 AF_Modules/PayloadSwapBean Local EB 1
    2 GetMailAttachment Local EB 2
    3 sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local EB 3
    1     swap.keyName          payload-name
    1     swap.keyValue          MailAttachment-1
    RECEIVER FILE MODULES
    1     localejbs/AF_Modules/DynamicConfigurationBean     Local Enterprise Bean     1
    2     localejbs/CallSapAdapter                    Local Enterprise Bean     2
    1     key.0          write http://sap.com/xi/XI/System/File FileName
    1     value.0          message.interface
    VARIABLE FILENAME SUBST WITH ASMA TURNED ON
    fName     message:interface_name
    JAVA SOURCE
    package sample;
    import javax.ejb.CreateException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import com.sap.aii.af.lib.mp.module.Module;
    import com.sap.aii.af.lib.mp.module.ModuleContext;
    import com.sap.aii.af.lib.mp.module.ModuleData;
    import com.sap.aii.af.lib.mp.module.ModuleException;
    import com.sap.engine.interfaces.messaging.api.Message;
    import com.sap.engine.interfaces.messaging.api.MessagePropertyKey;
    import com.sap.engine.interfaces.messaging.api.TextPayload;
    import com.sap.engine.interfaces.messaging.api.XMLPayload;
    import com.sap.aii.af.service.cpa.Channel;
    @ejbHome <{com.sap.aii.af.lib.mp.module.ModuleHome}>
    @ejbLocal <{com.sap.aii.af.lib.mp.module.ModuleLocal}>
    @ejbLocalHome <{com.sap.aii.af.lib.mp.module.ModuleLocalHome}>
    @ejbRemote <{com.sap.aii.af.lib.mp.module.ModuleRemote}>
    @stateless
    <code>GetMailAttachment</code>
    @SuppressWarnings("unused")
    public class GetMailAttachment implements SessionBean, Module {
         private static final long serialVersionUID = 7612238514043673502L;
         private SessionContext myContext;
         private MessagePropertyKey myFileName;
         public void ejbRemove() {
         public void ejbActivate() {
         public void ejbPassivate() {
         public void setSessionContext(SessionContext context) {
              myContext = context;
    @throws CreateException
         public void ejbCreate() throws CreateException {
         public void getMessageProperty(MessagePropertyKey FileName) {
              myFileName = FileName;
    @param moduleContext
               Contains data of the module processor that might be important
               for the module implementation such as current channel ID
    @param inputModuleData
               Contains the input XI message as principal data plus eventual
               set supplemental data
    @return ModuleData Contains the (changed) output XI message. Might be the
            response message if the module is the last in the chain.
    @exception ModuleException
                   Describes the cause of the exception and indicates whether
                   an retry is sensible or not.
         @SuppressWarnings("deprecation")
         public ModuleData process(ModuleContext moduleContext,
                   ModuleData inputModuleData) throws ModuleException {
              try {
                   Message msg = (Message) inputModuleData.getPrincipalData();
                   TextPayload payload = msg.getDocument();
                   String contentType = payload.getContentType();
                   // Content Type could be something like
                   // text/plain;charset="UTF-8";name="file.txt"
                   contentType = contentType.replaceAll("\"", "");
                   int i = contentType.lastIndexOf("=") + 1;
                   String fileName = contentType.substring(i);
                   msg.setMessageProperty(myFileName, fileName);
                   inputModuleData.setPrincipalData(msg);
              } catch (Exception e) {
              return inputModuleData;
    JAVA ERRORS
    2009-02-04 11:41:14     Information     Mail: calling the module processor for channel LMK_Common_Mail_Sender
    2009-02-04 11:41:14     Information     Swap: swapping by payload-name ? MailAttachment-1
    2009-02-04 11:41:14     Information     Swap: successfully swapped
    2009-02-04 11:41:14     Information     Mail: message leaving the adapter (call)
    2009-02-04 11:41:14     Information     The application tries to send an XI message asynchronously using connection AFW.
    2009-02-04 11:41:14     Information     Backward validation is enabled
    2009-02-04 11:41:14     Error     Unable to validate the message with message ID 8702df71-f254-11dd-9b9b-001a64a73518
    2009-02-04 11:41:14     Error     Returning to application. Exception: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Content is not allowed in prolog.
    2009-02-04 11:41:14     Error     Mail: error occured: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Content is not allowed in prolog.
    2009-02-04 11:41:14     Error     Mail: error occured: com.sap.aii.af.lib.mp.module.ModuleException

  • 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

  • Since upgrading iMac to osx lion I have been experiencing problems in mail, it spontaneously stops receiving and tells me it can't find the pop server and also the biggest problem is that when I send with an attachment the recipient doesn't receive it.

    Since upgrading iMac to osx lion I have been experiencing problems in mail, it spontaneously stops receiving and tells me it can't find the pop server and also the biggest problem is that when I send with an attachment the recipient doesn't receive it.
    I have to restart mail most times before it starts recieving or recognizes the pop server.
    As I said a lot of recipients do not recieve my mails when there is an attachment or when I reply to their email.

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

Maybe you are looking for

  • Multiple App syncing issues...

    Hello, all. I am having multiple application synching issues. I have a half dozen devices and have never had any of these issues before about a week ago. May have had an iTunes update? Here are the issues. 1.     Some Apps re-installing even though n

  • L512 How to do Full Re-Install

    I have an L512 (Win 7 Home Premium 32 bit, 4Gb RAM, 2.40GHz processor. It keeps chugging along, but is starting to slow down, and at times, really choke up. My virus and malware protection is current. I'm thinking it just needs a new lease on life wi

  • When I turned my ipad on this morning it is glowing on all sites as if in night view with a flourscent a. dded.  I can't find out how to remove it!

    When I turned my ipad on this morning it is glowing on all sites as if in night view with a flourscent a. dded.  I can't find out how to remove it!

  • Coverflow problem with iPhone

    I have several problems with the coverflow feature in my iphone: 1) Some covers does not appear even they are in itunes 2) Covers are scrambled .. does not corresponde to the actual album .. and they are correct in itunes 3) In coverflow .. the artwo

  • Standby do not applied archives

    Hi, Please help me any one, am facing the below problem, Errors in file /oracle/admin/marvlstd/bdump/marvlstd_mrp0_28273.trc: ORA-12801: error signaled in parallel query server P000 ORA-00600: internal error code, arguments: [3020], [90], [573443], [