<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error when emailing XML document in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224755#M137523</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I opened a new topic. I copied your code exactly, so type definitions are the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Martijn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 23 Jul 2006 11:59:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-07-23T11:59:58Z</dc:date>
    <item>
      <title>Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224743#M137511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to email an XML document to an external vendor by using the CL_DOCUMENT_BCS class.  The email is sent successfully and I receive it in the relevant mailbox.  To make it an XML document, I move 'XML' to the I_TYPE parameter of the class.  This sends it perfectly as an XML document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem occurs when I receive the email and open the attachment.  When I open the attachment, I get the error "Whitespace is not allowed at this location".  To rectify this problem, I open the XML attachment in notepad, concatenate these lines by deleting the return characters and I save the file and open it again.  It then displays perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I send the email as a normal text document and I change the extension manually to 'XML', the XML can be viewed perfectly.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone assist in rectifying this so that there is no manual intervention?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Gustav Coleske&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Apr 2006 08:50:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224743#M137511</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-11T08:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224744#M137512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you post the code how you are generating xml and how the generated xml is converted to table (the one used with add_attachment method).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Apr 2006 12:25:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224744#M137512</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-04-11T12:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224745#M137513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL TRANSFORMATION (`ID`)&lt;/P&gt;&lt;P&gt;  SOURCE itab = gt_sap_to_eprop[]&lt;/P&gt;&lt;P&gt;  RESULT XML gt_xml_out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Gustav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Apr 2006 12:38:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224745#M137513</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-11T12:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224746#M137514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;gt_xml_out will be in string format and how you are converting it to binary format to attach (the problem could be here) or you are attaching as text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need to see your code for &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD document-&amp;gt;add_attachment&lt;/P&gt;&lt;P&gt;            EXPORTING&lt;/P&gt;&lt;P&gt;              i_attachment_type    = 'XML'&lt;/P&gt;&lt;P&gt;              i_attachment_subject = atta_sub&lt;/P&gt;&lt;P&gt;              i_att_content_hex    = binary_content.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the data declration for the variables used in this method and how they are filled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;P&gt;Reward points to helpful answers by choosing the appropriate radiobutton next to the answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 06:41:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224746#M137514</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-04-12T06:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224747#M137515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM send_data_via_email .&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  DATA:   new_object_id LIKE sofolenti1-object_id,&lt;/P&gt;&lt;P&gt;          l_idx         LIKE sy-tabix.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;All activities done via facade CL_BCS!&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  DATA: send_request              TYPE REF TO cl_bcs.&lt;/P&gt;&lt;P&gt;  DATA: text                      TYPE bcsy_text.&lt;/P&gt;&lt;P&gt;  DATA: document                  TYPE REF TO cl_document_bcs.&lt;/P&gt;&lt;P&gt;  DATA: sender                    TYPE REF TO cl_sapuser_bcs.&lt;/P&gt;&lt;P&gt;  DATA: recipient                 TYPE REF TO if_recipient_bcs.&lt;/P&gt;&lt;P&gt;  DATA: bcs_exception             TYPE REF TO cx_bcs.&lt;/P&gt;&lt;P&gt;  DATA: lt_contents               TYPE TABLE OF soli.&lt;/P&gt;&lt;P&gt;  DATA: lt_contents2              TYPE TABLE OF solix.&lt;/P&gt;&lt;P&gt;  DATA: lv_subject                TYPE sood-objdes VALUE 'Rental Units'.&lt;/P&gt;&lt;P&gt;  DATA: lv_length                 TYPE i.&lt;/P&gt;&lt;P&gt;  DATA: lv_receiver_email_address TYPE adr6-smtp_addr.&lt;/P&gt;&lt;P&gt;  DATA: lv_string                 TYPE string.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Select the record for email address to send to off parameter table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SELECT SINGLE value FROM zca_partr INTO gs_real_recipients-receiver&lt;/P&gt;&lt;P&gt;    WHERE progid = sy-repid&lt;/P&gt;&lt;P&gt;    AND   id     = 'OUT_EMAIL'.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  APPEND gs_real_recipients TO gt_real_recipients.&lt;/P&gt;&lt;P&gt;  CLEAR gs_real_recipients.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  CLEAR new_object_id.&lt;/P&gt;&lt;P&gt;  gv_items_sent = 'X'.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Send back non-delivery and delivery reports.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  LOOP AT gt_real_recipients INTO gs_real_recipients.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;    gs_real_recipients-notif_del  = 'X'.&lt;/P&gt;&lt;P&gt;    gs_real_recipients-notif_ndel = 'X'.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;    gs_real_recipients-express    = gv_express.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;    MODIFY gt_real_recipients FROM gs_real_recipients.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  gt_contents[] = gt_xml_out[].&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set the subject of the email&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  lv_subject                   = 'Rental Units for rent'.&lt;/P&gt;&lt;P&gt;  gs_packing_list-mail_subject = lv_subject.&lt;/P&gt;&lt;P&gt;  gs_packing_list-doc_type     = 'XML'.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  TRY.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create persistent send request&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      send_request = cl_bcs=&amp;gt;create_persistent( ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create and set document&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create document from internal table with lt_content&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      lt_contents[] = gt_contents[].&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      DESCRIBE TABLE lt_contents[] LINES lv_length.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      gs_packing_list-doc_size = lv_length * 255.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      document = cl_document_bcs=&amp;gt;create_document(&lt;/P&gt;&lt;P&gt;                      i_type     = gs_packing_list-doc_type&lt;/P&gt;&lt;P&gt;                      i_text     = lt_contents&lt;/P&gt;&lt;P&gt;                      i_length   = gs_packing_list-doc_size&lt;/P&gt;&lt;P&gt;                      i_subject  = lv_subject&lt;/P&gt;&lt;P&gt;                      i_language = sy-langu&lt;/P&gt;&lt;P&gt;                   ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set the subject for the sending of mails.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      lv_string = gs_packing_list-mail_subject.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      TRY .&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;          CALL METHOD send_request-&amp;gt;set_message_subject&lt;/P&gt;&lt;P&gt;            EXPORTING&lt;/P&gt;&lt;P&gt;              ip_subject = lv_string.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;        CATCH cx_sy_dyn_call_illegal_method .&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      ENDTRY.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add document to send request&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      CALL METHOD send_request-&amp;gt;set_document( document ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Do send delivery info for successful mails&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      CALL METHOD send_request-&amp;gt;set_status_attributes&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          i_requested_status = 'E'&lt;/P&gt;&lt;P&gt;          i_status_mail      = 'A'.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set sender&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      sender = cl_sapuser_bcs=&amp;gt;create( sy-uname ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      CALL METHOD send_request-&amp;gt;set_sender&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          i_sender = sender.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add recipients (e-mail addresses)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      LOOP AT gt_real_recipients INTO gs_real_recipients.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create recipient&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;        lv_receiver_email_address = gs_real_recipients-receiver.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CHECK lv_receiver_email_address IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        recipient = cl_cam_address_bcs=&amp;gt;create_internet_address(&lt;/P&gt;&lt;P&gt;                                          lv_receiver_email_address ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add recipient with its respective attributes to send request&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;        CALL METHOD send_request-&amp;gt;add_recipient&lt;/P&gt;&lt;P&gt;          EXPORTING&lt;/P&gt;&lt;P&gt;            i_recipient  = recipient&lt;/P&gt;&lt;P&gt;            i_express    = 'X'&lt;/P&gt;&lt;P&gt;            i_blind_copy = gs_real_recipients-blind_copy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Send document&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;      CALL METHOD send_request-&amp;gt;send(&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          i_with_error_screen = 'X'&lt;/P&gt;&lt;P&gt;        RECEIVING&lt;/P&gt;&lt;P&gt;          result              = gv_sent_to_all ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Exception handling&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;    CATCH cx_bcs INTO bcs_exception.&lt;/P&gt;&lt;P&gt;      WRITE: text-001 , bcs_exception-&amp;gt;error_type.&lt;/P&gt;&lt;P&gt;      EXIT.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  ENDTRY.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  COMMIT WORK.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;ENDFORM.                    " send_data_via_email&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not using the add_attachment method as the normal document create automatically creates the attachment.  Would using this method be critical?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Gustav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 08:47:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224747#M137515</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T08:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224748#M137516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess its better to use add_attachment method to send attachments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 14:01:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224748#M137516</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-04-12T14:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224749#M137517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using the add attachment method and it still has the same problem.  I will just send this as a text document and ask the external system owner to change the extension on the file to .XML.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Gustav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Apr 2006 06:42:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224749#M137517</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-13T06:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224750#M137518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i tried and its working, here is the code sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: binary_content     TYPE solix_tab.
  DATA: xl_content TYPE xstring ,
