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

how to implement a call back service?

Former Member
0 Likes
437

hi all,

i have a method which calls a particular function module. i want to achieve the following two things in the code:

1. after calling the function module, i want the program flow to get paused - it should wait for a notification from the function module to proceed further.

2. the function module should send a call back to the method intimating that it is done with the job.

due to the scenario, synchronous call wil not solve the purpose. i need to use explicit wait and notificaion / call back service.

any help would be greatly appreciated. thank you.

rgds,

ram

hi all,

i have a method which calls a particular function module. i want to achieve the following two things in the code:

1. after calling the function module, i want the program flow to get paused - it should wait for a notification from the function module to proceed further.

2. the function module should send a call back to the method intimating that it is done with the job.

due to the scenario, synchronous call wil not solve the purpose. i need to use explicit wait and notificaion / call back service.

any help would be greatly appreciated. thank you.

rgds,

ram

1 REPLY 1
Read only

Former Member
0 Likes
408

Hello. Have you taken a look at CALL FUNCTION ... STARTING NEW TASK ...

See example below. Regards, Peter

DATA: INFO LIKE RFCSI,

  • Result of RFC_SYSTEM_INFO function

SEMAPHORE(1) VALUE SPACE, "For WAIT condition

MSG(80) VALUE SPACE. "Handling of exceptions

RET_SUBRC LIKE SY-SUBRC. "Handling of SUBRC

CALL FUNCTION 'RFC_SYSTEM_INFO'

STARTING NEW TASK 'INFO'

DESTINATION 'NONE'

PERFORMING RETURN_INFO ON END OF TASK

EXCEPTIONS

COMMUNICATION_FAILURE = 1 MESSAGE MSG

SYSTEM_FAILURE = 2 MESSAGE MSG.

IF SY-SUBRC = 0.

WRITE: 'Wait for reply'.

WAIT UNTIL SEMAPHORE = 'X'.

IF RET_SUBRC <> 0.

WRITE MSG.

ELSE.

WRITE: / 'Destination =', INFO-RFCDEST.

ENDIF.

ELSE.

WRITE MSG.

ENDIF.

...

FORM RETURN_INFO USING TASKNAME.

RECEIVE RESULTS FROM FUNCTION 'RFC_SYSTEM_INFO'

IMPORTING RFCSI_EXPORT = INFO

EXCEPTIONS

COMMUNICATION_FAILURE = 1 MESSAGE MSG

SYSTEM_FAILURE = 2 MESSAGE MSG.

RET_SUBRC = SY-SUBRC. "Set RET_SUBRC

SEMAPHORE = 'X'. "Reset semaphore

ENDFORM.