<?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: lock objects in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428650#M823596</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;Locks are maintained in a central lock table. This ensures that also programs that run on a different&lt;/P&gt;&lt;P&gt;application server of the same SAP System, are informed of the locks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before a database update is triggered, the program requests a lock using a special function module. You&lt;/P&gt;&lt;P&gt;can set a lock for a data record in a database table, or even a set of records, according to you&lt;/P&gt;&lt;P&gt;requirements. The function module first checks whether there is an existing lock that will obstruct the&lt;/P&gt;&lt;P&gt;lock request. If a lock does not already exist then the lock is set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If another program tries to set the same lock, the function module sends a message to say that the&lt;/P&gt;&lt;P&gt;record is already locked. This is carried out using an exception of the function module. Afterwards the&lt;/P&gt;&lt;P&gt;return code is set to the value &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The return code must be supplied with values in the program. You can inform the user of a corresponding message.&lt;/P&gt;&lt;P&gt;If the database change is successful, then the lock entry in the central lock table is deleted using a&lt;/P&gt;&lt;P&gt;different function module.&lt;/P&gt;&lt;P&gt;&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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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;&lt;STRONG&gt;Hope this helps, Do reward.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Feb 2008 06:25:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-13T06:25:37Z</dc:date>
    <item>
      <title>lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428644#M823590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Define Lock Objects &amp;amp; Explain where they will be used?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 04:30:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428644#M823590</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T04:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428645#M823591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai.&lt;/P&gt;&lt;P&gt;check this.&lt;/P&gt;&lt;P&gt;&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;check this link for example.&lt;/P&gt;&lt;P&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;tables:vbak.&lt;/P&gt;&lt;P&gt;call function 'ENQUEUE_EZLOCK3'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;mode_vbak = 'E'&lt;/P&gt;&lt;P&gt;mandt = sy-mandt&lt;/P&gt;&lt;P&gt;vbeln = vbak-vbeln&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;X_VBELN = ' '&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;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;FOREIGN_LOCK = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;SYSTEM_FAILURE = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;OTHERS = 3&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables&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;purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:&lt;/P&gt;&lt;P&gt;1. enque_lockobject&lt;/P&gt;&lt;P&gt;1. deque_lockobject&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject. &lt;/P&gt;&lt;P&gt;&lt;/P&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;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Sowjanya.b.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 04:44:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428645#M823591</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T04:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428646#M823592</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;In addition to the basic objects, the following object classes are used in the SAP system:&lt;/P&gt;&lt;P&gt;Views&lt;/P&gt;&lt;P&gt;Matchcodes &lt;/P&gt;&lt;P&gt;Lock objects &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock objects:simultaneous access to the same data   by several users needs to be synchronized.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simultaneous accessing of the same data record by two users in the SAP system is synchronized by a lock mechanism. When dialog transactions are programmed, locks are set and released by calling certain function modules. These function modules are generated automatically from the definition of so-called lock objects in the ABAP/4 Dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To synchronize the access to a table by setting and removing locks, a Lock object has to be defined in the ABAP/4 Dictionary. Activating the lock object automatically creates function modules for setting and removing locks. These function modules must be included when programming interactive transactions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The steps involved in creating a lock object are the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.Defining lock object attributes &lt;/P&gt;&lt;P&gt;2.Selecting secondary tables for the lock object &lt;/P&gt;&lt;P&gt;3.Selecting lock arguments and lock mode &lt;/P&gt;&lt;P&gt;4.Activating a lock object &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;reward if its useful&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 05:02:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428646#M823592</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T05:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428647#M823593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&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 program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Purpose:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SAP system is equipped with a special lock mechanism that synchronizes access to data on the database. The purpose of the lock mechanism is to prevent two transactions from changing the same data on the database simultaneously .&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;Reward Points if useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 05:06:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428647#M823593</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T05:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428648#M823594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lock Objects are Created using Tcode SE11.&lt;/P&gt;&lt;P&gt;The Lock object name must be start with EZur name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainly lock objects are used for locking the transactions, tables --etec.&lt;/P&gt;&lt;P&gt;Multiple users can not updated the same transaction at the same time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whenever u create a lock object using se11. SAP internally &lt;/P&gt;&lt;P&gt;creates a two function modules:&lt;/P&gt;&lt;P&gt;Enqueue_lockobjname ---For Locking purpose,&lt;/P&gt;&lt;P&gt;dequeue_lockobjname---For Unlocking purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U make use of these fms to lock and unlock transctions, tables..etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example is as follws:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
EPORT ZLOCK_UNLOCK
MESSAGE-ID ZBDC.

TABLES ZSTUD.

DATA text(8) TYPE c.

CALL SCREEN 100.

&amp;amp;---------------------------------------------------------------------
*&amp;amp; Module USER_COMMAND_0100 INPUT
&amp;amp;---------------------------------------------------------------------

