SAP Connector for Microsoft .NET 3.0

SAP Connector for Microsoft .NET 3.0 (NCo 3.0) allows developers to use BAPIs and remote-enabled function modules in any .NET application (inside-out). You can also access .NET components from any ABAP application by implementing an RFC server in .NET (outside-in). See SAP Note 856863 for details about availability and platform requirements.

The main differences to NCo 2.0 are: 

  • NCo 3.0 no longer distinguishes between a design time and a runtime. Instead of proxy classes and generated coding, you now program RFC calls dynamically. This has advantages (less and more easily understandable coding; robustness against changes on backend side — e.g. it is no longer necessary to re-generate the proxies and re-compile your application if the backend moves from non-Unicode to Unicode; no dependency on a fixed Visual Studio release) as well as disadvantages (no IntelliSense support; you need to know how the ABAP side looks when consuming RFMs in .NET).
  • RFC protocol is re-implemented in C#, so there is no longer a dependency on librfc32.dll. This should result in better performance, as almost no marshalling between managed and unmanaged code is now necessary.

Prerequisites

The .NET 2.0 variant of NCo 3.0 requires the Microsoft C++ Runtime DLLs version 8.0 (this is contained in Microsoft Visual C++ 2005 SP1 Redistributables) Please see SAP Note 684106 for details about downloading and installing this runtime.

The .NET 4.0 variant of NCo 3.0 requires the Microsoft C++ Runtime DLLs version 10.0 (this is contained in Microsoft Visual C++ 2010 Redistributables). You can get the MSI installer from the Microsoft download pages:

Downloads and Documentation

Frequently Asked Questions

The Proxy Wizard was removed. It was replaced by the extended designer and the new Server Explorer extension. When you add a new "Connection" class, an empty SAPWSDL file opens in the designer. To populate it with functions or a business object, drag the required item from the Server Explorer and drop it onto the designer.

  1. Open the Server Explorer window. The "SAP" root node is visible. If not, choose the "Data Connections" node and click on the "Refresh" button.
  2. Expand and select the "Application Servers" node. Right-click and choose "Add Application Server...".
  3. In the dialog box enter the logon information you want and click "Ok".
  4. Open the new server node.
  5. If you want to add a business object, open the "BOR" node and browse to required object. Drag the object, for example "Job" or "Employee", to the designer.
  6. If you want to add a single method, open the object and drag the method.

Unlike in SAP connector for Microsoft .NET 1.0, you add functions as follows:

First, add a function filter by right-clicking the "Functions" node and selecting "Add new filter".

When you have entered the required information, expand the filter and drag the single function or the filter node (for all functions inside the filter) to the designer.

SAP connector for Microsoft .NET 2.0 does not have the "Connect code" feature. We think that this is acceptable because of the new "Connection wire up" feature that allows you to select the required connection without writing any code.

Using "Windows Forms" or "Components" applications:

  1. Add your proxy class and populate it with all required functions. Do all required customizing and compile.
  2. Open your Windows form designer (not the SAP Proxy designer).
  3. Add a Destination or SAPLogonDestination to the form. You can drag it from the SAP Proxy toolbox and fill the properties (as with SAP connector for Microsoft .NET version 1.0). A simpler method is to drag the "SAP Server" node of the system you want to connect to from the Server Explorer. This creates a destination to the dragged SAP server with all required properties already filled.
  4. Go to the SAP Proxy toolbox. You see an item with the name of you proxy class, for example, "SAPProxy1". Drag it to your "Windows Forms" designer.
  5. You see the proxy object in your designer, for example, "sapProxy11". In the "Property" window, go to the "Connection" property and click on the drop-down icon.
  6. Select the destination you have added before, for example, "...from sapLogonDestination1". The designer automatically adds all necessary code to connect to the SAP server. You only have to call the required method, for example, "this.sapProxy11.Rfc_Customer_Get(...)";

Using ASP .NET WebForm apps (alternatively, you can use the procedure for "Windows Forms").

  1. Add your proxy class and populate it with all required functions. Do all necessary customizing and compile.
  2. Add a "SAP Login Page" to your project.
  3. Open the "SAP Login Page" in the Web form designer.
  4. Modify the settings in "destination1" of the SAPLogin1.aspx. An easier method is to drag the "SAP Server" node of the system you want to connect to from the Server Explorer while holding the "Shift" key. This will update "destination1" with the settings from the dragged SAP server.
  5. Open your Web form designer, for example, WebForm1.aspx.
  6. Go to the SAP Proxy toolbox. You see an item with the name of you proxy class, for example, "SAPProxy1". Drag it to your "Windows Forms" designer.
  7. You see the proxy object in your designer, for example, "sapProxy11". In the "Property" window, go to the "Connection" property and click on the drop-down icon.
  8. Select "...from Login Page". The designer automatically adds all necessary code to show the login page and connect to the SAP server. You only have to call the required method, for example,
    "this.sapProxy11.Rfc_Customer_Get(...)";

