Skip to Content
0
Former Member
Mar 07, 2014 at 06:28 AM

How to check whether the SAP system is connected to .NET or not?

64 Views

I have developed a sample appln to check whether the .NET4.0 is connected to SAP or not....

I have added the references

SAPconnectionmanager.dll

sapnco.dll

sapnco_util.dll

Then I have created a application Config file for my window application, and added the apps setting

<configuration>

<appSettings>

<add key= "ServerHost" value="122.159.217.222" />

<add key= "SystemNumber" value= "58"/>

<add key="User" value="xxvi"/>

<add key="Password" value="xxxxx"/>

<add key="Client" value="00"/> //*Instance Number*//

<add key="Language" value="EN"/>

<add key="PoolSize" value="5"/>

<add key="PeakConnectionsLimit" value="10"/>

<add key="IdleTimeout" value="600"/>

</appSettings>

</configuration>

Then I have added a code on Form load function

try

{

SAPSystemConnect sapCfg = new SAPSystemConnect();

RfcDestinationManager.RegisterDestinationConfiguration(sapCfg);

RfcDestination rfcDest = null;

rfcDest = RfcDestinationManager.GetDestination("Dev");

;

}

catch (Exception ex)

{

label1.Text=ex.Message;

}

After running this, the form is loading without error even if i give wrong username and password in apps setting.... Then how can i find the SAP system is connected???