<?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: Table Lock in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677960#M298979</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;    We Lock Database table to avoid Duplicate Entries. For Example if you are creating a Purchase Order from an Legacy say Excel file and at the same time there could be some one who would create an PO internaly. If the last PO is 10 an dyou Excel Contains from 11 to 20 at this time if a person creates PO internaly then it would be 11 so you cannot create from your Program so we Lock the DataBase.&lt;/P&gt;&lt;P&gt;    Locking and Unloacking can be done using Enque and Deque Function Modules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Hope this would have cleared you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Prashanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Nov 2006 11:03:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-06T11:03:02Z</dc:date>
    <item>
      <title>Table Lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677957#M298976</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;Some times we lock some DB tables?..Y we lock them?&lt;/P&gt;&lt;P&gt;How to lock and unlock a table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2006 10:57:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677957#M298976</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-06T10:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Table Lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677958#M298977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if  one  user  updating the data base table  another user can't use it at the time of updation at same time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*-------------lock Table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = table_name
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
 
 
 
*-------------Unlock Table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
tabname = table_name&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also check ....&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="159356"&gt;&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;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2677282"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2006 11:00:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677958#M298977</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-06T11:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Table Lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677959#M298978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, Lock objects are used to set locks on database tables. Usually the lock is applied using the key of the database table. This insures that only one user can change a specific record in a database table at one time. You create the lock object in SE11, once defined, there will be two function modules created, an ENQUEUE function module and a DEQUEUE function module. The naming convention is ENQUEUE_E&amp;lt;name of lock object&amp;gt;, DEQUEUE is the same, but replace ENQUEUE with DEQUEUE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why to lock the databse tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can consider example of bank transactions. Suppose I am transfering some amount from one account to other. Once i click on transfer button, immediately the amount will be debited from my account but at the next second it may or may be credited to other account. In betwwen if I try to do other transcations with the same amount, then that may not be correct one bcoz the money is not there in my account. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other example, Suppose a travel agent want to book a flight. The customer wants to fly to a particular city with a certain airline on a certain day. The booking must only be possible if there are still free places on the flight. To avoid the possibility of overbooking, the database entry corresponding to the flight must be locked against access from other transactions. This ensures that one user can find out the number of free places, make the booking, and change the number of free places without the data being changed in the meantime by another transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04s/helpdata/en/c2/2d7037ecc92a7ee10000009b38f8cf/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04s/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_nw04s/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04s/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Vibha &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2006 11:01:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677959#M298978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-06T11:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Table Lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677960#M298979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;    We Lock Database table to avoid Duplicate Entries. For Example if you are creating a Purchase Order from an Legacy say Excel file and at the same time there could be some one who would create an PO internaly. If the last PO is 10 an dyou Excel Contains from 11 to 20 at this time if a person creates PO internaly then it would be 11 so you cannot create from your Program so we Lock the DataBase.&lt;/P&gt;&lt;P&gt;    Locking and Unloacking can be done using Enque and Deque Function Modules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Hope this would have cleared you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Prashanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2006 11:03:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677960#M298979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-06T11:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Table Lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677961#M298980</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;create the lock objects from the transaction 'SE11' and then use them in the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;once you created two function module will be generated one for locking that is 'ENQUEUE_tabelname' and for unlocking 'DEQUEUE_tablename'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can call these FMs to lock and unlock the records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2006 11:03:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677961#M298980</guid>
      <dc:creator>dani_mn</dc:creator>
      <dc:date>2006-11-06T11:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Table Lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677962#M298981</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 are used to lock the database table while making the modifications on the database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can create your own lock objects using SE11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you create lock objects on any table system will create two function modules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.ENQUEUE....&lt;/P&gt;&lt;P&gt;2.DEQUEUE.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first one is used to lock the table&lt;/P&gt;&lt;P&gt;second one used to removing lock on the table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*-------------lock Table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = table_name
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
 
 
 
*-------------Unlock Table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
tabname = table_name&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this link :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_40b/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_40b/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls amrk all hlpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2006 11:06:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677962#M298981</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-11-06T11:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: Table Lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677963#M298982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When we are changing data base table then at that time if we have not put lock then others can also change it at a same time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Imagine you need to change the name of emp 1000 from PA0001 table. Now without locking table if you are making change of name from Vikas to Vishal.&lt;/P&gt;&lt;P&gt;Now at the same time i am making change in name and chaning it to Vikas to Amit.&lt;/P&gt;&lt;P&gt;Imaging what will happen ????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To avoid such scenario locking is required in table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To lock database table we need to create LOCK object.&lt;/P&gt;&lt;P&gt;SE11 there is option to create a lock object.&lt;/P&gt;&lt;P&gt;This will create 2 function module&lt;/P&gt;&lt;P&gt;1. ENQUEUE_*&lt;/P&gt;&lt;P&gt;2. DEQUEUE_*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in program when you are chaning DB then use FM ENQUEUE_*&lt;/P&gt;&lt;P&gt;this will lock DB table and if any one else is chaging DB at the same time then he ll get message that DB is locked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once updatiuon is done via DEQUEUE_* FM unlock it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*HOPE this will help you to understand lock/unlock concept&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2006 11:06:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677963#M298982</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-06T11:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Table Lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677964#M298983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will give u one live example. When u r trying to Draw cash from you bank account and one of u'r friend is also having a duplicat card of u'r account. You both cannot Draw the Cash at a time. Means when one is With Drawing the cash u'r account is locked after he Took the cash u can With Draw. Same way When u r Doing some thing on the Data base table and if any other person is trying to Access the data the data obtained will give errors as u r modifying them. In oder to avoid this We lock the DBTables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bye&lt;/P&gt;&lt;P&gt;Murthy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2006 11:07:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-lock/m-p/1677964#M298983</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-06T11:07:07Z</dc:date>
    </item>
  </channel>
</rss>

