![]() |
VOOZH | about |
The CData Cmdlets for SAP Ariba Procurement 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 Ariba Procurement.
The Cmdlets are not only a PowerShell interface to SAP Ariba Procurement, but also an SQL interface; this tutorial shows how to use both to retrieve SAP Ariba Procurement data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for SAP Ariba Procurement. To access SAP Ariba Procurement data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for SAP Ariba Procurement.
Once you have acquired the necessary connection properties, accessing SAP Ariba Procurement data in PowerShell can be enabled in three steps.
In order to connect with SAP Ariba Procurement, set the following:
After setting connection properties, you need to configure OAuth connectivity to authenticate.
For more information on creating an OAuth application, refer to the Help documentation.
After setting the following, you are ready to connect:
When you connect, the provider automatically completes the OAuth process:
Install the module:
Install-Module SAPAribaProcurementCmdlets
Connect:
$saparibaprocurement = Connect-SAPAribaProcurement -ANID "$ANID" -API "$API" -APIKey "$APIKey" -AuthScheme "$AuthScheme" -InitiateOAuth "$InitiateOAuth"
Search for and retrieve data:
$orderstatus = "CHANGED" $orders = Select-SAPAribaProcurement -Connection $saparibaprocurement -Table "Orders" -Where "OrderStatus = `'$OrderStatus`'" $orders
You can also use the Invoke-SAPAribaProcurement cmdlet to execute SQL commands:
$orders = Invoke-SAPAribaProcurement -Connection $saparibaprocurement -Query 'SELECT * FROM Orders WHERE OrderStatus = @OrderStatus' -Params @{'@OrderStatus'='CHANGED'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for SAP Ariba Procurement\lib\System.Data.CData.SAPAribaProcurement.dll")
Connect to SAP Ariba Procurement:
$conn= New-Object System.Data.CData.SAPAribaProcurement.SAPAribaProcurementConnection("ANID=AN02000000280;API=PurchaseOrdersBuyerAPI-V1;APIKey=wWVLn7WTAXrIRMAzZ6VnuEj7Ekot5jnU;AuthScheme=OAuthClient;InitiateOAuth=GETANDREFRESH;")
$conn.Open()
Instantiate the SAPAribaProcurementDataAdapter, execute an SQL query, and output the results:
$sql="SELECT DocumentNumber, Revision from Orders"
$da= New-Object System.Data.CData.SAPAribaProcurement.SAPAribaProcurementDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.documentnumber $_.revision
}
Download a free trial of the SAP Ariba Procurement Data Provider to get started:
Download NowLearn more:
👁 SAP Ariba Procurement IconRapidly create and deploy powerful .NET applications that integrate with SAP Ariba Procurement.