Skip to content

Getting Started

img This section shows how to install and set up ERPConnect for the first time.

Installation

Download and install the following components:

For more information, see Documentation: Installation.

Setup

To set up a project that connects to an SAP system:

  1. Open Visual Studio Code.
  2. Install the C# Dev Kit plugin.
  3. Create a new Console App.
  4. Integrate the ERPConnectStandard20.dll library from the ERPConnect installation directory at C:\Program Files\ERPConnect into your project.
  5. Integrate the SAP NetWeaver library:

    Example: Integrate Libraries
    <Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net10.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>
    <ItemGroup>
        <Reference Include="ERPConnectStandard20">
        <HintPath>..\ERPConnectStandard20.dll</HintPath>
        </Reference>
    </ItemGroup>
    <ItemGroup>
        <Content Include="../icudt57.dll">
        <Link>icudt57.dll</Link>
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Include="../icuin57.dll">
        <Link>icuin57.dll</Link>
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Include="../icuuc57.dll">
        <Link>icuuc57.dll</Link>
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Include="../sapnwrfc.dll">
        <Link>sapnwrfc.dll</Link>
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
    </ItemGroup>
    </Project>
    
  6. Set the (demo) license before connecting to SAP. The demo license is provided as a .json file that is located in the installation directory of ERPConenct, e.g., C:\Program Files\ERPConnect\ERPConnectLicense.json. Use one of the following methods to set the license:

    ERPConnect.LIC.LoadJsonLicense(@"C:\Users\[user]\Documents\ERPConnect\ERPConnectLicense.json");
    
    ERPConnect.LIC.SetJsonLicense("""
    {
        "product": "ERPConnect",
        "kind": "Enterprise",
        "licensee": "Theobald Software GmbH, Stuttgart, Germany",
        "serialNumber": "ERPC12249",
        "created": "20250407T120102.862Z",
        "signature": "0Q1wTR21...h2eDBwbrg=="
    }
    """);
    
  7. Create an R3Connection object for the SAP connection and define all input parameters. Use an SAP dialog user with sufficient SAP authorization for the connection, see Authorization Objects - SAP User Rights.

    using (R3Connection con = new R3Connection())
    {
        con.UserName = "SAPUser";
        con.Password = "SAPPassword";
        con.Language = "EN";
        con.Client = "800";
        con.Host = "sap-erp-as05.example.com";
        con.SystemNumber = 00;
        con.Protocol = ClientProtocol.NWRFC; //use ClientProtocol.RFC for classic RFC library
    
        con.Open();
    }
    
    using (R3Connection con = new R3Connection())
    {
        con.UserName = "SAPUser";
        con.Password = "SAPPassword";
        con.Language = "DE";
        con.Client = "800";
        con.MessageServer = "sap-erp-as05.example.com";
        con.LogonGroup = "PUBLIC";
        con.SID = "ECC";
        con.Protocol = ClientProtocol.NWRFC; //use ClientProtocol.RFC for classic RFC library
        con.UsesLoadBalancing = true;
    
        con.Open();
    }
    
    using (R3Connection con = new R3Connection())
    {
        con.UsesWebSocket = true;
        con.WebSocketHost = "myinstance-api.s4hana.cloud.sap";
        con.WebSocketPort = 443;
        con.TlsSettings = new TlsSettings
        {
            TrustAll = false,
            CryptoLibrary = @"C:\lib\sapcrypto.dll",
            ClientPse = "CLIENT.PSE"
        };
    
        con.AliasUser = "TESTUSER",
        con.Password = "Password",
    
        con.Open();
    }
    
  8. Establish the connection using Open().

  9. Build the .NET Project.
  10. Run the program to test the SAP connection.

Your program now connects to SAP. For more information, see Documentation: Connect to SAP.

Next Steps

ERPConnect offers the following features for reading and writing data from and to SAP:

Functionality / SAP Objects Description
ABAP Code Generate and execute ABAP code on-the-fly.
BAPIs and Function Modules Access BAPIs and RFC function modules to read and write data from and to SAP.
BW Cube and BEx Queries Extract data from SAP BW InfoCubes and BEx Queries.
IDocs Send and receive SAP IDocs.
Queries Extract SAP queries (not BEx queries).
RFC Server Functions Create, register and use RFC server functions.
Tables Read SAP Tables directly via RFC.
Transactions Execute SAP transactions via batch input.

Last update: May 4, 2026