Use
Variables are parameters of a query that you defined in the BEx Query Designer and that are filled with values when you execute the query or Web application. They serve as placeholders for characteristic values, hierarchies, hierarchy nodes, texts, and formula elements, and can be processed in different ways. The processing type determines how a variable is filled with a value for the runtime of the query or Web application. There are different types of variables depending on the object for which you want to define variables. These types specify where you can use the variables. Processing type Customer Exit enables, for example, the variable values to be prefilled customer-specifically using ABAP coding and a check for valid values or authorization to be performed. Variables are reusable objects. This means that when you define a variable for a query in the Query Designer, this variable can be used in all other queries. Variables are not dependent on the InfoProvider, only on the InfoObject. A variable that you define for an InfoObject is available in all InfoProviders that use this InfoObject. Within BI Integrated Planning, variables are used to parameterize a query, a planning function, a filter, a characteristic relationship, or a data slice. More information: Variable Types Variable Processing Types Overview of Variable Types and Processing Types
Prerequisites
For variables of type Manual Entry/Default Value and Replacement Path, there are no prerequisites. For variables of processing type Customer Exit, SAP Exit, and Authorization, you must ensure that the respective prerequisites are fulfilled, such as the creation of an enhancement project, the activation of BI Business Content, or the maintenance of the authorizations.
Procedure
Defining Variables
Define the variables using a variable editor in the BEx Query Designer or for planning applications using a variable wizard or a variable editor in the planning modeler or planning wizard.
For variables with processing type Manual Entry/Default Value, Replacement Path, and SAP Exit, it is sufficient to make the definition in the variable editor. For variables with processing type Customer Exit and Authorization, define the variables in the variable editor. In addition, you must make adjustments in the ABAP coding of the enhancement project or in the authorizations. More information: Defining Variables Saving Variables Save the variables in the variable editor of the Query Designer or in the variable wizard or variable editor in the planning modeler or planning wizard. Using Variables Use the variables in the following contexts: To parameterize queries, in the BEx Query Designer, drag the required variables from the InfoProvider screen area to the required position in the Filter or Rows/Columns screen area. To parameterize planning functions, you can use the variables in the area of the definition (for example, when specifying a conversion factor or a source version) as well as during the creation of a filter for restricting the selection. You can use a Web-based dialog to create, change, or delete the variables. To specify data slice selections, in the planning modeler, you can add variables to the selection on the Data Provider tab page in the Details when creating a data slice. Deleting Variables If you no longer require variables, delete them. In the InfoProvider screen area of the BEx Query Designer, select the variable and choose Delete in the context menu. In the planning modeler, you see in the restriction dialog of a characteristic, for example, the list of variables that are available for the selected characteristic in the filter in the Variables view. Select the variable and choose Delete.
Transporting Variables To make the variables available in various BI systems, transport them. If the transport system is activated, a dialog box for specifying a transport request appears when you save the variable. Enter the required transport request.
If a fixed standard BEx transport request is specified, the variables are automatically written to this request and the transport request dialog box is not displayed. From the planning modeler, you can transport variables using the standard BEx transport request only. The technical name of the object type (TLOGO) for variables in transport requests is ELEM (ELEM.VAR).
Features
The following processing types are available:
Manual Entry/Default Value Replacement Path Customer Exit SAP Exit Authorizations
Replacement Path
Use
You use the Replacement Path processing type to specify the value that automatically replaces the variable when you execute the query or Web application.
Integration
The processing type Replacement Path can be used with characteristic value variables, text variables, and formula variables.
Features
The following options are available:
The source variable must be input-ready The source variable must be available in the query The source variable must represent a single value or an interval In the variable editor, on the Replacement Path tab page, you specify the source variable from which the value is to be determined. The value is either determined from the key, the external attribute of the key, the description, or the attribute value. You can specify an Offset Start and an Offset Length for the output here. The variable is replaced on the variable screen upon each data release.
Activities
In the variable editor, on the General tab page, you choose the processing type Replacement Path. More information: Replacement Path
Example
If you specify a variable as a characteristic value, you do not have to specify a text for the characteristic value right away. Instead, you can fill the text field dynamically and specifically for the characteristic that you use for the variable when you execute the query. To do this, define a text variable with automatic replacement.
Replacement Path
Definition
A tab page in the variable editor that is necessary for characteristic value, hierarchy, formula, and text variables with the processing type Replacement Path.
Structure
Depending on the type of variable, you can make different settings for the replacement path: Text and formula variables with the processing type Replacement Path can be replaced with a corresponding characteristic value or by a variable. See Replacement Path: Replacement with a Characteristic Value and Replacement Path: Replacement from Variable.
Characteristic value variables with the Replacement Path processing type can be replaced with the result of a query or with a variable. See Replacement Path: Replacement with a Query and Replacement Path: Replacement from Variable. Hierarchy variables with the Replacement Path processing type are replaced with a variable. See Replacement Path: Replacement from Variable.
Features
Replacement Rule Here you choose the characteristic or attribute value with which the variable is replaced.
Key
The variable value is replaced with an external value of the characteristic (external/internal conversion).
Name (Text)
Note that formula variables have to contain numbers in their names so that the formula variable represents a number after replacement.
Attribute Value
The variable value is replaced with the value of an attribute. Enter the attribute under Replace Source.
Hierarchy Attribute
The variable value is replaced with a value of a hierarchy attribute. Enter the hierarchy attribute under Replace Source. You need this setting for sign reversal with hierarchy nodes. For more information, see Sign Reversal
This setting is only available for formula variables. Use Interval You have the following selection options:
If the replacement value found is an interval, you can use this setting to specify whether the lower interval limit (from value) or the upper interval limit (to value) is used as the replacement value. For formula variables, you can also choose the interval difference as the replacement value. Using this setting, you can easily calculate the difference of period boundaries. The interval difference is the from value minus the to value, plus 1. For example, the period January to March gives a result of 3 (the to value 3, minus the from value 1, plus 1). Offset Setting You use this function to specify the start and length of the text output.
You want to create a text variable for the fiscal year. On the Replacement Path tab page, choose the option Replace Variable with Key and enter the offset start at value 2 and the offset length as 2. The fiscal year is four digits; the output of the value begins after the second digit and shows 2 digits. Therefore, in the query, the text variable for fiscal year 2005 is replaced with the value 05. For more examples of the offset start and the offset length, see Variable Replacement Example.
This function is only available for formula variables. If you select this setting, the formula variable is not replaced by a value (for example, the key value) but gives the existence of a value. The value of the variable is 0 when the value to be replaced is a string with only blank spaces or a zero.
The value of the variable is 1 when the value to be replaced is a string with characters that are not blank spaces or a number does not equal 0.
You want to calculate paid amounts only. a. b. c. In the Replacement Path dialog step, choose the option Replace Variable with an Attribute Value. Enter the attribute Paid. (The master data attribute Paid shows open invoices with a blank space and paid invoices with the value X.) Select Evaluate as Boolean (Value 0 or 1)
For empty spaces you get a 0 and for the value X you get a 1. Multiplication by such a formula variable means that all unpaid amounts are omitted from the query and you only calculate paid amounts.
Features
Replacement Rule Here you choose the characteristic or attribute value with which the variable is replaced.
Key
The variable value is replaced with an external value of the characteristic (external/internal conversion).
Name (Text)
Note that formula variables have to contain numbers in their names so that the formula variable represents a number after replacement.
Attribute Value
The variable value is replaced with the value of an attribute. Enter the attribute under Replace Source.
Hierarchy Attribute
The variable value is replaced with a value of a hierarchy attribute. Enter the hierarchy attribute under Replace Source. You need this setting for sign reversal with hierarchy nodes. For more information, see Sign Reversal
This setting is only available for formula variables. Use Interval You have the following selection options:
If the replacement value found is an interval, you can use this setting to specify whether the lower interval limit (from value) or the upper interval limit (to value) is used as the replacement value. For formula variables, you can also choose the interval difference as the replacement value. Using this setting, you can easily calculate the difference of period boundaries. The interval difference is the from value minus the to value, plus 1. For example, the period January to March gives a result of 3 (the to value 3, minus the from value 1, plus 1). Offset Setting You use this function to specify the start and length of the text output.
You want to create a text variable for the fiscal year. On the Replacement Path tab page, choose the option Replace Variable with Key and enter the offset start at value 2 and the offset length as 2.
The fiscal year is four digits; the output of the value begins after the second digit and shows 2 digits. Therefore, in the query, the text variable for fiscal year 2005 is replaced with the value 05. For more examples of the offset start and the offset length, see Variable Replacement Example.
This function is only available for formula variables. If you select this setting, the formula variable is not replaced by a value (for example, the key value) but gives the existence of a value. The value of the variable is 0 when the value to be replaced is a string with only blank spaces or a zero.
The value of the variable is 1 when the value to be replaced is a string with characters that are not blank spaces or a number does not equal 0.
You want to calculate paid amounts only. a. b. c. In the Replacement Path dialog step, choose the option Replace Variable with an Attribute Value. Enter the attribute Paid. (The master data attribute Paid shows open invoices with a blank space and paid invoices with the value X.) Select Evaluate as Boolean (Value 0 or 1)
For empty spaces you get a 0 and for the value X you get a 1. Multiplication by such a formula variable means that all unpaid amounts are omitted from the query and you only calculate paid amounts.
If you want to display only the year in the text output, choose the offset start 7 and the offset length 4. K4/008.2002 is replaced by 2002 in the query. If you want to display only the period in the text output, choose the offset start 3 and the offset length 3. 008 in the query replace K4/008.2002. If you want to display the year and the period in the text output, choose the offset start 3 and the offset length 8. 008.2002 in the query replace K4/008.2002. Overview 0FISCYEAR 0FISCPER Offset Start 3 Offset length 7 for year Offset start 3 for period Offset start 3 for year and period Offset Length 4 Offset length 4 for year Offset length 3 for period Offset length 8 for year and period
Prerequisites
The following prerequisites need to be fulfilled: Target Variable (= the variable that is to be replaced) The target variable is not allowed to be input-ready The target variable must represent a single value Source Variable (= the variable that is to replace the target variable)
The source variable must be a characteristic variable, a hierarchy variable, a text variable, or a formula variable. (The source variable is not allowed to be a hierarchy node variable.) The source variable must be input-ready The source variable must be available in the query The source variable must represent a single value or an interval
Features
Replacement Rule Here you define the source variable.
Variable
Choose the source variable using the input help dialog . For more information on the using the input help dialog, see Restricting Characteristics.
Variable Represents
Choose from where the value of the variable is to be determined. Key The variable value is replaced with the characteristic key. External Attribute of the Key The variable value is replaced with an external value of the characteristic (external/internal conversion). Description The variable value is replaced with the name of the characteristic. Attribute Value The variable value is replaced with the value of an attribute. When you choose the Attribute Value, the Attribute dropdown box is displayed. Select the attribute you want.
The system displays all attributes for the characteristic upon which the source variable is defined.
If the attribute is time-dependent, the system cannot determine the variable value or does not replace the variable with the expected value, since the key date of the query is not properly taken into account if it is variable. If the attribute and the target characteristic have the same basic characteristic and this is compounded, the target variable must contain the uncompounded value. Proceed as follows: The source characteristic is either the characteristic to which the source variable belongs or the attribute from which the replacement is to be made. If the basic characteristic of the source characteristic and the basic characteristic of the target variable are the same, and the internal value is to be transferred, the system directly transfers the uncompounded value. In all other cases (if the basic characteristics are not the same, or replacement is to be made from the external format or the text), you must cut the uncompounded value with the offset and length specifications out of the target variable definition.
Offset Setting Using the Offset Start and Offset Length, you can establish the start and length of the text output. For more information on the offset setting, see Replacement Path: Replacement from Characteristic Value. Using Intervals You have the following selection options: From value To value Difference If the source variable is an interval, you can use this setting to specify whether the lower interval limit (from value) or the upper interval limit (to value) is used as the replacement value. For formula variables, you can also choose the interval difference as the replacement value. Using this setting, you can easily calculate the difference of period boundaries. The interval difference is the to value minus the from value, plus 1. For example, the
period January to March gives a result of 3 (the to value 3, minus the from value 1, plus 1).
Examples
Text Variable
You are using a text variable with automatic replacement in a formula. The formula operands have different selections for the characteristic concerned. The automatic replacement would not be able to replace the text variable in that case. If you use replacement from variable, the value of the source variable is used for the text variable.
Hierarchy Variable
The data in an InfoProvider is version dependent. A corresponding hierarchy version (with which a hierarchy is to be used) exists for every version. With replacement from variable, the variable for the hierarchy version can be filled from the variables for the version. If the versions do not correspond directly to one another, you can create a Hierarchy Version attribute in which the corresponding versions are stored.