![]() |
VOOZH | about |
The CData Cmdlets Module for SAP Ariba Source is a standard PowerShell module offering straightforward integration with SAP Ariba Source. Below, you will find examples of using our SAPAribaSource Cmdlets with native PowerShell cmdlets.
In order to connect with SAP Ariba Source, set the following:
If you are connecting to the Supplier Data API or the Contract API, additionally set the following:
If you're connecting to the Supplier API, set ProjectId to the Id of the sourcing project you want to retrieve data from.
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:
$conn = Connect-SAPAribaSource -API "$API" -APIKey "$APIKey" -Environment "$Environment" -Realm "$Realm" -AuthScheme "$AuthScheme" -InitiateOAuth "$InitiateOAuth"
Follow the steps below to retrieve data from the Vendors table and pipe the result into to a CSV file:
Select-SAPAribaSource -Connection $conn -Table Vendors | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myVendorsData.csv -NoTypeInformation
You will notice that we piped the results from Select-SAPAribaSource 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.The following line deletes any records that match the criteria:
Select-SAPAribaSource -Connection $conn -Table Vendors -Where "Region = USA" | Remove-SAPAribaSource
The cmdlets make data transformation easy as well as data cleansing. The following example loads data from a CSV file into SAP Ariba Source, checking first whether a record already exists and needs to be updated instead of inserted.
Import-Csv -Path C:\MyVendorsUpdates.csv | %{
$record = Select-SAPAribaSource -Connection $SAPAribaSource -Table Vendors -Where ("Id = `'"+$_.Id+"`'")
if($record){
Update-SAPAribaSource -Connection $saparibasource -Table Vendors -Columns ("SMVendorID","Category") -Values ($_.SMVendorID, $_.Category) -Where ("Id = `'"+$_.Id+"`'")
}else{
Add-SAPAribaSource -Connection $saparibasource -Table Vendors -Columns ("SMVendorID","Category") -Values ($_.SMVendorID, $_.Category)
}
}
As always, our goal is to simplify the way you connect to data. With cmdlets users can install a data module, set the connection properties, and start building. Download Cmdlets and start working with your data in PowerShell today!
Download a free trial of the SAP Ariba Source Cmdlets to get started:
Download NowLearn more:
👁 SAP Ariba Source IconAn easy-to-use set of PowerShell Cmdlets offering real-time access to SAP Ariba Source. The Cmdlets allow users to easily read, write, update, and delete live data - just like working with SQL server.