Send XML File as attachement in Mail Receiver adapter

Hi all,
i have the following scenario. i would like to read an XML file from the file system and send this file as an attachement of a mail to a mail receiver specified in this file.
i would like to fill the payload of the mail with some information from the xml file and in addition i would like to send the complete xml file as an mail attachement.
can anybody tell me, how the mail receiver adater needs to be specified ?
best regards,
martin

Hey,
you can go for dynamic configuration of mail adapter.
In this you need to import a mail structure.
mail details such as to, from, subject and content of the mail are a part of the structure.
In your ID check the Use Mail package and also keep attachments.
Now you can give your details in mapping itself.
whatever you want to map in the content of the mail, map it in the content field.
also your file will behave as an attachment.
refer to this blog.
this is the mail structure. Import it as extenal definitions.
<?xml version="1.0" encoding="utf-8" ?>
<!--
SAP takes no position regarding the validity or scope of any intellectual property or
other rights that might be claimed to pertain to the implementation or use of the
technology described in this document or the extent to which any license under such
rights might or might not be available; neither does it represent that it has made any
effort to identify any such rights.
Copyright © SAP 2003-2004. All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative
works that comment on or otherwise explain it or assist in its implementation may be
prepared, copied, published and distributed, in whole or in part, without restriction of
any kind, provided that the above copyright notice and this paragraph are included on all
such copies and derivative works. However, this document itself does not be modified in
any way, such as by removing the copyright notice or references to SAP.
This document and the information contained herein is provided on an u201CAS ISu201D
basis and SAP DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY
IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-->
<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:schema>
regards,
milan

