on 09-07-2011 3:45 AM
Hello,
I'm trying to do something very simple using the .NET Connector 3.0 and am getting the following exception when trying to access the RfcDestination:
LOCATION CPIC (TCP/IP) on local host RERICSSON with Unicode
ERROR service '?' unknown
TIME Tue Sep 06 21:28:41 2011
RELEASE 720
COMPONENT NI (network interface)
VERSION 40
RC -3
DETAIL NiErrSe
COUNTER 2
I'm basically using the example from "A Spotlight on the New .NET Connector 3.0" (/people/thomas.weiss/blog/2011/01/14/a-spotlight-on-the-new-net-connector-30) in Visual Studio 2010 with .NET 4.0 but I must be missing some configuration or another.
I can connect to my SAP instance from the my local host via SAP GUI. I remember with JCo, there was sometimes the need to add a service entry to the services file, but the service '?' unknown seems to point to something different.
The code looks like:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SAP.Middleware.Connector;
namespace TestNCo
{
class Program
{
static void Main(string[] args)
{
RfcDestinationManager.RegisterDestinationConfiguration(new
MyBackendConfig());//1
RfcDestination prd = RfcDestinationManager.
GetDestination("PRD_000");//2
try
{
RfcRepository repo = prd.Repository;//3
IRfcFunction companyBapi =
repo.CreateFunction
("BAPI_COMPANY_GETDETAIL");//4
companyBapi.SetValue("COMPANYID", "001000"); //5
companyBapi.Invoke(prd); //6
IRfcStructure detail = companyBapi.
GetStructure("COMPANY_DETAIL");
String companyName = detail.
GetString("NAME1");//7
Console.WriteLine(companyName);
Console.Read();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.Read();
}
}
public class MyBackendConfig : IDestinationConfiguration
{
public RfcConfigParameters GetParameters(String destinationName)
{
if ("PRD_000".Equals(destinationName))
{
RfcConfigParameters parms = new RfcConfigParameters();
parms.Add(RfcConfigParameters.MessageServerHost,
"some.ABAP.host");
parms.Add(RfcConfigParameters.LogonGroup, "PUBLIC");
parms.Add(RfcConfigParameters.SystemID, "ID1");
parms.Add(RfcConfigParameters.User, "user");
parms.Add(RfcConfigParameters.Password, "password");
parms.Add(RfcConfigParameters.Client, "800");
parms.Add(RfcConfigParameters.Language, "en");
parms.Add(RfcConfigParameters.PoolSize, "5");
parms.Add(RfcConfigParameters.MaxPoolSize, "10");
parms.Add(RfcConfigParameters.IdleTimeout, "600");
return parms;
}
else return null;
}
// The following two are not used in this example:
public bool ChangeEventsSupported()
{
return false;
}
public event RfcDestinationManager.ConfigurationChangeHandler ConfigurationChanged;
}
}
}
Any suggestions would be welcome.
Thanks.
Rob
Hi,
you were very close. The .NET Connector need to know the port of the message server, in case of load balanced target.
Either
Where 36xx is you message server port. Usually xx equals to the Instance number.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I figured this out. I was trying to connect to the message server per the example when I should have been connecting to the app server directly. A simple change of RfcConfigParameters.MessageServerHost to RfcConfigParameters.AppServerHost and it works fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.