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

data dictionary

hi experts,

In Data Dictionary what is lock objects.and explian different types of lock objects. if possible give examples.

regards,

Prerna.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2006 at 05:16 AM

    HI PRERNA,

    Welcome to SDN..

    Check this out

    lock-objects

    Regards,

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2006 at 05:19 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2006 at 05:19 AM

    Hi,

    check this .

    A lock object is a virtual link of several SAP tables which is used to synchronize simultaneous access by two users to the same set of data ( SAP lock concept).

    Locks are requested and released in the programming of online transactions by calling certain function modules which are automatically generated from the definition of the lock objects. These lock objects must be explicitly created in the ABAP Dictionary.

    To set locks, you must perform the following steps:

    1. You must define a lock object in the ABAP Dictionary. The name of the lock object should begin with E.

    2. The function modules for requesting and releasing locks which are created automatically when the lock object is activated must be linked to the programming of the relevant online transactions.

    jaffer vali shaik

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2006 at 05:23 AM

    Hi prerna,

    Lock object is a concept, if you are creating or<b> changing</b> entries in a table this lock object will get activated and it will not allow any other users to change that record until you save and come out from editing mode.

    you can create lock object for your program in se11 and lock object will generate two function modules one is for locking and another is for unlocking.Ex: go to table mara or any standard table their you will find lock objects for that table. in se11 tcode give mara you will get to know lock and unlock object for mara table.

    Reward if useful..

    Regards,

    srinivas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2006 at 05:50 AM

    between two FM

    ENQUEUE_E_TABLE and DEQUEUE_E_TABLE

    u can lock any DB table.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 14, 2006 at 08:36 AM

    Hi

    this might help you,

    Reasons for Setting Locks

    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.

    Lock Mechanisms in the Database System

    The database system automatically sets database locks when it receives change statements (INSERT, UPDATE, MODIFY, DELETE) from a program. Database locks are physical locks on the database entries affected by these statements. You can only set a lock for an existing database entry, since the lock mechanism uses a lock flag in the entry. These flags are automatically deleted in each database commit. This means that database locks can never be set for longer than a single database LUW; in other words, a single dialog step in an R/3 application program.

    Physical locks in the database system are therefore insufficient for the requirements of an R/3 transaction. Locks in the R/3 System must remain set for the duration of a whole SAP LUW, that is, over several dialog steps. They must also be capable of being handled by different work processes and even different application servers. Consequently, each lock must apply on all servers in that R/3 System.

    SAP Locks

    To complement the SAP LUW concept, in which bundled database changes are made in a single database LUW, the R/3 System also contains a lock mechanism, fully independent of database locks, that allows you to set a lock that spans several dialog steps. These locks are known as SAP locks.

    The SAP lock concept is based on lock objects. Lock objects allow you to set an SAP lock for an entire application object. An application object consists of one or more entries in a database table, or entries from more than one database table that are linked using foreign key relationships.

    Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary. A lock object definition contains the database tables and their key fields on the basis of which you want to set a lock. When you create a lock object, the system automatically generates two function modules with the names ENQUEUE_<lock object name> and DEQUEUE_<lock object name> . You can then set and release SAP locks in your ABAP program by calling these function modules in a CALL FUNCTION statement.

    These function modules are executed in a special enqueue work process. Within an R/3 System, enqueue work processes run on a single application server. This server maintains a central lock table for the entire R/3 System in its shared memory.

    The enqueue function module sets an SAP lock by writing entries in the central lock table. If the lock cannot be set because the application object (or a part of it) is already locked, this is reflected in the return code sy-subrc. The following diagram shows the components of the R/3 System that are involved in setting a lock.

    Unlike the database, which sets physical locks, the SAP lock mechanism sets logical locks. This means that

    &#8226; A locked database entry is not physically locked in the database table.

    The lock entry is merely entered as a lock argument in the central R/3 lock table. The lock argument is made up of the primary key field values for the tables in the lock object. These are import parameters of the enqueue function module. The lock is independent of database LUWs. It is released either implicitly when the database update or the SAP transaction ends, or explicitly, using the corresponding dequeue function module. You can use a special parameter in the update function module to set the exact point at which the lock is released during the database update.

    &#8226; A locked entry does not necessarily have to exist in a database table.

    You can, for example, set a lock as a precaution for a database entry that is not written to the database until the update at the end of the SAP LUW.

    &#8226; The effectiveness of the locks depends on cooperative application programming.

    Since there are no physical locks in the database tables themselves, all programs that use the same application objects must look in the central table themselves for any locks. There is no mechanism that automatically prevents a program from ignoring the locks in the lock table.

    Lock Types

    There are two types of lock in the R/3 System:

    &#8226; Shared lock

    Shared locks (or read locks) allow you to prevent data from being changed while you are reading it. They prevent other programs from setting an exclusive lock (write lock) to change the object. It does not, however, prevent other programs from setting further read locks.

    &#8226; Exclusive lock

    Exclusive locks (or write locks) allow you to prevent data from being changed while you are changing it yourself. An exclusive lock, as its name suggests, locks an application object for exclusive use by the program that sets it. No other program can then set either a shared lock or an exclusive lock for the same application object.

    Regards

    pavan

    if Helpful Reward Points

    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.