<?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: Performance problem when creating XML-file in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459999#M217195</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what SAP has answered to my question:&lt;/P&gt;&lt;P&gt;"In release 46x there is no special support for&lt;/P&gt;&lt;P&gt;writing xml documents in a streaming fashion. There are only two ways.&lt;/P&gt;&lt;P&gt;The first is to use the DOM interface and then rendering the DOM into a string. This solution is very memory consuming if you want to create large documents. The second way is to use the concatenate statement to&lt;/P&gt;&lt;P&gt;append tags and values as strings directly."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I changed my program. For each line of the XML-file I fill a field of type string and I transfer it to a dataset. As simple as that!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks for your help.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Jul 2006 17:38:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-07-06T17:38:14Z</dc:date>
    <item>
      <title>Performance problem when creating XML-file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459995#M217191</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;I want to create a XML-file with customer data from an internal table. This internal table has appr. 62000 entries. It takes hours to create the elements of the file.&lt;/P&gt;&lt;P&gt;This is the coding I have used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at it_debtor.&lt;/P&gt;&lt;P&gt;    at first.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Creating a ixml factory&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      l_ixml = cl_ixml=&amp;gt;create( ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Creating the dom object model&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      l_document = l_ixml-&amp;gt;create_document( ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Fill root node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      l_element_argdeb  = l_document-&amp;gt;create_simple_element(name = 'argDebtors'&lt;/P&gt;&lt;P&gt;                  parent = l_document ).&lt;/P&gt;&lt;P&gt;    endat.&lt;/P&gt;&lt;P&gt;                                                                        &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Create element 'debtor' as child of 'argdeb'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    l_element_debtor  = l_document-&amp;gt;create_simple_element(&lt;/P&gt;&lt;P&gt;                 name = 'debtor'&lt;/P&gt;&lt;P&gt;               parent = l_element_argdeb ).&lt;/P&gt;&lt;P&gt;                                                                                &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Create elements as child of 'debtor'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    l_value = it_debtor-admid.&lt;/P&gt;&lt;P&gt;    perform create_element using 'financialAdministrationId'.&lt;/P&gt;&lt;P&gt;    l_value = it_debtor-kunnr.&lt;/P&gt;&lt;P&gt;    perform create_element using 'financialDebtorId'.&lt;/P&gt;&lt;P&gt;    l_value = it_debtor-name1.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;    21 child elements in total are created&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;  Creating a stream factory&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  l_streamfactory = l_ixml-&amp;gt;create_stream_factory( ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Connect internal XML table to stream factory&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  l_ostream = l_streamfactory-&amp;gt;create_ostream_itable( table =&lt;/P&gt;&lt;P&gt;  l_xml_table ).&lt;/P&gt;&lt;P&gt;                                                                        &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Rendering the document&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  l_renderer = l_ixml-&amp;gt;create_renderer( ostream  = l_ostream&lt;/P&gt;&lt;P&gt;                                      document = l_document ).&lt;/P&gt;&lt;P&gt;  l_rc = l_renderer-&amp;gt;render( ).&lt;/P&gt;&lt;P&gt;                                                                        &lt;/P&gt;&lt;P&gt;  open dataset p_path for output in binary mode.&lt;/P&gt;&lt;P&gt;  if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;    loop at l_xml_table into rec.&lt;/P&gt;&lt;P&gt;      transfer rec to p_path.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;                                                                        &lt;/P&gt;&lt;P&gt;    close dataset p_path.&lt;/P&gt;&lt;P&gt;    if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;      write:/ wa_lines, 'records have been processed'.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    write:/ p_path, 'can not be opened.'.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form create_element using    p_text.&lt;/P&gt;&lt;P&gt;  check not l_value is initial.&lt;/P&gt;&lt;P&gt;  l_element_dummy  = l_document-&amp;gt;create_simple_element(&lt;/P&gt;&lt;P&gt;                name = p_text&lt;/P&gt;&lt;P&gt;                value = l_value&lt;/P&gt;&lt;P&gt;                parent = l_element_debtor ).&lt;/P&gt;&lt;P&gt;                                                                                endform.                    " create_element&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please can anyone tell me how to improve the performance.&lt;/P&gt;&lt;P&gt;The method create_simple_element takes a long time.&lt;/P&gt;&lt;P&gt;SAP release : 46C&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regard,&lt;/P&gt;&lt;P&gt;Christine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jul 2006 08:09:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459995#M217191</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-04T08:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem when creating XML-file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459996#M217192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christine!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There might be several reasons - but you have to look at the living patient, not only the dead coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You did not show any selects, loop at ... where or read table statements -&amp;gt; the usual slow parts are not included (or visible...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course the method-calls can contain slow statements, but you can also have problems because of size (when internal memory gets swaped to disc).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make a runtime analysis (SE30), have a look in SM50 (details!) for the size, maybe add an info-message for every 1000-customer (-&amp;gt; will be logged in job-log), so you will see if all 1000-packs are executed in same runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this tools you have to search for the slow parts:&lt;/P&gt;&lt;P&gt;- general out of memory problems, maybe because of to much buffering (visible by slower execution at the end)&lt;/P&gt;&lt;P&gt;- slow methods / selects / other components by SM30 -&amp;gt; have a closer look&lt;/P&gt;&lt;P&gt;- ...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe a simple solution: make three portions with 20000 entries each and just copy the files into one, if necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jul 2006 16:31:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459996#M217192</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2006-07-05T16:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem when creating XML-file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459997#M217193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The runtime analysis show that the database access is minimal (only 1,3%), ABAP takes 75%.&lt;/P&gt;&lt;P&gt;In sm50 we see that the memory usage is not that high so it would give problems.&lt;/P&gt;&lt;P&gt;I have debugged the job while it was running and noticed that oo-object &lt;/P&gt;&lt;P&gt;l_element_dummy  = l_document-&amp;gt;create_simple_element(&amp;#133;) takes a long time.&lt;/P&gt;&lt;P&gt;As you have said we decrease the size of the internal table to no more than 10000 entries and create so several XML-files. When more the execution time increases exponential.&lt;/P&gt;&lt;P&gt;Is there no other way to create a XML-file in SAP?&lt;/P&gt;&lt;P&gt;The stranges thing about this is when the program has ended (after a write-statement) it also takes a long time before the execution stops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jul 2006 11:59:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459997#M217193</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-06T11:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem when creating XML-file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459998#M217194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christine!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know, if there are other tools, just have a look in the forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The increasing execution time can have (in general) two reasons: &lt;/P&gt;&lt;P&gt;- a read table is getting slow, because it's accessing a bigger table without key definition (sorted or hashed, not standard key)&lt;/P&gt;&lt;P&gt;- a file scan of the previously added statements is done (for checking the syntax or whatever) for every step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might make a closer analyses with the runtime analysis restricted to the method and logging more statements - maybe a simple improvement can be done.&lt;/P&gt;&lt;P&gt;Make the analysis at the end of a 'long runner' - otherwise it's not so easy to see the slow part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jul 2006 13:39:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459998#M217194</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2006-07-06T13:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem when creating XML-file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459999#M217195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what SAP has answered to my question:&lt;/P&gt;&lt;P&gt;"In release 46x there is no special support for&lt;/P&gt;&lt;P&gt;writing xml documents in a streaming fashion. There are only two ways.&lt;/P&gt;&lt;P&gt;The first is to use the DOM interface and then rendering the DOM into a string. This solution is very memory consuming if you want to create large documents. The second way is to use the concatenate statement to&lt;/P&gt;&lt;P&gt;append tags and values as strings directly."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I changed my program. For each line of the XML-file I fill a field of type string and I transfer it to a dataset. As simple as that!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks for your help.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jul 2006 17:38:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-when-creating-xml-file/m-p/1459999#M217195</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-06T17:38:14Z</dc:date>
    </item>
  </channel>
</rss>

