Ready to get started?

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

 Download Now

Learn more:

SAP Netweaver Gateway Icon SAP Netweaver Gateway ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with SAP Netweaver Gateway.

Connect to SAP Netweaver Gateway Data from PowerBuilder



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

This article demonstrates using the CData ADO.NET Provider for SAP Netweaver Gateway 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 Netweaver Gateway to perform reads and writes.

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

    User=user;Password=password;URL=https://sapes5.sapdevcenter.com/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/;InitiateOAuth=GETANDREFRESH

    SAP Gateway allows both basic and OAuth 2.0 authentication. You can use basic authentication to connect to your own account, or you can use OAuth to enable other users to retrieve data from your service with their accounts. In addition to authenticating, set the following connection properties to access SAP Gateway tables.

    • Url: Set this to the URL of your environment, or to the full URL of the service. For example, the full URL might appear as: https://sapes5.sapdevcenter.com/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/. In this example, the environment URL would just be: https://sapes5.sapdevcenter.com.
    • Namespace: Set the appropriate Service Namespace. In the example above, IWBEP is the namespace. It is optional if the full URL to the service is specified.
    • Service: Set this to the service you want to retrieve data from. In the example above, the service is GWSAMPLE_BASIC. It is not required if the full URL is specified.

    Authenticate via Basic Authentication

    In basic authentication, you use your login credentials to connect. Set the following properties:

    • User: This is the username you use to log in to SAP Gateway.
    • Password: This is the password you use to log in to SAP Gateway.

    Authenticate via OAuth Authentication

    You can connect to SAP Gateway using the embedded OAuth connectivity (without setting any additional authentication connection properties). When you connect, the OAuth endpoint opens in your browser. Log in and grant permissions to complete the OAuth process. See the OAuth section in the online Help documentation for more information on other OAuth authentication flows.

  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=Id}" Header="Id" Width="SizeToHeader" /> <DataGridTextColumn x:Name="nameColumn" Binding="{Binding Path=ProductID}" Header="ProductID" Width="SizeToHeader" /> ... </DataGrid.Columns> </DataGrid>
  4. Add a reference to the CData ADO.NET Provider for SAP Netweaver Gateway 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.SAPGateway.SAPGatewayConnection conn conn = create System.Data.CData.SAPGateway.SAPGatewayConnection(connectionString) System.Data.CData.SAPGateway.SAPGatewayCommand comm comm = create System.Data.CData.SAPGateway.SAPGatewayCommand(command, conn) System.Data.DataTable table table = create System.Data.DataTable System.Data.CData.SAPGateway.SAPGatewayDataAdapter dataAdapter dataAdapter = create System.Data.CData.SAPGateway.SAPGatewayDataAdapter(comm) dataAdapter.Fill(table) datagrid1.ItemsSource=table.DefaultView

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