<?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: Attach XML File to email as an attachment in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/attach-xml-file-to-email-as-an-attachment/m-p/5308881#M1224150</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this link it is help full&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/exporting" target="test_blank"&gt;https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/exporting&lt;/A&gt;&lt;EM&gt;data&lt;/EM&gt;to&lt;EM&gt;Excel&lt;/EM&gt;-&lt;EM&gt;XML&lt;/EM&gt;to&lt;EM&gt;the&lt;/EM&gt;rescue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/abapdocu/en/ABAPCALL_TRANSFORMATION.htm" target="test_blank"&gt;http://help.sap.com/abapdocu/en/ABAPCALL_TRANSFORMATION.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2009 06:17:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-07T06:17:34Z</dc:date>
    <item>
      <title>Attach XML File to email as an attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/attach-xml-file-to-email-as-an-attachment/m-p/5308879#M1224148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Using Call transformation, I have created a XML document. Now I want to send this XML document as an attachment  to a e-mail. Can anyone help me how can I achieve this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  v_resstream      = v_stream_factory-&amp;gt;create_ostream_itable(&lt;/P&gt;&lt;P&gt;                       table = t_restab ).&lt;/P&gt;&lt;P&gt;  v_resstream-&amp;gt;set_encoding( encoding = v_encoding ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CALL TRANSFORMATION ZSD_INVOICE_MX_DIGITAL&lt;/P&gt;&lt;P&gt;       SOURCE OUTPUT = t_output[]&lt;/P&gt;&lt;P&gt;       RESULT XML v_resstream.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_output has the data and ZSD_INVOICE_MX_DIGITAL is the XSLT code where I have the XML documents template.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the XML document is in the byte format in table t_restab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I attach this to the mail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried as below but still it doesnt work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT t_restab INTO v_line.&lt;/P&gt;&lt;P&gt;    CONCATENATE v_resstr v_line INTO v_resstr IN BYTE MODE.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: v_str TYPE string,&lt;/P&gt;&lt;P&gt;             t_restab              TYPE d_restab,&lt;/P&gt;&lt;P&gt;             v_resstr              TYPE xstring,&lt;/P&gt;&lt;P&gt;             v_line                TYPE d_line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  REFRESH: lt_objbin1, lt_record.&lt;/P&gt;&lt;P&gt;  CLEAR: v_str, wa_record.&lt;/P&gt;&lt;P&gt;  v_str = v_resstr.&lt;/P&gt;&lt;P&gt;  DO.&lt;/P&gt;&lt;P&gt;    wa_record = v_str.&lt;/P&gt;&lt;P&gt;    APPEND wa_record TO lt_record.&lt;/P&gt;&lt;P&gt;    SHIFT v_str LEFT BY 255 PLACES.&lt;/P&gt;&lt;P&gt;    IF v_str IS INITIAL.&lt;/P&gt;&lt;P&gt;      EXIT.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="5" type="ul"&gt;&lt;P&gt;Filling all the other details here for sending the mail&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  lt_objbin1 = lt_record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: wa_objpack.&lt;/P&gt;&lt;P&gt;  lv_lines = lv_lines + 1.&lt;/P&gt;&lt;P&gt;  wa_objpack-transf_bin = c_x.&lt;/P&gt;&lt;P&gt;  wa_objpack-head_start = 1.&lt;/P&gt;&lt;P&gt;  wa_objpack-head_num   = 1.&lt;/P&gt;&lt;P&gt;  wa_objpack-body_start = 1.&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE lt_objbin1 LINES lv_lines.&lt;/P&gt;&lt;P&gt;  wa_objpack-body_num   = lv_lines.&lt;/P&gt;&lt;P&gt;  wa_objpack-doc_type   = 'XML'.&lt;/P&gt;&lt;P&gt;  wa_objpack-obj_name   = 'text2'.&lt;/P&gt;&lt;P&gt;  CONCATENATE p_nast-objky  '_' v_kunrg '_' v_vkorg '_1'&lt;/P&gt;&lt;P&gt;               INTO wa_objpack-obj_descr.&lt;/P&gt;&lt;P&gt;  wa_objpack-doc_size   = ressize.&lt;/P&gt;&lt;P&gt;  APPEND wa_objpack TO lt_objpack.&lt;/P&gt;&lt;P&gt;  APPEND LINES OF lt_objbin1 TO lt_objbin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calling the FM SO_DOCUMENT_SEND_API1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can see that in the mail, an .XML attachment is existing successfully but there is no content. It says some error while reading the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me achieve this?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suganya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2009 11:12:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/attach-xml-file-to-email-as-an-attachment/m-p/5308879#M1224148</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-05T11:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Attach XML File to email as an attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/attach-xml-file-to-email-as-an-attachment/m-p/5308880#M1224149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suganya,&lt;/P&gt;&lt;P&gt;      Could you please care to share the solution as am facing the same issue, hope you would respond.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks N Regards,&lt;/P&gt;&lt;P&gt;Abdul.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:10:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/attach-xml-file-to-email-as-an-attachment/m-p/5308880#M1224149</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T06:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Attach XML File to email as an attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/attach-xml-file-to-email-as-an-attachment/m-p/5308881#M1224150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this link it is help full&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/exporting" target="test_blank"&gt;https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/exporting&lt;/A&gt;&lt;EM&gt;data&lt;/EM&gt;to&lt;EM&gt;Excel&lt;/EM&gt;-&lt;EM&gt;XML&lt;/EM&gt;to&lt;EM&gt;the&lt;/EM&gt;rescue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/abapdocu/en/ABAPCALL_TRANSFORMATION.htm" target="test_blank"&gt;http://help.sap.com/abapdocu/en/ABAPCALL_TRANSFORMATION.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:17:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/attach-xml-file-to-email-as-an-attachment/m-p/5308881#M1224150</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T06:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Attach XML File to email as an attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/attach-xml-file-to-email-as-an-attachment/m-p/5308882#M1224151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abdul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above code holds good except that the xstring format has to be converted to binary format..&lt;/P&gt;&lt;P&gt;In my code itself, after the loop , just add the below function module .. Rest of the code remains same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: v_resstr, v_line.&lt;/P&gt;&lt;P&gt;  LOOP AT t_restab INTO v_line.&lt;/P&gt;&lt;P&gt;    CONCATENATE v_resstr v_line INTO v_resstr IN BYTE MODE.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  REFRESH: lt_objbin1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Convert the xstring to binary &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      buffer     = v_resstr&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      binary_tab = lt_objbin1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear: lv_lines.&lt;/P&gt;&lt;P&gt;  CLEAR: wa_objpack.&lt;/P&gt;&lt;P&gt;  wa_objpack-transf_bin = c_x.&lt;/P&gt;&lt;P&gt;  wa_objpack-head_start = 1.&lt;/P&gt;&lt;P&gt;  wa_objpack-head_num   = 1.&lt;/P&gt;&lt;P&gt;  wa_objpack-body_start = 1.&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE lt_objbin1 LINES lv_lines.&lt;/P&gt;&lt;P&gt;  wa_objpack-body_num   = lv_lines.&lt;/P&gt;&lt;P&gt;  wa_objpack-doc_type   = c_xml.&lt;/P&gt;&lt;P&gt;  wa_objpack-obj_name   = 'XMLAttachment'.&lt;/P&gt;&lt;P&gt;  wa_objpack-obj_descr  = u2018INVOICE XMLu2019.&lt;/P&gt;&lt;P&gt;  wa_objpack-doc_size   = ressize.&lt;/P&gt;&lt;P&gt;  APPEND wa_objpack TO lt_objpack_final.&lt;/P&gt;&lt;P&gt;  APPEND LINES OF lt_objbin1 TO lt_objbin_final.&lt;/P&gt;&lt;P&gt;  APPEND LINES OF lt_objpack TO  lt_objpack_final.&lt;/P&gt;&lt;P&gt;  APPEND LINES OF lt_objbin  TO  lt_objbin_final.&lt;/P&gt;&lt;P&gt;  APPEND LINES OF lt_objtxt  TO  lt_objtxt_final.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Call the FM SO_DOCUMENT_SEND_API1 to create and the send the mail to the &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;receivers.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suganya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:20:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/attach-xml-file-to-email-as-an-attachment/m-p/5308882#M1224151</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T06:20:35Z</dc:date>
    </item>
  </channel>
</rss>

