如何使abap程序暂停?
问题描述:
出于测试目的,我需要ABAP程序等待几秒钟。
For testing purposes I need my ABAP program to wait for few seconds. How can this be done?
答
2个解决方案:
1 )都可以使用等待至。。 。秒。
WAIT UP TO 42 SECONDS.
WAIT UP TO '0.5' SECONDS. " decimals are possible since ABAP 7.40 SP 8
- 并将工作流程释放给侦听器
- 执行隐式数据库提交
在以下情况下使用它CPU进程非常珍贵,并且隐式提交不会由于打开的数据库游标而损坏数据或导致短暂转储。
Use it when CPU processes are at a premium and when the implicit commit will not corrupt your data or cause a short dump because of an open database cursor.
2)或使用功能模块 ENQUE_SLEEP
:
2) Or use the function module ENQUE_SLEEP
:
CALL FUNCTION 'ENQUE_SLEEP'
EXPORTING
seconds = 42.
- 不发布工作流程
- 不会导致隐式数据库提交
在您无法承担隐式提交的情况下使用它,并且系统可以在SLEEP命令的持续时间内处理被捆绑的工作流程。
Use it when you cannot afford an implicit commit, and the system can handle the work process(es) being tied up for the duration of the SLEEP command.