cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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???

Accepted Solutions (1)

Accepted Solutions (1)

former_member197445
Contributor
0 Kudos

Use "CreateFunction" and "Invoke" an ABAP function module with it.  That would be the easiest way to find out.

Answers (2)

Answers (2)

Former Member
0 Kudos

i got it

Former Member
0 Kudos

Hi Jeswin,

I am also trying to connect SAP-ECC through .net. Would you please tell me your method worked and you were able to ping and retrieve data? Thanks.

hynek_petrak
Active Participant
0 Kudos

Doing that you are encouraging Jeswin to violate licensing agreement for the NCO 3. It's not permitted to redistribute it. You need to get your account on market place.

Former Member
0 Kudos

Hi Hynek Petrak!

Don't worry it won't happen at any cause!!

hynek_petrak
Active Participant
0 Kudos

Use .Ping() on destination. This is the simplest.