Locking DB table in SAP by Standard Function Module

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


 

Tx- SM12

Run the report.

 Here is lock entry in Tx- SM12


 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s