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: 

How to get the username who is locking a database table read / write ??

Former Member

hi !!

I have a requirement to give a meesage with the user name when a particular database table is locked using ENQUEUE Function module .

regards

1 ACCEPTED SOLUTION

Former Member

Have a look at the FM ENQUEUE_READ. This gives a list of all programs locked at any given time, along with the user's name. You can customize it to your requirement by passing the name of the database table.

The return paramter ENQ should have all the details for you.

Hope this helps.

Sudha

6 REPLIES 6

Former Member

Have a look at the FM ENQUEUE_READ. This gives a list of all programs locked at any given time, along with the user's name. You can customize it to your requirement by passing the name of the database table.

The return paramter ENQ should have all the details for you.

Hope this helps.

Sudha

0 Kudos

Thanks Sudha very much it solved my problem ..i am late in confirming as I was busy in implementing it and testing ...

regards

Former Member
0 Kudos

/1BCDWBEN/CEN0003 Lock and unlock functions

ENQUEUE_ESLX_TABLE Request lock for object ESLX_TABLE

/1BCDWBEN/FEN0003 Lock and unlock functions

ENQUEUE_E_TBSK_KEY_TABLE Request lock for object E_TBSK_KEY_TABLE

/1BCDWBEN/FEN0004 Lock and unlock functions

ENQUEUE_E_VTBTABLE Request lock for object E_VTBTABLE

/1BCDWBEN/SEN4

ENQUEUE_E_TABLE

/1BCDWBEN/SENQ

ENQUEUE_E_TABLEE

ENQUEUE_E_TABLES

sy-uname will give u the user name

reward points if it helps

regards

gunjan

0 Kudos

hi,

try:

 sptab-tabname = c_sperr.
  sptab-varkey  = sy-mandt.
*
  CALL FUNCTION 'ENQUEUE_E_TABLE'
       EXPORTING
            tabname        = sptab-tabname
            varkey         = sptab-varkey
       EXCEPTIONS
            foreign_lock   = 1
            system_failure = 2
            OTHERS         = 3.

  IF sy-subrc <> 0.
    MESSAGE e001(00) WITH ...
  ENDIF.

Former Member
0 Kudos

hi

you can just pass an import parameter of type sy-uname in

Function module 'ENQUEUE_lockobjectname'.and then pass user name in this parameter.

To get the user name in Message, you can write Message e(---) with sy-uname.

Regards

Naveen

Former Member
0 Kudos

HI

T-Code SM12 will give the info of all the locks. HOwevere you need authorization for this T-code.