Execute Queries
The following sample shows how to fetch data from an SAP Query using ERPConnect.
Tip
If you don't know the technical name of a Query parameter, you can look it up in your SAP-System. Use the transaction SQ01 or SQ02 to search a Query. Open the description of the Query and scroll to the section Selections. All parameter properties including the name are listed.
Call Queries
- Connect to the SAP system using
R3Connection
. - Create a query object using
CreateQuery
. Each SAP query is defined by three descriptors:- the user workspace (local or global)
- the user group
- the name of the query
- Define the parameters of the query. Every parameter has a distinctly technical name that can be looked up in the SAP.
Example: To create a selection criteria, access the parameter's range collection via the indexer and add a new range usingAdd
. An individual range is defined by three descriptors:- a sign (include or exclude)
- an operator (e.g. equals for parity)
- a low or high value (LowValue and HighValue or only LowValue when using parity).
- Execute the query using
Execute
. - The query returns a table of the DataTable type. Access the result table using
Result
attribute.
Related Links
Last update: January 30, 2024