<?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: regarding lock objects in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498556#M841527</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The R/3 System synchronizes simultaneous access of several users to the same data records with a lock mechanism. When interactive transactions are programmed, locks are set and released by calling function modules (see Function Modules for Lock Requests). These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Structure of a Lock Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The tables in which data records should be locked with a lock request are defined in a lock object together with their key fields. When tables are selected, one table (the primary table) is first selected. Further tables (secondary tables) can also be added using foreign key relationships (see also Conditions for Foreign Keys).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock Arguments&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lock argument of a table in the lock object consists of the key fields of the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lock argument fields of a lock object are used as input parameters in the function modules for setting and removing locks generated from the lock object definition. When these function modules are called, the table rows to be locked or unlocked are specified by defining certain values in these fields. These values can also be generic. The lock argument fields therefore define which subset of the table rows should be locked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The simplest case of a lock object consists of exactly one table and the lock argument of the table is the primary key of this table. Several tables can also be included in a lock object. A lock request therefore can lock an entire logical object, and not only a record of a table. Such a logical object can be for example a document comprising an entry in a header table and N entries in a position table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Locks can also be set from programs in other systems with the corresponding interfaces if the lock object was defined with RFC authorization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A lock mode can be assigned for each table in the lock object. This mode defines how other users can access a locked record of the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table SFLIGHT in the  flight model contains all the scheduled flights of a carrier. Field SEATSMAX contains the number of seats available. Field SEATSOCC contains the number of seats already booked. If a booking is made for a customer (by a travel agency or sales desk), you must check whether there are enough seats available. The number of seats booked is incremented when the booking is made.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This mechanism must ensure that two sales desks do not make the same booking at the same time and that the flight is not overbooked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This can be done by creating lock object ESFLIGHT. Only the table SFLIGHT must be included in this lock object. The flight can then be locked (with the function modules generated from the lock object) when booking. If another sales desk also wants to book seats for this flight, the lock will prevent the flight from being overbooked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lock mode controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the lock table of the system for each table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Access by more than one user can be synchronized in the following ways:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exclusive lock: The locked data can only be displayed or edited by a single user. A request for another exclusive lock or for a shared lock is rejected. &lt;/P&gt;&lt;P&gt;Shared lock: More than one user can access the locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock is rejected. &lt;/P&gt;&lt;P&gt;Exclusive but not cumulative: Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. All other lock requests are rejected.&lt;/P&gt;&lt;P&gt;Activating a lock object in the ABAP Dictionary automatically creates function modules for setting (ENQUEUE_&amp;lt;lock object name&amp;gt;) and releasing (DEQUEUE_&amp;lt;lock object name&amp;gt;) locks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The generated function modules are automatically assigned to function groups. You should not change these function modules and their assignment to function groups since the function modules are generated again each time the lock object is activated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Never transport the function groups, which contain the automatically generated function modules. The generated function modules of a lock object could reside in a different function group in the target system. Always transport the lock objects. When a lock object is activated in the target system, the function modules are generated again and correctly assigned to function groups.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters of the Function Modules&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field Names of the Lock Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The keys to be locked must be passed here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A further parameter X_&amp;lt;field&amp;gt; that defines the lock behavior when the initial value is passed exists for every lock field &amp;lt;field&amp;gt;. If the initial value is assigned to &amp;lt;field&amp;gt; and X_&amp;lt;field&amp;gt;, then a generic lock is initialized with respect to &amp;lt;field&amp;gt;. If &amp;lt;field&amp;gt; is assigned the initial value and X_&amp;lt;field&amp;gt; is defined as X, the lock is set with exactly the initial value of &amp;lt;field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters for Passing Locks to the Update Program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A lock is generally removed at the end of the transaction or when the corresponding DEQUEUE function module is called. However, this is not the case if the transaction has called update routines. In this case a parameter must check that the lock has been removed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameter _SCOPE controls how the lock or lock release is passed to the update program (see The Owner Concept for Locks). You have the following options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_SCOPE = 1: Locks and lock releases are not passed to the update program. The lock is removed when the transaction is ended. &lt;/P&gt;&lt;P&gt;_SCOPE = 2: The lock or lock release is passed to the update program. The update program is responsible for removing the lock. The interactive program with which the lock was requested no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module. &lt;/P&gt;&lt;P&gt;_SCOPE = 3: The lock or lock release is also passed to the update program. The lock must be removed in both the interactive program and in the update program. This is the standard setting for the DEQUEUE function module.&lt;/P&gt;&lt;P&gt;Parameters for Lock Mode&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A parameter MODE_&amp;lt;TAB&amp;gt; exists for each base table TAB of the lock object. The lock mode for this base table can be set dynamically with this parameter. Valid values for this parameter are S (shared), E (exclusive) and X (exclusive but not cumulative).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lock mode specified when the lock object for the table is created is the default value for this parameter. This default value can however be overridden as required when the function module is called.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If a lock set with a lock mode is to be removed by calling the DEQUEUE function module, this call must have the same value for the parameter MODE_&amp;lt;TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Controlling Lock Transmission&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameter _COLLECT controls whether the lock request or lock release should be performed directly or whether it should first be written to the local lock container. This parameter can have the following values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initial value: The lock request or lock release is sent directly to the lock server. &lt;/P&gt;&lt;P&gt;X : The lock request or lock release is placed in the local lock container. The lock requests and lock releases collected in this lock container can then be sent to the lock server at a later time as a group by calling the function module FLUSH_ENQUEUE.&lt;/P&gt;&lt;P&gt;Behavior for Lock Conflicts (ENQUEUE only)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ENQUEUE function module also has the parameter _WAIT. This parameter determines the lock behavior when there is a lock conflict.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have the following options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initial value: If a lock attempt fails because there is a competing lock, the exception FOREIGN_LOCK is triggered. &lt;/P&gt;&lt;P&gt;X : If a lock attempt fails because there is a competing lock, the lock attempt is repeated after waiting for a certain time. The exception FOREIGN_LOCK is triggered only if a certain time limit has elapsed since the first lock attempt. The waiting time and the time limit are defined by profile parameters.&lt;/P&gt;&lt;P&gt;Controlling Deletion of the Lock Entry (DEQUEUE only)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The DEQUEUE function module also has the parameter _SYNCHRON. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If X is passed, the DEQUEUE function waits until the entry has been removed from the lock table. Otherwise it is deleted asynchronously, that is, if the lock table of the system is read directly after the lock is removed, the entry in the lock table may still exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exceptions of the ENQUEUE Function Module&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOREIGN_LOCK: A competing lock already exists. You can find out the name of the user holding the lock by looking at system variable SY-MSGV1. &lt;/P&gt;&lt;P&gt;SYSTEM_FAILURE: This exception is triggered when the lock server reports that a problem occurred while setting the lock. In this case, the lock could not be set.&lt;/P&gt;&lt;P&gt;If the exceptions are not processed by the calling program itself, appropriate messages are issued for all exceptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reference Fields for RFC-Enabled Lock Objects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The type of an RFC-enabled function module must be completely defined. The parameters of the generated function module therefore have the following reference fields for RFC-enabled lock objects:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters&lt;/P&gt;&lt;P&gt; Reference fields&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;X_&amp;lt;field name&amp;gt;&lt;/P&gt;&lt;P&gt; DDENQ_LIKE-XPARFLAG&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;_WAIT&lt;/P&gt;&lt;P&gt; DDENQ_LIKE-WAITFLAG&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;_SCOPE&lt;/P&gt;&lt;P&gt; DDENQ_LIKE-SCOPE&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;_SYNCHRON&lt;/P&gt;&lt;P&gt; DDENQ_LIKE-SYNCHRON&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Mar 2008 05:49:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-05T05:49:46Z</dc:date>
    <item>
      <title>regarding lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498550#M841521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello everyone,&lt;/P&gt;&lt;P&gt;                      plz tell me what's the use of lock objects and how we can create lock object in se11.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2008 05:04:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498550#M841521</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-04T05:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: regarding lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498551#M841522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP Provide three type of Lock objects. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read Lock(Shared Locked) &lt;/P&gt;&lt;P&gt;protects read access to an object. The read lock allows other transactions read access but not write access to &lt;/P&gt;&lt;P&gt;the locked area of the table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Write Lock(exclusive lock) &lt;/P&gt;&lt;P&gt;protects write access to an object. The write lock allows other transactions neither read nor write access to &lt;/P&gt;&lt;P&gt;the locked area of the table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enhanced write lock (exclusive lock without cumulating) &lt;/P&gt;&lt;P&gt;works like a write lock except that the enhanced write lock also protects from further accesses from the &lt;/P&gt;&lt;P&gt;same transaction. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Technicaly: &lt;/P&gt;&lt;P&gt;When you create a lock object System automatically creat two function module. &lt;/P&gt;&lt;P&gt;1. ENQUEUE_&amp;lt;Lockobject name&amp;gt;. to insert the object in a queue. &lt;/P&gt;&lt;P&gt;2. DEQUEUE_&amp;lt;Lockobject name&amp;gt;. To remove the object is being queued through above FM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to use these function module in your program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will give a basic idea. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a Link with good example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3685728"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look the following Links for additionl info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/c2/2d7037ecc92a7ee10000009b38f8cf/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/c2/2d7037ecc92a7ee10000009b38f8cf/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://articles.techrepublic.com.com/5100-6329_11-5066352.html" target="test_blank"&gt;http://articles.techrepublic.com.com/5100-6329_11-5066352.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/a2/3547360f2ea61fe10000009b38f839/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/a2/3547360f2ea61fe10000009b38f839/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function modules required for lock objects:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this Helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2008 05:07:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498551#M841522</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-04T05:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: regarding lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498552#M841523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;GO TO SE11&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select the radio button "Lock object"..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give the name starts with EZ or EY..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: EYTEST&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Press Create button..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give the short description..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: Lock object for table ZTABLE..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the tables tab..Give the table name..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: ZTABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save and generate..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your lock object is now created..You can see the LOCK MODULES..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the menu ..GOTO -&amp;gt; LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock objects: &lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm" target="test_blank"&gt;http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Match Code Objects:&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html" target="test_blank"&gt;http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm" target="test_blank"&gt;http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check these links -&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3036414"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2912662"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3005172"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2008 05:10:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498552#M841523</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-04T05:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: regarding lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498553#M841524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Lock Objects are used to synchronize access to the same data by&lt;/P&gt;&lt;P&gt;more than one user. Function modules that can be used in&lt;/P&gt;&lt;P&gt;application programs are generated from the definition of a lock&lt;/P&gt;&lt;P&gt;object in the ABAP Dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&amp;gt; Select object type Lock object in the initial screen of the ABAP&lt;/P&gt;&lt;P&gt;     Dictionary, enter an object name and choose Create.&lt;/P&gt;&lt;P&gt;     The name of a lock object should begin with an E (Enqueue). &lt;/P&gt;&lt;P&gt;     The maintenance screen for lock objects is displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2&amp;gt; Enter an explanatory short text in the field Short text. &lt;/P&gt;&lt;P&gt;     You can then use the short text to find the lock object at a later&lt;/P&gt;&lt;P&gt;     time, for example with the R/3 Repository Information System.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3&amp;gt; Enter the name of the primary table of the lock object. &lt;/P&gt;&lt;P&gt;     All other tables in the lock object must be linked with the primary&lt;/P&gt;&lt;P&gt;     table using foreign keys.&lt;/P&gt;&lt;P&gt;4&amp;gt; Select the lock mode of the primary table in the field below it. &lt;/P&gt;&lt;P&gt;     The lock mode is used as the default value for the corresponding&lt;/P&gt;&lt;P&gt;     parameters of the function modules generated from the lock&lt;/P&gt;&lt;P&gt;     object.&lt;/P&gt;&lt;P&gt;5&amp;gt; Choose Add if you want to lock records in more than one table&lt;/P&gt;&lt;P&gt;     with the lock object. &lt;/P&gt;&lt;P&gt;     A list of all the tables linked with the primary table using valid&lt;/P&gt;&lt;P&gt;     foreign keys is displayed. Select the appropriate table. The lock&lt;/P&gt;&lt;P&gt;     mode of the primary table is copied as lock mode. You can change&lt;/P&gt;&lt;P&gt;     this setting as required, for example you can assign the lock mode&lt;/P&gt;&lt;P&gt;    separately for each table&lt;/P&gt;&lt;P&gt;Similarly, you can add a table linked with the secondary table just&lt;/P&gt;&lt;P&gt;     added with foreign keys. To do this, place the cursor on the name &lt;/P&gt;&lt;P&gt;     of the secondary table and choose Add.&lt;/P&gt;&lt;P&gt;     If no lock mode is assigned to a table, no lock is set for the entries&lt;/P&gt;&lt;P&gt;     in this table when the generated function modules are called. You&lt;/P&gt;&lt;P&gt;     should not assign a lock mode if a secondary table was only used&lt;/P&gt;&lt;P&gt;     to define a path between the primary table and another secondary&lt;/P&gt;&lt;P&gt;     table with foreign keys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6&amp;gt; Save your entries. &lt;/P&gt;&lt;P&gt;     A dialog box appears in which you have to assign the lock object&lt;/P&gt;&lt;P&gt;     a development class.&lt;/P&gt;&lt;P&gt;7&amp;gt; You can define whether the function modules generated from the&lt;/P&gt;&lt;P&gt;     lock object should be RFC-enabled on the Attributes tab page. &lt;/P&gt;&lt;P&gt;     If you set the Allow RFC flag, the generated function modules&lt;/P&gt;&lt;P&gt;     can be called from within another system with Remote Function&lt;/P&gt;&lt;P&gt;     Call.&lt;/P&gt;&lt;P&gt;     If you permit Remote Function Calls for an existing lock object,&lt;/P&gt;&lt;P&gt;     you must ensure that the generated function modules are called&lt;/P&gt;&lt;P&gt;     from within an ABAP program with parameters appropriate for&lt;/P&gt;&lt;P&gt;     the type. You should therefore check all programs that use the&lt;/P&gt;&lt;P&gt;     associated function modules before activating the lock object with&lt;/P&gt;&lt;P&gt;     the new option.&lt;/P&gt;&lt;P&gt;8&amp;gt; Choose Activate.&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;When you activate the lock object, the two function modules&lt;/P&gt;&lt;P&gt;ENQUEUE_&amp;lt;lockobjectname&amp;gt; and DEQUEUE_&amp;lt;lockobjectname&amp;gt;&lt;/P&gt;&lt;P&gt;are generated from its definition to set and release locks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,Priya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2008 05:15:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498553#M841524</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-04T05:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: regarding lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498554#M841525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP Provide three type of Lock objects.  &lt;/P&gt;&lt;P&gt;- Read Lock(Shared Locked) &lt;/P&gt;&lt;P&gt;   protects read access to an object. The read lock allows other  transactions read access but not write access to  &lt;/P&gt;&lt;P&gt;   the locked area of  the table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Write Lock(exclusive lock) &lt;/P&gt;&lt;P&gt;   protects write access to an object. The write lock allows other  transactions neither read nor write access to  &lt;/P&gt;&lt;P&gt;    the locked area of the  table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Enhanced write lock (exclusive lock without cumulating) &lt;/P&gt;&lt;P&gt;  works like a write lock except that the enhanced write lock also  protects from further accesses from the  &lt;/P&gt;&lt;P&gt;  same transaction. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Technicaly: &lt;/P&gt;&lt;P&gt;When you create a lock object System automatically creat two function module. &lt;/P&gt;&lt;P&gt;1. ENQUEUE_&amp;lt;Lockobject name&amp;gt;. to insert the object in a queue. &lt;/P&gt;&lt;P&gt;2. DEQUEUE_&amp;lt;Lockobject name&amp;gt;. To remove the object is being queued through above FM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to use these function module in your program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  ZLOCKING                                                    *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  zlocking                                .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : tab_emp TYPE TABLE OF zemp_51772,&lt;/P&gt;&lt;P&gt;       wa_emp TYPE zemp_51772.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_emp-emp_no = '102'.&lt;/P&gt;&lt;P&gt;wa_emp-emp_id = '157'.&lt;/P&gt;&lt;P&gt;wa_emp-emp_name = 'SIVA'.&lt;/P&gt;&lt;P&gt;wa_emp-emp_dept = 'SAP'.&lt;/P&gt;&lt;P&gt;APPEND wa_emp TO tab_emp.&lt;/P&gt;&lt;P&gt;CLEAR wa_emp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_emp-emp_no = '128'.&lt;/P&gt;&lt;P&gt;wa_emp-emp_id = '138'.&lt;/P&gt;&lt;P&gt;wa_emp-emp_name = 'RAMA'.&lt;/P&gt;&lt;P&gt;wa_emp-emp_dept = 'SAP'.&lt;/P&gt;&lt;P&gt;APPEND wa_emp TO tab_emp.&lt;/P&gt;&lt;P&gt;CLEAR wa_emp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_emp-emp_no = '133'.&lt;/P&gt;&lt;P&gt;wa_emp-emp_id = '121'.&lt;/P&gt;&lt;P&gt;wa_emp-emp_name = 'KRISHNA'.&lt;/P&gt;&lt;P&gt;wa_emp-emp_dept = 'SAP'.&lt;/P&gt;&lt;P&gt;APPEND wa_emp TO tab_emp.&lt;/P&gt;&lt;P&gt;CLEAR wa_emp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'ENQUEUE_E_TABLEE'&lt;/P&gt;&lt;P&gt; EXPORTING&lt;/P&gt;&lt;P&gt;   mode_rstable         = 'X'&lt;/P&gt;&lt;P&gt;   tabname              = 'ZEMP_51772'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  varkey               =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  X_TABNAME            = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  X_VARKEY             = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  _SCOPE               = '2'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  _WAIT                = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  _COLLECT             = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&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;          .&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;  INSERT zemp_51772 FROM TABLE tab_emp.&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;CALL FUNCTION 'DEQUEUE_E_TABLEE'&lt;/P&gt;&lt;P&gt; EXPORTING&lt;/P&gt;&lt;P&gt;   mode_rstable       = 'X'&lt;/P&gt;&lt;P&gt;   tabname            = 'ZEMP_51772'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  VARKEY             =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  X_TABNAME          = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  X_VARKEY           = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  _SCOPE             = '3'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  _SYNCHRON          = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  _COLLECT           = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;  WRITE:/ 'Unlocked the Table'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;this gives u a basic idea.&lt;/P&gt;&lt;P&gt;Award if helpful&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Sravani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 05:24:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498554#M841525</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T05:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: regarding lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498555#M841526</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;SAP data dictionary provides you with a locking mechanism to synchronize simultaneous data access by different users.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock objects are created in SE11.&lt;/P&gt;&lt;P&gt;Customer lock objects must begin with EY or EZ .&lt;/P&gt;&lt;P&gt;Three possible lock modes exist for lock objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Lock Mode&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock mode E: This sets a lock for changing data for single user. This lock can be accumulated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock mode X: This mode is used like mode E  for changing data. The only technical difference from mode E is that the respective lock does not allow accumulation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock mode S: This mode ensures that data displayed in your program cannot be changed by other users during the entire display time. Here you do not want to change the data yourself (allows read only access for data).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Creating Lock object&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter lock object name beginning with EY or EZ&lt;/P&gt;&lt;P&gt;and hit create.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter  table names containing data records that should be locked and the lock mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter short text /tbale/lockmode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The primary keys of the specified tables are automatically selected as lock parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It automatically selects the primary key for the selected table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To set a lock in the application program&lt;/P&gt;&lt;P&gt;call a function module ENQUEUE_&amp;lt;LOCK_OBJECT&amp;gt;.&lt;/P&gt;&lt;P&gt;For our example, it would be ENQUEUE_EZMARA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To release the lock in the application program&lt;/P&gt;&lt;P&gt;call a function module DEQUEUE_&amp;lt;LOCK_OBJECT&amp;gt;.&lt;/P&gt;&lt;P&gt;For our example, it would be DEQUEUE_EZMARA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer the code executed by user (say abap1) for&lt;/P&gt;&lt;P&gt;matnr = &amp;#146;000000000000000012&amp;#146;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If another user (say abap2) tries to access the same data i.e. matnr = &amp;#145;000000000000000012&amp;#146;,via a program or a transaction it would deny him read or write access.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 05:28:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498555#M841526</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T05:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: regarding lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498556#M841527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The R/3 System synchronizes simultaneous access of several users to the same data records with a lock mechanism. When interactive transactions are programmed, locks are set and released by calling function modules (see Function Modules for Lock Requests). These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Structure of a Lock Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The tables in which data records should be locked with a lock request are defined in a lock object together with their key fields. When tables are selected, one table (the primary table) is first selected. Further tables (secondary tables) can also be added using foreign key relationships (see also Conditions for Foreign Keys).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock Arguments&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lock argument of a table in the lock object consists of the key fields of the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lock argument fields of a lock object are used as input parameters in the function modules for setting and removing locks generated from the lock object definition. When these function modules are called, the table rows to be locked or unlocked are specified by defining certain values in these fields. These values can also be generic. The lock argument fields therefore define which subset of the table rows should be locked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The simplest case of a lock object consists of exactly one table and the lock argument of the table is the primary key of this table. Several tables can also be included in a lock object. A lock request therefore can lock an entire logical object, and not only a record of a table. Such a logical object can be for example a document comprising an entry in a header table and N entries in a position table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Locks can also be set from programs in other systems with the corresponding interfaces if the lock object was defined with RFC authorization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A lock mode can be assigned for each table in the lock object. This mode defines how other users can access a locked record of the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table SFLIGHT in the  flight model contains all the scheduled flights of a carrier. Field SEATSMAX contains the number of seats available. Field SEATSOCC contains the number of seats already booked. If a booking is made for a customer (by a travel agency or sales desk), you must check whether there are enough seats available. The number of seats booked is incremented when the booking is made.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This mechanism must ensure that two sales desks do not make the same booking at the same time and that the flight is not overbooked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This can be done by creating lock object ESFLIGHT. Only the table SFLIGHT must be included in this lock object. The flight can then be locked (with the function modules generated from the lock object) when booking. If another sales desk also wants to book seats for this flight, the lock will prevent the flight from being overbooked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lock mode controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the lock table of the system for each table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Access by more than one user can be synchronized in the following ways:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exclusive lock: The locked data can only be displayed or edited by a single user. A request for another exclusive lock or for a shared lock is rejected. &lt;/P&gt;&lt;P&gt;Shared lock: More than one user can access the locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock is rejected. &lt;/P&gt;&lt;P&gt;Exclusive but not cumulative: Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. All other lock requests are rejected.&lt;/P&gt;&lt;P&gt;Activating a lock object in the ABAP Dictionary automatically creates function modules for setting (ENQUEUE_&amp;lt;lock object name&amp;gt;) and releasing (DEQUEUE_&amp;lt;lock object name&amp;gt;) locks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The generated function modules are automatically assigned to function groups. You should not change these function modules and their assignment to function groups since the function modules are generated again each time the lock object is activated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Never transport the function groups, which contain the automatically generated function modules. The generated function modules of a lock object could reside in a different function group in the target system. Always transport the lock objects. When a lock object is activated in the target system, the function modules are generated again and correctly assigned to function groups.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters of the Function Modules&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field Names of the Lock Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The keys to be locked must be passed here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A further parameter X_&amp;lt;field&amp;gt; that defines the lock behavior when the initial value is passed exists for every lock field &amp;lt;field&amp;gt;. If the initial value is assigned to &amp;lt;field&amp;gt; and X_&amp;lt;field&amp;gt;, then a generic lock is initialized with respect to &amp;lt;field&amp;gt;. If &amp;lt;field&amp;gt; is assigned the initial value and X_&amp;lt;field&amp;gt; is defined as X, the lock is set with exactly the initial value of &amp;lt;field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters for Passing Locks to the Update Program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A lock is generally removed at the end of the transaction or when the corresponding DEQUEUE function module is called. However, this is not the case if the transaction has called update routines. In this case a parameter must check that the lock has been removed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameter _SCOPE controls how the lock or lock release is passed to the update program (see The Owner Concept for Locks). You have the following options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_SCOPE = 1: Locks and lock releases are not passed to the update program. The lock is removed when the transaction is ended. &lt;/P&gt;&lt;P&gt;_SCOPE = 2: The lock or lock release is passed to the update program. The update program is responsible for removing the lock. The interactive program with which the lock was requested no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module. &lt;/P&gt;&lt;P&gt;_SCOPE = 3: The lock or lock release is also passed to the update program. The lock must be removed in both the interactive program and in the update program. This is the standard setting for the DEQUEUE function module.&lt;/P&gt;&lt;P&gt;Parameters for Lock Mode&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A parameter MODE_&amp;lt;TAB&amp;gt; exists for each base table TAB of the lock object. The lock mode for this base table can be set dynamically with this parameter. Valid values for this parameter are S (shared), E (exclusive) and X (exclusive but not cumulative).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lock mode specified when the lock object for the table is created is the default value for this parameter. This default value can however be overridden as required when the function module is called.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If a lock set with a lock mode is to be removed by calling the DEQUEUE function module, this call must have the same value for the parameter MODE_&amp;lt;TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Controlling Lock Transmission&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameter _COLLECT controls whether the lock request or lock release should be performed directly or whether it should first be written to the local lock container. This parameter can have the following values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initial value: The lock request or lock release is sent directly to the lock server. &lt;/P&gt;&lt;P&gt;X : The lock request or lock release is placed in the local lock container. The lock requests and lock releases collected in this lock container can then be sent to the lock server at a later time as a group by calling the function module FLUSH_ENQUEUE.&lt;/P&gt;&lt;P&gt;Behavior for Lock Conflicts (ENQUEUE only)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ENQUEUE function module also has the parameter _WAIT. This parameter determines the lock behavior when there is a lock conflict.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have the following options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initial value: If a lock attempt fails because there is a competing lock, the exception FOREIGN_LOCK is triggered. &lt;/P&gt;&lt;P&gt;X : If a lock attempt fails because there is a competing lock, the lock attempt is repeated after waiting for a certain time. The exception FOREIGN_LOCK is triggered only if a certain time limit has elapsed since the first lock attempt. The waiting time and the time limit are defined by profile parameters.&lt;/P&gt;&lt;P&gt;Controlling Deletion of the Lock Entry (DEQUEUE only)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The DEQUEUE function module also has the parameter _SYNCHRON. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If X is passed, the DEQUEUE function waits until the entry has been removed from the lock table. Otherwise it is deleted asynchronously, that is, if the lock table of the system is read directly after the lock is removed, the entry in the lock table may still exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exceptions of the ENQUEUE Function Module&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOREIGN_LOCK: A competing lock already exists. You can find out the name of the user holding the lock by looking at system variable SY-MSGV1. &lt;/P&gt;&lt;P&gt;SYSTEM_FAILURE: This exception is triggered when the lock server reports that a problem occurred while setting the lock. In this case, the lock could not be set.&lt;/P&gt;&lt;P&gt;If the exceptions are not processed by the calling program itself, appropriate messages are issued for all exceptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reference Fields for RFC-Enabled Lock Objects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The type of an RFC-enabled function module must be completely defined. The parameters of the generated function module therefore have the following reference fields for RFC-enabled lock objects:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters&lt;/P&gt;&lt;P&gt; Reference fields&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;X_&amp;lt;field name&amp;gt;&lt;/P&gt;&lt;P&gt; DDENQ_LIKE-XPARFLAG&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;_WAIT&lt;/P&gt;&lt;P&gt; DDENQ_LIKE-WAITFLAG&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;_SCOPE&lt;/P&gt;&lt;P&gt; DDENQ_LIKE-SCOPE&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;_SYNCHRON&lt;/P&gt;&lt;P&gt; DDENQ_LIKE-SYNCHRON&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 05:49:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498556#M841527</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T05:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: regarding lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498557#M841528</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;You set a lock entry by calling an ENQUEUE function module for an appropriate lock object. You can&lt;/P&gt;&lt;P&gt;find out which lock objects are available for a database table from the table's where-used list in the&lt;/P&gt;&lt;P&gt;ABAP Dictionary. The "lock" and "unlock" function modules for the selected lock object require only the&lt;/P&gt;&lt;P&gt;ENQUEUE_&amp;lt;Name of lock object&amp;gt; and DEQUEUE_&amp;lt;Name of lock object&amp;gt; naming conventions. In&lt;/P&gt;&lt;P&gt;general, you need only pass the interface key fields. Default values are passed to all the other&lt;/P&gt;&lt;P&gt;parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'ENQUEUE_ESSPFLI'&lt;/P&gt;&lt;P&gt;EXPORTING carrid = wa_spfli-carrid&lt;/P&gt;&lt;P&gt;connid = wa_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 &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hope this helps, Do reward.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 06:05:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498557#M841528</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T06:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: regarding lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498558#M841529</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;*LOCK OBJECTS:*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock Objects are used to synchronize access to the same data by more than one user&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Creation of lock objects:*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Go to   SE11&lt;/P&gt;&lt;P&gt;2. Seelct Lock object&lt;/P&gt;&lt;P&gt;3. Give name of the lock object which Starts with EZ____&lt;/P&gt;&lt;P&gt;4. Create the object&lt;/P&gt;&lt;P&gt;5. Give short text&lt;/P&gt;&lt;P&gt;6. Under Tables-- primary key--selcetion mode&lt;/P&gt;&lt;P&gt;7. lock mode. &lt;/P&gt;&lt;P&gt;8. Enter the table name fields to be locked&lt;/P&gt;&lt;P&gt;9. Save, activate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;kavitha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 09:14:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-lock-objects/m-p/3498558#M841529</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T09:14:26Z</dc:date>
    </item>
  </channel>
</rss>

