Pipe SAP Business One DI Data to CSV in PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

SAP Business One DI Data Cmdlets

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



Use standard PowerShell cmdlets to access SAP Business One DI tables.

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

Creating a Connection to Your SAP Business One DI Data

To connect to SAP Business One DI data, specify the following connection properties:

  • DBServerType: The type of server being connected to.
  • Server: The name or IP address of the Business One DI server to connect to.
  • CompanyDB: The company to connect to.
  • User: The username used when connecting to the LicenseServer.
  • Password: The password used when connecting to the LicenseServer.
  • LicenseServer (optional): Set this if your License Server is different from the Server.
  • UseTrusted (optional): Set to TRUE to connect using Windows credentials.

$conn = Connect-SAPBusinessOneDI  -Server "$Server" -DBServerType "$DBServerType" -CompanyDB "$CompanyDB" -User "$User" -Password "$Password"

Selecting Data

Follow the steps below to retrieve data from the OACT table and pipe the result into to a CSV file:

Select-SAPBusinessOneDI -Connection $conn -Table OACT | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myOACTData.csv -NoTypeInformation

You will notice that we piped the results from Select-SAPBusinessOneDI 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.