‎2007 Nov 16 2:07 AM
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
‎2007 Nov 16 3:38 AM
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...
‎2007 Nov 16 3:38 AM
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...
‎2007 Nov 16 3:49 AM
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.
‎2007 Nov 16 4:06 AM
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