Skip to content
An easy way of making SAP RFC calls from .NET Core
Branch: master
Clone or download
Latest commit 17d1804 Jan 8, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets initial release Sep 17, 2019
samples closes #31 closes #5 Oct 4, 2019
src/NwRfcNet pass the right parameters for all types and add null checks for prope… Dec 20, 2019
tests/NwRfcNet.Tests closes #6 Sep 21, 2019
.gitattributes initial release Sep 17, 2019
.gitignore closes #31 closes #5 Oct 4, 2019
LICENSE Initial commit Sep 16, 2019
NwRfcNet.sln closes #31 closes #5 Oct 4, 2019 Update Jan 4, 2020

.NET client library for SAP NetWeaver RFC

An easy way of making SAP RFC calls from .NET. Libray is supported in Windows, Linux and macOS.

Supported Platforms & Prerequisites

  • Requires .NET Framework ( .NET Standard 2.0 or higher )

    • .NET Framework 4.6.1 or higher
    • .NET Core 2.0 or higher
  • OS versions

    • Windows x64.
    • Redhat Linux 7 or other Linux distribution that is supported simultaneously by .NET Core and SAP NetWeaver RFC.
    • macOS 10.12+.
  • SAP NetWeaver RFC Library 7.50 SDK C++ binaries must be installed locally. For download and installation instructions check SAP Note 2573790

Using this package

Add the package using the dotnet cli:

$ dotnet add package NwRfcNet

Create a class to match SAP RFC parameters

    public class BapiCompanyOutputParameters
        public CompanyDetails[] Details { get; set; }

    public class CompanyDetails
        public string CompanyCode { get; set; }

        public string Name { get; set; }

Map RFC mapameters to class

    RfcMapper mapper = new RfcMapper();

    mapper.Parameter<BapiCompanyOutputParameters>().Property(x => x.Details)

    mapper.Parameter<CompanyDetails>().Property(x => x.CompanyCode)

    mapper.Parameter<CompanyDetails>().Property(x => x.Name)

Open a connection to server and invoke a BAPI

    using (var conn = new RfcConnection(userName, password, hostname, client))
        using(var func = _conn.CallRfcFunction("BAPI_COMPANYCODE_GETLIST"))

Get result and display to Console

    var returnValue =  func.GetOutputParameters<BapiCompanyOutputParameters>();
    Console.WriteLine(String.Format("|{0,-20}|{1,-10}", "Company Code", "Company Name"));
    foreach (var row in returnValue.Details)
        Console.WriteLine(String.Format("|{0,-20}|{1,-10}", row.CompanyCode, row.Name));

Output should be

Company Code Company Name
C001 company 1
C002 Company 2


Included samples in project

  • List FI Companies
  • List FI Customers
  • Get Details of a FI Customer
  • FI General Ledger Account
  • RFC Read Table

Single sign-on (SSO)

Alternatively it's possible to sign-on with SSO instead of user and password.

Example : Opening a RFC connection using NTLM.

    var conn = new RfcConnection(
        hostname: "server_name", 
        client: "000", 
        sncPartnername: @"p:DOMAIN\SRVACC",
        sncLib: @"gx64ntlm.dll" )

Define the SNC parameters related to your environment. If SncLib is not defined, NetWeaver RFC Library uses library defined in environment variable SNC_LIB or SNC_LIB_64.

        public string SncQop { get ; set; }

        public string SncMyname { get; set; }

        public string SncPartnername { get; set; }

        public string SncLib { get; set; }
You can’t perform that action at this time.