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: 

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

lisa_gravito
Explorer
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

lisa_gravito
Explorer
0 Kudos

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)?

Former Member
0 Kudos

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

lisa_gravito
Explorer
0 Kudos

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

~ Lisa

Former Member
0 Kudos

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

lisa_gravito
Explorer
0 Kudos

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

0 Kudos

You forgot about our incentives?? OUR POINTS??

lisa_gravito
Explorer
0 Kudos

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

0 Kudos

Thanks!!