‎2013 Apr 30 1:13 PM
Hi all experts,
I'm working on a custom development which deals also with entry modification/insertion in DB tables (both standard and custom).
Shortly, an user can access to some data in "view mode", then pressing an EDIT (custom) button, these fields become enabled and editable.
Then, user can save persistently these data by pressing a SAVE (custom) button.
I have to implement a locking technique which should work at single entry's granularity.
To provide an example:
- ZTABLE is my custom table; it has a specific field in key which represents a "group" of users (say, user A and user B);
- if user A press the EDIT button, he should acquire a lock on the (single) specific entry of his group, so that user B can't simultaneously access to the EDIT mode. This to prevent cuncurrent modifications on the tuple.
Is there a straightforward way to lock a specific entry of the table? As far as I've seen from some examples, there's a lot of documentation about locking an entire table... but that's not our case.
Thanks in advance,
M.
‎2013 Apr 30 1:20 PM
Read first some documentation at help.sap.com like The SAP Lock Concept (BC-CST-EQ), look for SAP Lock Concept or Function Modules for Lock Requests.
Your Group must be second key after client, then create a lock object on your table via SE11, and check the parameters of the generated Enqueue module.
Remember you can use "wildcard" in the lock request (the call of the Enqueue FM) so lock the whole group or single record if ypu pass the whole primary key, or the whole table if you pass only "*" at first key)
Regards,
Rzymond
‎2013 Apr 30 1:22 PM
‎2013 Apr 30 2:23 PM
‎2013 May 01 3:24 AM
Hi,
Please go through basic Locking concepts and how locks operate you will be able to understand and execute your desired logic.
Cheers,
Arindam