cancel
Showing results for 
Search instead for 
Did you mean: 

Refreshing Connection to SAP R3 Systems

Former Member
0 Kudos

I have a console application that acts as an RFC server. When I start it, it connects to 4 r3 Applications servers. It works great and test fine from SM59.

The problem is when they take the R3 system down for an offline backup or other emergency, my console application loses its connections. Does anybody have any suggestions for how to have the console application check the connection programatically.

Appricatiate any ideas.

Regards,

Tom

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Sorry, forgot to say that I am using the .net Connector for SAP.

reiner_hille-doering
Active Contributor
0 Kudos

Implement you own SAPServerHost class, inheriting from the original one. Override the OnServerException method and return the appropriate value.

Former Member
0 Kudos

Hi Thomas,

Can you please tell me how did you implement your functions in your server program.

After adding SAP Connector Proxy then did you add any existing SAP function module (like RFC_CUSTOMER_GET as given in .NET connector help doc) or created your own .NET function which uses its own structure.

Can you please provide me with a sample code?

Stephen

reiner_hille-doering
Active Contributor
0 Kudos

To create an RFC server you allways need one ore more RFC function module(s) defined on an SAP server that declares the structure of your API. The implementation can be empty, but it has to exist.

After dragging the needed functions to the .sapwsdl designer, delete the <name>Impl.cs file, right-click the .sapwsdl file and select "Run Custom tool". Now fill your implementation into the Impl.cs file.

Former Member
0 Kudos

Like Rainer said, I did it. If you already need it, try this:

public class ServerHost : SAP.Connector.SAPServerHost

{

/// <summary>

/// Event OnServerException thrown after a Exception occured in the Server

/// </summary>

public event OnServerException ServerException;

/// <summary>

/// Method thrwos the Event OnServerException and writes a Message to Console Output

/// </summary>

/// <param name="server">object</param>

/// <param name="e">Event Arguments</param>

/// <returns>SAP.Connector.ActionOnServerException</returns>

public override ActionOnServerException OnServerException(SAP.Connector.SAPServer server, System.Exception e)

{

ServerException(this, System.EventArgs.Empty);

return ActionOnServerException.Reconnect;

}

}

I Hope this helps.

Regards