Introduction

This short material will guide on the following integration points.

For this Tech Tip will create a console application using C#.

SAP .Net connector

SAP .NET Connector 3.0 is the current version of SAP's development environment for communication between the Microsoft .NET platform and SAP systems. This connector supports RFCs and Web services. It allows developers to write different applications such as Webform, Windows form, or console applications in Microsoft Visual Studio.Net. With the SAP .NET Connector, a developer can use all common programming languages, such as Visual Basic. NET, C#, or Managed C++.

Step 1. Download the Sapnco libraries from the SAP official site and reference the Visual Studio project as shown below.

  1. sapnco.dll
  2. sapnco_utils.dll
    References

Spanco Library's details are as follows.

Properties

Reference property

Step 2. Append the following to the app.Config.

Note. Provide the required IP and Credentials to connect to the target SAP System as received from the SAP team.

Credentials

Step 3. This example will show how the program is accessed in getting the invoice details from the SAP system

The below methods will help to connect to the SAP System and access the RFC function by passing the necessary input and output parameters.

Note. In RFC Terms the input parameters are called import and output as export parameters.

Do request the SAP team to provide the RFC function name and its import, and export parameters which will help build the logic.

RFC function

Connection sap system

Step 4

Step 5. Program Output.

Program output

Step 6. Exception handling.

Apply the below try-catch blocks as below to handle exceptions.

Exception handling

Add On

Since we used x86(32-bit) sapnco libraries, and servers in general x64 (64-bit) the following need to be applied to the application pool of the Web Application,

Read more articles on .NET