huysentruitw / SapNwRfc

SAP NetWeaver RFC library for .NET 5, .NET Core and .NET Framework
MIT License
148 stars 43 forks source link

Problem with SapPooledConnection #57

Closed jecojack closed 2 years ago

jecojack commented 2 years ago

Hello, I'm facing the following error when I try to call a bapi

SapNwRfc.Exceptions.SapException: SAP RFC Error: RFC_ABAP_RUNTIME_FAILURE with message: No roll memory of length 2353575936 available for event stack.

when I call:

public T CallFunction(string functionName, string connectionstring)
{
    ISapConnectionPool pool = new SapConnectionPool(connectionstring);
    ISapPooledConnection connection = new SapPooledConnection(pool);
    return connection.InvokeFunction(functionName);
}

Instead, using the following, it works...

public void CallFunction3(string functionName, string connectionstring)
{
    using (var connection = new SapConnection(connectionstring))
    {
        connection.Connect();
        using var someFunction = connection.CreateFunction(functionName);
        var result = someFunction.Invoke<SomeFunctionResult>(new SomeFunctionParameters
        {
            PROGRAMID = "RESULT",
        });
    }
}

Any ideas? thx

tom-j-irvine commented 2 years ago

Just another user here, but your initial generic function doesn't look valid - I would expect something like public T CallFunction<T>() that could return T. You also aren't providing any input parameters (and you are in the second example).

Additionally, creating a pool every time you want a connection kind of defeats the purpose - you want to have a pool of connections where you take and return connections so they can be reused. Otherwise, just create a normal connection.