Hi,

I've got a little situation that I need to solve.

I'm, successfully, executing a SAP function, but after executing, or exiting, the application, the SAP connection remains open in SAP. This is not a good practice. The connection need to be closed, but I can't figure out the problema.

Can anyone help me?


Print with the open SAP connections (it creates two, don't know why…)

The SAPConnection is defined as Dynamic Login

On the OnBeforeConnection I'm defining the language, SAP server and client.

In the login action I'm calling the SAP function to validate if the user and password is correct

Everything works well, but the SAP connection is not closing.

Thank you


Hugo

It seems that the prints are not showing… but if I edit the post they appear to me.

Please tell me if you are not able to see the prints or understand the problem

I had a problem a few weeks ago, where several connections to SAP were opened. But is was because several calls were made. They all ended when data transfer finished.


Are you sure it is only one call? Follow in debug mode with the SAP connections window opened to see when OS creates the first and second connection.

Hi Nuno,


Thanks for the reply. 

It's only one call, to a BAPI called SUSR_Login_Check_Rfc.

This bapi is used to check if the credentials given are correct. I don't know if it's because of the dynamic login, but in SAP two new RFC connections are created.

It's not critical because SAP closes iddle RFC connections after 10 minutes. But I would prefer to know why the connections are not closed once the SAP function is called.


Hugo

Hi,

The same thing here - calling a BAPI after modifying the connection (in our case, setting new login ticket to connection), creates 2 connections which both remain open even after the data transfer / OutSystems action flow is finished. If we perform a call with system user (as set up in service studio), connection is closed as expected after action flow is finished. Connections are closed after being idle for 10 minutes per default settings, sure. We have a longer timeout because other systems interacting with SAP. 

This becomes a problem when there's lots of users, because the amount of active connections is 200 unless a different value is supplied through SAP environment variable CPIC_MAX_CONV (or set programmatically with GeneralConfiguration.CPICMaxConnections).

Re-using login ticket does not create another connection, using different ticket does.

I'd like to know if there's any way to explicitly close the SAP connection? 

I digged around the SAPUtilities extension a bit, but did not find anything obvious way to achieve this using OutSystems.SAP.API. Calling SAPUtilities.BeginContext / EndContext did not help.

br,

-Mikko(N)