<?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 after locking database ????? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044150#M966698</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just holding a lock on table does not commit. It'll prevent&lt;/P&gt;&lt;P&gt;others from accessing only . U need to commit even if UR &lt;/P&gt;&lt;P&gt;holding a lock ..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jun 2008 11:54:07 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-12T11:54:07Z</dc:date>
    <item>
      <title>commit after locking database ?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044149#M966697</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;Is it necessary to commit work though i am holding a lock on a database ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reasons and example needed............&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Jun 12, 2008 2:19 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2008 11:50:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044149#M966697</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-12T11:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: commit after locking database ?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044150#M966698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just holding a lock on table does not commit. It'll prevent&lt;/P&gt;&lt;P&gt;others from accessing only . U need to commit even if UR &lt;/P&gt;&lt;P&gt;holding a lock ..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2008 11:54:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044150#M966698</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-12T11:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: commit after locking database ?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044151#M966699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMMIT WORK is for updation checking.If data updated successfully then commit work should be done means it should save that changes or else rollback will done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For every updation lock will be there for database.so though lock is there commitwork will be used.its not realted with each other.locking is only to prevent other for accessing same data &amp;amp; updating it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;&lt;P&gt;twinkal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: twinkal patel on Jun 12, 2008 1:56 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Jun 12, 2008 4:06 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2008 11:55:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044151#M966699</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-12T11:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: commit after locking database ?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044152#M966700</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;Yes, it is necessary to commit the work explicitly.Locking doesnt commit the data to  the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2008 11:55:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044152#M966700</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-12T11:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: commit after locking database ?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044153#M966701</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;The database system uses locks to ensure that two or more users cannot change the same data simultaneously, since this could lead to inconsistent data being written to the database. A database lock can only be active for the duration of a database LUW. They are automatically released when the database LUW ends. In order to program SAP LUWs, we need&lt;/P&gt;&lt;P&gt;a lock mechanism within the R/3 System that allows us to create locks with a longer lifetime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Open SQL statements INSERT, UPDATE, MODIFY, and DELETE allow you to program database changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SAP lock concept is based on lock objects. Lock objects allow you to set an SAP lock for an entire application object. An application object consists of one or more entries in a database table, or entries from more than one database table that are linked using foreign key&lt;/P&gt;&lt;P&gt;relationships.&lt;/P&gt;&lt;P&gt;Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary. A lock object definition contains the database tables and their key fields on the basis of which you want to set a lock. When you create a lock object, the system automatically generates two function modules with the names ENQUEUE_&amp;lt;lock object name&amp;gt; and DEQUEUE_&amp;lt;lock object name&amp;gt;. You can then set and release SAP locks in your ABAP program by calling these function modules in a CALL FUNCTION statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two types of lock in the R/3 System:&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;Shared lock&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Shared locks (or read locks) allow you to prevent data from being changed while you are reading it. They prevent other programs from setting an exclusive lock (write lock) to&lt;/P&gt;&lt;P&gt;change the object. It does not, however, prevent other programs from setting further read locks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;Exclusive lock&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Exclusive locks (or write locks) allow you to prevent data from being changed while you are changing it yourself. An exclusive lock, as its name suggests, locks an application&lt;/P&gt;&lt;P&gt;object for exclusive use by the program that sets it. No other program can then set either a shared lock or an exclusive lock for the same application object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The user requests a given flight i.e (on screen 100) display or update it (on screen 200). If the user chooses Change, the table entry is locked; if he or she chooses Display, it is not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The PAI processing for screen 100 in this transaction processes the user input and prepares for the requested action (Change or Display). If the user chooses Change, the program locks the relevant database object by calling the corresponding ENQUEUE function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE USER_COMMAND_0100 INPUT.&lt;/P&gt;&lt;P&gt;CASE OK_CODE.&lt;/P&gt;&lt;P&gt;WHEN 'SHOW'....&lt;/P&gt;&lt;P&gt;WHEN 'CHNG'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;&amp;lt;...Authority-check and other code...&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL FUNCTION 'ENQUEUE_ESFLIGHT'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;MANDT = SY-MANDT&lt;/P&gt;&lt;P&gt;CARRID = SPFLI-CARRID&lt;/P&gt;&lt;P&gt;CONNID = SPFLI-CONNID&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;FOREIGN_LOCK = 1&lt;/P&gt;&lt;P&gt;SYSTEM_FAILURE = 2&lt;/P&gt;&lt;P&gt;OTHERS = 3.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;MESSAGE ID SY-MSGID&lt;/P&gt;&lt;P&gt;TYPE 'E'&lt;/P&gt;&lt;P&gt;NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the end of a transaction, the locks are released automatically. However, there are exceptions if you have called update routines within the transaction. You can release a lock explicitly by calling the corresponding DEQUEUE module. As the programmer, you must decide for yourself the point at which it makes most sense to release the locks (for example, to make the data available to other transactions).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The subroutine UNLOCK_FLIGHT calls the DEQUEUE function module for the lock object ESFLIGHT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM UNLOCK_FLIGHT.&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'DEQUEUE_ESFLIGHT'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;MANDT = SY-MANDT&lt;/P&gt;&lt;P&gt;CARRID = SPFLI-CARRID&lt;/P&gt;&lt;P&gt;CONNID = SPFLI-CONNID&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;OTHERS = 1.&lt;/P&gt;&lt;P&gt;SET SCREEN 100.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might use this for the BACK and EXIT functions in a PAI module for screen 200 in this example transaction. In the program, the system checks whether the user leaves the screen without having saved his or her changes. If so, the PROMPT_AND_SAVE routine sends a reminder, and gives the user the opportunity to save the changes. The flight can be unlocked by calling the UNLOCK_FLIGHT subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE USER_COMMAND_0200 INPUT.&lt;/P&gt;&lt;P&gt;CASE OK_CODE.&lt;/P&gt;&lt;P&gt;WHEN 'SAVE'....&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;CLEAR OK_CODE.&lt;/P&gt;&lt;P&gt;IF OLD_SPFLI NE SPFLI.&lt;/P&gt;&lt;P&gt;PERFORM PROMPT_AND_SAVE.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;PERFORM UNLOCK_FLIGHT.&lt;/P&gt;&lt;P&gt;LEAVE TO SCREEN 0.&lt;/P&gt;&lt;P&gt;WHEN 'BACK'....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope with this example you get a clear picture of lock concept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Dhanashri.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Jun 12, 2008 2:19 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2008 12:26:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044153#M966701</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-12T12:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: commit after locking database ?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044154#M966702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just think a report that locks a certain row of a table, than performs an update and after 10.000 of those operations does a COMMIT WORK to save a bulk of changes to the database and then works on the next 10.000 items and so. If we don't use update modules for database changes the lock objects still exists and will vanish not until end of the report . This is the case why the people use the commit work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2008 18:53:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-after-locking-database/m-p/4044154#M966702</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-12T18:53:07Z</dc:date>
    </item>
  </channel>
</rss>

