Skip to Content

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 08:01 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 07:41 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2008 at 07:49 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 07:51 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2008 at 07:54 PM

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

    ~ Lisa

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2008 at 08:09 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2008 at 08:17 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.