NSAPConnector library

I published yesterday another helper library NSAPConnector which you can use for making remote function calls (rfc) to a SAP system. Basically this library wraps existing SAP .Net Connector 3.0 and exposes the most frequent used functionalities under a different form, let say in a more .Netish style. For example below you can find an usage example of SAP .Net Connector 3.0

        var destination = 
            RfcDestinationManager.GetDestination("DestinationName");

        var repository = destination.Repository;

        var functionReference = repository.CreateFunction("functionName");

        functionReference.SetValue("ParamName","ParamValue");

        functionReference.Invoke(destination);

        var resultTable = functionReference.GetTable("ResultTableName");

        for (var i = 0; i < resultTable.RowCount; i++)
        {
            resultTable.CurrentIndex = i;

            Console.WriteLine(resultTable.CurrentRow.GetString("ColumnName"));
        }

as you can see it is not a very intuitive api for a .Net developer comparing to the ADO.Net api style which NSAPConnector exposes, below is an usage example of my library:

        using (var connection = new SapConnection("DestinationName"))
        {
            connection.Open();

             var command = 
                new SapCommand("functionName", connection);

            command.Parameters.Add("parameterName","parameterValue");

            DataSet resultDataSet = command.ExecuteDataSet();
        }

As usual you can find more details and examples on Github and Codeplex, it is also available as NuGet packages NSAPConnector x86 and NSAPConnector x64.

c# .net SAP
Posted by: Ion Sapoval
Last revised: 07 Feb, 2013 05:51 PM

Comments

Emir
Emir
17 Jun, 2014 02:36 PM

Hello Sapoval,

I am newer using Rfc, but the class RfcConfigParameters() (internally) already load the parameters declared in the SectionGroups in the .Config file and make the register: --> To Client: RfcDestinationManager.RegisterDefaultConfiguration; or RfcDestinationManager.RegisterDestinationConfiguration; --> To Server: RfcServerManager.RegisterServerConfiguration

It is true that in almost examples code that I look for, it always are using new RfcConfigParameters(), params.add(...).

So, I didnĀ“t understant why should be to use the NSAP DestinationConfiguration() when O call SapConnection() and why the the RegisterDestinationConfiguration is call again.

If I had used the .Config file and call Open(), so, the effect would not be the same?

By the way, I like very much your approach. You will give us a Server NSAPConnector?

Thanks.

Your Comments

Used for your gravatar. Not required. Will not be public.
Posting code? Indent it by four spaces to make it look nice. Learn more about Markdown.

Preview