‎2007 Jan 31 10:40 AM
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.
‎2007 Jan 31 10:44 AM
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
‎2007 Jan 31 10:44 AM
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
‎2007 Jan 31 10:56 AM
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
‎2007 Jan 31 10:58 AM
‎2007 Jan 31 11:00 AM
HI,
All search helps in customer name space should start with EZor EY.
Regards,
Sesh
‎2007 Jan 31 11:51 AM
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.
‎2007 Jan 31 11:58 AM
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^