![]() |
VOOZH | about |
The CData ADO.NET Provider for SAP enables you to rapidly develop service-oriented applications using the Windows Communication Foundation (WCF) framework, providing SAP data data to OData consumers. This article guides you through creating an entity data model for connectivity and a WCF Data Service to expose OData services. You can then consume the feed with various OData clients, such as Power Pivot or applications using the CData ADO.NET Provider for OData.
CData provides the easiest way to access and integrate live data from SAP. Customers use CData connectivity to:
While most users leverage our tools to replicate SAP data to databases or data warehouses, many also integrate live SAP data with analytics tools such as Tableau, Power BI, and Excel.
Follow the steps below to create a WCF service application that will provide connectivity to SAP data via OData.
Use the Package Manager Console in Visual Studio to install the latest version of Entity Framework. Run the following command to download and install Entity Framework automatically:
Install-Package EntityFramework
<configuration> ... <entityFramework> <providers> ... <provider invariantName="System.Data.CData.SAPERP" type="System.Data.CData.SAPERP.SAPERPProviderServices, System.Data.CData.SAPERP.Entities.EF6" /> </providers> </entityFramework> </configuration>
In the Connection properties dialog, select the CData SAP Data Source and enter the necessary credentials.
A typical connection string is below:
Host=sap.mydomain.com;User=EXT90033;Password=xxx;Client=800;System Number=09;ConnectionType=Classic;Location=C:/mysapschemafolder;
You can connect to SAP systems using either librfc32.dll, librfc32u.dll, NetWeaver, or Web Services (SOAP). Set the ConnectionType connection property to CLASSIC (librfc32.dll), CLASSIC_UNICODE (librfc32u.dll), NETWEAVER, or SOAP.
If you are using the SOAP interface, set the Client, RFCUrl, SystemNumber, User, and Password properties, under the Authentication section.
Otherwise, set Host, User, Password, Client, and SystemNumber.
Note: We do not distribute the librfc32.dll or other SAP assemblies. You must find them from your SAP installation and install them on your machine.
For more information, see this guide on obtaining the connection properties needed to connect to any SAP system.
π Required connection properties, specified in the Add Connection dialog. (Salesforce is shown.)Specify the data source class and configure access to the new WCF Data Service. In the example below, the Access Rule for the entities is set to All. This means that any user will be able to read and modify data.
using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
using System.ServiceModel.Web;
using System.Web;
namespace SAPERPService{
public class SAPERPDataService : DataService<SAPERPEntities> {
public static void InitializeService(DataServiceConfiguration config) {
config.SetEntitySetAccessRule("*", EntitySetRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
}
}
}
You can now use the service from any OData client; for example, Excel Power Pivot.
Download a free trial of the SAP ERP Data Provider to get started:
Download NowLearn more:
π SAP ERP IconStraightforward SAP ERP integration. Now accessing SAP RFC's from .NET applications is as easy as querying SQL Server.