维护一个旧程序,直接用UPDATE更新数据库透明表,现要求加上正在操作提示,以免数据出错。

1、先找到PA30多人修改时对应的锁对象。

 

2、在UPDATE前加锁,调用函数。

CALL FUNCTION 'ENQUEUE_EPPRELE'
* EXPORTING
* MODE_PREL = 'E'
* MANDT = SY-MANDT
* PERNR =
* INFTY =
* SUBTY =
* OBJPS =
* SPRPS =
* ENDDA =
* BEGDA =
* SEQNR =
* X_PERNR = ' '
* X_INFTY = ' '
* X_SUBTY = ' '
* X_OBJPS = ' '
* X_SPRPS = ' '
* X_ENDDA = ' '
* X_BEGDA = ' '
* X_SEQNR = ' '
* _SCOPE = '2'
* _WAIT = ' '
* _COLLECT = ' '
* EXCEPTIONS
* FOREIGN_LOCK = 1
* SYSTEM_FAILURE = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

 

3、更新之后,调用解锁函数。

CALL FUNCTION 'DEQUEUE_EPPRELE'
* EXPORTING
* MODE_PREL = 'E'
* MANDT = SY-MANDT
* PERNR =
* INFTY =
* SUBTY =
* OBJPS =
* SPRPS =
* ENDDA =
* BEGDA =
* SEQNR =
* X_PERNR = ' '
* X_INFTY = ' '
* X_SUBTY = ' '
* X_OBJPS = ' '
* X_SPRPS = ' '
* X_ENDDA = ' '
* X_BEGDA = ' '
* X_SEQNR = ' '
* _SCOPE = '3'
* _SYNCHRON = ' '
* _COLLECT = ' '
.

 

posted on 2016-04-29 16:06  小伙儿  阅读(2357)  评论(0编辑  收藏  举报