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

Problem regarding Enqueue and Locked Objects

Former Member
0 Likes
1,408

Hi there guys,  I'm facing a strange problem which i don't understand very well.

I want to lock one of my table so that while i'm editing no one can access it.

Let's say the tabel Z_ENQTEST is my table , has key Mandt, ID and Name.

So in my program I call the function

CALL FUNCTION 'ENQUEUE_E_TABLE'

     EXPORTING

       mode_rstable         = 'E'

       tabname              = 'Z_ENQTEST'

       varkey               = lv_varkey " = sy-mandt

*   X_TABNAME            = ' '

*   X_VARKEY             = ' '

       _scope               = '2'

*   _WAIT                = ' '

*   _COLLECT             = ' '

     EXCEPTIONS

       foreign_lock         = 1

       system_failure       = 2

       OTHERS               = 3.


While my function is called  i can see in sm12 that the object is locked. If a user tries to edit the program with se11 , add a entry or delete one it notifies him that the object is locked. So this means it should be locked. But if the user use a program to manually edit the table ( like INSERT Z_ENQTEST FROM etc or DELETE FROM Z_ENQTEST etc ) it let's him do it.

My question is, how is it possible?

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
800

Direct manipulation by ABAP code bypasses a lot of things, authority checks, SAP locks and more.

That's why it is important to properly program the necessary checks when doing such manipulations, and also to restrict development access as much as possible.

Thomas

3 REPLIES 3
Read only

ThomasZloch
Active Contributor
801

Direct manipulation by ABAP code bypasses a lot of things, authority checks, SAP locks and more.

That's why it is important to properly program the necessary checks when doing such manipulations, and also to restrict development access as much as possible.

Thomas

Read only

0 Likes
800

Ok so this was the issue. I tried to make a second lock from diff user and didn't work. So it seams the only way to properly use locked objects is to have a careful programming with all the necessary checks thanks, it was really helpful

Read only

Former Member
0 Likes
800

Because SAP locks are logical, not physical. Any program that updates the table must also try to lock it. If it cannot lock, it is because someone else has it locked. And after updating, the lock must be released.

But we normally do not lock an entire table, just those rows that will be updated.

Rob