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

原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/17958.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论