SAP .NET Connector (SAPNCO) & .Net Core

10,062

Solution 1

For making calls from a .NET Core or .NET Framework application, I've open-sourced a cross-platform library SapNwRfc.

Get it on NuGet:

dotnet add package SapNwRfc

or

PM> Install-Package SapNwRfc

Strengths:

  • Cross-platform: Windows / Linux / macOS
  • Maps input and output models by convention (zero configuration)
  • Mapping functions are generated on-the-fly using expression trees
  • Connection pooling with retry support, DI friendly
  • Allows test driven development by the means of simple mockable interfaces
  • Licensed under MIT

The library is fully unit-tested and production ready.

Example

string connectionString = "AppServerHost=MY_SERVER_HOST; SystemNumber=00; User=MY_SAP_USER; Password=SECRET; Client=100; Language=EN; PoolSize=5; Trace=8";

using var connection = new SapConnection(connectionString);
connection.Connect();

class SomeFunctionParameters
{
    [SapName("SOME_FIELD")]
    public string SomeField { get; set; }
}

using var someFunction = connection.CreateFunction("BAPI_SOME_FUNCTION_NAME");
someFunction.Invoke(new SomeFunctionParameters
{
    SomeField = "Some value",
});

For more details, see the README.

Solution 2

​I have created a library to easly making SAP RFC calls from .NET CORE Libray is supported in Windows, Linux and macOS. Check it solves your needs https://github.com/nunomaia/NwRfcNet/

Share:
10,062
Dries
Author by

Dries

Updated on July 15, 2022

Comments

  • Dries
    Dries almost 2 years

    The SAP .NET connector is not compatible with the .NET Core framework. Is there any other way to retrieve data from SAP when using .NET Core?

    I've allready searched for an alternative in the nuget package manager but I did not found one. Is there any workaround I can use? I would very much like to benefit from the performance of .NET Core but I also need to be able to connect to SAP.

  • Dries
    Dries about 6 years
    Actually I make use of nuget package nuget.org/packages/sapnco3.x64 in my projects(.net Framework 4.5). Now I've created a test application in .NET Core and it seems I cannot use the package cause it is not compatible with .NET core. I am wondering if there is any other nuget package I can use to connect to SAP (via RFC, not via SOAP) ...
  • Jesus Zamora
    Jesus Zamora over 2 years
    The library needs better documentation and examples.