Similar Messages

  • Sending XML file as attachment in E-mail

    Hi,
    I'm facing a problem with sending e-mails with an XML-file as attachment. Scenario is as follows:
    - I collect the payload from XI with FM 'SXMB_READ_MESSAGE_VERSION_RAW'.
    - This payload is in the form of an xstring.
    - I convert this xstring to binary content by using FM 'SCMS_XSTRING_TO_BINARY'.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer                = lv_buffer
      * APPEND_TO_TABLE       = ' '
      IMPORTING
        output_length         = lv_i
      TABLES
        binary_tab            = lt_conhex.
    The itab lt_conhex is of type solix_tab.This is used finally to send the mail via class CL_BCS following normal procedures. Now when I open the e-mail with attachments I get the error that in the last line of my xml-file some squares are placed, which causes the document to open incorrectly.  When I delete the squares via e.g. notepad and open my xml-file again in my internet browser, it opens correctly.
    If I look at the contents of the solix_tab I see that the last line of the hexadecimal values are zero's, probably causing the XML file to be attached/oopened incorrectly. Is there any way to replace these zero's with some hexadecimal value in order to display my XML-file correctly?
    Kind regards!

    Thanks Sandra,
    Overlooked that parameter. Indeed if you take the XSTRLEN of the document and place this in the method for creating the attachment it works fine.
    CALL METHOD lo_email->add_attachment
      EXPORTING
        i_attachment_type      = ls_email-type
        i_attachment_subject   = ls_email-subject
        i_att_content_hex      = ls_email-content_hex
        i_attachment_size      = ls_email-content_length.
    By the way...if you're dealing with PDF documents this documentlength doesn't matter.

  • Error while sending excel sheet as attachment to Mail Receiver

    Hi everyone,
    I am facing the below error when I am trying to send data to Mail receiver adapter. The attachment is excel sheet.
    Delivery of the message to the application using connection Mail_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Object not found in lookup of MessageTransformBean.: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of MessageTransformBean..
    I don't understand where the problem is. This has been running since long time and last month we have changed our web dispatcher details. I hope everything is fine. But not sure the root cause for this issue.
    Please help me in resolving this.
    Thank you.
    Regards
    Bhanu T.

    Check if this helps: MessageTransformBean module
    Confirm that you have configured the MessagetransformationBean properly.
    Are you trying to convert some payload into Excel and send it as an attachment in the Mail CC? If yes, then I hope that you have included the correct Content_type value.
    Check this for more info on Content_type: /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    Regards,
    Abhishek.

  • Attachment in Mail Receiver Adapter

    Hi,
    I wrote a Adapter Module to create attachment in Receiver Mail Adapter. I create a PDF document using the IText API and create the attachment using this one. But it not work properly and the attachment is not send with the e-mail. My code is:
    public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)
              throws ModuleException{
              try{
                   Document doc = new Document(PageSize.A4);
                   ByteArrayOutputStream out = new ByteArrayOutputStream();
                   PdfWriter.getInstance(doc,out);
                   doc.open();
                   PdfPTable table = new PdfPTable(3);
                   PdfPCell cell;
                   cell = new PdfPCell(new Paragraph("Rank"));
                   cell.setBackgroundColor(new Color(34, 90, 141));
                   table.addCell(cell);
                   cell = new PdfPCell(new Paragraph("Name"));
                   cell.setBackgroundColor(new Color(34, 90, 141));
                   table.addCell(cell);
                   cell = new PdfPCell(new Paragraph("Points"));
                   cell.setBackgroundColor(new Color(34, 90, 141));
                   table.addCell(cell);
                   //add the data rows.
                   int flag = 0;
                   Color bg;
                   for (int i = 0; i <= 10; i++){
                        //alternate colors
                        if (flag == 0){
                             flag = 1;
                             bg = new Color(204, 204, 255);
                        } else {
                             flag = 0;
                             bg = new Color(255, 255, 255);
                        cell = new PdfPCell(new Paragraph("1"));
                        cell.setBackgroundColor(bg);
                        table.addCell(cell);
                        cell = new PdfPCell(new Paragraph("Prakash Singh: " + i));
                        cell.setBackgroundColor(bg);
                        table.addCell(cell);
                        cell = new PdfPCell(new Paragraph("" + (50000 - i * 10) + ""));
                        cell.setBackgroundColor(bg);
                        table.addCell(cell);
                   doc.add(table);
                   doc.close();
                   Message msg = (Message)inputModuleData.getPrincipalData();
                   AuditMessageKey amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);
                   Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,"CreateAttachment: Module Called");
                   Payload attachment = msg.createPayload();
                   attachment.setName("Order");
                   attachment.setContentType("Plain/Text");
                   attachment.setContent(out.toByteArray());
                   msg.addAttachment(attachment);
                   inputModuleData.setPrincipalData(msg);
              }catch (Exception ex){
                   ModuleException me = new ModuleException(ex);
                   throw me;
              return inputModuleData;
    somebody has some ideia.
    thanks.

    Hi,
    I checked the "Keep Attachments" in the Communication Channel and the file was sent, but the extension of attachment is .bin. How I do to change the extension file name in attachment to .pdf? And how I do to keep the content in body of the mail when the keep attachments is checked?
    thanks.

  • How to attach Excel file in Mail Receiver Adapter?

    Hello Experts,
    In R/3 coding I have Internal Table data available for which i have to generate an Alert mail with Excel file attachment.
    This is the scenario of Proxy sender to Mail Receiver. but I don't know how to convert the Internal Table data into Alert mail excel File attachment.
    Please suggest me.
    Regards,
    Jagesh

    Hi Santhosh,
    Thanks for your suggestion.
    But without using XSLT mapping also, I have generated the Excel File attachment.
    Throgh R/3 coding I am passing following.
    G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-FROM = From Mail Address.
          G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-TO = TO Mail Address.
          G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-SUBJECT = 'Test Alert mail'.
          G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-DATE = SY-DATUM.
          G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT_TYPE =   'text/plain;name="CSV_data.csv"'.
          G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT = 'Testing1,Testing2,Testing3'.
          G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT_DISPOSITION = 'attachment'.
    And in the Mail Receiver Adapter i have configured as following.
    Use Mail package and Keep Attachment both options are selectd.
    So I am getting the data in different columns in the excel file But How to set the Next ROW in Excel file?
    I thnk i am missing something in CONTENT value.
    Regards
    Jagesh

  • Receive a mail with attachment and send it as it is via Mail-receiver

    Hi,
    we have PI/7.0
    I have a scenario with a mail-sender.
    I get mails with attachments and depending on the subject I have to send some mails to an other mail-address via mail-receiver-adapter.
    My problem is, that I have to send it "as it was" - with all attachments (and the correct attachment names) and the original mail-body.
    I tried to check the checkbox "keep attachments": I got all attachments but the original mail-body was now an extra attachment (with the extension .xml).
    I don't wanna have this new attachment!
    What can I do?
    Thanx a lot!
    Regards
    Wolfgang

    Hi,
    I think quite simple
    message protocol: xipayload
    Use Mail package: NO
    Keep Attachments: YES
    Content encoding: <nothing>
    No extra modul
    I entered all address-informations (from, to,...) in the fields displayed after the checkbox for "use mail package".
    that's all.
    regards
    Wolfgang

  • Not able to send pdf file as attachment in my apple mail.

    Hi, I was easily able to attach pdf files to my apple mail.  infact I could just open a pdf file and then send it as attachment in the email earlier. but after downloading and upgrading to os X Mountain lion, I am neither being able to attach and send pdf files in my apple mail, nor can I send PDF file as an attachment.
    Is there any issue with OS X Mountain Lion.
    Issue 1.  I compose Email , then click attach > Browse > select pdf file > click attach > it shows in my Email body either as an icon or as first page of the pdf document > I send it. >>> But when the receipient opens the Email, that pdf attachment is missing. In fact When I put a cc to my self and I open the Email, the attachment is mssing in the incoming E amil.
    Issue 2. I open the PDF document > Click on File > send as attachment in E-Mail > on right, a menu appears where I select the File and click attach> I get a message
    The SendMail doesnot know how to talk to your default mail client. Please select a different mail application to use. Attaching a screen shot.
    I never had these issues earlier with my Lion OS . but since the time I have upgraded to mountain Lion OS, I am having these issues.
    Are these the Mountain Lion issues, how to fix these please.

    I believe, the software team forgot to put a button for send or share as an attachment to preview.

  • Problem in Sending  .txt as an attachment to mail

    Dear Experts,
         I am working on a file to mail scenario. I have searched a lot in sdn, but could not locate the exact answer for the same.
    I am using file adapter to pick up a txt file from a location and supposed to send this as an attachment to mail(in box).
    My scenario is ready, have configured the IR and ID. there are only 5 fields at the sender side, have done one to one mapping at the receiver side.
    question is
    1)  Do I have to use content conversion at the sender side in order to read the file in XI or....
    2)  Can i send the payload of the message as an attachment? Do i have to configure anything else for the same for eg
    3) where i have to configure my sender and receiver, has to be in mail adapter or in xml payload?
    Kindly provide your valuable suggestions or  idea to proceed , as i am confused how to proceed wz the same.
    Thanks
    Virendra

    Hi,
    1) Do I have to use content conversion at the sender side in order to read the file in XI or....
    Since ur source is a .txt file... to convert it to a xml format u need to use the FCC in file adapter.
    2) Can i send the payload of the message as an attachment? Do i have to configure anything else for the same for eg
    You can send the payload of a message as a attachment.
    I hope u dont want to send the XML structure as a attachment... In receiver...first u have to convert the XML to a .txt file and then
    u need to send this .txt as a attachment..
    If this is ur requirement u can do it by using the inbuilt EJB's and  a Mail adapter in receiver.
    The inbuilt bean is MessageTransformationBean... which can convert a XML structure a Text file.
    and then u have to pass it to Mail adapter... Please keep in mind the sequence of processing.
    If clarification needed u can put a post again
    3) where i have to configure my sender and receiver, has to be in mail adapter or in xml payload?
    U need to configure both sender and receiver. Sender is a file adapter and receiver is a Mail adapter.
    Decide first u want to use mail package or not..
    For ur scenario u can do both ways using Payload or XIALL..
    Babu

  • How to send XML file to https server using POST

    Hi, I am having an requirement, that I have to connect to https server and I have to pass an input XML file as a response server will give me output XML file.
    The certificate validation part is over, I am using FileInputStream to read the XML file and attaching this to connection.getOutputStream(); but server is throwing me DTD does n't match.
    Can any body tell me how to send XML file, I have to use any DOM parser to send the XML file, suggest me and give me sample code.
    Thanks,

    Can anybody give me the solution

  • Mail receiver adapter: attachment adds 3 empy lines

    Hi,
    i use the mail receiver adapter with "mail package" for setting dynamic attachment names.
    The attachment always gets 3 "cr/lf" lines at the end? Why and how can i stop that?
    System: xi3.0sp15build0
    Message was edited by:
            Bernhard Josef Neuhauser

    HI,
    Please read above link for PayloadSwapBean.
    You use the PayloadSwapBean module to replace the application payload of the XI message that contains the business data with another payload that is appended to the XI message as an attachment
    Also see the links below.. how to use PayloadSwapBean.
    HOW - PayloadSwapBean - adding attachments to the message? :-)
    Mailadapter, receive mails from mailserver: attachment?
    Work with attachments
    Sender Mail Adapter - html body mail
    Multi Attachments with ZIP or Mail Adapter (Outbound)
    Regards
    Chilla..

  • Mail Receiver Adapter Attachment Content Encoding

    Hello to all,
    we use a mail receiver adapter to sent XI messages as email. Everything works fine but the content encoding of the  attachment is set to UTF-8. I need ISO-8859-1 instead of UTF-8. How could I achieve this ?
    Thanks Christian

    Hello Stefan,
    we've tried this too (content type to: text/plain;charset="ISO-8859-1"), but it didn't work.
    This is our output structure
    <?xml version="1.0" encoding="ISO-8859-1"?><ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30"><Subject>Daten von 01.07.2008 12:20</Subject><From>mail(at)dummy.de</From><To>max.muster(at)web.de</To><Content_Type>multipart/mixed; boundary="--AaZz"</Content_Type><Content>----AaZz
    Content-Type: text/html; charset=ISO-8859-1
    Content-Disposition: inline
    Mit freundlichen Grüßen
    ----AaZz
    Content-Type: text/plain; charset=ISO-8859-1; name=Daten 01.07.2008 1220.txt
    Content-Disposition: attachment; filename=Daten 01.07.2008 1220.txt
    "N";2000000003;"1234123412341234";1234500009;000000000000;01;"L";"OKDAU";1;"Prof. Dr.";"Max";"Mustermann";"";"Musterstraße";"";000000;"PLZ45";"Musterhausen";"";19990101;"max.mustermann(at)muster.com";"";"";"";"";"1";"Titel";"Vorname";"Name";"20000101";"";"0";"Max Mustermann";"L";"BLZ";"100000001";"Musterbank";00;;01;000000;;;00;1;0;0;1;0;"ForumNr";1;1;0;1;0;1;0;0;20080620;0;;0;20080620;0;20080620;0002;STANDARD
    "N";2000000004;"5678567856785678";1234567009;000000000000;01;"L";"OKDAU";1;"Prof. Dr.";"Stefan";"Maier";"";"Teststraße";"";000000;"PLZ65";"Testhausen";"";19991201;"stefan.maier(at)test.de";"";"";"";"";"1";"Titel";"Vorname";"Name";"20001201";"";"0";"Stefan Maier";"L";"BLZ";"100000001";"Testbank";00;;01;000000;;;00;1;0;0;1;0;"ForumENr";1;1;0;1;0;1;0;0;20080620;0;;0;20080620;0;20080620;0002;STANDARD</Content></ns:Mail>
    But the attachment is UTF-8
    Thanks for your help.
    Christian

  • How to send XML file into XI using sender HTTP adapter

    I am using HTTP sender adapter to post the XML file into XI. I tried to form the URL by using the following String query , but I am unable to execute file.
    String urlString = "http://<servername:portno>/sap/xi/adapter_plain?namespace=<namespace>&interface=<interface name>&service=<service name>&party=&agency=&scheme=&QOS=BE&sap-user=xiappluser&sap-password=satyam&sap-client=100&sap-language=EN";
    How can I execute xml file by using HTTP sender adapter.
    Any one with better suggestions, about this idea?
    Thanks in advance for all.
    Ram Raj

    Hi
    Just use the following parameter to send xml file using HTTP adapter.
    "http://xiserver:8000/sap/xi/adapter_plain?namespace="senderNamespace"&interface=senderinterface&service=sender service";
    "&party=sender party"&agency=&scheme=&QOS=BE&sap-user=userid &sap-password=password&sap-client=100&sap-language=D";
    with the help of this you are able to point out which interface you would like to use.
    And in payload pass the xml.
    and thats it
    carry on
    Cheers
    Regards
    Piyush

  • Send multiple files in different directories using Receiver File Adapter

    Hi Experts,
    I have one File to File without ESR scenario where I have to pick multiple files from different directories and to save them in different directories on receiver side.
    Can anyne help me to send multiple files in different directories using receiver file adapter.
    Is it possible??
    Any help will be appreciated.
    Regards,
    Danish

    hi ,
    that is possiable without esr,
    we need to create one sender communication channel , in that  we nend to use "adavnced selection for source file " for sending multiple files from multiple directories.
    we need to create 'n' receiver communication channels and 'n' receiver agreements based on communication channels .
    in receiver determination, provide multiple receivers
    In interface determination , provide * symbol for receiver communication components
    thanks,

  • How to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 using ftp

    how to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 device using ftp through Ethernet

    Hello
    For using FTP function in LabVIEW, I recommend you to check this document: FTP Basics
    Also, take a look at FTP Browser.vi, which is available at the Example Finder.
    To edit a XML file, try to use VIs in XML palette. Maybe Write to XML.vi helps you.
    Post your current VI if possible.
    Regards
    Mondoni

  • How to send txt file  as attachement in email

    Hi Experts ,
    How to send  txt file  as attachement in email .
    which function module i use

    Hi,
    Try to use this one
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
    Hope it can solve your problem!
    Good luck!
    Tao

