<?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: commit work when uploading large files in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627851#M1090022</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ok - I tried to keep it simple. Volker was asking for no. of records so I set a fixed commit size of 512 Kbyte (or 1024 Kbyte, ...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" define the TAB_WIDTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe field int_tab_struc length TAB_WIDTH in byte mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACKAGE_SIZE = KB512 / TAB_WIDTH&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACKAGE_SIZE = KB1024 / TAB_WIDTH&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, the problem is you can't really know for sure if your db undo area is large enough to handle the complete transaction (ever tried to insert zillions of rows in ORACLE and got the famous ORA-1555 because the DB Admins want to save space because it costs so much &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;   - if you would have enough space in undo &lt;/P&gt;&lt;P&gt;I would try to limit my commits as much as possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So divide (your resources) and conquer (in the transaction).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think in SAP BW they have something similar (data package size in terms of no. of records or size in Kbytes;&lt;/P&gt;&lt;P&gt;wich hit's first fires a commit).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only way to survive in a heavy load system ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bye&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Oct 2008 14:47:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-28T14:47:58Z</dc:date>
    <item>
      <title>commit work when uploading large files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627846#M1090017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are uploading large files ( 15 * 10exp6 records ) into a database table.&lt;/P&gt;&lt;P&gt;Is there any suggestion whether or not to perform a COMMIT WORK?&lt;/P&gt;&lt;P&gt;If yes: how to calculate the number of records to perform the commit after?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Oct 2008 14:15:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627846#M1090017</guid>
      <dc:creator>former_member226519</dc:creator>
      <dc:date>2008-10-27T14:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: commit work when uploading large files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627847#M1090018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may also use the FM [DB_COMMIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&amp;amp;query=db_commit&amp;amp;adv=false&amp;amp;sortby=cm_rnd_rankvalue#] to insure the writing of data to database, use the [COMMIT WORK|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_forums_rm&amp;amp;query=commit&lt;EM&gt;WORK&lt;/EM&gt;time&lt;EM&gt;out&lt;/EM&gt;luw&amp;amp;adv=false&amp;amp;sortby=cm_rnd_rankvalue#] to avoid time-out and memory consumption (also free the internal tables of data no longer requested)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Oct 2008 14:17:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627847#M1090018</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2008-10-27T14:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: commit work when uploading large files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627848#M1090019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; We are uploading large files ( 15 * 10exp6 records ) into a database table.&lt;/P&gt;&lt;P&gt;&amp;gt; Is there any suggestion whether or not to perform a COMMIT WORK?&lt;/P&gt;&lt;P&gt;&amp;gt; If yes: how to calculate the number of records to perform the commit after?&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;COMMITing  after every n bytes or so is more accurate for the database because a record's width&lt;/P&gt;&lt;P&gt;can be different and an internal table of 1000 records could be small or big in terms of bytes&lt;/P&gt;&lt;P&gt;so be aware of that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My proposal: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Read through the file packagewise:  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A package is made up of an internal table of a specific size wich you can calculate from the width&lt;/P&gt;&lt;P&gt;of the internal table in bytes and a given fixed commit size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMMIT_SIZE   :   the fixed commit size in bytes (524288 bytes)&lt;/P&gt;&lt;P&gt;TAB_WIDTH       : structure size of internal table (add data types field length) &lt;/P&gt;&lt;P&gt;PACKAGE_SIZE :  no. of internal table entries (no. of loops until refresh internal table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACKAGE_SIZE =  COMMIT_SIZE  / TAB_WIDTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. You can use this int. table for an array insert into your database tables and commit after the array insert:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT  dbtable from table intTable &lt;/P&gt;&lt;P&gt;COMMIT WORK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Ex.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMMIT_SIZE = 524288 bytes&lt;/P&gt;&lt;P&gt;TAB_WIDTH = 143 bytes&lt;/P&gt;&lt;P&gt;PACKAGE_SIZE =  524288 / 143 = 3666 records&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you would insert 3666 records and commit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. You can adjust the commit size as you want resulting in bigger (or smaller) package sizes.&lt;/P&gt;&lt;P&gt;But you have an approx. measure how many bytes are written to the database wich is important in&lt;/P&gt;&lt;P&gt;regarding to database undo area after an error in the transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bye&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 14:06:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627848#M1090019</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T14:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: commit work when uploading large files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627849#M1090020</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;COMMIT WORK ends a SAP Logical unit of work (LUW)  wich could be made of several database sessions these sessions are ended with mentioned db commits - no need to call the function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You would call the function if you want to have more control over the current db session you are in &lt;/P&gt;&lt;P&gt;without affecting other sessions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bye&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 14:08:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627849#M1090020</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T14:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: commit work when uploading large files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627850#M1090021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; COMMIT_SIZE = 524288 bytes&lt;/P&gt;&lt;P&gt;&amp;gt; TAB_WIDTH = 143 bytes&lt;/P&gt;&lt;P&gt;&amp;gt; PACKAGE_SIZE =  524288 / 143 = 3666 records&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;YK - I like this approach, but how do you determine COMMIT_SIZE?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 14:13:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627850#M1090021</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T14:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: commit work when uploading large files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627851#M1090022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ok - I tried to keep it simple. Volker was asking for no. of records so I set a fixed commit size of 512 Kbyte (or 1024 Kbyte, ...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" define the TAB_WIDTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe field int_tab_struc length TAB_WIDTH in byte mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACKAGE_SIZE = KB512 / TAB_WIDTH&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACKAGE_SIZE = KB1024 / TAB_WIDTH&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, the problem is you can't really know for sure if your db undo area is large enough to handle the complete transaction (ever tried to insert zillions of rows in ORACLE and got the famous ORA-1555 because the DB Admins want to save space because it costs so much &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;   - if you would have enough space in undo &lt;/P&gt;&lt;P&gt;I would try to limit my commits as much as possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So divide (your resources) and conquer (in the transaction).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think in SAP BW they have something similar (data package size in terms of no. of records or size in Kbytes;&lt;/P&gt;&lt;P&gt;wich hit's first fires a commit).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only way to survive in a heavy load system ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bye&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 14:47:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627851#M1090022</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T14:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: commit work when uploading large files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627852#M1090023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I'm reading you correctly, you set it arbitrarily large and then try it? If it works - fine (or increase it); if it doesn't - decrease.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 14:55:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627852#M1090023</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T14:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: commit work when uploading large files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627853#M1090024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had it coded like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table gt_in.&lt;/P&gt;&lt;P&gt;gv_maxrecs = trunc( gc_maxmem / sy-tleng ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I wanted a second opinion to calm my customer because the report runs pretty long.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 17:18:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627853#M1090024</guid>
      <dc:creator>former_member226519</dc:creator>
      <dc:date>2008-10-28T17:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: commit work when uploading large files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627854#M1090025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;make it simple, commit every 1000 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check record size, if really large (&amp;gt;5k) commit after 500 records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Oct 2008 14:55:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-work-when-uploading-large-files/m-p/4627854#M1090025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-29T14:55:57Z</dc:date>
    </item>
  </channel>
</rss>

