Application Development and Automation 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: 
Read only

locking

Former Member
0 Likes
714

suppose i'm doing two programs parallel,by using one program locked table..can i access the table by using another program?

1 ACCEPTED SOLUTION
Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
678

Hi,

No u cant ... after the lock is released then only the second program will be able to access that table for writing...

The SAP system is equipped with a special lock mechanism that synchronizes access to data on the database. The purpose of the lock mechanism is to prevent two transactions from changing the same data on the database simultaneously.

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.

- Optimistic lock

Optimistic locks initially behave like shared locks and can be converted into exclusive locks.

You can create a lock on a object of SAP thorugh transaction SE11.

Have a look at below links. It will help you surely.

http://help.sap.com/saphelp_nw04s/helpdata/en/c2/2d7037ecc92a7ee10000009b38f8cf/content.htm

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

Cheers,

Simha.

5 REPLIES 5
Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
679

Hi,

No u cant ... after the lock is released then only the second program will be able to access that table for writing...

The SAP system is equipped with a special lock mechanism that synchronizes access to data on the database. The purpose of the lock mechanism is to prevent two transactions from changing the same data on the database simultaneously.

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.

- Optimistic lock

Optimistic locks initially behave like shared locks and can be converted into exclusive locks.

You can create a lock on a object of SAP thorugh transaction SE11.

Have a look at below links. It will help you surely.

http://help.sap.com/saphelp_nw04s/helpdata/en/c2/2d7037ecc92a7ee10000009b38f8cf/content.htm

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

Cheers,

Simha.

Read only

Former Member
0 Likes
678

hi,

It depends on the type of lock. whether it is a exclusive or shared

Read only

Former Member
0 Likes
678

Hi ,

You can access the table but if it is locked , you will be able to read only.

Hope this helps

Sunil.M

Read only

Former Member
0 Likes
678

hi Balu,

It depends on the type of lock that you are using for locking the table if it is exclusive lock ( E ) you can not ...

Regards,

Santosh

Read only

Former Member
0 Likes
678

hi balu,

it depends on the lock u r using on the table.

Here is a small description on lock object.

The lock mode controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the lock table of the system for each table.

Access by more than one user can be synchronized in the following ways:

Exclusive lock: The locked data can only be displayed or edited by a single user. A request for another exclusive lock or for a shared lock is rejected.

Shared lock: More than one user can access the locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock is rejected.

Exclusive but not cumulative: Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. All other lock requests are rejected.

Check out this thread:

Regards....

Arun.