<?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: INTERNAL TABLE TO XML (IDOC) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862389#M1475961</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi blue22,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can solve this by using class cl_xml_document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Get your data in an internal table&lt;/P&gt;&lt;P&gt;2. Create XML Object type cl_xml_document&lt;/P&gt;&lt;P&gt;3. Convert data in table to XML by using method "create_with_data" of cl_xml_document&lt;/P&gt;&lt;P&gt;4. Save XML to local PC by using method "export_to_file"  of cl_xml_document&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;rea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 May 2010 13:48:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-05-12T13:48:10Z</dc:date>
    <item>
      <title>INTERNAL TABLE TO XML (IDOC)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862386#M1475958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have this requirement to fetch data from internal table and dowload this to an xml file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the xml file has this XML format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output Sample (in XML format):&lt;/P&gt;&lt;P&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;ORDERS01&amp;gt;&lt;/P&gt;&lt;P&gt;  &amp;lt;IDOC BEGIN="1"&amp;gt;&lt;/P&gt;&lt;P&gt;    &amp;lt;EDI_DC40 SEGMENT="1"&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;TABNAM&amp;gt;EDI_DC40&amp;lt;/TABNAM&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;DIRECT&amp;gt;1&amp;lt;/DIRECT&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;IDOCTYP&amp;gt;ORDERS01&amp;lt;/IDOCTYP&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;MESTYP&amp;gt;ORDERS&amp;lt;/MESTYP&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;SNDPOR&amp;gt;SAPEX3&amp;lt;/SNDPOR&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;SNDPRT&amp;gt;LS&amp;lt;/SNDPRT&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;SNDPRN&amp;gt;0011297603&amp;lt;/SNDPRN&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;RCVPOR&amp;gt;SAPP82&amp;lt;/RCVPOR&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;RCVPRT&amp;gt;LI&amp;lt;/RCVPRT&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;RCVPFC&amp;gt;LF&amp;lt;/RCVPFC&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;RCVPRN&amp;gt;&amp;lt;/RCVPRN&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;CREDAT&amp;gt;2003-09-15&amp;lt;/CREDAT&amp;gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;CRETIM&amp;gt;12:39:13&amp;lt;/CRETIM&amp;gt;&lt;/P&gt;&lt;P&gt;    &amp;lt;/EDI_DC40&amp;gt;&lt;/P&gt;&lt;P&gt;    &amp;lt;E1EDK01&amp;gt;&lt;/P&gt;&lt;P&gt; this format is in IDOC format, is there any function modules of way to download it to this file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help. thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 09:52:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862386#M1475958</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-12T09:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: INTERNAL TABLE TO XML (IDOC)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862387#M1475959</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;Just check if this link might help you.&lt;/P&gt;&lt;P&gt;Link[XML|http://sapprograms.blogspot.com/2008/11/download-to-xml.html]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards and Best wishes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 09:57:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862387#M1475959</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-12T09:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: INTERNAL TABLE TO XML (IDOC)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862388#M1475960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but i need the xml to have the tags from idocs the &amp;lt;SEGMET&amp;gt; etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there another way?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 10:05:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862388#M1475960</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-12T10:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: INTERNAL TABLE TO XML (IDOC)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862389#M1475961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi blue22,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can solve this by using class cl_xml_document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Get your data in an internal table&lt;/P&gt;&lt;P&gt;2. Create XML Object type cl_xml_document&lt;/P&gt;&lt;P&gt;3. Convert data in table to XML by using method "create_with_data" of cl_xml_document&lt;/P&gt;&lt;P&gt;4. Save XML to local PC by using method "export_to_file"  of cl_xml_document&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;rea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 13:48:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862389#M1475961</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-12T13:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: INTERNAL TABLE TO XML (IDOC)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862390#M1475962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. You use the FM: IDX_IDOC_TO_XML to get the idoc data in XML_DATA export param.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Now you can use this snippet to download data as an XML file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:
      v_stream TYPE string,
      lcl_xml_doc TYPE REF TO cl_xml_document,
      v_subrc TYPE sysubrc,
      v_filename TYPE localfile.

CREATE OBJECT lcl_xml_doc.

IF sy-subrc = 0.

" V_STREAM contains the idoc data in XML format which you got 
" from the func. module IDX_IDOC_TO_XML

  v_subrc = lcl_xml_doc-&amp;gt;parse_string( stream = v_stream ).

  CHECK v_subrc = 0.

  v_filename = `C:\Users\Suhas Saha\Desktop\xml_data.xml`.

  v_subrc = lcl_xml_doc-&amp;gt;export_to_file( filename = v_filename ).

  IF v_subrc = 0.
    WRITE / `File downloaded successfully. Yippee!!!`.
  ELSE.
    WRITE / `Why does not this work ? Sob !!!`.
  ENDIF.

ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 16:30:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-to-xml-idoc/m-p/6862390#M1475962</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-05-12T16:30:15Z</dc:date>
    </item>
  </channel>
</rss>

