• 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
  • 相关阅读:
    Java 密钥库 证书 公钥 私钥
    Theos小例子
    armbian禁用zram
    常见JS混淆器和特征
    命令行工具收藏
    python中生成器的两段代码
    把mysql数据库从windows迁移到linux系统上的方法
    【转载】使用Flink低级处理函数ProcessFunction
    spark读取压缩文件
    SpringBoot系列——validation参数校验
  • 原文地址:https://www.cnblogs.com/ricoo/p/10184274.html
Copyright © 2020-2023  润新知