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

ABAP locking technique

matteo_montalto
Contributor
0 Likes
613

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.

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
586

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

Read only

Azeemquadri
Contributor
0 Likes
586

This message was moderated.

Read only

Clemenss
Active Contributor
0 Likes
586

Hi,

Please do some more research.

Thank you

Clemens

Read only

arindam_m
Active Contributor
0 Likes
586

Hi,

Please go through basic Locking concepts and how locks operate you will be able to understand and execute your desired logic.

Cheers,
Arindam