cancel
Showing results for 
Search instead for 
Did you mean: 

RfcCommunicationException in SAP .Net Connector

Former Member
0 Kudos

Hi,

I am very new to SAP. I got the task to fetch SAP data in .Net application. I am able to connect and generate report by SAP Logon Pad 740 tool.

My plan is to fetch same report in .Net for that I wrote below program (got from https://www.codeproject.com/Articles/824928/SAP-Net-Connector-NCo-Example ) and using NuGet package https://www.nuget.org/packages/SAPDotNetConnector3but getting SAP.Middleware.Connector.RfcCommunicationException exception:

Note:- Once the Ping will be successful I will write code to Fetch Report (and may be raise another question J )

using SAP.Middleware.Connector;

namespace SAPTest

{

classProgram

{

staticvoid Main(string[] args)

{

TestSAPConnection test = new TestSAPConnection();

test.TestConnection();

}

}

classTestSAPConnection

{

publicvoid TestConnection()

{

Start();

RfcDestination destination = RfcDestinationManager.GetDestination("DCS");

destination.Ping();

}

publicvoid Start()

{

IDestinationConfiguration configuration = new SAPDestinationConfig();

RfcDestinationManager.RegisterDestinationConfiguration(configuration);

}

}

classSAPDestinationConfig : IDestinationConfiguration

{

publicstaticint PortNumber = 0;

publicevent RfcDestinationManager.ConfigurationChangeHandler ConfigurationChanged;

publicbool ChangeEventsSupported()

{

returnfalse;

}

public RfcConfigParameters GetParameters(string destinationName)

{

RfcConfigParameters parameters = new RfcConfigParameters();

parameters.Add(RfcConfigParameters.Name, "DCS");

parameters.Add(RfcConfigParameters.AppServerHost, "dcs1.esb.eur.deuba.com");

parameters.Add(RfcConfigParameters.SystemNumber, "0");

parameters.Add(RfcConfigParameters.SystemID, "010");

parameters.Add(RfcConfigParameters.User, "dehapar");

parameters.Add(RfcConfigParameters.Password, "password");

parameters.Add(RfcConfigParameters.Client, "010");

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

parameters.Add(RfcConfigParameters.PoolSize, "100");

return parameters;

}

}

}

Note: Here I am not sure if SystemNumber and SystemID is correct or not. But in SAP Logon there is one textbox where I enter Client value as 010. There is no port number I have to enter in SAP Logon.

Exception:

SAP.Middleware.Connector.RfcCommunicationException occurred

HResult=0x80131600

Message=

LOCATIONCPIC (TCP/IP) on local host with Unicode

ERRORpartner '10.225.16.10:3300' not reached

TIMEThu Dec 28 15:04:48 2017

RELEASE720

COMPONENTNI (network interface)

VERSION40

RC-10

MODULEnixxi.cpp

LINE3286

DETAILNiPConnect2: 10.225.16.10:3300

SYSTEM CALL connect

ERRNO10061

ERRNO TEXTWSAECONNREFUSED: Connection refused

COUNTER2

Source=sapnco_utils

StackTrace:

at SAP.Middleware.Connector.CpicConnection.ConnectAsClient(Dictionary`2 options)

at SAP.Middleware.Connector.RfcConnection.ConnectAsClient(RfcDestination destination)

at SAP.Middleware.Connector.RfcConnectionPool..ctor(RfcDestination destination, Boolean forRepositoryCalls)

at SAP.Middleware.Connector.RfcConnectionPool.GetPool(RfcDestination destination, Boolean forRepository, Boolean create)

at SAP.Middleware.Connector.RfcDestination.GetClient(Boolean forRepository)

at SAP.Middleware.Connector.RfcDestination.Ping()

Please let me know how to resolve it. I think this would be because of some Firewall issue but then how SAP Logon Pad 740 is able to fetch the report. What exactly I have to do to resolve it.

I saw similar issue at https://archive.sap.com/discussions/thread/272667 but unable to understand the solution. As per the 3rd solution, I checked services file at C:\windows\System32\drivers\etc and having below SAP related entry

sapdp013201/tcp

sapdp023202/tcp

till

sapdp983298/tcp

sapdp993299/tcp

sapgw003300/tcp

sapgw013301/tcp

till

sapgw983398/tcp

sapgw993399/tcp

Thanks

Paresh Dehadray

Accepted Solutions (0)

Answers (0)