text 
----------------------------------------------------------------------
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'SELECT'.
SELECT SINGLE * FROM ZSTUD WHERE ROLLNO = ZSTUD-ROLLNO.
MESSAGE i004 WITH 'SY-SUBRC:' sy-subrc.

WHEN 'EXIT'.
LEAVE PROGRAM.

WHEN 'ENQUEUE'.
CALL FUNCTION 'ENQUEUE_EZLOCK1'
EXPORTING
MODE_ZSTUD = 'X'
ROLLNO = ZSTUD-ROLLNO
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.

CASE sy-subrc.
WHEN 0.
MESSAGE i004 WITH 'Enqueue successful'(001).
WHEN 1.
text = sy-msgv1.
MESSAGE e004 WITH 'Record already'(002) 'locked by'(003)
text.
CALL TRANSACTION 'SM12'.
WHEN 2 OR 3.
MESSAGE e004 WITH 'Error in enqueue!'(004)
'SY-SUBRC:' sy-subrc.
ENDCASE.

WHEN 'DEQUEUE'.
CALL FUNCTION 'DEQUEUE_EZLOCK1'
EXPORTING
MODE_ZSTUD = 'X'
ROLLNO = ZSTUD-ROLLNO
EXCEPTIONS
OTHERS = 1.
CASE sy-subrc.
WHEN 0.
MESSAGE i004 WITH 'Dequeue successful'(005).
WHEN 1.
MESSAGE e004 WITH 'Error in dequeue!'(006).
ENDCASE.

WHEN 'SM12'.
CALL TRANSACTION 'SM12'.
ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT
&amp;amp;---------------------------------------------------------------------
*&amp;amp; Module STATUS_0100 OUTPUT
&amp;amp;---------------------------------------------------------------------

text 
----------------------------------------------------------------------
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'BASIC'.

ENDMODULE. " STATUS_0100 OUTPUT&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 05:07:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428648#M823594</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T05:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428649#M823595</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;STRONG&gt;Lock Mode&lt;/STRONG&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;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;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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 05:19:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428649#M823595</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T05:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428650#M823596</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;Locks are maintained in a central lock table. This ensures that also programs that run on a different&lt;/P&gt;&lt;P&gt;application server of the same SAP System, are informed of the locks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before a database update is triggered, the program requests a lock using a special function module. You&lt;/P&gt;&lt;P&gt;can set a lock for a data record in a database table, or even a set of records, according to you&lt;/P&gt;&lt;P&gt;requirements. The function module first checks whether there is an existing lock that will obstruct the&lt;/P&gt;&lt;P&gt;lock request. If a lock does not already exist then the lock is set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If another program tries to set the same lock, the function module sends a message to say that the&lt;/P&gt;&lt;P&gt;record is already locked. This is carried out using an exception of the function module. Afterwards the&lt;/P&gt;&lt;P&gt;return code is set to the value &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The return code must be supplied with values in the program. You can inform the user of a corresponding message.&lt;/P&gt;&lt;P&gt;If the database change is successful, then the lock entry in the central lock table is deleted using a&lt;/P&gt;&lt;P&gt;different function module.&lt;/P&gt;&lt;P&gt;&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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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;&lt;STRONG&gt;Hope this helps, Do reward.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 06:25:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428650#M823596</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T06:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428651#M823597</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;here is the simple answer for your Q.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lock objetcs are used for locking purpose. it mean suppose one user has open transaction code "XD02" for changing the customer 'X'. at the same time another user also want to change the same customer 'X' in this case second user should not allow for change. this can be done through locking mechanism.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose if you create a lock object through SE11, named as 'EIQMEL' then two function modules will create by system automatically named as 'ENQUEUE_EIQMEL' and 'DEQUEUE_EIQMEL'. so user has to call these two FM's in the program for locking and unlocking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Venkat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 09:17:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428651#M823597</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T09:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428652#M823598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here u can get all you need to know about lock objects&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;A href="http://www.stephan-brumme.com/download/erp/Assignment4.pdf" target="test_blank"&gt;http://www.stephan-brumme.com/download/erp/Assignment4.pdf&lt;/A&gt; - Similar pages&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;DO REWARD IF HELPFUL&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 09:25:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428652#M823598</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T09:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428653#M823599</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;To maintain the operational integrity lock objects are used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If first person is modifying the record, and the other person is deleting the same record at the same time, then the first person gets a problem. To go away from such problems, sap has provided a locking mechanism. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If lock object  is created in se11, Then internally two function modules are created  . The two function modules are enque_lockobjectname and deque_lockobjectname. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enqueue function module is used to lock the record in the program and deque function module is used to release the lock.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The record is locked at runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;kamala.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 09:31:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428653#M823599</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T09:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428654#M823600</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;Kindly check this link.&lt;/P&gt;&lt;P&gt;&lt;STRONG&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;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This will help u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thasneem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 09:34:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-objects/m-p/3428654#M823600</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-13T09:34:49Z</dc:date>
    </item>
  </channel>
</rss>

