Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting details back from qRFC call

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

adam_krawczyk1
Contributor
0 Kudos

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

3 REPLIES 3

adam_krawczyk1
Contributor
0 Kudos

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

0 Kudos

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

0 Kudos

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