PARAMETERS : p_table TYPE  tabname.
* FM to lock a table
CALL FUNCTION 'ENQUEUE_E_TABLE'
  EXPORTING
    mode_rstable   = 'E'
    tabname        = p_table
*   VARKEY         =
*   X_TABNAME      = ' '
*   X_VARKEY       = ' '
*   _SCOPE         = '2'
*   _WAIT          = ' '
*   _COLLECT       = ' '
  EXCEPTIONS
    foreign_lock   = 1
    system_failure = 2
    OTHERS         = 3.
IF sy-subrc = 0.
  MESSAGE 'Table locked' TYPE 'I'.
ENDIF.

* FM to unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
  EXPORTING
    mode_rstable = 'E'
    tabname      = p_table
*   _COLLECT     = ' '
  .

MESSAGE 'Table Unlocked' TYPE 'I'.



Serkan AKKAVAK
Computer Engineer
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com