2013 Oct 15 7:18 AM
Hello,
We have a requirement where we need to perform parallel processing with in an RFC function(JAVA). However, on executing parallel processing inside an RFC we are getting an error that "Resource Failure".
Kindly guide, if it is possible to perform parallel processing within RFC function( called from JAVA)?
2013 Oct 15 11:53 AM
Hy Anurag,
Can you please post the code you using to perform you parallel processing call?
Which destination group are you using? Are you using the "parallel_generators"?
Did you check how many dialogue processes are available? (function modules : SPBT_INITIALIZE or SPBT_GET_CURR_RESOURCE_INFO )
Either way, here follows an example on parallel processing that I found on web some time ago. Note that this implementation might be unsafe, this code is not regarding the available resources:
*________________________________________________________
TABLES : MARA.
DATA : BAPIMATDOA TYPE BAPIMATDOA,
BAPIRETURN TYPE BAPIRETURN.
DATA : SYSTEM TYPE RZLLI_APCL,
taskname(8) type c,
index(3) type c,
snd_jobs TYPE i,
rcv_jobs TYPE i,
exc_flag TYPE i,
mess TYPE c LENGTH 80.
TYPES : BEGIN OF type_material,
desc TYPE maktx,
END OF type_material.
DATA : Material type table of type_material with header line.
data: functioncall1(1) type c.
constants: done(1) type c value ‘X’.
SELECT-OPTIONS S_MATNR FOR MARA-MATNR.
system = ‘parallel_generators’. ” RFC Server Group
LOOP AT S_MATNR.
index = sy-tabix.
CONCATENATE ‘Task’ index into taskname. ” Generate Unique Task Name
CALL FUNCTION ‘BAPI_MATERIAL_GET_DETAIL’ STARTING NEW TASK taskname
DESTINATION IN GROUP system
performing set_function1_done on end of task
EXPORTING
MATERIAL = S_MATNR-LOW
EXCEPTIONS
system_failure = 1 MESSAGE mess
communication_failure = 2 MESSAGE mess
resource_failure = 3.
CASE sy-subrc.
WHEN 0.
snd_jobs = snd_jobs + 1.
WHEN 1 OR 2.
MESSAGE mess TYPE ‘I’.
WHEN 3.
IF snd_jobs >= 1 AND
exc_flag = 0.
exc_flag = 1.
WAIT UNTIL rcv_jobs >= snd_jobs
UP TO 5 SECONDS.
ENDIF.
IF sy-subrc = 0.
exc_flag = 0.
ELSE.
MESSAGE ‘Resource failure’ TYPE ‘I’.
ENDIF.
WHEN OTHERS.
MESSAGE ‘Other error’ TYPE ‘I’.
ENDCASE.
ENDLOOP.
WAIT UNTIL rcv_jobs >= snd_jobs.
loop at material.
write : material-desc.
endloop.
form set_function1_done using taskname.
rcv_jobs = rcv_jobs + 1.
receive results from function ‘BAPI_MATERIAL_GET_DETAIL’
IMPORTING
MATERIAL_GENERAL_DATA = BAPIMATDOA.
BAPIRETURN = BAPIRETURN.
functioncall1 = done.
APPEND bapimatdoa-matl_desc TO material.
ENDFORM.
*________________________________________________________
Best Regards,
José Vília
2013 Oct 18 2:37 PM
2013 Oct 18 2:37 PM
Hello José,
Pasting Source Code below, I used in my code:
CALL FUNCTION 'ZSQP_GET_CONFIG_PRICE'
STARTING NEW TASK 'SANITY_CHECK'
DESTINATION IN GROUP DEFAULT
PERFORMING get_result ON END OF TASK
EXPORTING
iv_customer = piv_customer
iv_package_type = piv_package_type
iv_body_size = piv_body_size
iv_layer = piv_layer
iv_wire_mat_cost = piv_wire_mat_cost
iv_substrate_cost = piv_substrate_cost
iv_leadframe_cost = piv_leadframe_cost
EXCEPTIONS
communication_failure = 1
system_failure = 2.
FORM get_result USING taskname.
DATA : lt_return TYPE bapiret2_t.
RECEIVE RESULTS FROM FUNCTION 'ZSQP_GET_CONFIG_PRICE'
IMPORTING
et_ref_price = gt_price
et_return = lt_return
EXCEPTIONS
communication_failure = 1
system_failure = 2.
CLEAR gv_return.
ENDFORM. "get_result
"Get Reference Price
WAIT UNTIL gv_return IS INITIAL.
et_ref_price[] = gt_price[].
2013 Oct 18 6:31 PM
Hello Anurag,
Try to change the:
DESTINATION IN GROUP DEFAULT
to
DESTINATION IN GROUP system
note: System has to be declared and filled:
DATA : SYSTEM TYPE RZLLI_APCL.
system = ‘parallel_generators’.
Check in t-code RZ10 if you have set the group server parallel_generators. If it's not set, use one destination set there.
Regards,
José Vília