Maybe you are looking for

  • Cannot open customize OAF screen after upgrade to 12.1.3

    Hi, After upgrade to 12.1.3, I am not able top open customize OAF screens from Applications. By following some documents from MOS, I have done the following. 1)-applied patch 9879989 on Linux server. 2)-I am able to install JDeveloper,open and compil

  • How do I select a thick paper to print from Indesign?

    How do I select a thick paper to print from Indesign? I have to go to the printer to select the thicker paper. I would like to select the paper from my computer in Indesign.  Other programs allow this.

  • Macbook Pro can't connect to WEP 128 bits Router.

    I'll try to list everything here so you can get a clear picture of the situation. First, after all my PCs flatmates connected to our Wireless internet (Amper aw01), I was still struggling. I tried everything, from WEP, to WEP 128 hex, WEP 128 ASCII,

  • Partner Links sometimes in left swim-lane sometimes in right swim-lane

    Hello, I am using jdeveloper 11.1.6 (or about) and am working with SOA. I have noticed that the partner links inside the BPEL show up on different swim-lanes, sometimes the right side, and other times the left side, and there seems no rhyme or reason

  • Printing small envelopes

    I am trying to print on small envelopes - 3.5"x 5" and the envelope gets stuck in the printer.  I am feeding it according to directions.  I have the HP 4500 all-in- one printer.   Please advise. Thanks