怎样使程序只运行一个实例

    技术2022-05-11  52

    SAP提供了两个FM来解决程序运行时的同步锁定问题。 ENQUEUE_ES_PROG和DEQUEUE_ES_PROG。

    ENQUEUE_ES_PROGSummaryPrevents the parallel execution of a program.DescriptionThis function creates a lock in a program that should not be processed more than once, simultaneously.The lock remains in place until either the DEQUEUE_ES_PROG function moduleis called or the transaction is completed (with an implicit DEQUEUE_ALL call).ParametersEXPORTINGNAME Program name to lockSCOPE Controls how the lock is passed to the update program:Value Meaning1 The lock is not passed to the update program. The lockis removed when the transaction ends.2 (default) The lock is passed to the update program. The updateprogram is responsible for removing the lock.3 The lock is passed to the update program. The lock mustbe removed in both the interactive program and in theupdate program.

     

    DEQUEUE_ES_PROGSummaryReleases program locks.DescriptionThis function releases a lock in a program that has been set by ENQUEUE_ES_PROG.ParametersEXPORTINGNAME Program name to lock

    使用时需要注意下列问题:

    1 程序在锁定后,解锁的动作不是必须的,程序退出或者完成后会自动解锁。

    2 程序的锁定只对前台程序有用,如果运行的是后台服务,则需要其他的解决方案。可以考虑使用如下方法:a 将AS配置为同一程序只允许同时运行一个JOB。 b 通过判断表TBTCO的JOB状态字段来解决。

    3锁定的FM在不同的事件中运行效果不同,请根据具体的需求来确定该在何种事件后锁定。


    最新回复(0)