ABAP程序并行处理

…衆ロ難τιáo~ 提交于 2019-11-30 06:14:28
  • 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.

     

    说明:转自 https://www.cnblogs.com/jiangzhengjun/p/4265586.html

  • 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!