<?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: Understanding commit and rollback in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613453#M1439374</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Aditya,&lt;/P&gt;&lt;P&gt;   a PERFOMR ..ON COMMIT is executed on COMMIT WORK. Keep in mind that the data may change from executing PERFORM statement until performing the COMMIT_WORK.&lt;/P&gt;&lt;P&gt;If you execute an ROLLBACK WORK the FORM-routines are not executed.&lt;/P&gt;&lt;P&gt;SET SCREEN 0 doesn't perform a COMMIT WORK. If this would do so, every time a screen changes, a COMMIT WORK would be performed. This is not the case.&lt;/P&gt;&lt;P&gt;  Regards&lt;/P&gt;&lt;P&gt;        Elmar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Feb 2010 10:59:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-03T10:59:16Z</dc:date>
    <item>
      <title>Understanding commit and rollback</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613452#M1439373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been doing lot of readings on LUW.Rather it has made me more confused.I have two questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prob 1.&lt;/P&gt;&lt;P&gt;perform routine1 on commit.&lt;/P&gt;&lt;P&gt;perform routine2  on commit.&lt;/P&gt;&lt;P&gt;commit work and wait.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this means that all update statements in routine 1 and routine 2 are bundled and commit wil happen only once&lt;/P&gt;&lt;P&gt;on reaching commoit work and wait.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly in this section of code ,i am trying to update a Z table from an internal table.Here in my opinion if i used&lt;/P&gt;&lt;P&gt;SET SCREEN 0,it is equal to commit also as it indicates dialog change. Is it true ?&lt;/P&gt;&lt;P&gt;But i used commit work and wait for a synchronized commit. Is this a better way ?.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prob2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_zlcdetail into wa_zlcdetail.&lt;/P&gt;&lt;P&gt;modify zsendlc from wa_zlcdetail.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;commit work and wait.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here how to provide rollback,incase things do not meet well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 10:51:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613452#M1439373</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-03T10:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding commit and rollback</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613453#M1439374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Aditya,&lt;/P&gt;&lt;P&gt;   a PERFOMR ..ON COMMIT is executed on COMMIT WORK. Keep in mind that the data may change from executing PERFORM statement until performing the COMMIT_WORK.&lt;/P&gt;&lt;P&gt;If you execute an ROLLBACK WORK the FORM-routines are not executed.&lt;/P&gt;&lt;P&gt;SET SCREEN 0 doesn't perform a COMMIT WORK. If this would do so, every time a screen changes, a COMMIT WORK would be performed. This is not the case.&lt;/P&gt;&lt;P&gt;  Regards&lt;/P&gt;&lt;P&gt;        Elmar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 10:59:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613453#M1439374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-03T10:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding commit and rollback</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613454#M1439375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I read in books that every dialog change makes an implicit commit.Then why not ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 11:01:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613454#M1439375</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-03T11:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding commit and rollback</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613455#M1439376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Second thing, if you see this loop where i can ensure that something gone wrong with updating table.&lt;/P&gt;&lt;P&gt;We do not have try catch  here.like when to call rollback here,how i know things didn;t work out well?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 11:04:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613455#M1439376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-03T11:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding commit and rollback</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613456#M1439377</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;There is something called a call stack where every command that is executed is stored here with an address assigned to it.&lt;/P&gt;&lt;P&gt;So when a subroutine is called, it has to know  to which point it has to return back exactly. During the time of the call, all the data is stored and the return address is also stored here in the return address. Once the call is done, it goes to another address (where the FORM...ENDFORM is written), executes that and then returns to the address as specified in the stack.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The same goes with a dialog screen change too.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you are referring to this.&lt;/P&gt;&lt;P&gt;It is not a literal COMMIT on the database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before I answer your second question &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- It is not advisable to modify your database table in a loop unless it is unavoidable. Its an expensive affair coz you hit your database for every record. So it is always better to accumulate all the data into an internal table and then insert them into the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So as to when you want to use ROLLBACK, it totally depends on how you want your functionality to work. The MODIFY or INSERT (for database table updates and insert) have a sy-subrc value associated. So when it is 4, you can do a ROLLBACK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it is always advisable to validate your data for all possible scenarios and then insert them into the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Others&lt;/P&gt;&lt;P&gt;Please correct me if I'm wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 11:15:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613456#M1439377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-03T11:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding commit and rollback</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613457#M1439378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Netwick say i use this example code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM FORMA ON COMMIT.&lt;/P&gt;&lt;P&gt;PERFORM FORMB ON COMMIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMMIT WORK AND WAIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM A &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE ZMSEG WHERE MBLNR = 'X'.   //sy-subrc = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE ZMSEG WHERE MBLNR = 'Y'. //sy- subrc = 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;END FORM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE ZMKPF  WHERE MBLNR = 'X'.  //sy-subrc = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE ZMKPF  WHERE MBLNR = 'Y'. //sy-subrc = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;END FORM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where to check here as we see sy-subrc = 4 in second update query. How to rollback now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 11:38:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613457#M1439378</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-03T11:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding commit and rollback</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613458#M1439379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My second question is how this code should ideally behave ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 11:53:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613458#M1439379</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-03T11:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding commit and rollback</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613459#M1439380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt;Hello Aditya,&lt;/P&gt;&lt;P&gt;&amp;gt;a PERFOMR ..ON COMMIT is executed on COMMIT WORK. Keep in mind that the data may change from executing PERFORM &amp;gt;statement until performing the COMMIT_WORK.&lt;/P&gt;&lt;P&gt;&amp;gt;If you execute an ROLLBACK WORK the FORM-routines are not executed.&lt;/P&gt;&lt;P&gt;&amp;gt;SET SCREEN 0 doesn't perform a COMMIT WORK. If this would do so, every time a screen changes, a COMMIT WORK would be &amp;gt;performed. This is not the case.&lt;/P&gt;&lt;P&gt;&amp;gt;Regards&lt;/P&gt;&lt;P&gt;&amp;gt;Elmar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No Mr Elmar implicit DB commit happend with every screen change.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2010 04:27:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/understanding-commit-and-rollback/m-p/6613459#M1439380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-11T04:27:50Z</dc:date>
    </item>
  </channel>
</rss>

