Connect to SAP Data from PowerBuilder



This article demonstrates how to access SAP data from Appeon PowerBuilder using the CData ADO.NET Provider for SAP.

This article demonstrates using the CData ADO.NET Provider for SAP in PowerBuilder, showcasing the ease of use and compatibility of these standards-based controls across various platforms and development technologies that support Microsoft .NET, including Appeon PowerBuilder.

This article shows how to create a basic PowerBuilder application that uses the CData ADO.NET Provider for SAP to retrieve 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.

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


  1. In a new WPF Window Application solution, add all the Visual Controls needed for the connection properties. Below is a typical connection string:

    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.

  2. Add the DataGrid control from the .NET controls.
  3. Configure the columns of the DataGrid control. Below are several columns from the Account table: <DataGrid AutoGenerateColumns="False" Margin="13,249,12,14" Name="datagrid1" TabIndex="70" ItemsSource="{Binding}"> <DataGrid.Columns> <DataGridTextColumn x:Name="idColumn" Binding="{Binding Path=MANDT}" Header="MANDT" Width="SizeToHeader" /> <DataGridTextColumn x:Name="nameColumn" Binding="{Binding Path=MANDT}" Header="MANDT" Width="SizeToHeader" /> ... </DataGrid.Columns> </DataGrid>
  4. Add a reference to the CData ADO.NET Provider for SAP assembly.

Connect the DataGrid

Once the visual elements have been configured, you can use standard ADO.NET objects like Connection, Command, and DataAdapter to populate a DataTable with the results of an SQL query:

System.Data.CData.SAPERP.SAPERPConnection conn conn = create System.Data.CData.SAPERP.SAPERPConnection(connectionString) System.Data.CData.SAPERP.SAPERPCommand comm comm = create System.Data.CData.SAPERP.SAPERPCommand(command, conn) System.Data.DataTable table table = create System.Data.DataTable System.Data.CData.SAPERP.SAPERPDataAdapter dataAdapter dataAdapter = create System.Data.CData.SAPERP.SAPERPDataAdapter(comm) dataAdapter.Fill(table) datagrid1.ItemsSource=table.DefaultView

The code above can be used to bind data from the specified query to the DataGrid.

Ready to get started?

Download a free trial of the SAP ERP Data Provider to get started:

 Download Now

Learn more:

SAP ERP Icon SAP ERP ADO.NET Provider

Straightforward SAP ERP integration. Now accessing SAP RFC's from .NET applications is as easy as querying SQL Server.