- CASE1. 程序中 start new task ,并在后面获取处理结果
*"---------------------------------------------------------------------- *"*"本地接口: *" IMPORTING *" VALUE(IS_NAST) TYPE NAST *" EXPORTING *" VALUE(CV_SUBRC) TYPE SY-SUBRC *"---------------------------------------------------------------------- DATA:IV_FUNCNAME TYPE RS38L_FNAM. DATA et_return TYPE TABLE OF bapiret2. DATA et_pro_stru TYPE TABLE OF zif_pro_structure. DATA lt_bapiret2 TYPE TABLE OF bapiret2. CALL FUNCTION 'ZIF_FUNC_CALL' STARTING NEW TASK is_nast-objky PERFORMING frm_function_recevie_data ON END OF TASK EXPORTING iv_funcname = lv_funcname iv_zproid = ls_pro-zproid is_nast = is_nast TABLES rt_bapiret2 = lt_bapiret2[]. FORM frm_function_recevie_data USING ck . DATA: lt_bapiret2 TYPE TABLE OF bapiret2 . RECEIVE RESULTS FROM FUNCTION 'ZIF_FUNC_CALL' TABLES rt_bapiret2 = lt_bapiret2 EXCEPTIONS communication_failure = 1 system_failure = 2 . gt_bapiret2 = lt_bapiret2 . gv_done = 'X'. ENDFORM.
-
20.1.2. RFC函数:远程调用
20.1.2.1. 同步
CALL FUNCTION func [DESTINATION dest] [?desti?nei??n]
(在DESTINATION不省略的情况下,且dest取值又不为SPACE,则函数一定要是RFC函数才能采用此方式进行远程同步调用)
20.1.2.2. 异步
CALL FUNCTION rfm_name STARTING NEW TASK [DESTINATION dest]taskname PERFORMING return_form ON END OF TASK FORM return_form USING taskname. ... RECEIVE RESULTS FROM FUNCTION rfm_name ... ENDFORM.
等待多个异步调用的返回结果:WAIT UNTIL log_exp [UP TO sec SECONDS].
异步调用时不能有IMPORTING参数;函数一定要是RFC函数才能采用异步调用;只要有STARTING NEW TASK选项,即为异步调用;如果是异步调用同一目标端的RFC函数,则可以省略DESTINATION
来源:https://www.cnblogs.com/rainysblog/p/11566641.html