cancel
Showing results for 
Search instead for 
Did you mean: 

NCO 3.0 client connection using gateway - how to configure?

Former Member
0 Kudos

Prepare for a question from a .NET expert but SAP newbie:

We are using NCO 3.0 successfully to connect to both ECC and SAP CRM directly. We have now been asked to connect via a gateway to ECC. We are struggling to configure our destination to do this redirection.

The documentation on connector config seems to be almost non-existent but from what I can see of the NCO classes in Visual Studio and looking at the example config files, defining a gateway with the GWSERV/GWHOST config attributes seems to be associated with creating a server, not creating a client connection to SAP. We are creating a client connection and calling BAPIs to retrieve information - is a gateway valid in this scenario? If so, how do we specify the co-ordinates in our config file?

Any help much appreciated. Thanks in advance,

Richard

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,

I'm having the same problems + some more. When reading connection parameters from application config parameter GWHOST is not supported. For Some Reason class RfcDestination doesn't support all parameters.

I have managed to get past the error about GWHOST parameter by coding the connection details directly into RfcConfigParameters. See the example. The problem however is how to call the BAPI function through PI from Application server.

I'm connecting to PI server with Gateway host, gateway service and ServiceID parameters and specifying application server connection properties repositoryDestination parameter.

Everything work until Invoking the BAPI function. Function is invoked from PI server where it doesn't exist thus giving the error "Function module "BAPI_COMPANYCODE_GETLIST" not found"

When getting the metadata for BAPI there is no problem since it is retrieved from repository ( RfcFunctionMetadata rf = repo.GetFunctionMetadata("BAPI_COMPANYCODE_GETLIST"); )

How to invoke the method through PI to the repository?

private void button1_Click(object sender, EventArgs e)

{

RfcDestinationManager.RegisterDestinationConfiguration(new SAPConfig());//1

RfcDestination prd = RfcDestinationManager.GetDestination("SAP_PI");//2

MessageBox.Show(prd.Repository.Name);

RfcRepository repo = prd.Repository;//3

RfcFunctionMetadata rf = repo.GetFunctionMetadata("BAPI_COMPANYCODE_GETLIST");

IRfcFunction companyBapi = rf.CreateFunction();

MessageBox.Show("invoke:");

companyBapi.Invoke(prd); //6

IRfcStructure detail = companyBapi.GetStructure("RETURN");

String message = detail.GetString("MESSAGE");//7

Console.WriteLine(message);

Console.Read();

MessageBox.Show(message);

}

public class SAPConfig : IDestinationConfiguration

{

public RfcConfigParameters GetParameters(String destinationName)

{

if ("SAP_PI".Equals(destinationName))

{

RfcConfigParameters parms = new RfcConfigParameters();

parms.Add(RfcConfigParameters.GatewayHost, "xx.xx.xx.xxx");

parms.Add(RfcConfigParameters.GatewayService, "sapgw00");

parms.Add(RfcConfigParameters.ProgramID, "PROGRAM_ID");

parms.Add(RfcConfigParameters.RepositoryDestination, "Repository");

return parms;

}

if ("Repository".Equals(destinationName))

{

RfcConfigParameters parms = new RfcConfigParameters();

parms.Add(RfcConfigParameters.AppServerHost, "xx.xx.xx.xxx");

parms.Add(RfcConfigParameters.Client, "100");

parms.Add(RfcConfigParameters.SystemNumber, "01");

parms.Add(RfcConfigParameters.User, "*****");

parms.Add(RfcConfigParameters.Password, "*****");

parms.Add(RfcConfigParameters.Language, "EN");

parms.Add(RfcConfigParameters.Name, "Repository");

return parms;

}

else return null;

}

// The following two are not used in this example:

public bool ChangeEventsSupported()

{

return false;

}

public event RfcDestinationManager.ConfigurationChangeHandler

ConfigurationChanged;

}

Jani

Former Member
0 Kudos

Hello,

I am facing a similar issue. Anyone knows a solution to this?

Regards,

Leandro Fonseca