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

Trying to read locks using function: ENQUEUE_READ not returning results.

lisa_gravito
Explorer
0 Likes
15,668

Hi,

I am attempting to read user locks programmatically by calling the function: ENQUEUE_READ. This however is not working. Has anyone successful read locks using this FM?

  • Piece from my function module

  • checking to see if user has a BPS BSP layout lock

CALL FUNCTION 'ENQUEUE_READ'

EXPORTING

gclient = sy-mandt

gname = 'UPC_YS_LOCK'

guname = sy-uname

IMPORTING

number = l_num

TABLES

enq = l_enq.

Thank you!

~ Lisa

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
7,802

SImply pass client and that's it ...

'UPC_YS_LOCK' is table name on which locks exist..if any entry of this table is not being edited currently..then it will not return anything...

CALL FUNCTION 'ENQUEUE_READ'

EXPORTING

gclient = leave blank if you want locks across the system

gname = table name which is locked/leave blank

guname = leaveblank

IMPORTING

number = l_num

TABLES

enq = l_enq.

If you want to see it work then simply pass the table name you see in sm12..

9 REPLIES 9
Read only

Former Member
0 Likes
7,802

How did you know it's not working?? Is it giving any exception..check sy-subrc value and post back!!

Read only

lisa_gravito
Explorer
0 Likes
7,802

I checked SM12 to ensure I had locks, called ENQUEUE_READ and parameter: l_num returned 0. (I had 2 locks)

After I check the locks, I need to be able to log those user out if they in fact have locks...

  • log user off if lock exists

IF l_num > 0.

CALL FUNCTION 'TH_DELETE_USER'

EXPORTING

user = sy-uname

client = sy-mandt.

ENDIF.

Perhaps I'm using the wrong elementary ock (UPC_YS_LOCK)?

Read only

Former Member
0 Likes
7,802

Hi Lisa,

Your code looks perfect. I think it is an authorization issue. Check you have proper authorization to execute that Function Module as this is related to Security.

Thanks,

Greetson

Read only

lisa_gravito
Explorer
0 Likes
7,802

Will do! I'll let you know whether I don't have the proper authorizations or not...

~ Lisa

Read only

Former Member
0 Likes
7,803

SImply pass client and that's it ...

'UPC_YS_LOCK' is table name on which locks exist..if any entry of this table is not being edited currently..then it will not return anything...

CALL FUNCTION 'ENQUEUE_READ'

EXPORTING

gclient = leave blank if you want locks across the system

gname = table name which is locked/leave blank

guname = leaveblank

IMPORTING

number = l_num

TABLES

enq = l_enq.

If you want to see it work then simply pass the table name you see in sm12..

Read only

lisa_gravito
Explorer
0 Likes
7,802

I ran the function without the table name and l_num was populated!

It makes sense that the table would only be populated with a lock if entries were being edited.

Thanks for your help guys!

~ Lisa Gravito

Read only

0 Likes
7,802

You forgot about our incentives?? OUR POINTS??

Read only

lisa_gravito
Explorer
0 Likes
7,802

Sorry! 1st time posting. Please let me know if I've now rewarded the points correctly.

Edited by: Lisa Gravito on Apr 9, 2008 3:18 PM

Read only

0 Likes
7,802

Thanks!!