Automate SAP BusinessObjects BI Integration Tasks from PowerShell



Are you in search of a quick and easy way to access SAP BusinessObjects BI data from PowerShell? This article demonstrates how to utilize the SAP BusinessObjects BI Cmdlets for tasks like connecting to SAP BusinessObjects BI data, automating operations, downloading data, 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.

PowerShell Cmdlets or ADO.NET Provider?

The Cmdlets are not only a PowerShell interface to SAP BusinessObjects BI, 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.

Once you have acquired the necessary connection properties, accessing SAP BusinessObjects BI data in PowerShell can be enabled in three 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 }

Ready to get started?

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

 Download Now

Learn more:

SAP BusinessObjects BI Icon SAP BusinessObjects BI ADO.NET Provider

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