09-05-2008 9:50 AM
Dear experts,
I have a table (own development) that we use to save some data ...
In one of our programs we will need to change the data of some records. So, one of my colleagues created a lock-object to use ... There is also the generated function to lock the table ...
As possible test I open the table with SM30 and in my program I try to lock the table. Unfortunately this seems to be possible ... The function returns with sy-subrc 0, which means that the lock was executed ?
I don't understand why this is working ? In SM12 I see that the table is locked, but I still can lock it with the function in my program ?
Does anyone knows an explanation for this ?
Thanks in advance !
Greetz, Kurt.
09-05-2008 10:43 AM
Locks only work when everybody use the same locking mechanism e.g. the same lock name and key-fields. because only then the program can see if a lock exists. so if the lockname is different from the SM30 then the one that has been made by your colleague, two locking mechanisms are working. and since this is NOT a real DB-lock, it will not work.
Guido
09-05-2008 9:53 AM
Hi Curt,
Have you use any key field to lock the table or only MANDT is used?
Also, What kind of lock you have executed, READ, WRITE or Exclusive?
Regards,
Kunjal
09-05-2008 9:57 AM
Hi ,
In SM30 did you open the table is Change or Edit mode .
If you pressed the display button then through Program will work .
In Display the table is not locked thru transaction ,but thru program if you lock you will get the result what you are getting now .
09-05-2008 9:58 AM
Locks that are created in se11are locical locks not physical lock that exist in DB level , so for SM 30 it will not work. Try running the program from your end , you can see subrc returning '4'.
09-05-2008 10:01 AM
Look for the type of lock you have used as there are shared lock , cumulative not exclusive , cumulative exculsive locks are available.
Locks are established at the time of update .
09-05-2008 10:43 AM
Locks only work when everybody use the same locking mechanism e.g. the same lock name and key-fields. because only then the program can see if a lock exists. so if the lockname is different from the SM30 then the one that has been made by your colleague, two locking mechanisms are working. and since this is NOT a real DB-lock, it will not work.
Guido