03-01-2013 8:52 AM
Hello,
Is it possible to get any details back from the qRFC call. For example i have a qRFC call which creates a sales order in the target system. Is it possible to get the sales order number from the target system after the qRFC call is finished?
I checked the SAP help document. There are no details about receiving transaction details back. We can just check if the qRFC call is successful or not.
Is there any other way where the functionality is similar to qRFC, but we can get back the transaction results?
Thanks
Rajvansh
03-01-2013 11:17 AM
Hi Rajvansh,
You can submit function module by RFC with "starting new task" statement. This is the way to call function in remote or current system and it is possible to retrieve results back. This is asynchronous call, so new dialog process is made and current program is still running. However you can stop program until the response comes back from call. Results are retrieved by callback function, like mark_calc_finished as in this case. This statement can be even used for parallel processing if you want to control many tasks in parallel. Example syntax:
CALL FUNCTION 'ZCUSTOM_PROGRAM'
DESTINATION 'NONE' " None works on current server
STARTING NEW TASK gv_task_name
PERFORMING mark_calc_finished ON END OF TASK
EXPORTING
it_item_guids = gt_calc_guids
EXCEPTIONS
COMMUNICATION_FAILURE = 1 MESSAGE l_rfc_error_msg
SYSTEM_FAILURE = 2 MESSAGE l_rfc_error_msg
RESOURCE_FAILURE = 3.
Useful example:
http://scn.sap.com/docs/DOC-31024
Regards,
Adam
03-01-2013 11:17 AM
Hi Rajvansh,
You can submit function module by RFC with "starting new task" statement. This is the way to call function in remote or current system and it is possible to retrieve results back. This is asynchronous call, so new dialog process is made and current program is still running. However you can stop program until the response comes back from call. Results are retrieved by callback function, like mark_calc_finished as in this case. This statement can be even used for parallel processing if you want to control many tasks in parallel. Example syntax:
CALL FUNCTION 'ZCUSTOM_PROGRAM'
DESTINATION 'NONE' " None works on current server
STARTING NEW TASK gv_task_name
PERFORMING mark_calc_finished ON END OF TASK
EXPORTING
it_item_guids = gt_calc_guids
EXCEPTIONS
COMMUNICATION_FAILURE = 1 MESSAGE l_rfc_error_msg
SYSTEM_FAILURE = 2 MESSAGE l_rfc_error_msg
RESOURCE_FAILURE = 3.
Useful example:
http://scn.sap.com/docs/DOC-31024
Regards,
Adam
03-03-2013 1:11 PM
Hi Adam,
Thanks. I am aware of this technique. But unlike qRFC, the called system has to be available at the time of the call.
I guess getting results back from a qRFC call is not possible, unless we do some kind of a explicit call back.
Thanks
Rajvansh
03-03-2013 11:12 PM
Rajvansh, you are correct. In case of qRFC what you need is not possible unless you make a call back to the called system. What Adam suggested is a aRFC and is actually a good option in case you need results back.
Now since you referred to SO creation (considering that is exactly what you need), you should be able to make a call back from UE_SAVE_DOC and achieve what you need.
Thanks,
Vikram.M