I am trying to connect to SAP with a little c# program using SAPNCO x64 v. 3.0.2 with this code:
public partial class Connection
{
public class Configuration : IDestinationConfiguration
{
public event RfcDestinationManager.ConfigurationChangeHandler ConfigurationChanged;
public bool ChangeEventsSupported()
{
return false;
}
public RfcConfigParameters GetParameters(string destinationName)
{
var Parameters = new RfcConfigParameters();
if (destinationName == "TEST")
{
Parameters.Add(RfcConfigParameters.AppServerHost, "...");
Parameters.Add(RfcConfigParameters.SystemID, "...");
Parameters.Add(RfcConfigParameters.SystemNumber, "01");
Parameters.Add(RfcConfigParameters.LogonGroup, "COMMON");
Parameters.Add(RfcConfigParameters.User, "...");
Parameters.Add(RfcConfigParameters.Password, "...");
Parameters.Add(RfcConfigParameters.Client, "...");
Parameters.Add(RfcConfigParameters.Language, "EN");
Parameters.Add(RfcConfigParameters.PoolSize, "5");
Parameters.Add(RfcConfigParameters.MaxPoolSize, "10");
}
else
throw new ArgumentException();
return Parameters;
}
}
public void ConnectionTest()
{
RfcDestinationManager.RegisterDestinationConfiguration(new Configuration());
RfcDestination destination = RfcDestinationManager.GetDestination("TEST");
destination.Ping();
}
}
When I call Ping()
I get this error:
LOCATION SAP-Gateway on host ... / ...
ERROR Gateway not connected to local R/3
TIME Mon Jan 29 19:43:34 2018
RELEASE 722
COMPONENT SAP-Gateway
VERSION 2
RC 726
MODULE gwr3cpic.c
LINE 5831
COUNTER 2
I can figure it out. Any would be appreciated. Thanx.
NB: I have replaced sensible data with dots, of course.
M.
I have solved the problem replacing this line:
Parameters.Add(RfcConfigParameters.AppServerHost, SAPServeHost);
with this one:
Parameters.Add(RfcConfigParameters.MessageServerHost, SAPServeHost);
it was just a wrong configuration.