Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →DataBind SAP Data to the DevExpress Data Grid
Use the CData ADO.NET Provider for SAP with the DevExpress Windows Forms and Web controls to provide SAP data to a chart.
The ADO.NET Provider for SAP by CData incorporates conventional ADO.NET data access components compatible with third-party controls. You can adhere to the standard ADO.NET data binding procedures to establish two-way access to real-time data through UI controls. This article will demonstrate the utilization of CData components for data binding with DevExpress UI Controls (Windows Forms and Web controls), specifically binding to a chart that visualizes live data.
About SAP Data Integration
CData provides the easiest way to access and integrate live data from SAP. Customers use CData connectivity to:
- Access every edition of SAP, including SAP R/3, SAP NetWeaver, SAP ERP / ECC 6.0, and SAP S/4 HANA on premises data that is exposed by the RFC.
- Perform actions like sending IDoc or IDoc XML files to the server and creating schemas for functions or queries through SQL stored procedures.
-
Connect optimally depending on where a customer's SAP instance is hosted.
- Customers using SAP S/4HANA cloud public edition will use SAP NetWeaver Gateway connectivity
- Customers using SAP S/4HANA private edition will use either SAP ERP or SAP NetWeaver Gateway connectivity.
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.
Getting Started
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.
Windows Forms Controls
The code below shows how to populate a DevExpress chart with SAP data. The SAPERPDataAdapter binds to the Series property of the chart control. The Diagram property of the control defines the x- and y-axes as the column names.
using (SAPERPConnection connection = new SAPERPConnection(
"Host=sap.mydomain.com;User=EXT90033;Password=xxx;Client=800;System Number=09;ConnectionType=Classic;Location=C:/mysapschemafolder;")) {
SAPERPDataAdapter dataAdapter = new SAPERPDataAdapter(
"SELECT MANDT, MBRSH FROM MARA", connection);
DataTable table = new DataTable();
dataAdapter.Fill(table);
DevExpress.XtraCharts.Series series = new DevExpress.XtraCharts.Series();
chartControl1.Series.Add(series);
series.DataSource = table;
series.ValueDataMembers.AddRange(new string[] { "MBRSH" });
series.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;
series.ArgumentDataMember = "MANDT";
series.ValueScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;
((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true;
}
Web Controls
The code below shows how to populate a DevExpress Web control with SAP data. The SAPERPDataAdapter binds to the Series property of the chart; the Diagram property defines the x- and y-axes as the column names.
using DevExpress.XtraCharts;
using (SAPERPConnection connection = new SAPERPConnection(
"Host=sap.mydomain.com;User=EXT90033;Password=xxx;Client=800;System Number=09;ConnectionType=Classic;Location=C:/mysapschemafolder;"))
{
SAPERPDataAdapter SAPERPDataAdapter1 = new SAPERPDataAdapter("SELECT MANDT, MBRSH FROM MARA", connection);
DataTable table = new DataTable();
SAPERPDataAdapter1.Fill(table);
DevExpress.XtraCharts.Series series = new Series("Series1", ViewType.Bar);
WebChartControl1.Series.Add(series);
series.DataSource = table;
series.ValueDataMembers.AddRange(new string[] { "MBRSH" });
series.ArgumentScaleType = ScaleType.Qualitative;
series.ArgumentDataMember = "MANDT";
series.ValueScaleType = ScaleType.Numerical;
((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true;
}