Skip to Content
author's profile photo Former Member
Former Member

Reset or Clear SAP user context by external RFC caller program


I have a SAP system with performance problems due to a SAP user context starts using a lot of memory.

This user context comes from an External RFC caller program written in Delphi and which uses the SAP RFC SDK provided by SAPGUI 6.40: SAP Automation library, SAPFuntionsOCX, I mean, using methods in the object "SAPFunctions" in SAPFunctionsOCX in file "wdtfuncU.ocx", in SAPGUI directory.

Everytime we have performance problems, this RFC SAP user context is using near 1400 Mb of extended memory, although there is a lot of free physical RAM memory available, there are free dialog processes and CPU load is low (no more than 30%).

This performance problem is solved by closing the external program (written in Delphi) which connects to SAP via RFC.

This external program works for the warehouse management and connects to SAP several times per minute. Due to connection performance and the high frequency with which this external program must connect to SAP, the connection to SAP is not closed after each call to RFC SAP function modules.

The extended memory used by this SAP RFC user is growing along time. I detected, using ST03 transaction, that these user sessions have always the same transaction code hash, I mean, although the external programs call the same SAP RFC funcion modules several times (¡¡¡ always clearing the variables at the beginning and at the end of de ABAP code, with ABAP commands like REFRESH and FREE ¡¡¡¡) the technical transaction code is the same and I suppose the user context (in extended memory) is not deleted.

I think it is better than the external program close the context memory (similar to "/n" okcode in SAPGUI).

But we don't want to close the connection, because the external program connects to SAP with a high frequency, and the logon process is expensive.

Is there any way to send something similar to "/n" (end of transaction) from the external program? Is there any command in the SAP RFC SDK library (SAPFuntionsOCX or something similar?

I cannot find any method to do that in the object "SAPFunctions" in SAPFunctionsOCX in file "wdtfuncU.ocx", in SAPGUI directory.

Old information for Object Classes "SAPFunctions" in SAPFunctionsOCX in file "wdtfuncU.ocx", in SAPGUI directory, is described in the following URL:

But I cannot find anything related to something similar to a "/n" in SAPGUI.

As I have the SAPGUI installed on my desktop, I can see all SAP RFC classes and methods from Excel, by opening the Visual Basic editor.

I am only asking a way to send to SAP a command to free the user context used for an open RFC session in order to avoid the memory used to be continuously growing, without having to close the RFC session.

The external program only calls a certain SAP function module periodically and we want to free the user context between calls without logging off. This is the same, very similar, as if we called that function from SAPGUI and we used "/n" in SAPGUI between calls.

Anyone can help me?

Thanks and best regards.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Apr 15, 2011 at 03:27 PM


    I don't know if this will solve your problem, but you may be using MF 'RFC_CONNECTION_CLOSE' between each call of you RFC function.



    Edited by: blsapsdn on Apr 15, 2011 5:27 PM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.