‎2009 Jul 06 5:29 PM
Hi All,
I want to update an entry from MARA table so what ii did is
select single for update * from mara where matnr = 'ZYS'.
The for update is supposed to create a lock for me and the the lock is released after the commit or roll back.
I'm running this prg in debug mode and after the statment
select single for update * from mara where matnr = 'ZYS''.
I opened MM02 for this material and could change the data which i'm not supposed to be as there is lock on this particular mater from single for update statemnt
or
I even tried from other program
select single * from mara where matnr = 'ZYS'. in debug mode and it returned a sy-subrc eq 0.
and i don't see a lock in SM12 FOR SELECT * FOR UPDATE.....
Can anyone clarify on this
Thanks
David
‎2009 Jul 06 5:35 PM
When using the FOR UPDATE, you are applying a lock at the DB level, not the application level. I believe that MM02 will always use the lock object to put locks on material master tables. You can only see lock object locks in SM12, this is why you don't see them when using the FOR UPDATE. I would suggest using a lock object for the material master tables instead of the FOR UPDATE.
You can find the lock object via SE11
REgards,
Rich Heilman
‎2009 Jul 06 5:35 PM
When using the FOR UPDATE, you are applying a lock at the DB level, not the application level. I believe that MM02 will always use the lock object to put locks on material master tables. You can only see lock object locks in SM12, this is why you don't see them when using the FOR UPDATE. I would suggest using a lock object for the material master tables instead of the FOR UPDATE.
You can find the lock object via SE11
REgards,
Rich Heilman
‎2009 Jul 06 5:37 PM
I don't use this variant, so I'm not entirely sure what happens.
But I think this will create a lock at the database level, not an SAP lock. To lock the record, you should use the ENQUEUE functions.
Rob
‎2009 Jul 06 5:38 PM
Hi,
Using the select/Insert/update/delete statement on the MARA table for Matnr will not lock the Material number from accessing through MM02 tcode.
To lock the Matnr you need to call the ENQUEUE and DEQUEUE FM .
Search the SCN for ENQUEUE and DEQUEUE / Lock objects..
‎2009 Jul 06 5:42 PM
Hi All,
I knew we can create a lock object but thought to give a shot without creating lock object.
So i'm just curious to know when we can use select * for update
F1 Help says select * for update creates an E type lock- which will prevent other locks(X AND S type locks) overwriting or even reading that entry
Also ,
can someone throw some light DB lock and SAP Lock ( is this same as SAP LUW and DB LUW)
Thanks
David