Chinaunix首页 | 论坛 | 博客
  • 博客访问: 394927
  • 博文数量: 120
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 1266
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-16 16:04
文章分类

全部博文(120)

文章存档

2011年(4)

2010年(10)

2009年(38)

2008年(68)

我的朋友

分类:

2008-12-06 13:57:51

程序做好之后,用一个session专门跑这个程序,就不会因为超时挂掉了。因为它会一分钟和前台交互一次。
REPORT  ztimeout.
PARAMETERS seconds TYPE i.
DATA: base TYPE i,
      span TYPE i,
      ms TYPE i,
      text_clock TYPE string,
      timer TYPE REF TO if_abap_runtime.
AT SELECTION-SCREEN.
  IF seconds > 3600.
    MESSAGE 'Please input seconds lower than 3600 (1 hour).' TYPE 'E'.
  ENDIF.
START-OF-SELECTION.
  ms = seconds * 1000 . " Maybe different in other OS, we have used win2003
  timer = cl_abap_runtime=>create_lr_timer( ).
  base = timer->get_runtime( ) / 1000.
  DO.
    DO 100 TIMES.
      span = timer->get_runtime( ) / 1000 - base.
      IF span > ms.
        MESSAGE 'Time is up.' TYPE 'S'.
        LEAVE PROGRAM.
      ENDIF.
      text_clock = span.
      CONCATENATE 'We have spend' text_clock 'milliseconds.'
        INTO text_clock SEPARATED BY ' '.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          percentage = sy-index
          text       = text_clock.
      WAIT UP TO 60 SECONDS.  " Maybe use more long waiting time
    ENDDO.
  ENDDO.
阅读(702) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~