How to pipe SAP ByDesign Data to CSV in PowerShell



Use standard PowerShell cmdlets to access SAP ByDesign tables.

The CData Cmdlets Module for SAP ByDesign is a standard PowerShell module offering straightforward integration with SAP ByDesign. Below, you will find examples of using our SAPByDesign Cmdlets with native PowerShell cmdlets.

Creating a Connection to Your SAP ByDesign Data

Set the following connection properties to connect to SAP ByDesign.

  • Url: Set this to the Url of your SAP ByDesign site. For example, https://test.sapbydesign.com
  • User: Set this to the username of your account.
  • Password: Set this to the password of your account.
  • CustomService or AnalyticsService: Only one of these must be specified. If you have a custom service you want to retrieve data from, specify CustomService. If you want to retrieve the reports of a analytical service, specify AnalyticsService.
    If neither is specified, 'cc_home_analytics.svc' will used as a default for the AnalyticsService property. If you are not sure what service to specify, you can always query the Services view to list available services.

$conn = Connect-SAPByDesign  -URL "$URL" -User "$User" -Password "$Password" -CustomService "$CustomService"

Selecting Data

Follow the steps below to retrieve data from the [Inventory Balance] table and pipe the result into to a CSV file:

Select-SAPByDesign -Connection $conn -Table [Inventory Balance] | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\my[Inventory Balance]Data.csv -NoTypeInformation

You will notice that we piped the results from Select-SAPByDesign into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.

The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.

Ready to get started?

Download a free trial of the SAP ByDesign Cmdlets to get started:

 Download Now

Learn more:

SAP ByDesign Icon SAP ByDesign Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to SAP ByDesign. The Cmdlets allow users to easily read, write, update, and delete live data - just like working with SQL server.