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

Function group memory with RFC calls

Former Member
0 Likes
2,617

We have a system where a web front-end interacts with our 4.6C system through RFC calls.

I am having a number of problems where variables declared in a function group are not being cleared out between separate RFC calls to functions in the same group.

I would not have expected separate RFC calls from an external system to use the same memory area.

I have seen this happen at other sites too, but have never found an explanation for it.

Has anyone else experienced this problem and if so can you give me more information about why it happens?

Thanks for you help,

Denis.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,868

This does make sense as global data within a function group is accessable by all function modules of the group. Normally, in the ABAP system, you call multiple function modules of the same group, and they all share the data. If you are calling from outside the system, I would expect a different behavior if you are connecting one by one. But if you are using a pooled connection, this may be the issue. Not sure though. It seems that the session on r/3 has not ended and you are accessing the same when calling the second function module. Is there any function module of the group that looks like it is a "refresher". In some groups, there is a function module that will refresh the global data.

http://help.sap.com/saphelp_46c/helpdata/en/9f/db992335c111d1829f0000e829fbfe/frameset.htm

Regards,

Rich Heilman

6 REPLIES 6
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,869

This does make sense as global data within a function group is accessable by all function modules of the group. Normally, in the ABAP system, you call multiple function modules of the same group, and they all share the data. If you are calling from outside the system, I would expect a different behavior if you are connecting one by one. But if you are using a pooled connection, this may be the issue. Not sure though. It seems that the session on r/3 has not ended and you are accessing the same when calling the second function module. Is there any function module of the group that looks like it is a "refresher". In some groups, there is a function module that will refresh the global data.

http://help.sap.com/saphelp_46c/helpdata/en/9f/db992335c111d1829f0000e829fbfe/frameset.htm

Regards,

Rich Heilman

Read only

0 Likes
1,868

Thanks for you quick response Rich,

We are connecting using JCO and a connection pool.

Its not an issolated example. Sometimes I have found a refresh function and this fixes that issue, but another arises later down the line.

I am really trying to understand the issue better so that I am not constantly patching up holes.

Read only

0 Likes
1,868

Denis,

As Rich has pointed out and once the function group is loaded into the memory, the variables exist. So, you make a call to one of the RFC's now and after about 1/2 hr make a call to another RFC in the same group, there is a possibility that you might have variables that are still active in the memory.

As a developer, it should have been taken care the function module level to clear out the variables that are not required at the global level before you start execution of code of the function.

This process could be erroneous as you will not be able to guess the output as sometimes the memory might exist and sometimes it could have been cleared.

Regards,

Ravi

Note : Please reward the helpful posts.

Read only

0 Likes
1,868

I am aware that the memory of a function group is loaded at the first call to one of the functions.

But it is the lifetime of this memory that I want to understand.

If we were talking about function calls with an ABAP program then the memory would disappear at the end of the internal session of the program. However with RFC calls it seems that it stays around from one call to the next.

Ensuring our developments correctly clear out the memory is fine. However the problems I have is when we make call to standard SAP FMs that make use of the Function group memory. These are extremely difficult to track down.

I would really like to know if there is some way of releasing this memory between calls.

Read only

0 Likes
1,868

Denis,

I am not sure if we will be able to figure out when the garbage collection kicks in. Its better to take care in the coding part.

Regards,

Ravi

Read only

0 Likes
1,868

If you look at the BAPIs, almost all of them will do initialization of the variables and memory areas before starting the actual process. You will have to do the same in your RFCs to avoid any memory left-overs from a previous run.

I don't know if it is going to wipe out the export and tables parameter values, but in report programs, FREE MEMORY at the end of the code does the trick. I haven't used it in function modules, so I cannot comment.

Srinivas