aRFC Call ABAP sample
aRFC is very useful to process many data, especially when importing large volume of data.
This is memo of sample program.
Report.abap
DATA:
gv_process TYPE i.
PARAMETERS:
p_limit TYPE sy-uzeit,
p_para TYPE i,
p_rfc_g TYPE rzlli_apcl.
START-OF-SELECTION.
DATA:
lt_order TYPE TABLE OF xxx.
DO.
GET TIME.
IF sy-uzeit > p_limit.
MESSAGE s398(00) WITH 'Finished'.
EXIT.
ENDIF.
WRITE:/ sy-uzeit, 'Start Loop', sy-index.
PERFORM f_select_target CHANGING lt_order.
IF lt_order[] IS INITIAL.
EXIT.
ENDIF.
gv_process = p_para.
DO.
GET TIME.
IF sy-uzeit > p_limit.
MESSAGE s398(00) WITH 'Finished'.
EXIT.
ENDIF.
gv_process = gv_process - 1.
PERFORM f_call_update
CHANGING lv_index
lt_order.
WAIT UNTIL gv_process > 0.
CHECK lt_order[] IS INITIAL.
EXIT.
ENDDO.
WAIT UNTIL gv_process = p_para.
* write result.
ENDDO.
*&---------------------------------------------------------------------*
*& Form F_SELECT_TARGET
*&---------------------------------------------------------------------*
* Select Targets
*----------------------------------------------------------------------*
FORM f_select_target CHANGING et_order.
* Select Orders here
ENDFORM.
*&---------------------------------------------------------------------*
*& Form F_CALL_UPDATE
*&---------------------------------------------------------------------*
* Call aRFC
*----------------------------------------------------------------------*
FORM f_call_update CHANGING cv_index TYPE i
ct_order.
* call aRFC
* Performing f_end_of_call on end of task
* destination in group p_rfc_g
ENDFORM.
*&---------------------------------------------------------------------*
*& Form F_END_OF_CALL
*&---------------------------------------------------------------------*
* Recieve Function
*----------------------------------------------------------------------*
FORM f_end_of_call USING iv_task TYPE clike.
* Recieve aRFC
* Recieve results from function XXX
* importing xxx = xxx
* Performing f_end_of_call on end of task
ENDFORM.