cancel
Showing results for 
Search instead for 
Did you mean: 

Can we serialize/deserialize connection object

Former Member
0 Kudos

Hello All,

We have a requirement to keep the connection open while the user is working with a given record in order to maintain a lock on the record until the user moves out of the current record (so that other users cannot work on the same record). If we close the connection object after each BAPI call the record will be unlocked since the SAP backend session will be the closed. So we have to use the same connection across multiple BAPI invocations for the same record within the same session. We are using ASP.NET 2.0 and SAP .NET Connector 2.0.1. We are currently researching a way to store the connection object in ASP.NET out of proc SQL server based session and have been unsuccessful in serializing/deserializing the proxy object. We tried storing the connection object in the session as well but looks like internally some of the properties within the connection object are set as non-serializable. Our .NET web servers are in a load balanced environment so we have to ensure the connection remains open even when different requests are serviced by different web servers. We cannot use connection pooling as well since internally the pool is an arraylist within a given web server and my understanding is each web server will maintain its own pool. Also we use the MYSAPSSO2 ticket for invoking RFC based BAPI calls. Please let me know if anyone has come across this requirement within your projects and have any ideas, suggestions or alternatives.

Thanks for your help

Narayanan

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Have you tried to save the SSO ticket?

Then you can build the connection again, and open it using the SSO ticket you've saved before.

Here's the sample code:

ERPConnect.R3Connection conts = new ERPConnect.R3Connection();

conts.Host = "duncan";

conts.SystemNumber = 7;

conts.Client = "800";

conts.Language = "DE";

conts.OpenSSO(Session["ssoticket"].ToString());

FYI, I use ERPConnect.

I hope it helps.