03-14-2013 6:07 PM
Hi Seniors,
Is it not possible to call a Remote Enabled Function Module inside another Remote Enabled Function Module of the Same Function Group? I want to call the 2nd / sub function module in a "BACKGROUND TASK, (w/wo AS SEPARATE UNIT)" or a "BACKGROUND UNIT". If yes, what are the prerequisites other than both the FM's being remote enabled ?
Thank you,
Chaitanya
03-14-2013 7:46 PM
Hi Chaitanya,
So your first program will call a RFC FM in a 2nd system that will call another RFC FM in a 3rd? Cool!
At a first glance I don't see any concerns on this, specially because you would call 2nd RFC FM as background task (and it will run independently) what would mean you don't need to have any commiting point at 1st RFC FM. But you would need to test it, please tell us what happened.
Regards,
Edgar
03-15-2013 3:45 AM
Hi Edgar and Christian,
Firstly, Thank you very much for your replies
The concept is: There are 2 RFC FM's - both custom(ZFM's);
1> 1 is the wrapper, which is called from an external system/application, and this passes all the selection criteria data from its interface parameters to the called/2nd RFC FM.
2> Both these FM's are from the same function group as I said earlier. Also, both the remote calls are to the same system - No other SAP system involved.
3> The second RFC FM is supposed/expected to fetch some good amount of data at times, based on the selection parameters it receives from the wrapper(1st) RFC FM. ((Considering performance issues as well, I am having to call this in background...!!!))
4> Now, I tried to call the 2ndRFC FM in background task and also in background unit. In the debug, while I try to get into the 2nd RFC FM, the execution does not go into it at all - as a result, no data is fetched.
When a FM is called in the Background task or unit is it not supposed to execute in background for execution ? Or is there some thing missing in here ?
Thank you,
Chaitanya
03-15-2013 4:06 AM
Hi Chaitanya,
You're very welcome and I'm truly glad to see you appreciatte our (simple but sincere ) help. Some people over here doesn't say thank you at all.
Okay, think I got your requirement now and, indeed, you've mentioned both FMs were part of same function group (and therefore running at same system), my misunderstanding. It's about assynchronous processing and what you would need to do with 2nd FM is to implement some parallel processing techniques and, in this way, make 1st FM to wait for 2nd FM all results. I won't try to explain all of it over here once it could be extensive but don't be affraid, it's not a big deal.
Take a look in following link (would suggest to google for some examples too) specially regarding this addition (what will make your 1st FM to wait for 2nd one results):
WAIT: ABAP keyword
WAIT UNTIL
<logical expression>
Required if you
wish to wait for all of the asynchronous parallel tasks created with CALL
FUNCTION to return. This is normally a requirement for orderly background
processing. May be used only if the CALL FUNCTION includes the PERFORMING ON
RETURN addition.
The link: http://help.sap.com/saphelp_nw04/helpdata/en/22/0425c6488911d189490000e829fbbd/content.htm
Sorry for to not explain it all but, as I mentioned, it would take some time. It's just a direction, hope you can find the way.
Regards,
Edgar
03-15-2013 9:05 AM
Hi Chaitanya,
I agree with Edgar. It's about assynchronous processing and the RFC call is syncronous.
As per SAP documentation the call of the 2nd RFC in background only register your function to be executed later, right after a commit work.
I see two different approaches to turn your synchronous process into asynchronous:
1) Instead of having only one RFC being called by the external system, create a 3rd RFC two fetch the results in a second call. You can return an ID in the first RFC call so you can identify the second request later.
2) Create a 3rd RFC to callback the first system when the proccess is finished
Both are not easy two implement.
Best regards,
Christian
03-14-2013 10:29 PM
Hi Chaitanya,
It is seems to be an very odd requirement.
Anyway, we need to know the complete scenario (basically answering Edgar's questions). We rely on your answers to provide suggestions..
Best regards,
Christian