bw_query_data
Query BW data or preview provider content via BICS. Prepare by retrieving metadata to set axis layout, filters, and variables accurately.
Instructions
Execute a BW query or preview data from a provider (CompositeProvider, aDSO, etc.) via the BICS reporting endpoint. ALWAYS call the appropriate read tool first before querying data: bw_get_composite_provider for a CompositeProvider (is_provider=true), bw_get_adso for an aDSO (is_provider=true), bw_get_query for a BEx Query — this gives you the available fields, key figures, and the query structure before you attempt a data call. Then perform a GET (no state/variables) first to discover the current axis layout, characteristic ids, variables, and background filters before sending any POST. IMPORTANT — always call bw_get_filter_values before applying any filter or variable value. This is the only way to know the correct internal key format for a characteristic (e.g. date/time characteristics like 0CALMONTH, 0CALYEAR, 0CALDAY may use non-obvious formats). Never guess or assume filter value formats — always look them up first. If the GET response shows inputRequired="true", variables must be filled via POST before data is available. If unsure whether a BEx Query exists for the desired analysis, use bw_search or bw_list_contents first before falling back to a direct provider call (is_provider=true). Result is rendered as a formatted table with hierarchy indentation. KEY FIGURE STRUCTURE FILTER: to restrict which key figures appear in the result, apply filterValues directly on the structure dimension (isStructure=true) in state.infoObjects — use the technical name of the calculated or restricted key figure as the low value (e.g. "CKF_NAME" or "RKF_NAME"). Hierarchical children of the filtered member are included automatically. This is the correct approach because ad-hoc threshold filters on key figure values are not supported via the state mechanism; only structure-member selection is possible this way. CRITICAL: variable id and name values in the variablesContainer are session-specific and change between GET calls. Always extract variable id and name exactly from the variablesContainer in the GET response and use them immediately in the next POST — never reuse IDs from a previous GET call or from bw_get_query output. The variable name includes trailing spaces and a 4-digit suffix (e.g. "VARNAME 0004") that must be copied verbatim from the GET response. format="raw" returns XML.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comp_id | Yes | BEx Query name or InfoProvider name (ADSO, HCPR, etc.) to query. | |
| is_provider | No | Set to true when comp_id is an InfoProvider name (CompositeProvider, aDSO, etc.) rather than a BEx Query name. Adds the required "!" prefix to the compid URL parameter. If unsure whether a query exists for the desired analysis, use bw_search or bw_list_contents first to check before falling back to a direct provider call. | |
| format | No | "text" (default): structured human-readable output. "raw": raw XML response body. | |
| state | No | Axis layout and optional per-characteristic filters. All InfoObjects from the query must be listed (even those staying on FREE axis). id values must come from the GET metadata response. | |
| variables | No | Variable values to fill. name must match exactly as returned by GET (may contain trailing spaces). id and other metadata fields come from the GET variablesContainer response. | |
| from_row | No | Start row for pagination (default 0). | |
| to_row | No | End row for pagination (default 1000). | |
| drill_operations | No | Optional. Expand or collapse hierarchy nodes or key figure structure nodes in the current result. Each operation targets one node by its 1-based tuple index. drill_state: 3 = expand, 2 = collapse. element_idx: which dimension within the tuple (1 = first, 2 = second, etc.) — use 2 when ROWS has multiple dimensions and the target node is on the second one. Requires the full state and variables to be sent again in the same POST (stateless endpoint). Use after an initial bw_query_data call to drill into a collapsed structure node or hierarchy node. |