Application Development and Automation 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: 
Read only

Synchronization between two different abap threads

Former Member
0 Likes
527

I need to perform a call to a remote system and receive a response asynchronously (that is the response will be a out of band call back into another RFC). What i need is to synchronize the request and response. That is, i want to be able to make the async call, than wait for an event which be set by the async receiving rfc. The rfc receiving the call should be able to provide me with the response values. How can this be done?

3 REPLIES 3
Read only

JackGraus
Active Contributor
0 Likes
450

Can you use the statements:

CALL FUNCTION 'RFC_SYSTEM_INFO'

STARTING NEW TASK 'INFO'

PERFORMING RETURN_INFO ON END OF TASK.

FORM RETURN_INFO USING TASKNAME.

RECEIVE RESULTS FROM FUNCTION 'RFC_SYSTEM_INFO'

IMPORTING RFCSI_EXPORT = INFO.

ENDFORM.

Best regards Jack

Read only

Former Member
0 Likes
450

Hi Neer,

if I understood your problem correctly this is what you can do:

1. call a function via rfc.

2. the called function is doing the requested stuff

3. after all, it is calling a function via rfc and passing the result

4. this called function raises an event and posts teh results into memory

5. a new or your first program reacts on this event

regards

Siggi

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
450

Hi,

do you know about these?

<b>CALL FUNCTION func STARTING NEW TASK task DESTINATION ... [{PERFORMING subr}|{CALLING meth} ON END OF TASK].</b>

Asynchronous call of a remote-enabled function module.

The addition specifies either a subroutine <b>subr</b> or, as of release 6.20, a method <b>meth</b> as callback routine, which is executed after terminating the asynchronously called function module. Prerequisite for the execution of the callback routine is that the calling program still exists in its internal mode when the remote function is terminated.

<b>RECEIVE RESULTS FROM FUNCTION func</b>

You can use this statement in a callback routine specified in an asynchronous RFC to receive output parameters of an asynchronously called function module.

<b>WAIT UNTIL log_exp [UP TO sec SECONDS]. </b>

Interrupts program execution for as long as the result of the logical expression log_exp is incorrect. If the result of log_exp is incorrect, the program waits until a callback routine of a previous function that was called asynchronously was executed and then checks the logical expression again.