Skip to Content
avatar image
Former Member

Lock Objects

Hi ,

How to create Lock Objects for Z**** Tables ( Steps ). How to check ?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

8 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 02, 2007 at 10:22 AM

    So using ABAP report we do some Processing in TABLES , That time no uses will be able to do any update to Data base Table . Right ?

    That Processing may be UPDATING DB table ?

    Can you tell some Real Time Scenarios Where LOCK is Used ?

    Which SAP Defined tables are used Frequently in LOCKING mechanism ?

    This will solve my issue .

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Kumar,

      See the Lock Object 'EVVBAKE' created for VBAK i.e. SO header for the Sales Order No. Any person making any change in a SO (VA02) an lock entry gets created for that SO Number. So no one else make changes in the same unless and untill the lock is released.

      Sample code to ENQUE the code for the same Lock Object

      CALL FUNCTION 'ENQUEUE_EVVBAKE'

      EXPORTING

      vbeln = i_document_number

      EXCEPTIONS

      foreign_lock = 2

      system_failure = 3.

  • avatar image
    Former Member
    Feb 02, 2007 at 10:04 AM

    Say for example i have a user defined table ZSALES . The field SDNO will be having SD Number in new document is created ..

    I created a lock object for SDNO in ZSALES table .

    My question now ?

    <i>Now to use this Lock object in Report ? I mean if i use ENQUEE Function in any report to see list of SDNO at the moment , will it makes the system not to store any data till the report is runing</i> .

    If i dont Give DEQUEE what will happen ?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Kumar,

      If you have put Exclusive Lock for an entry with a SDNO say XXX using ENQUE function module, unless and untill you do DEQUE for the same XXX SDNO the database lock do not get released. And till this is DEQUEd no one else can make any change in that record. DEQUE happens either by using DEQUE function exclusively or if you log out from the SAP session all the lock entries get DEQUEd or released automatically.

      The lock entries can be seen using Tcode SM12.

  • avatar image
    Former Member
    Feb 02, 2007 at 09:46 AM
    Add comment
    10|10000 characters needed characters exceeded

  • Feb 02, 2007 at 09:47 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 02, 2007 at 09:57 AM

    Check the below thread:

    Lock Objects

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 02, 2007 at 09:47 AM

    Hi

    Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.

    SAP Provide three type of Lock objects.

    - Read Lock(Shared Locked)

    protects read access to an object. The read lock allows other transactions read access but not write access to

    the locked area of the table

    - Write Lock(exclusive lock)

    protects write access to an object. The write lock allows other transactions neither read nor write access to

    the locked area of the table.

    - Enhanced write lock (exclusive lock without cumulating)

    works like a write lock except that the enhanced write lock also protects from further accesses from the

    same transaction.

    You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.

    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.

    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.

    Technicaly:

    When you create a lock object System automatically creat two function module.

    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.

    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.

    You have to use these function module in your program.

    Please also check this link

    http://help.sap.com/saphelp_40b/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 02, 2007 at 10:14 AM

    So i have to pass the parameter SDNO in enquee , Dequee function Right ?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 02, 2007 at 10:35 AM

    Thanks for Everyone . Closed The Thread

    Add comment
    10|10000 characters needed characters exceeded