‎2008 Jan 03 12:16 AM
Hello All,
I have some issues with updating a table. The program works fine. But problem arrives when two users try to run the program at the same time. I am getting only one update in the table. The other data is getting lost. This happens only when both users try to update at the same time. I am using following statement:
INSERT dbtab FROM TABLE itab.
How I can lock the dbtab while it is being used by one user , so that I do not lose data from second user? Can I create some type of queue so that while one user is writing the data to dbtab, the other user data get queued up and when dbtab is available, this queued data can be written to it.
Thanks for the help in advanced!
‎2008 Jan 03 12:51 AM
Create a Lock Object for that Table and use the Relevant Enque Deque functions that you generate.
That would help you
Vinodh Balakrishnan
‎2008 Jan 03 3:35 AM
Hi,
You can aplly the concept of locking for this.
Please refer to the document:
http://help.sap.com/saphelp_nw04/helpdata/en/7b/f9813712f7434be10000009b38f8cf/content.htm
Hope this helps. Pls reward poins if useful.
Regards,
Renjith Michael.
‎2008 Jan 03 4:52 AM
Hi,
When two users trying to update the same table then it is problem.
So u need to use Logical Locks which are created at SE11-> locks
Which consist entries like table name and fields by which u need to lock that table.
Also have lock type s- shared, x- exclusive and c- cumulative.
Here in u r case use type X or C.
Then while it activated it create two function module 1. EnqueueE<name> and
2. DEqueueE<name> .
In program while updating data base use:-
Call Function EnqueueE<name>
Exporting
Then modifying data base statements.
Then
Call Function DEqueueE<name>.