Use BAPI/FMs to delete SM12 LOCK object in SAP

Purpose:lots of object locked for a long time when the network is pool.

I hate to be called to delete/Realease the SM12 lock object in the middle night.

Sample Code as ABAP Source Code:

DATA: lt_locks TYPE TABLE OF seqg3 .
DATA ls_lock TYPE seqg3.
CALL FUNCTION ‘ENQUEUE_READ’
EXPORTING
*   GCLIENT               = SY-MANDT
gname                 = ‘SEOCLSENQ’
*   GARG                  = ‘ ‘
*   GUNAME                = SY-UNAME
*   LOCAL                 = ‘ ‘
*   FAST                  = ‘ ‘
*   GARGNOWC              = ‘ ‘
* IMPORTING
*   NUMBER                =
*   SUBRC                 =
TABLES
enq                   = lt_locks
EXCEPTIONS
communication_failure = 1
system_failure        = 2
OTHERS                = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

LOOP AT lt_locks INTO ls_lock.
CALL FUNCTION ‘ENQUE_DELETE’
*     EXPORTING
*       CHECK_UPD_REQUESTS          = 0
*       SUPPRESS_SYSLOG_ENTRY       = ‘ ‘
*     IMPORTING
*       SUBRC                       =
TABLES
enq = lt_locks[].

ENDLOOP.

 

About me: 链接联系我

本文为作者原创,如果这篇文章对您有用,欢迎转载,

转载请务必注明来源《今日热点在看》http://www.hot583.com/

微信原文《全文完》

今日热点在看SAP HOT583