output TYPE string .
  DATA: flights TYPE flighttab .


CALL TRANSFORMATION (`ID`)
              SOURCE flights   = flights[]
              RESULT XML output.


    CLEAR: xl_content .
*      xl_content = output .

    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        text           = output
*   MIMETYPE       = ' '
*   ENCODING       =
     IMPORTING
       buffer         = xl_content
     EXCEPTIONS
       failed         = 1
       OTHERS         = 2
              .
    IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    REFRESH binary_content .

    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer     = xl_content
      TABLES
        binary_tab = binary_content.

now add the attachment.

 CALL METHOD document-&amp;gt;add_attachment
          EXPORTING
            i_attachment_type    = 'XML'
            i_attachment_subject = atta_sub
            i_att_content_hex    = binary_content.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Apr 2006 06:54:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224750#M137518</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-04-15T06:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224751#M137519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I create XMX xstring in ABAB program and I would like this XML as attachment file via e-mail. I try use your examples and still don't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;King Regards&lt;/P&gt;&lt;P&gt;Pavel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 09:04:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224751#M137519</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T09:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224752#M137520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Welcome to SDN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open it as a new thread and post your code, i will try and correct it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 09:39:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224752#M137520</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-06-22T09:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224753#M137521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I copied your code to a test program, but when i execute the "Call transformation" the generated string (output) contains an unknown character which causes the function module 'SCMS_STRING_TO_XSTRING' to raise an error(unknown character). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i debug the program i see that the first character of the 'output'-string is a square. When i delete this first charcter, everything goes well......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions on what might create this unknown character?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any change you could post the rest of your code as a sample? So an example of the way you fill the rest of the document-object and which function you use to send the e-mail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Martijn de Jong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: M. de Jong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Jul 2006 11:07:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224753#M137521</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-23T11:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224754#M137522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;whats the type of the variable which is holding the resulting xml string?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you open a new thread and post your code there, i will check and see whats the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Jul 2006 11:35:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224754#M137522</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-07-23T11:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Error when emailing XML document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224755#M137523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I opened a new topic. I copied your code exactly, so type definitions are the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Martijn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Jul 2006 11:59:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-emailing-xml-document/m-p/1224755#M137523</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-23T11:59:58Z</dc:date>
    </item>
  </channel>
</rss>

