Locking and Unlocking of Tables

Submitted by Chandra Bose

We can use the function modules ENQUEUE_E_TABLE for locking tables and the function module DEQUEUE_E_TABLE for unlocking tables. With this method, we don't need to lock objects in order to lock the tables. In other words, any table can be locked/unlocked using these function modules.

Report  zsubhas_enqueue.

* testing the locking of tables...
data:
  varkey like rstable-varkey.

  varkey = sy-mandt.

* locking the tables............................
call function 'ENQUEUE_E_TABLE'
 exporting
*   MODE_RSTABLE         = 'E'
   tabname              = 'MARA'
   varkey               = varkey
*   X_TABNAME            = ' '
*   X_VARKEY             = ' '
*   _SCOPE               = '2'
*   _WAIT                = ' '
*   _COLLECT             = 'X'
 exceptions
   foreign_lock         = 1
   system_failure       = 2
   others               = 3
          .
  case sy-subrc.
    when 1.
        message i184(bctrain) with 'Foreignlock'.
    when 2.
      message i184(bctrain) with 'system failure'.
    when 0.
      message i184(bctrain) with 'success'.
        when others.
        message i184(bctrain) with 'others'.
  endcase.

* unlocking the table...............

  call function 'DEQUEUE_E_TABLE'
   exporting
*     MODE_RSTABLE       = 'E'
     tabname            = 'MARA'
     varkey             =  varkey
*     X_TABNAME          = ' '
*     X_VARKEY           = ' '
*     _SCOPE             = '3'
*     _SYNCHRON          = ' '
*     _COLLECT           = ' '
            .

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image