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
  • 相关阅读:
    oracle--单表查询
    oracle--本地网络配置tnsnames.ora和监听器listener.ora
    HDU1251统计难题(字典树Trie Tree好题)
    模板——字典树Trie Tree
    51nod——1277 字符串中的最大值
    KMP——hdu 3336 count the string
    KMP模板
    KMP——Game
    BFS——Weed
    DFS——Sum It Up
  • 原文地址:https://www.cnblogs.com/ricoo/p/10184274.html
Copyright © 2011-2022 走看看