<?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: Updating the Database Table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-the-database-table/m-p/3356456#M805331</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) use a counter in you loop.&lt;/P&gt;&lt;P&gt;2) use command rollback work (look F1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Jan 2008 12:07:38 GMT</pubDate>
    <dc:creator>andreas_mann3</dc:creator>
    <dc:date>2008-01-29T12:07:38Z</dc:date>
    <item>
      <title>Updating the Database Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-the-database-table/m-p/3356455#M805330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the requirements where i need to update the Database table for only two fields,  But the Update should happen for every 1000 records for all the records.  If one record has error none of the records should get updated in the database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate if you have a quick response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 11:38:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-the-database-table/m-p/3356455#M805330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-29T11:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Updating the Database Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-the-database-table/m-p/3356456#M805331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) use a counter in you loop.&lt;/P&gt;&lt;P&gt;2) use command rollback work (look F1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 12:07:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-the-database-table/m-p/3356456#M805331</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2008-01-29T12:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Updating the Database Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-the-database-table/m-p/3356457#M805332</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;Copy the DB table into an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at Internal table.&lt;/P&gt;&lt;P&gt;if sy-tabix is a multiple of '1000' update the db table.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reawrd if helpfull.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Madhu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 12:11:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-the-database-table/m-p/3356457#M805332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-29T12:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Updating the Database Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-the-database-table/m-p/3356458#M805333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should have your 1000 records in an internal table with the same structure as the database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;UPDATE dbtab FROM TABLE itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then you check for SY-SUBRC. If it equals 0 it means that all entries were updated. In the other hand, if it's 4 then at least one row could not be updated. The code should be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF SY-SUBRC EQ 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
MESSAGE eXXX.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the message you can specify the number of rows that contains error, because in SY-DBCNT the number of updated rows are stored. Then if you know you have 1000 lines in the internal table you can do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;error = 1000 - SY-DBCNT.

MESSAGE e000 WITH 'There where ' error ' lines with errors'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps, reward points please.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 12:14:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-the-database-table/m-p/3356458#M805333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-29T12:14:09Z</dc:date>
    </item>
  </channel>
</rss>

