‎2006 Jan 23 3:19 AM - edited ‎2024 Feb 04 2:02 AM
Dear all,
I have a request to solve call RFC in other destination "time out" problem.and I want to use
STARTING NEW TASK xxx DESTINATION yyy
PERFORMING zzz ON END OF TASK,and a subroutine zzz is used for
RECEIVE RESULTS FROM FUNCTIONand
WAIT UNTIL <contition>for condition true then continue...
But when I try to debug how the "Asychronized RFC" work:
after call FM,then return back soon,and go to subroutine zzz,and make the condition is true.Actually nothing was got from another destination.
Q1: is there any configuration need for asychronized RFC?
Q2: if this is not a good way,do you have any idea to recommend? or samples to review?
Tks a lot!
Regina
‎2006 Jan 23 10:57 AM
Hi Regina.
If you use [DESTINATION IN GROUP] when calling aRFC,
you can maintain the group via t-code RZ12.
And Chek up t-code SM59.
You said that the condition was true.
But, I think that it did not satify the condition in a subroutine zzz. You need to check up the condition.
The best paractice is F1(help). There are some samples.
regards.
‎2006 Jan 23 12:39 PM
Here is some sample code if you need it. This program works pretty good in my system.
report zrich_0001.
data: functioncall1(1) type c.
data: functioncall2(1) type c.
constants: done(1) type c value 'X'.
data: cstgdetail1 type bapicustomer_kna1.
data: cstgdetail2 type bapicustomer_kna1.
parameters: p_kunnr1 type kna1-kunnr,
p_kunnr2 type kna1-kunnr.
start-of-selection.
call function 'BAPI_CUSTOMER_GETDETAIL2'
starting new task 'FUNC1'
destination 'NONE'
performing set_function1_done on end of task
exporting
customerno = p_kunnr1.
call function 'BAPI_CUSTOMER_GETDETAIL2'
starting new task 'FUNC2'
destination 'NONE'
performing set_function2_done on end of task
exporting
customerno = p_kunnr2.
* Receive remaining asynchronous replies
wait until functioncall1 = done
and functioncall2 = done.
write:/ cstgdetail1.
write:/ cstgdetail2.
************************************************************************
* FORM FUNCTION1_DONE
************************************************************************
form set_function1_done using taskname.
receive results from function 'BAPI_CUSTOMER_GETDETAIL2'
importing
customergeneraldetail = cstgdetail1.
functioncall1 = done.
endform.
************************************************************************
* FORM FUNCTION2_DONE
************************************************************************
form set_function2_done using taskname.
receive results from function 'BAPI_CUSTOMER_GETDETAIL2'
importing
customergeneraldetail = cstgdetail2.
functioncall2 = done.
endform.
Regards,
Rich Heilman
‎2006 Jan 24 2:29 AM
Hi Rich,
Thanks for your reply. After check the sample,it's good to get data from 'NONE' destination...do you ever try to get data from not 'NONE' destination because I need it but it can't be work...Is there other configuration need to be set?
‎2006 Jan 24 8:17 AM
‎2006 Jan 24 9:25 AM
Hi,
Can anybody tell what is the use of this asynchronus type fm.
rgds
p.kp
‎2006 Jan 24 9:29 AM
asynchronous fn module means it works parallelly.
generally when we call a fn module, it will stop the current program , go thera nd again control will return .
but with asynchronous fn module control will start parallelly with out stopping the current program from which u called the fn module.
i hope it is clear
‎2006 Jan 24 3:47 PM
Hello Regina,
Richs sample is good to show RFC in general. To use 'NONE' or something else does not touch the logic in your program. The destination however needs to be configured (e.g. via TA 'SM59') and the name of the destination needs to be specified to your program.
Best Regards
Klaus
‎2006 Jan 27 8:02 AM
Dear all,
Basically I used call function for destination is no problem,so SM59 configure is done.Now I try to go aRFC
but it is not process as I thought. why it return soon when call function by NEW TASK in a DESTINATION? What can I see in the destination server?
I ever tried to use DO...ENDDO until the WAIT UNTIL condition is fulfill then exit this loop to check result,but I see the status by SM51 in destination server is: waiting->running->stop->waiting->running->stop...
seems endless loop occurs. Can you help me to check the following codes where have problem to go aRFC?
Tks!
CALL FUNCTION 'Y_RFC_YCME' STARTING NEW TASK TASKNAME
DESTINATION RFC_DEST "another server
PERFORMING BACK ON END OF TASK
EXPORTING
S_BUDAT_FROM = S_BUDAT-LOW
S_BUDAT_TO = S_BUDAT-HIGH
P_BUKRS = P_BUKRS
P_MATNR = P_MATNR
S_KUNNR_TO = S_KUNNR-HIGH
S_KUNNR_FROM = S_KUNNR-LOW.
WAIT UNTIL FLAG = 'X'.
*something strang because FLAG not equal 'X',but it still
*go to the LOOP AT COMM_TAB statement...
LOOP AT COMM_TAB.
...
ENDLOOP.
*******************************************
FORM BACK USING TASKNAME.
RECEIVE RESULTS FROM FUNCTION 'Y_RFC_YCME'
IMPORTING
I_OWNSYS = W_OWNSYS
TABLES
ITAB = ITAB
KEY_COMBINATION = KEY_COMBINATION
COMM_TAB1 = COMM_TAB.
IF SY-SUBRC = 0 AND NOT COMM_TAB[] IS INITIAL.
FLAG = 'X'.
ENDIF.
‎2006 Jan 27 8:59 AM
Hi Regina!
Looks like Y_RFC_YCME runs into a problem, can't fill comm_tab and returns before time.
This would explain little runtime and your flag would not be 'X' -> you have a endless loop.
You need to set the return flag without condition - even a wrong execution was a complete execution from aRFC point of view.
To be able to follow up the problems, run Y_RFC_YCME local.
Regards,
Christian