![]() |
VOOZH | about |
The CData Cmdlets for SAP ByDesign 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 ByDesign.
The Cmdlets are not only a PowerShell interface to SAP ByDesign, but also an SQL interface; this tutorial shows how to use both to retrieve SAP ByDesign data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for SAP ByDesign. To access SAP ByDesign data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for SAP ByDesign.
Once you have acquired the necessary connection properties, accessing SAP ByDesign data in PowerShell can be enabled in three steps.
Set the following connection properties to connect to SAP ByDesign.
Install the module:
Install-Module SAPByDesignCmdlets
Connect:
$sapbydesign = Connect-SAPByDesign -URL "$URL" -User "$User" -Password "$Password" -CustomService "$CustomService"
Search for and retrieve data:
$productcategoryid = "1234567" $[inventory balance] = Select-SAPByDesign -Connection $sapbydesign -Table "[Inventory Balance]" -Where "ProductCategoryID = `'$ProductCategoryID`'" $[inventory balance]
You can also use the Invoke-SAPByDesign cmdlet to execute SQL commands:
$[inventory balance] = Invoke-SAPByDesign -Connection $sapbydesign -Query 'SELECT * FROM [Inventory Balance] WHERE ProductCategoryID = @ProductCategoryID' -Params @{'@ProductCategoryID'='1234567'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for SAP ByDesign\lib\System.Data.CData.SAPByDesign.dll")
Connect to SAP ByDesign:
$conn= New-Object System.Data.CData.SAPByDesign.SAPByDesignConnection("URL=https://my999999.sapbydesign.com;User=username;Password=password;CustomService=servicename;")
$conn.Open()
Instantiate the SAPByDesignDataAdapter, execute an SQL query, and output the results:
$sql="SELECT ID, ProductCategoryID from [Inventory Balance]"
$da= New-Object System.Data.CData.SAPByDesign.SAPByDesignDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.id $_.productcategoryid
}
Download a free trial of the SAP ByDesign Data Provider to get started:
Download NowLearn more:
👁 SAP ByDesign IconRapidly create and deploy powerful .NET applications that integrate with SAP ByDesign.