bw_create_variable
Create reusable BW variables for SAP BW/4HANA queries to filter or parameterize data. Supports characteristic, formula, and text types.
Instructions
Create a reusable BW Variable, created active and consistent. A characteristic variable (the default) is a filter parameter on a characteristic: processing types UserEntry (manual entry, the default), CustomerExit, Authorization and the current-member flavour of ReplacementPath; it stands for a characteristic value, a hierarchy or hierarchy nodes. A formula variable (variable_type "Formula") stands for a number and is used as a formula operand in bw_update_query_key_figures, bw_create_ckf and bw_update_ckf: no iobj_name, filled by UserEntry or CustomerExit, with a dimension, an optional default value, and a unit (Quantity), a currency (Amount) or either (Price). A text variable (variable_type "Text") is written as &NAME& into a query or member description and replaced at runtime: by replacement path (the default with iobj_name) it shows the key, the external key or the text of that characteristic's value and is never ready for input; filled by CustomerExit or UserEntry it takes no iobj_name. The query tools bind a text variable named in a description when they save the query. To keep a variable out of the user's variable screen, set ready_for_input false.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"variable_name": "<variable_name>",
"description": "<description>"
},
"name": "bw_create_variable"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| unit | No | Formula variables only: unit of measure. Required for dimension Quantity (a query cannot be generated without it), optional for Price. | |
| package | No | Alias for development_class (for consistency with other tools). | |
| currency | No | Formula variables only: currency key. Required for dimension Amount, optional for Price. | |
| reusable | No | Whether the variable can be reused in multiple queries. Defaults to true. | |
| dimension | No | Formula variables only: what the number stands for. Defaults to Number. | |
| iobj_name | No | Technical name of the InfoObject (characteristic) this variable is based on (e.g. "CHARACTERISTIC"). Must exist in the system. Required for a characteristic variable and for a text variable by replacement path (the characteristic whose value it shows); leave it out for a formula variable and for a text variable filled by CustomerExit or UserEntry. | |
| transport | No | Transport request number (e.g. "DEVK900123"). Only needed when the target package is transportable. | |
| input_type | No | Whether a value is required: Optional (default), MandatoryWithInitial (entry required, initial value allowed) or MandatoryWithoutInitial (entry required, initial value rejected). | |
| represents | No | Selection type. Interval is a from/to range, SelectionOption allows the full set of comparison operators. Defaults to Interval. | |
| description | Yes | Variable description (displayed in query parameter screens). | |
| offset_start | No | Text variables by replacement path only: first character of the value shown, counted from 0 (default 0). | |
| default_value | No | Formula variables only: the value proposed on the variable screen. BW parses it in the logon user's decimal notation, so a fractional value needs read access to that setting (USR01 through ADT DataPreview); without it only whole numbers are accepted. | |
| offset_length | No | Text variables by replacement path only: number of characters shown; 0 (default) shows the rest. | |
| variable_name | Yes | Technical name of the variable to create (e.g. "VAR_NAME"). | |
| variable_type | No | What the variable stands for: a characteristic value (default), a whole hierarchy, hierarchy nodes, a number (Formula) or a text (Text). Hierarchy variables still reference a characteristic via iobj_name; formula and text variables always represent a single value. | |
| master_language | No | Language code for the descriptions (e.g. "EN", "DE"). Defaults to the BW_LANGUAGE of the connection, otherwise "EN". | |
| processing_type | No | How the variable is filled: UserEntry (manual entry by the user, the default), CustomerExit (filled by the exit), Authorization, or ReplacementPath. Replacement path is limited to the current-member variant, which needs no donor object; replacement from a query result is not supported. | |
| ready_for_input | No | Whether the variable is shown on the variable screen for user input. Defaults to true, for a text variable only with UserEntry. Set false for a variable that only the customer exit fills. A text variable by replacement path cannot be ready for input. | |
| replacement_type | No | Text variables by replacement path only: what the text shows of the characteristic value — the key (default), the external key, or its text (Name). | |
| development_class | No | Package name (e.g. "ZPKG"). Defaults to $TMP if omitted. | |
| replacement_interval | No | Text variables by replacement path only: for a range, the lower bound (default), the upper bound, or the difference. | |
| replacement_variable | No | Text variables by replacement path only: a characteristic value variable on the same characteristic (iobj_name) to read the value from, instead of the characteristic itself (e.g. "VAR_NAME"). |