Pipe SAP Fieldglass Data to CSV in PowerShell

Ready to get started?

Download a free trial:

Download Now

Learn more:

SAP Fieldglass Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to SAP Fieldglass data. The Cmdlets allow users to easily read, write, update, and delete live data - just like working with SQL server.

Use standard PowerShell cmdlets to access SAP Fieldglass tables.

The CData Cmdlets Module for SAP Fieldglass is a standard PowerShell module offering straightforward integration with SAP Fieldglass. Below, you will find examples of using our SAPFieldglass Cmdlets with native PowerShell cmdlets.

Creating a Connection to Your SAP Fieldglass Data

To authenticate, you will need to specify the Username, Password, APIKey, and EnvironmentURL connection properties.

To obtain an APIKey, log in to the SAP API Business Hub and click on Get API Key.

$conn = Connect-SAPFieldglass  -EnvironmentURL "$EnvironmentURL" -Username "$Username" -Password "$Password" -APIKey "$APIKey"

Selecting Data

Follow the steps below to retrieve data from the AuditTrails table and pipe the result into to a CSV file:

Select-SAPFieldglass -Connection $conn -Table AuditTrails | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myAuditTrailsData.csv -NoTypeInformation

You will notice that we piped the results from Select-SAPFieldglass 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.