Mapping to Mail Package Content

Hi,
I'm trying to get information from an IDoc into the "Content" tag of the Mail Package structure. The format of the content should be a few values separated by semicolons and then "End Of Line" character after each line of values. Ex.
<Content>VAL1;VAL2;VAL3 "EOL" VAL4;VAL5;VAL6 "EOL" VAL7;VAL8;VAL9</Content>
The semicolons can easily be created using the concat function, but how do I get the EOL character in there so that the end result of the content attachment out of the Mail adapter becomes:
VAL1;VAL2;VAL3
VAL4;VAL5;VAL6
VAL7;VAL8;VAL9
So, in other words the result should be CSV with EOL characters.
Solutions that work will be highly rewarded!!
Thanks,
Mattias

write a simple UDF...
the code in it would be just one line...
return (""+ ((char)10) );
i am assuming you want the "new line" at the end..right ?
for new line it is "((char)10)"...for carriage return it is "((char)13)"...

Similar Messages

  • Mail Adapter & Mail package - pb of content

    Hi,
    I want to send an email from XI to my mail server (Lotus) by using the Mail Adapter with option "Use mail package".
    I have just succeed to send email with only <b>ONE line</b> because of field "content" which has an occurence 0..1.
    How is it possible to have several lines?
    When I try to duplicate field "content" or to change its occurence (0..Unbounded), then I don't receive an email?
    <i>Note: Unfortunatelly, I don't know XSL / XSLT mapping.</i>

    If you want to have several lines, you have to put EOL within the one "content" tag like this:
    <ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
      <Subject>Hello</Subject>
      <From>[email protected]</From>
      <To>[email protected]</To>
      <Content>row1
    row2
    row3
    row4</Content>
    </ns:Mail>
    Sorry, I can only give you an XSLT example to do this.  Assume your original message payload is:
    <root>
      <text>row1</text>
      <text>row2</text>
      <text>row3</text>
      <text>row4</text>
    </root>
    you can use following XSLT file, which you attach directly to the Mail Adapter (like described in another thread):
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="xml" indent="yes" />
      <xsl:template match="*">
        <ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
          <Subject>Hello</Subject>
          <From>[email protected]</From>
          <To>[email protected]</To>
          <Content><xsl:apply-templates/></Content>
        </ns:Mail>
      </xsl:template>
      <xsl:template match="text">
        <xsl:value-of select="."/>
      </xsl:template>
    </xsl:stylesheet>
    Regards
    Stefan

  • Filter emails based on "From" of mail package

    My sender mail adapter is picking up all emails from an email account and processing the file attachment - This is working fine.
    The problem is that it processes everything sent to this email account even junk mails - resulting in XI alerts.  How can I ignore the junk emails and only process emails sent from a certain source???
    I see that we have "use mail package" and when I check this I get two payloads when I look in the monitor:
    PAYLOAD 1: MailMessage:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Inbound Message
      -->
    - <xim:Mail xmlns:xim="http://sap.com/xi/XI/Mail/30" encoding="base64">
      <Subject>Test - use mail package</Subject>
      <From>"Wood, Lynn" email address removed</From>
      <To>"bcdinvoices, sapxd1" email address removed</To>
      <Content_Type>multipart/alternative;boundary="_000_91543CF4B231AE46B0B72867A9775AFE75E2BDB4B0SFLDMIEX001fe_"</Content_Type>
      <Date>2008-10-15T13:04:05Z</Date>
      <Message_ID><91543CF4B231AE46B0B72867A9775AFE75E2BDB4B0></Message_ID>
      <Content>LS1fMDAwXzkxNTQzQ0Y0QjIzMUFFNDZCMEI3Mjg2N0E5Nzc1QUZFNzVFMkJEQjRCMFNGTERNSUVY
    etc........
    RTc1RTJCREI0QjBTRkxETUlFWDAwMWZlXy0tDQo=</Content>
      </xim:Mail>
    PAYLOAD 2: MailAttachment-1 - which is my attachment with data which I process
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns:MT_BCD_INVOICES xmlns:ns="urn://federalmogul.com/BCDTRAVEL/FINGLOBCD001/00">
    - <RECORDSET>
      <COST_CENTRE>90200955</COST_CENTRE>
      <EMPLOYEE_ID>66230</EMPLOYEE_ID>
      <PRODUCT_GROUP>VSP</PRODUCT_GROUP>
      <COMP_CODE>FEDERAL MOGUL FRICTION</COMP_CODE>
      <BCD_ACCOUNT>3301419</BCD_ACCOUNT>
      <INVOICE_DATE>20080811</INVOICE_DATE>
      <TRAVELER_NAME>PIERREY</TRAVELER_NAME>
      <TRAVELER_FIRST_NAME>JEAN FRANCOIS</TRAVELER_FIRST_NAME>
      <INVOICE_NO>8212654</INVOICE_NO>
      <AMOUNT_EXCL_VAT>15.00</AMOUNT_EXCL_VAT>
      <CURRENCY1>EUR</CURRENCY1>
      <AMOUNT_VAT>0.00</AMOUNT_VAT>
      <CURRENCY2>EUR</CURRENCY2>
      <AMOUNT_DOC_CURRENCY>15.00</AMOUNT_DOC_CURRENCY>
      <CURRENCY3>EUR</CURRENCY3>
      </RECORDSET>
      </ns:MT_BCD_INVOICES>
    Can I pick out   <From>"Wood, Lynn" email address removed</From>
    To check it is the correct FROM  - ie. only process emails from a certain sender????
    Is this possible???  And how do I do it???
    I already use payloadSwapBean and messageTransformBean to swap the attachment for payload and to format the file.
    Please do not send me endless links to anything email related !

    Yes this is pretty much what I thought to do - my problem is what do I check in the UDF.  I need to get the "From" field into the header.  I see that you can do it if you check "Use Adapter Specific Message Attributes" and "Variable Transport Binding" then you have available in the header SHeaderFROM which you can then get in the mapping.  But we are on SP19 and we do not have "Variable Transport Binding" on the Sender Mail adapter - nor an advanced tab page - only an advanced mode check box and additional parameters.
    So not sure how I can get the "From" field into mapping???  Any ideas anyone?

  • 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

  • Couldn't find delivery channel when using Mail-Package

    Hi,
    I use the mail receiver adapter. If I configure the mail header data (sender, receiver, subject) in the adapter configuration everything works fine. But now I need a dynamic subject, so I thought of using "mail package". But now I get an error "Couldn't find receiver channel for message..."
    The mail package looks like this:
      <?xml version="1.0" encoding="UTF-8" ?>
      <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
      <Subject>[email protected]</Subject>
      <From>[email protected]</From>
      <To>[email protected]</To>
      <Content_Type>text/xml</Content_Type>
      <Content>This is my mail content</Content>
      </ns1:Mail>
    Has anyone an idea - thanks a lot - werner

    Hi Werner,
    some time ago I posted a weblogs
    which describes such a configuration
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    have a look at it
    BTW
    >>>>now I need a dynamic subject
    if you have sp14 or above then there's much
    easier method with adapter identifiers
    (then you can set the subject in message mapping )
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

  • Issue with mail package - namespace

    Hi All
    I am trying to use mail package in my receiver mail adapter.
    The mandatory elements for using mail package are:
    <ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
    <Subject>Hello</Subject>
    <From>sender email</From>
    <To>receiveremail</To>
    <Content>This is a mail</Content>
    </ns:Mail>
    How can i get the above specified namespace? How can i override my existing namespace with this new one?
    As i am using message mapping, I spicified message type's 'XML Namespace' field as "http://sap.com/xi/XI/Mail/30".
    But even this doesnt help.
    Thanks
    Chandra

    I am also trying to use the namespace.  All seems to be working but I do not get the e-mail message sent to me.  This what shows in my Technical routing payload.  (FYI had to replace the "at" sign with "-" for this posting due to the limits for the forum software.)
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
      <subject>824 test</subject>
      <from>edi-na.modine.com</from>
      <to>s.m.posnanski-na.modine.com</to>
      <reply_to>edi_support-na.modine.com</reply_to>
      <content_Type>text/plain</content_Type>
      <content>Hello</content>
      </ns:Mail>
    I am usingXSL as an attachment and have the floowing defined in Module.
    Processing Sequence
    localejbs/AF_Modules/MessageTransformBean
       CHAN
    localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
    email
    Module Configuration.
    CHAN      Transform.ContentDisposition      attachment.filename="file.html"
    CHAN      Transform.ContentType      text/html;charset=utf-8
    This works fine when not using "Mail Package".  I want to use mail package to be able to have a dynamic subject line for the e-mail.
    Thanks.
    Scott

  • Receiver Mail adapter - mail package - mail not received

    Hi guys!
    I'm using receiver mail adapter and when I want to use Mail Package (subject is assign dinamically based on mapping) I do not receive the e-mail. When I switch to not using Mail Package, the mail is sent correctly..
    In RWB everything seems to be ok, it says mail sent successfully... just not to my outlook
    Any ideas, what could be wrong?
    Thanx a lot!
    Olian

    Hi Stefan,
    thank you 4 reply..  I checked it. To be sure - I copied the content of the To tag and put it into my Outlook and sent an e-mail... It has arrived
    I can't understand this..
    Which fields are neccessary to fill? Is from, to and content enough? I think it should be...
    Thank you!
    Olian

  • Receiver Mail adapter Content type issue

    Hello,
    I am formatting the body of the receiver mail. The body of the email  should look like below.
    Dear PI User,
    The following Interface has been successfully processed by the middleware PI system.
    Please do not reply to this email. If you need more information please contact the Super User.
    Regards,
    SAP PI Team
    The mapping looks fine and My source MT looks like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:MT_Mail_Reply xmlns:ns1="http://test.com/Mail/Reply"> 
    - <Reply>  [0..unbounded] 
    - <Item> [0..unbounded] 
    <MESSAGE>Dear Business User, </MESSAGE>   [0..1] 
    /Item>
    - <Item> 
    <MESSAGE>The following Interface has been successfully processed by the middleware PI system.</MESSAGE> [0..1]
    </Item>
    - <Item> 
    <MESSAGE>Please do not reply to this email. If you need more information please contact the Super User.</MESSAGE> [0..1]
    </Item>
    - <Item>
    <MESSAGE>Regards,</MESSAGE> [0..1] 
    </Item>
    - <Item>
    <MESSAGE>SAP PI Team </MESSAGE>  [0..1]
    </Item>
    </Reply>
    </ns1:MT_Mail_Reply>
    The mapping works fine without errors and I get the target message as below after mapping-
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30"> 
    <Subject>ISAP PI Interface Status</Subject> 
    <From>[email protected]</From> 
    <To>[email protected]</To> 
    <Content>Dear Business User</Content> 
    <Content>The following Interface has been successfully processed by the middleware PI system.</Content> 
    <Content>Please do not reply to this email. If you need more information please contact the Super User</Content>
      <Content>Regards,</Content>
      <Content>SAP PI Team</Content>
    </ns1:Mail>
    t
    The context of MESSAGE has been changed to Reply.
    In the adapter I still get the following error.       
    Delivery of the message to the application using connection Mail_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.af.sdk.xi.srt.BubbleException: Failed to call the endpoint  [null "null"]; nested exception caused by: com.sap.aii.af.sdk.xi.util.XMLScanException: expecting end tag: {http://sap.com/xi/XI/Mail/30}Mail, but found {}Content at state 1
    Please advise !!
    Thanks,
    Teresa
    **I changed the receiver mail adapter to not use Mail package and I receive an email without errors with the Content as mentioned above. **

    Hi Teresa,
    I think the problem is that you are using multiple "Content" tags. Have you tried to use only one?, you can concatenate all your text.
    Check the page 3 of this document to know how introduce new-line character http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0964d7c-e66e-2910-24bb-ac535e4a5992?overridelayout=t…
    Regards.

  • How to install XI mail package?

    Hi,
    I wanna use the mail package I can download from SAP-Note 748024.
    I already read different HowTos (e.g. How To use the mail adapter of the Xi 3.0 J2EE Adapter Engine,...) but I cannot find an information about how to install the XSD-File?
    Do I have to install it?
    In my mail sender communication channel I use mail package and I can see in message monitoring, that the adapter creates a xml structure with "Subject, from, to, content,..." - fine!
    But now I have to develop a message mapping and I need the source xml datatype (this mail package).
    Tx for your help.
    Regards
    Wolfgang

    Hi,
    Download the mail apckage as given in the note.
    Save it as an .XSD file  and then import this as an Extrenal Definition in your Integration Repository. Use this as your message Type in the mapping and message interfaces.
    You can also download it from this link,
    https://websmp205.sap-ag.de/~sapidb/012006153200000361852004E/ximail30_xsd.txt
    This will be your Source Message Type in the case of Sender Mail adapter and the Target message type for receiver mail adapters
    Regards
    Bhavesh

  • Using mail package in file to mail scenario

    For sending the mail in proper email format ,
    we have to check the USE MAIL PACKAGE option.
    the corresponding  TO, FROM ,SUBJECT and CONTENT
    need to be handled in mapping..
    Can anyone tell me which field in the mapping will match the req fields ????

    <ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
    <Subject>Hello</Subject>
    <From>[email protected]</From>
    <To>[email protected]</To>
    <Content>row1
    row2
    row3
    row4</Content>
    </ns:Mail>
    You can use UDF example to do this. Assume your original message payload is:
    <root>
    <text>row1</text>
    <text>row2</text>
    <text>row3</text>
    <text>row4</text>
    </root>
    Create a advanced user defined function like this:
    public void AddText(String[] a, ResultList result, Container container){
    codeString b = "";
    for (int j=0;j<a.length;j++)
    b = b + a[j] + "\n";
    result.addValue(b);[/code]
    Now you connect
    text -> addText -> Content

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

    Hi 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

  • PayloadZIPBean with Mail Package... is it possible?

    Hi,
    In proxy to file scenario, I send mails from PI with data received from proxy as attachment. I also need to zip the attachment.
    I will be getting the email address dynamically, hence I should use Mail Package with 'Keep Attachments' option. Now the problem is if I use mail package since the <content> tag data is taken as mail attachment, can I use PayloadZipBean in receiver mail adapter to zip the attachemnt?
    I tried using the follwoing adapter module in receiver mail mail adapter but ended with an error.
    Module Name: AF_Modules/PayloadZipBean                             Module Key: zip
    Module Config:
    zip             zip.filenameKey                   payloadName
    zip             zip.mode                              zipOne
    Error:
    org.xml.sax.SAXParseException: Content is not allowed in prolog
    Regards,
    Sreedhar

    Hi Sreedhar,
        Have you looked at this help link?
    http://help.sap.com/saphelp_nwpi711/helpdata/en/45/da9358a1772e97e10000000a155369/content.htm
    Also see :
    Zip Payload using PayloadZipBean Module Processor
    Regards,
    Ravi Kanth Talagana
    Edited by: Ravi Kanth Talagana on Oct 22, 2009 5:13 PM

  • Mail Adapter: Working with mail packages

    Hi All
    I am having a receiver mail adapter.
    I am using mail package to send data as a text file attachment.I am getting the following error:
    failed to send mail: com.sap.aii.messaging.util.XMLScanException: expecting start tag: Mail, but found TM_Mail at state 1
    How can i override my current namespace with the recomended namespace 'http://sap.com/xi/XI/Mail/30}Mail'??
    Thanks
    Chandra

    I am trying to use the mail package as well and no e-mail delivered.  However,  when I do not use the mail package an use mail attribute and remove the code below it works fine.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30"> 
    <subject>824 test</subject>
    <from>edi/@/na.modine.com</from>
    <to>s.m.posnanski/@/na.modine.com</to>
    <reply_to>edi_support/@/na.modine.com</reply_to>
    <content_Type>text/plain</content_Type>
    <content>
    Hello
    </content>
    </ns:Mail>
    Can some provide the settings that are needed in the Module tab when using the "Mail Package" option??

  • Sender Mail Adapter Content Conversion

    Hi All,
         I just want to know if we can send a flat file(Rather Than the XML) with content conversion using Mail Adapter. If yes then what are all the possible ways for this.
    I have tried but i am sucessful in sending the complete payload as a XML file, but i want the file with the content conversion, so that this should be able to picked by the third party systems.
    Will be oblidge if any supported blog or pdf is provided for the same.
    Thanks in Advance.
    Jay

    Hi,
    Now for the negative items, i want to send them back to business as flat file format
    using the mail adapter as attachment. This will help them to process the file as for there
    requirement.
    Since you need to send an email message you have to use the format mentioned here: (S-UserID required)
    https://websmp205.sap-ag.de/~sapidb/012006153200000361852004E/ximail30_xsd.txt
    Save this file as an XSD in you local system and upload it as an External Definition in your XI server.
    Develop MI based on this External Definition (IN, ASYNC)
    Create an Interface Mapping with Source as the file containing Negative items and target as the above developed MI
    Now you need to develop an XSLT mapping (can use StylusStudio to do it) between the source and target Message Types
    This XSLT mapping has to be designed in such a way that it extracts the payload out of the Negative Items message and maps it to the target (Content) field....you need to use CDATA element of XSLT here.
    In this mapping itself you can define to what email-id you want to send the message.....
    Everything happens on the XI --> Business service side...so it is not the sender channel but is the receiver channel:)
    Your XSLT mapping will look something like:
    <Mail>
         <Content>
              XSLT CODE
         </Content>
    </Mail>
    where Mail and Content are the tags in the email message format...the External definition one.....
    If you are new to XSLT then refer to my answer in this thread...
    Re: JAVA MAPPING
    regards,
    Abhishek.

  • Mail adapter - content coming as attachment

    Hellow experts,
    I am sending data from R3 to emails using mail adapter.  I am using the follwoing mail package format.  
    <?xml version="1.0" encoding="UTF-8" ?>
      <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
      <Subject>Water Catchment Form</Subject>
      <From>[email protected]</From>
      <To>[email protected]</To>
      <Reply_To>[email protected]</Reply_To>
      <Content_Type>text/plain</Content_Type>
      <Content>You have work order(s) !!</Content>
      </ns1:Mail>
    In my mail adapter, I have ticked
      Use Mail Package Format and
      Keep Attachments
    I am getting the content as an attachment - I want it inside the email.
    The attachment is coming with a name Untitled.pdf  - I need the actual name.
    Am I missing anything?
    What can I do to get things right?
    Thnx

    Hi Sabbir
    refer this Pdf may be helpful for u
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9e6c7911-0d01-0010-1aa3-8e1bb1551f05
    Thanks!!

Maybe you are looking for