Application Development 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: 

Lock table does not work

kumaro412
Active Participant
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

5 REPLIES 5

Former Member
0 Kudos

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

Former Member
0 Kudos

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 .

Former Member
0 Kudos

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'.

Former Member
0 Kudos

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 .

Former Member
0 Kudos

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