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

Shared Lock

Former Member
0 Likes
778

I am using a customized screen to upload a material. How to perform a shared lock... for eg., if a user is editing a particular material(m100) then if any other user tries to edit the same material, he should not be able to edit... he should be able to only view the details in that screen.

1 ACCEPTED SOLUTION
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
704

Hi,

You need to create a lock object for this table. Then first thing you need to do in the program is try to attain a lock on the perticular record that you want to edit that you can do it by using the FM that is generated once you create the lock object. The FM will be ENQUEUE_XXXX.. If you get the lock that is if this call to FM is sucessful then you can proceed to edit else raise an error message that somebody else is editing the same record.

Regards,

Sesh

6 REPLIES 6
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
705

Hi,

You need to create a lock object for this table. Then first thing you need to do in the program is try to attain a lock on the perticular record that you want to edit that you can do it by using the FM that is generated once you create the lock object. The FM will be ENQUEUE_XXXX.. If you get the lock that is if this call to FM is sucessful then you can proceed to edit else raise an error message that somebody else is editing the same record.

Regards,

Sesh

Read only

Former Member
0 Likes
704

i tried to create a lock object starting with E, but i was not able to create it. i also tried starting with Z.... but it didn't work. pls tell me how to create a lock object

Read only

0 Likes
704

Rajesh...

Start it with EZ....

e.g. EZTEST1

Read only

0 Likes
704

HI,

All search helps in customer name space should start with EZor EY.

Regards,

Sesh

Read only

Former Member
0 Likes
704

Hi,

Do the following

1. Go to Se11 :you will find the option Lock object (Naming convetion should be followed Example : EZ_ )

2.Select object type Lock object in the initial screen of the ABAP Dictionary, enter an object name and choose Create. The name of a lock object should begin with an E (Enqueue).

3.The maintenance screen for lock objects is displayed.

4.Enter an explanatory short text

5. Enter the name of the primary table

6,Select the lock mode

Save your entries.

Now with help of foll code call the lock in se38 pgm.

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

tabname = 'ZTABLE'

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

        • Now do your coding here

**************Unlocktable:

CALL FUNCTION 'DEQUEUE_E_TABLE'

EXPORTING

tabname = 'ZTABLE'.

Please reward points.

Read only

Former Member
0 Likes
704

hi

good

One type of lock is the shared lock.

Once a shared lock is assigned to a transaction for a particular data object, concurrent transactions can access the object but not modify it. Other transactions can set a shared lock, but not an exclusive lock for this object.

Shared locks refer to a row or a table.

http://www.sapdb.org/7.4/htmhelp/43/151d12671a2240947990c5152a4bbd/content.htm

thanks

mrutyun^