Yes, you can customize your proxies to contain any number of properties. These can be data-bound to controls. This makes the use of proxies even easier. Here is an example:

  1. Create a "Windows Forms" application.
  2. Add an empty SAP Connection class with the ABAP functions RFC_CUSTOMER_GET and RFC_CUSTOMER_UPDATE.
  3. Leave the proxy designer open. Go to the SAP Proxy toolbox and drag the "Proxy field" icon to the designer.
  4. Rename the new "Field1" to "Tab". Change the "Type" property to BRFCKNA1Table. To do this, use the drop down icon.
    Note that the ReadOnly property automatically changes to "true" and the default value changes to "new BRFCKNA1Table()".
  5. Add a second Proxy Field with the name "Filter", the type "String" and the default value "A*".
  6. Select the "Rfc_Customer_Get" function and click on the "..." button of the "Parameters" property.
  7. Set the default values of the three parameters with the drop-down icon as follows:
    Name1: Filter
    Kunnr: "" Customer_T: _Tab
  8. Save the proxy designer and switch to your Windows form. Add a TextBox, a Button and a DataGrid.
  9. Add an instance of your SAP proxy to your Windows form, add a "Destination" and set the "Connection" property as described in "A4".
  10. Set the DataSource property of the datagrid to "sapProxy11". Set the DataMember property of the datagrid to "Tab". Alternatively you can set the DataSource to "sapProxy11.Tab" and leave the DataMember empty.
  11. For "textBox1" use the DataBinding feature to bind the "Text property" of the textbox to "sapProxy11.Filter".
  12. Double-click the button to create an event handler and add a single line:
    "this.sapProxy11.Rfc_Customer_Get_();"
  13. You are using "sapProxy11" as a smart DataSet that contains the necessary state. You bind the state to the corresponding controls. The overload method Rfc_Customer_Get_() does not have any parameters, as the required state is already in the bound Proxy Fields.

Yes, SAP connector for Microsoft .NET 2.0 supports Soap.

SAP connector for Microsoft .NET 1.x also supported Soap, but with version 2.0 the use of Soap is easier. It is now fully transparent to a client wheather RFC or Soap is used. The underlying idea is to extend the "Connection" and "Destination" model. With SAP connector for Microsoft .NET 2.0 as well as with SAP connector for Microsoft .NET 1.0, the SAPClient class (and thus all client proxies) have a "Connection" property. In SAP connector for Microsoft .NET 1.0, you had to assign a "SAPConnection" object that was the container for RFC connections. You were able to create such an object directly, for example

"proxy.Connection = new SAPConnection(connString)"

Or you were able to create an object indirectly with the SAPClient's constructor or the "ConnectionString" property:

"proxy.ConnectionString = "...""

or

"SAPProxy1 proxy = new SAPProxy(connStr);"

To build up a connection string, you could use a Destination or SAPLogonDestination object. In SAP Connector for Microsoft .NET 2.0, this model has been extended: The SAPClient's "Connection" property can contain either an object of class "RfcConnection" (which is the successor of SAPConnection) or an object of class "SoapConnection". The new "SoapConnection" class builds the correct URLs and credentials as expected by the Soap entry of SAP Web Application Server 6.20.

A static function SAP.Connector.Connection.GetConnection() is available that creates the correct "Connection" class for the connection string.

The following sets a SoapConnection to the proxy:

"proxy.Connection = Connection.GetConnection("http://appserver:1080/sap/bc/soap/rfc")

Compare this with the following, which sets an RFC connection:

"proxy.Connection = Connection.GetConnection("ASHOST=iwdf9401 SYSNR=1 CLIENT=801 USER=hille PASSWD=***** LANG=de).

On the other hand, "Destination" and "SAPLogonDestination" have been extended to create URL connection strings instead of RFC connection strings. Therefore the connection classes have many new properties; of which the most important one is "UseSoap". When it is set to "False" (default), the "Destination" classes work as before. When it is set to "True", it produces an URL instead.

Destination destination1 = new Destination();
... // set properties here
destination1.UseSoap = false;
proxy.Connection = Connection.GetConnection(destination1);
// running with RFC
destination1.UseSoap = true;
proxy.Connection = Connection.GetConnection(destination1);
// running with Soap.

Connection.GetConnection exists in several overloads to support different kinds of connection and connection providers, automatic connection pooling, and so on. As it has also designer support (see "A4"), we recommend you to use this method for connection management.

Support

Report any problems under the following components:

  • BC-MID-CON-NCO for any issues with SAP .NET Connector 3.0
    Support will be offered until July 31, 2018.
  • Note that support and maintenance for SAP .NET Connector 2.0 (runtime parts) ended on March 31, 2013.
  • Note that support and maintenance for the SAP .NET Connector 2.0 Proxy Wizard for Visual Studio .NET (Visual Studio 2003) expired on December 31, 2009, due to the fact that the Microsoft Visual Studio .NET/2003 is no longer supported.