How to make an abap program pause?

丶灬走出姿态 提交于 2019-12-21 14:01:47

问题


For testing purposes I need my ABAP program to wait for few seconds. How can this be done?


回答1:


2 solutions:

1) Either use WAIT UP TO ... SECONDS.

WAIT UP TO 42 SECONDS.
WAIT UP TO '0.5' SECONDS.
  • Does a roll-out and releases the work process to the listener
  • Does an implicit Database commit

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) Or use the function module ENQUE_SLEEP:

    CALL FUNCTION 'ENQUE_SLEEP'
      EXPORTING
        seconds = 42.
  • Does not release the work process
  • Does not cause an implicit Database commit

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.




回答2:


ABAP WAIT UP TO SAP Documentation

WAIT statement has an implicit COMMIT which is something that should be avoided.




回答3:


Do you really need it to pause? You could trace through it by entering /h into the transaction field before you execute the program or by setting a breakpoint in the code.



来源:https://stackoverflow.com/questions/396663/how-to-make-an-abap-program-pause

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!