Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to lock a table in a report program

Former Member
0 Kudos

Hi all,

I have a requirement inwhich if i have selected one radio button the table should locked .

and the i need to check wether the table is locked or not by checking the condition.if locked continue else i need to stop.

can any one help me doing this.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Anjali,

There are lock objects in SE11 Transactions, in that u have to mention which table you have to lock. it generates two function modules Enque and Dequeue. with this , u can use them in your report program.

Regards

Kumar M.

8 REPLIES 8

Former Member
0 Kudos

Hi Anjali,

There are lock objects in SE11 Transactions, in that u have to mention which table you have to lock. it generates two function modules Enque and Dequeue. with this , u can use them in your report program.

Regards

Kumar M.

Former Member
0 Kudos

Hi

Create lock object for the z table in SE11...Then it will generate two function modules..ENQUEUE & DEQUEUE ...

Use the ENQUEUE FM to lock the record.

use the DEQUEUE FM to unlock the record.

Check this link of how to create lock objects:

[Lock Object Creation|http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eef3446011d189700000e8322d00/content.htm]

Regards,

Vishwa.

0 Kudos

ok thank u

then how to check the condition wether the table is locked or not

0 Kudos

Hi,

After calling the FM "ENQUEUE..", check the value of sy-subrc.

if sy-subrc = 0, then it means table is locked.

Regards,

Naveen

0 Kudos

Hi

YOu can use this FM ENQUEUE_READ to check whether table is locked or not.

Regards,

Vishwa.

0 Kudos

thank u to all

Former Member
0 Kudos

Go to SE11 ->Choose Lock object -> Enter E(table Name)

then choose create .Enter table name in Table tab and choose E Exclusive ,cumulative in Lock mode then save it

In program Use FM ENQUEUE_E(TABLE Name) to lock the table

Use DEQUEUE_E(table name) to unlock the Table

Former Member
0 Kudos

Hi,

Hope this information will be useful for you.....

The description of an SAP lock to a table is made via the lock condition and the lock mode.

The lock condition is a logical condition for the lines of the table to be locked. It describes the area of the table which the lock is to protect from competitive access. To avoid the administration of the lock becoming complicated, the lock condition can not be formulated as freely as the WHERE clauses: only fully qualified key fields related by AND may appear in the condition.

Via the lock mode you define which operations on the table are to be protected by the lock. The lock modes available are:

Read lock (shared lock)

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 cumulation)

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

In order to be able to define SAP locks for a table, you must first create a lock object for the table via Development->Dictionary.

If the data for an application object is distributed among several database tables, it is often necessary to be able to lock these tables simultaneously. It is therefore possible to include several tables in a lock object, althought they must be related via appropriate foreign key relationships. The tables involved in a lock object are also known as its base tables.

Thanks

NITESH