Automate SAP BusinessObjects BI Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

SAP BusinessObjects BI ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with SAP BusinessObjects BI.



Are you looking for a quick and easy way to access SAP BusinessObjects BI data from PowerShell? We show how to use the Cmdlets for SAP BusinessObjects BI and the CData ADO.NET Provider for SAP BusinessObjects BI to connect to SAP BusinessObjects BI data and synchronize, automate, download, and more.

The CData Cmdlets for SAP BusinessObjects BI are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to SAP BusinessObjects BI.

Cmdlets or ADO.NET?

The cmdlets are not only a PowerShell interface to the SAP BusinessObjects BI API, but also an SQL interface; this tutorial shows how to use both to retrieve SAP BusinessObjects BI data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for SAP BusinessObjects BI. To access SAP BusinessObjects BI data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for SAP BusinessObjects BI.

After obtaining the needed connection properties, accessing SAP BusinessObjects BI data in PowerShell consists of three basic steps.

To connect to your SAP Business Objects BI instance, you must set the following connection properties:

  • Url: set this to the rest API URL. After logging into the Central Management Console, choose 'Applications' from the combo box. Double-click on 'RESTful Web Service' and you'll see the access URL. By default it is, http://{Server-Name}:6405/biprws.
  • User: set this to the username of your instance.
  • Password: set this to the password of your instance.

PowerShell

  1. Install the module:

    Install-Module SAPBusinessObjectsBICmdlets
  2. Connect:

    $sapbusinessobjectsbi = Connect-SAPBusinessObjectsBI -User "$User" -Password "$Password" -Url "$Url"
  3. Search for and retrieve data:

    $state = "CA" $mycustomreport = Select-SAPBusinessObjectsBI -Connection $sapbusinessobjectsbi -Table "MyCustomReport" -Where "State = `'$State`'" $mycustomreport

    You can also use the Invoke-SAPBusinessObjectsBI cmdlet to execute SQL commands:

    $mycustomreport = Invoke-SAPBusinessObjectsBI -Connection $sapbusinessobjectsbi -Query 'SELECT * FROM MyCustomReport WHERE State = @State' -Params @{'@State'='CA'}

ADO.NET

  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for SAP BusinessObjects BI\lib\System.Data.CData.SAPBusinessObjectsBI.dll")
  2. Connect to SAP BusinessObjects BI:

    $conn= New-Object System.Data.CData.SAPBusinessObjectsBI.SAPBusinessObjectsBIConnection("User=username;Password=password;Url=http://myinstance:6405/biprws") $conn.Open()
  3. Instantiate the SAPBusinessObjectsBIDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT StoreName, TotalRevenue from MyCustomReport" $da= New-Object System.Data.CData.SAPBusinessObjectsBI.SAPBusinessObjectsBIDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.storename $_.totalrevenue }