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: 

How to wrap stateful Function Module into stateless RFC?

Former Member
0 Kudos

Hi all

We are trying to wrap some Function module into RFC, because Function module is stateful and RFC is stateless. We want to convert FM into RFC BAPI, how to approach it? Can we just bypass sap buffer in funciton module? And the effort to convert a FM to RFC BAPI?

thanks a lot

6 REPLIES 6

madan_ullasa
Contributor
0 Kudos

Hi,

I am not sure of your requirement. But to make a FM RFC enabled you just need to make it remote enabled in the processing type ... You will have to do this in the attribute of the FM... This RFC can be called in another server using 'Destination' vairant in the Call function syntax...

Madan.

0 Kudos

Hi Madan

Thanks for your quickly reply. Actually , we do this as you replied way, but we have a issue with the buffer in this Funciton Module, The FM CUK1_API_DEPNET_MAINTAIN, When we run FM first time in test sequences, there are warning info (CUK1_API_DEPNET_MAINTAIN) or error info. (CAMA_CON_PROFILE_MAINTAIN). Due to the data is not correct. We correct related data in ECC before we run second time of FM. We run the FM second time, the warning and error info. are still there. We do the above step again, but we call FM separately in ECC and does not put into one sequence.( exit SE37, then enter into SE37 to run this FM again) The test result is that there is no warning or error message. We know this is cuased by SAP program buffer, The requirement is how to by pass these SAP buffer to let us we can this FM can access data from database directly. Hope I make my issue clear.

0 Kudos

Did you try this remotely? I mean through se37 the buffer wont be refreshed, but if you call from a different system the scenario might be differernt.

Anywayz this happens because when you call the FM the entire function group(global variables) is loaded into memory. and they remain alive for consecutive calls.

The only solution i can think of is to always clear the global varaibles at the start of the FM or RFC. If you take a look at most of the standard Idoc FM's, all of them have a perform to refresh data at the start.

0 Kudos

Hi,

There is no way you can access the data directly from the database. You would be using SAP Open sql... otherwise you wouuld have to use native sql to access the data... anyway this is not your concern....

On the second thought, see if you can work around the COMMIT_AND_WAIT

NO_COMMIT parameters of the FM...

And also do this.... Go to SE38 .. and type 'Shared buffer' and then look for help (F1). You can do this by placing the curser on 'Shareed' and click on 'F1'... You may get help here....

But remember if you bypass the buffer, the program execution will be very slow since the data is picked directly from DB..

Madan..

0 Kudos

Hello Zhuang

In case of function group CUK1 have you tried to call fm CUK1_API_INIT within your RFC-fm prior to calling the other CUK1_... fm's?

Regards

Uwe

0 Kudos

Hi Madan and Uwe

Thank you both for your kindly help. actually, we call this FM remotely, it is the same result, and we have tried to call fm CUK1_API_INIT prior to calling the other CUK1_... fm's. I have noticed anothe FM "STATUS_BUFFER_REFRESH". Don't know can i call this FM to refresh SAP buffer? Or I have to rewrite the FM "CUK1_API_DEPNET_MAINTAIN" to clear the global varaibles at the start of this FM. But we have another FM have the same issue, for example CAMA_CON_PROFILE_MAINTAIN". Total , we have more then ten FM like this way. I am afraid this would need some efforts to rewrite FM. since i am not familar ABAP, your suggestion are appreciated. thanks again