<?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 object not working in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745926#M1459287</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Janagar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just check the SM12 before and after the call of Enqueue FM, and I see that it has successfully locked the table. No other program/transaction has locked the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The purpose for locking the table is because we want to read/select the records (not update/insert), and make sure that while  doing that, nobody has inserted/updated any record into the table yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again in advance for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Joyie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Apr 2010 06:09:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-04-12T06:09:44Z</dc:date>
    <item>
      <title>Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745924#M1459285</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;I tried to create a program that locks the database table BKPF by using lock object EFBKPF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I only called the FM like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'ENQUEUE_EFBKPF'  &lt;/P&gt;&lt;P&gt;exporting                       &lt;/P&gt;&lt;P&gt;  mandt = sy-mandt.             &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I executed the program, breakpoint at sy-subrc ( = 0), and I can also see in SM12 that the table BKPF was successfully locked. However, when I try to create and post an FI document (FB01) (while it was still locked), I can still save and post the document, and an entry in BKPF was inserted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder if I'm doing something wrong here. ABAP Geniuses, please advise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Joyie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 03:28:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745924#M1459285</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T03:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745925#M1459286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;at what point you are using this lock object&lt;/P&gt;&lt;P&gt;one thing you have to note&lt;/P&gt;&lt;P&gt;before using lock object&lt;/P&gt;&lt;P&gt;check for enqueue_read FM to check that object which you are going to lock is locked&lt;/P&gt;&lt;P&gt;if it is locked then throw a error message saying that the object is been locked&lt;/P&gt;&lt;P&gt;do u want insert some entries in BKPF is it why you are using this?&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;S.Janagar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Janagar Sundaramoorthy Nadar on Apr 12, 2010 7:05 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 05:05:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745925#M1459286</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T05:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745926#M1459287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Janagar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just check the SM12 before and after the call of Enqueue FM, and I see that it has successfully locked the table. No other program/transaction has locked the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The purpose for locking the table is because we want to read/select the records (not update/insert), and make sure that while  doing that, nobody has inserted/updated any record into the table yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again in advance for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Joyie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 06:09:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745926#M1459287</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T06:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745927#M1459288</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;Give the Break-point in IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then open another session and debug it.&lt;/P&gt;&lt;P&gt;u ll get the proper error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pravin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 06:14:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745927#M1459288</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T06:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745928#M1459289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pravin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As mentioned in my first post, I put at breakpoint at sy-subrc, and it is returning 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While the the enqueue statement is still successful, and SM12 also shows that the database table is locked, I run FB01 to post an FI document. I have successfully posted the FI document, and a record is inserted at BKPF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really dont know what the problem is. &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Joyie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 06:30:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745928#M1459289</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T06:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745929#M1459290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are updating the records in BKPF, use Enqueue and Dequeue with primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'ENQUEUE_EFBKPF'
                EXPORTING
                  MODE_BKPF       = 'E'
                  MANDT           = SY-MANDT
                 BUKRS           = &amp;lt;comp code&amp;gt;
                  BELNR           = &amp;lt;doc no&amp;gt;
                  GJAHR           = &amp;lt;fiscal year&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to create new FI document, I think you don't need to lock the table BKPF, as it will be taken care automatically.&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, 12 Apr 2010 06:35:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745929#M1459290</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T06:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745930#M1459291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Joyie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your are using More docu from an ITAB then you need loop through them&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;call function 'ENQUEUE_EFBKPF' " in SE37 Enter this FM and Find Where used List there are many Examples
       exporting
            mode_bkpf      = 'E' " or 'X' here
            mandt          = sy-mandt
            bukrs          = bukrs
            belnr          = docno
            gjahr          = gjahr
       exceptions
            foreign_lock   = 1
            system_failure = 2
            others         = 3.
  case sy-subrc .
    when 1.
      message e130 with  'Data blocked by user'  sy-msgv1 .
    when 2.
      message e130 with 'Failed to read lock table' .
    when 3.
      message e130 with 'Error in locking table '.
  endcase.

" Or create your own Lock Object in SE11 for the DB table and the Key fields  and before you read the Table you can use this   
"   Lock Object and then do SELECT   Data base 


  call function 'DEQUEUE_EFBKPF'
       exporting
            mode_bkpf = 'E' " or 'X' Here
            mandt     = sy-mandt
            bukrs     = bukrs
            belnr     = belnr
            gjahr     = gjahr
*         X_BUKRS   = ' '
*         X_BELNR   = ' '
*         X_GJAHR   = ' '
*         _SCOPE    = '3'
*         _SYNCHRON = ' '
       exceptions
            others    = 1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Cheerz&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 06:39:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745930#M1459291</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T06:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745931#M1459292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much for your reply, Ram/Vinod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just realized that the above function works on FB02 (changing/updating the record).&lt;/P&gt;&lt;P&gt;But I also want to block user from inserting a new record (FB01).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is, I can successfully insert new record, but I cant update/change an existing one. Is there a way for me to do that?&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;I mean, is there a way for me to block a user from inserting a new record as well?&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Joyie&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: joyie0823 on Apr 12, 2010 8:54 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 06:53:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745931#M1459292</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T06:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745932#M1459293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Joyie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;" To Control the FB01 Tcode from creating/Inserting a Document you the below FM

  call function 'ENQUEUE_EFBVOR'
       exporting
*            bvorg        = bvorg " This is in BVOR Table and I am not sure how to use it
" Put a Debug in FB01 Tcode and find how this Value can be assigned.
" Go to Main Program of FB01 and find this FM and put a break Point
            mandt     = mandt
            belnr        = x_belnr
            bukrs       = bukrs
            gjahr       = gjahr

       exceptions
            foreign_lock = 1
            others       = 2.
  if sy-subrc = 1.
message 'Another User locked this Document' type 'E'
  elseif sy-subrc = 2.
    message .
  endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Cheerz&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 07:03:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745932#M1459293</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T07:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745933#M1459294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THanks so much for your help. But I can still insert new records.&lt;/P&gt;&lt;P&gt;I am thinking of locking the transaction FB01 instead, is there a function module for that? I've checked that there is an FM called RSAU_WRITE_SM01_LOG, but our SAP is release 4.5B, and there is no such FM. I'm thinking of just doing a call transaction for SM01, but it looks messy to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Joyreen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 08:03:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745933#M1459294</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T08:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Lock object not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745934#M1459295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We've decided to use DB_SET_ISOLATION_LEVEL instead and maybe lock the transaction too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've found the answer at this post:&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="7526708"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks all for your help. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: joyie0823 on Apr 13, 2010 4:51 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Apr 2010 02:51:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lock-object-not-working/m-p/6745934#M1459295</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-13T02:51:12Z</dc:date>
    </item>
  </channel>
</rss>

