Skip to Content
author's profile photo Former Member
Former Member

Lock Objects

Hi all,

Can we include the fields of the structure used in some tables ( eg MARA ) as a fields of the Lock objects ?

Thanks in advance.

regards

Raj

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 09, 2007 at 06:27 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.

    check this link for example.

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

    tables:vbak.

    call function 'ENQUEUE_EZLOCK3'

    exporting

    mode_vbak = 'E'

    mandt = sy-mandt

    vbeln = vbak-vbeln

    • X_VBELN = ' '

    • _SCOPE = '2'

    • _WAIT = ' '

    • _COLLECT = ' '

    • EXCEPTIONS

    • FOREIGN_LOCK = 1

    • SYSTEM_FAILURE = 2

    • OTHERS = 3

    .

    if sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    endif.

    Reward points for useful Answers

    Regards

    Anji

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 04:27 AM

    hi,

    Lock Objects:

    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.

    Steps: first we create a lock object in se11 . Suppose for a table mara. It will create two functional module.:

    1. enque_lockobject

    1. deque_lockobject

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.