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

Concurrent update problem

Former Member
0 Likes
945

Hi all....

Any way to counter measure the issue where 2 people at the same time update the database? Is there any code that able to identify who done the job first and update the table. Help please

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
812

to ensure that nobody can update the database while one updation is going on, lock facility is provided by SAP...

in the standard tables it is by default there,,, but for custom table we need to design a lock for the object.. which you can design through SE11....

to keep track of the updation i.e. update time n responsible person.. you can add 2 fields in your database table to keep track of same.. whenever any update is done on the records capture the sy-datum n sy-uname in these fields...

3 REPLIES 3
Read only

Former Member
0 Likes
813

to ensure that nobody can update the database while one updation is going on, lock facility is provided by SAP...

in the standard tables it is by default there,,, but for custom table we need to design a lock for the object.. which you can design through SE11....

to keep track of the updation i.e. update time n responsible person.. you can add 2 fields in your database table to keep track of same.. whenever any update is done on the records capture the sy-datum n sy-uname in these fields...

Read only

Former Member
0 Likes
812

Hi Gary,

To ensure serialized access to table you can use locking mechanism.

Step 1. Creating lock object

Goto TXN 11 Create lock object E<table name>.

Enter table name in Primary Table.

Enter key fields (in-order) in Lock Parameters and activate.

This will create two function modules Enqueue_E<table name> and Dequeue_E<table name> which you need to call for locking and unlocking respectively.

Step 2. Accessing table

In your code before updating table call Enqueue_E<table name> to get a write lock.

Before reading table call Enqueue_E<table name> to get a read lock.

After you are finished with the table call Dequeue_E<table name> to release lock or call Dequeue_All.

Regards,

Manish

Note: Please let us know if this solves your question.

Read only

Former Member
0 Likes
812

Hi Gary,

You need to create a lock object for the same.

Goto SE11 & type the name for lock object.

CREATE

enter the primary key field & table names

Activate

CLick GOTO LOCK MODULES

You will find to FM

ENQUEUE_... --> Used for locking the record

DEQUEUE_... --> Used for unlocking the record.

Best regards,

Prashant