‎2014 Mar 12 5:13 AM
Hi All,
i have used the below code for parallel processing.
CALL FUNCTION 'ZCCR_TABLE_DATA' STARTING NEW TASK taskname
PERFORMING f_return_data ON END OF TASK
EXPORTING
i_input = _it_count-count
TABLES
it_table1 = t_table1[]
*&---------------------------------------------------------------------*
*& Form return_zrfc
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->TASKNAME text
*----------------------------------------------------------------------*
FORM f_return_data USING taskname.
RECEIVE RESULTS FROM FUNCTION 'ZCCR_TABLE_DATA'
IMPORTING
e_output = it_result[]
SO i have debugged the code and found that the data is being calculated in FM, but the perform f_return_data is not being called. I put an infinite loop in side this perform and try to check in SM50. but in any case it is not called.
Can anyone help me to get a solution on it ??
‎2014 Mar 12 6:59 AM
HI Andy,
I wrote the following demo program and sample FM code which works for me. Not sure if you have your wait statement working correctly or if you have used the wrong import param name as I can't see your FM code.
Cheers,
Katan
*&---------------------------------------------------------------------*
*& Report ZKP_ASYNC_FUNC_TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zkp_async_func_test.
*----------------------------------------------------------------------*
* CLASS cl_async_func_controller DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_async_func_controller DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: execute_program,
response IMPORTING p_task TYPE clike.
CLASS-DATA: g_result TYPE char10.
ENDCLASS. "cl_async_func_controller DEFINITION
*----------------------------------------------------------------------*
* CLASS cl_async_func_controller IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_async_func_controller IMPLEMENTATION.
METHOD execute_program.
break bcuser.
* Can use this to kick off a load of selects in parallel that are not dependent
* and then wait on the results
CALL FUNCTION 'ZFUNC_ASYNC1'
STARTING NEW TASK 'TASK1'
CALLING response ON END OF TASK.
* Without this wait statement the program just completes
* need to set an appropriate time out. Not too short and not too long
WAIT UNTIL g_result IS NOT INITIAL UP TO 20 SECONDS.
ENDMETHOD. "execute_program
METHOD response.
DATA: l_result TYPE char10.
break bcuser.
RECEIVE RESULTS FROM FUNCTION 'ZFUNC_ASYNC1'
IMPORTING ex_result = l_result.
g_result = l_result.
WRITE: l_result.
ENDMETHOD. "response
ENDCLASS. "cl_async_func_controller IMPLEMENTATION
START-OF-SELECTION.
cl_async_func_controller=>execute_program( ).
*********************************************
This is the code for the FM
FUNCTION zfunc_async1.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" EXPORTING
*" VALUE(EX_RESULT) TYPE CHAR10
*"----------------------------------------------------------------------
WAIT UP TO 5 SECONDS.
ex_result = 'Async 1'.
ENDFUNCTION.
‎2014 Mar 12 5:35 AM
Hi,
In which server are you executing the RFC the name of the group server and destination keyword missing . Also, have a look at the prerequisites.
CALL FUNCTION 'RFC_SYSTEM_INFO' "Function module to perform
"in parallel
STARTING NEW TASK TASKNAME "Name for identifying this
"RFC call
DESTINATION IN GROUP group "Name of group of servers to
"use for parallel processing.
"Enter group name exactly
"as it appears in transaction
"RZ12 (all caps). You may
"use only one group name in a
"particular ABAP program.
PERFORMING RETURN_INFO ON END OF TASK
Kindly go through the following link, for better understanding the parallel processing
Implementing Parallel Processing (SAP Library - Background Processing)
Regards,
DPM
‎2014 Mar 12 6:59 AM
HI Andy,
I wrote the following demo program and sample FM code which works for me. Not sure if you have your wait statement working correctly or if you have used the wrong import param name as I can't see your FM code.
Cheers,
Katan
*&---------------------------------------------------------------------*
*& Report ZKP_ASYNC_FUNC_TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zkp_async_func_test.
*----------------------------------------------------------------------*
* CLASS cl_async_func_controller DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_async_func_controller DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: execute_program,
response IMPORTING p_task TYPE clike.
CLASS-DATA: g_result TYPE char10.
ENDCLASS. "cl_async_func_controller DEFINITION
*----------------------------------------------------------------------*
* CLASS cl_async_func_controller IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_async_func_controller IMPLEMENTATION.
METHOD execute_program.
break bcuser.
* Can use this to kick off a load of selects in parallel that are not dependent
* and then wait on the results
CALL FUNCTION 'ZFUNC_ASYNC1'
STARTING NEW TASK 'TASK1'
CALLING response ON END OF TASK.
* Without this wait statement the program just completes
* need to set an appropriate time out. Not too short and not too long
WAIT UNTIL g_result IS NOT INITIAL UP TO 20 SECONDS.
ENDMETHOD. "execute_program
METHOD response.
DATA: l_result TYPE char10.
break bcuser.
RECEIVE RESULTS FROM FUNCTION 'ZFUNC_ASYNC1'
IMPORTING ex_result = l_result.
g_result = l_result.
WRITE: l_result.
ENDMETHOD. "response
ENDCLASS. "cl_async_func_controller IMPLEMENTATION
START-OF-SELECTION.
cl_async_func_controller=>execute_program( ).
*********************************************
This is the code for the FM
FUNCTION zfunc_async1.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" EXPORTING
*" VALUE(EX_RESULT) TYPE CHAR10
*"----------------------------------------------------------------------
WAIT UP TO 5 SECONDS.
ex_result = 'Async 1'.
ENDFUNCTION.
‎2014 Mar 12 8:54 AM
The example can work, but usually I use those tools to execute multiple calls, and I increment a counter of requested executions at call statement. In receive methods/forms I decrement the counter. then only wait til counter back to initial value and a fixed duration in cas of aborted tasks.
Regards,
Raymond
‎2014 Mar 12 12:01 PM
Ditto that. That was just a demo program and you need to make sure that you don't lock out all the system processes (you may upset some of the basis guys), so make sure you factor that in to your design.
Was in a rush so did not get a chance to make sure you apply all the due diligence checks...
‎2014 Mar 12 12:13 PM
‎2014 Mar 12 7:50 AM