Skip to content

Getting Started

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

Installation

  1. Download a 30 day trial version of ERPConnect or download the latest version from the customer portal.
  2. Run the ERPConnect executable (ERPConnectSetup.exe) to install ERPConnect. For information on system requirements, see Requirements.
  3. Download one of the following SAP libraries from the SAP Marketplace download area:
  4. When using a 64-bit system, copy the 64-bit version of the library to the C:\Windows\System32 folder.
    When using a 32-bit system, copy the 32-Bit Version of librfc32.dll to the C:\Windows\SysWoW64 folder.
  5. Add the ERPConnect.dll class library as a reference to your project.
    The library is located in the ERPConnect installation directory, e.g., C:\Program Files\ERPConnect.

For more information, see Installation.

Connect to SAP

  1. 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.

    • Read the license file and apply the license:
      ERPConnect.LIC.LoadJsonLicense(string filename);
      
    • Copy and paste the content of the ERPConnectLicense.json file into a constant string in the code and use the string to set the license:
      ERPConnect.LIC.SetJsonLicense(string json); 
      

    The demo license is provided in the ERPConnectTrialKey.txt file in the installation directory of ERPConenct, e.g., C:\Program Files\ERPConnect\ERPConnectTrialKey.txt. Use the following command to set the license number:

    ERPConnect.LIC.SetLic("XXXXXXXXXX");
    

    Tip

    You can also provide the path to the ERPConnectTrialKey.txt file to set the license. Example:

    ERPConnect.LIC.SetLic(File.ReadAllText("C:\\Program Files\\ERPConnect\\ERPConnectTrialKey.txt"));
    
  2. Create an R3Connection object and define all input parameters.
    Make sure to use an SAP dialog user with sufficient SAP authorization, 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();
    }
    
  3. Establish the connection using Open().

  4. Run the program to test the SAP connection.

For more information, see 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: January 29, 2025