Excel Spreadsheet Automation on SAP Business Warehouse Data with the QUERY Formula
The CData Excel Add-In for SAP Business Warehouse provides formulas that can query SAP Business Warehouse data. The following three steps show how you can automate the following task: Search SAP Business Warehouse data for a user-specified value and then organize the results into an Excel spreadsheet.
The syntax of the CDATAQUERY formula is the following:
=CDATAQUERY(Query, [Connection], [Parameters], [ResultLocation]);
This formula requires three inputs:
- Query: The declaration of the SAP Business Warehouse data records you want to retrieve, written in standard SQL.
Connection: Either the connection name, such as SAPBusinessWarehouseConnection1, or a connection string. The connection string consists of the required properties for connecting to SAP Business Warehouse data, separated by semicolons.
To connect to SAP Business Warehouse, set the URL property to a valid SAP Business Warehouse server base URL. The driver must connect to SAP Business Warehouse instances hosted over HTTP with XMLA access.
The driver supports the following authentication schemes via the AuthScheme property:
- None: Anonymous authentication, if available on the server.
- Basic: Set User and Password and set AuthScheme to Basic.
- Kerberos: See the Using Kerberos section of the help documentation for the required Kerberos properties.
By default, the driver attempts to negotiate SSL/TLS by checking the server's certificate against the system's trusted certificate store. To specify another certificate, see the SSLServerCert property for the available formats.
- ResultLocation: The cell that the output of results should start from.
Pass Spreadsheet Cells as Inputs to the Query
The procedure below results in a spreadsheet that organizes all the formula inputs in the first column.
- Define cells for the formula inputs. In addition to the connection inputs, add another input to define a criterion for a filter to be used to search SAP Business Warehouse data, such as Country.
- In another cell, write the formula, referencing the cell values from the user input cells defined above. Single quotes are used to enclose values such as addresses that may contain spaces.
- Change the filter to change the data.
=CDATAQUERY("SELECT * FROM Sales WHERE Country = '"&B5&"'","URL="&B1&";AuthScheme="&B2&";User="&B3&";Password="&B4&";Provider=SAPBusinessWarehouse",B6)