<?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: Locking only certain fields of a table using lock objects in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988873#M1342159</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes. You can lock individual records based on the Key Fields. Use the FM: ENQUEUE_E_TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the parameter VARKEY, concatenate your Key Field values and pass it to the above FM. So only the particular record will be locked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters:&lt;/P&gt;&lt;P&gt;TABNAME&lt;/P&gt;&lt;P&gt;VARKEY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chathia.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Aug 2009 05:59:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-18T05:59:36Z</dc:date>
    <item>
      <title>Locking only certain fields of a table using lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988872#M1342158</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;I am aware that we can lock an entire table using locking.&lt;/P&gt;&lt;P&gt;However i was wondering how we can use lock objects to lock specific Fields of a table for specfic records&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 05:48:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988872#M1342158</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T05:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Locking only certain fields of a table using lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988873#M1342159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes. You can lock individual records based on the Key Fields. Use the FM: ENQUEUE_E_TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the parameter VARKEY, concatenate your Key Field values and pass it to the above FM. So only the particular record will be locked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters:&lt;/P&gt;&lt;P&gt;TABNAME&lt;/P&gt;&lt;P&gt;VARKEY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chathia.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 05:59:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988873#M1342159</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T05:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Locking only certain fields of a table using lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988874#M1342160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sarvesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, its possible to lock the table at record level.&lt;/P&gt;&lt;P&gt;You can lock individual records based on the Key Fields only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose if you have created a lock object EZMARA, then two FMs will be created, one for locking the table at record level and one for unlocking it,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FMs:&lt;/P&gt;&lt;P&gt;ENQUEUE_EZMARA&lt;/P&gt;&lt;P&gt;DEQUEUE_EZMARA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to lock the table at record level you need to call ENQUEUE_EZMARA and assign the keyfield value ( for which record you need to lock)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls dont forget to unlock the record one updation is done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Infact this is a good programming practice in Database systems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Sripal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 09:44:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988874#M1342160</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T09:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Locking only certain fields of a table using lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988875#M1342161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; However i was wondering how we can use lock objects to lock &lt;STRONG&gt;specific Fields&lt;/STRONG&gt; of a table for specfic records&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understand correctly, the original poster wants to lock &lt;EM&gt;specific fields&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sarvesh, keep in mind that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- A lock using SAP lock objects only works if others updating the table also always call the lock function. That is, if this is a Z table you have to make sure you call the lock function before each update (and unlock afterwards).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- If you do this with a specific Z lock object before you update the &lt;EM&gt;fields&lt;/EM&gt; you want (but not before &lt;EM&gt;other different &lt;STRONG&gt;fields&lt;/STRONG&gt;&lt;/EM&gt; are updated) then you should get what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- If what you want is actually to lock specific &lt;EM&gt;records&lt;/EM&gt; then forget what I just said and read the answers above.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 13:01:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988875#M1342161</guid>
      <dc:creator>Rui_Dantas</dc:creator>
      <dc:date>2009-08-18T13:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Locking only certain fields of a table using lock objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988876#M1342162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sarvesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is possible to lock a database table at a record (row) level but not at a field level. For example you can lock all the lines of a sales order in table VBAP by specifying the client (MANDT) and order number (VBELN) in function module ENQUEUE_EMVBAP. However it is not possible to lock table for say a specified material number. Locking is always possible either for the entire table or for a combination of the primary key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Certain tables have lock objects that have lock modules. For example VBAP has a lock object EMVBAP. Lock object EMVBAP&lt;/P&gt;&lt;P&gt;has lock modules ENQUEUE_EMVBAP for locking and DEQUEUE_EMVBAP for unlocking locked records in table VBAP. Not all database tables have lock objects. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When a table does not have lock objects assigned to it you can use the generic function module ENQUEUE_E_TABLEE and DEQUEUE_E_TABLEE to do the same thing. Function module ENQUEUE_E_TABLEE has a parameter VARKEY. You need to pass a concatenation of the fields values (in the primary key) that you want to lock. for example if you order number is '9999999999' and you client is '010' then VARKEY = '0109999999999'. If sales oder '9999999999' has hundred line items all the line items will get locked. If I want to just lock line item '000030' then VARKEY = '0109999999999000030'. Make sure you add the leading zeros for VBELN and POSNR while constructing the VARKEY parameter. I am not sure if you can lock records using '&lt;STRONG&gt;'. For example if I want to lock all records in VBAP where POSNR is '000030', I am not sure if this can be done by say VARKEY = '010&lt;/STRONG&gt;000030'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another thing that you need to keep in mind with locking records is that you want to make sure that you do not create too many locks. I think there is a limit on the number of records you can lock at one time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 14:01:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-only-certain-fields-of-a-table-using-lock-objects/m-p/5988876#M1342162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T14:01:10Z</dc:date>
    </item>
  </channel>
</rss>

