zoukankan      html  css  js  c++  java
  • ABAP-定时-异步

    *&---------------------------------------------------------------------*
    *& Report  ZRICO_TEST18
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    report zrico_test18.
    
    data: g_init_once,
          ok_code(20),
          g_ref_from_timer.
    
    types: begin of t_ekko,
             ebeln type ekpo-ebeln,
             ebelp type ekpo-ebelp,
             statu type ekpo-statu,
             aedat type ekpo-aedat,
             matnr type ekpo-matnr,
             menge type ekpo-menge,
             meins type ekpo-meins,
             netpr type ekpo-netpr,
             peinh type ekpo-peinh,
           end of t_ekko.
    
    data: it_ekko type standard table of t_ekko initial size 0,
          wa_ekko type t_ekko.
    
    
    if g_init_once <> 'X'.
      g_init_once = 'X'.
      call function 'Z_ENQUE_SLEEP'
        starting new task 'WAIT'
        performing when_finished on end of task.
    
    endif.
    
    write:/ 'wait for 10 sec....'.
    
    start-of-selection.
    
    at user-command.
      case ok_code.
        when 'FCT_R'.
          select ebeln ebelp statu aedat matnr menge meins netpr peinh
           up to 10 rows
            from ekpo
            into table it_ekko.
          write:/ sy-uzeit. "Time
          loop at it_ekko into wa_ekko.
            write:/ wa_ekko-ebeln, wa_ekko-ebelp.
          endloop.
          sy-lsind = 0.
          if g_ref_from_timer = 'X'.
    
            call function 'Z_ENQUE_SLEEP'
              starting new task 'INFO'
              performing when_finished on end of task.
    
            g_ref_from_timer = ''.
          endif.
      endcase.
    
    
    *---------------------------------------------------------------------*
    *       FORM WHEN_FINISHED                                            *
    *---------------------------------------------------------------------*
    *       ........                                                      *
    *---------------------------------------------------------------------*
    *  -->  TASKNAME                                                      *
    *---------------------------------------------------------------------*
    form when_finished using taskname.
      data:lv_txt type string.
    
      receive results from function 'Z_ENQUE_SLEEP'
      importing
        ev_txt = lv_txt .
    
      g_ref_from_timer = 'X'.
    
    * Trigger an event to run the at user-command
      set user-command 'FCT_R'.
      ok_code = 'FCT_R'.
      sy-ucomm = 'FCT_R'.
    
    endform.                    " WHEN_FINISHED
  • 相关阅读:
    路由
    更改HTTP头信息
    laravel 笔记
    laraven安装记录
    虚拟机Centos设置静态IP
    关于正向代理,反向代理,负载均衡的个人理解
    exce族函数详解
    【C】多线程编程笔记
    【转】Linux C 网络编程——TCP套接口编程
    MySQL 用户管理及权限管理
  • 原文地址:https://www.cnblogs.com/ricoo/p/10184274.html
Copyright © 2011-2022 走看看