Specifying Details of Variables


After completing this lesson, you will be able to:

  • Explain details of variables

Processing Types

A variable processing type defines how a variable receives its values. The following processing types are available:

Manual Input / Default Value

If you select the processing type Manual Input for an input-ready variable, you can manually enter the required value when executing the query.

You can specify a default value when you create the variable. The default value is displayed for input-enabled variables in the input field of the variable screen. The default value can also be used as the variable value for fields that are not input-enabled.

Replacement Path

You use the Replacement Path processing type to specify the value that automatically replaces the variable when you execute the query.

The Replacement Path processing type can be used with characteristic value variables, text variables, and formula variables.

For example, when you enter a Characteristic value for a a characteristic value variable, you do not need to enter manually the text for the text variable straight away. Instead, it can be retrieved dynamically from the characteristic value or even from the characteristic value variable.

  • Replacement from Characteristic Value:

    Text and formula variables with the processing type Replacement Path can be replaced with a corresponding characteristic value. The value of a formula variable has to be a number. The value of a text variable has to be a text.

  • Replacement from CURRENT MEMBER:

    CURRENT MEMBER variables (variables with the replacement path CURRENT MEMBER) can only be defined for characteristics, which relate to a calendar. These include 0CALDAY, 0CALMONTH, 0FISCPER, and other similar characteristics, as well as characteristics that reference these. This function is not possible for other characteristics, especially pseudo time characteristics such as 0CALMONTH2 or 0FISCPER3.

    The CURRENT MEMBER variable can be used in restricted key figures as a single value, or as either the lower limit or the upper limit in combination with an offset. However, only one restriction with a CURRENT MEMBER variable – with a maximum of one interval – is allowed per restricted key figure.

    For example, define the value from the previous month by defining a restricted key figure, and restricting the 0CALMONTH characteristic with the Current Member variable with an offset of -1.

  • Replacement from Query:

    Characteristic value variables with the Replacement Path processing type can be replaced with the results of a query. The variable is replaced from the data result of the selected query.

  • Replacement from Variable:

    Characteristic value variables, text variables, and formula variables with processing type Replacement Path can be replaced by the value from a different variable, the source variable. The value is determined either from the key, the external attribute of the key, the description, or the attribute value. You can also define an offset start and offset length. The variable is replaced in the Variables screen with each data release.


With the Authorization processing type you can specify that a variable is automatically filled with the values from the user authorization. When the user opens a query, the system automatically selects the data according to his or her authorizations.

The Authorization processing type can be used with characteristic value variables and hierarchy node variables. As a precondition, you must have maintained the authorizations.

Customer Exit

The processing type, Customer Exit, allows you to set up a processing type for variables that is specially tailored for your requirements. A customer exit is designed as an enhancement that you can configure with customer-specific logic. The customer exit enables you to generate default values for variables, or create variable values from specified variables automatically. You can also check all the variables after they have been entered.

The prerequisite here is that you need to create the enhancement implementation for the RSROA_VARIABLES_EXIT_BADI enhancement spot (located in package RSROA_VAR) in the ABAP Development Tools. The BADl implementation includes the IF_BADI_INTERFACE interface.


The Customer Exit processing type cannot be used with external SAP HANA views. Processing type SAP HANA Exit is provided for this purpose.


Processing type SAP HANA Exit is a specific form of processing type Customer Exit. It allows you to use an AMDP class implementation to determine default values for variables. We particularly recommend using the SAP HANA Exit in queries that you want to generate an external SAP HANA view for, and for which special requirements apply for in terms of determining the variable values and processing performance.

In the ABAP Development Tools, you create the enhancement implementation for the RSROA_VARIABLES_HANA_EXIT enhancement spot. This is contained in package RSROA_VAR. The BADI implementation class requires an AMDP class containing the following interfaces: IF_BADI_INTERFACE,IF_AMDP_MARKER_HDB, and IF_RSROA_VAR_HANA_EXIT.

SAP Exit

The SAP exit processing type is contained in variables that are delivered with SAP BW/4HANA Content Add-On.

Note that you can use the variables provided by SAP only once they exist as an active version. You may have to activate these delivered variables before you can use them.

BRFplus Exit

Variables of processing type BRFplus Exit make it possible to access the functions of the SAP rule engine Business Rules Framework plus (BRFplus) in SAP BW/4HANA.

Variables of processing type BRFplus Exit have a BRFplus Function tab page. On this tab page, you can assign a BRFplus function to the variable. This BRFplus function is then executed when the variable is processed

These BRFplus functions must have a corresponding BRFplus context (signature) and a corresponding result data object (result object).

You can set the required logic for this kind of BRFplus function in the Business Rules Framework plus (transaction BRFPLUS).

Variable Types and available Processing Types

 Characteristic ValueTextFormulaHierarchyHierarchy Node
Manual Input / Default ValueYesYesYesYesYes
Replacement PathReplacement from query, variable, or CURRENT MEMBERReplacement from InfoObject or variableReplacement from InfoObject or variable  
Customer Exit, SAP ExitYesYesYesYesYes
SAP HANA ExitYes Yes  
BRF plus ExitYesYesYes  
AuthorizationYes   Yes

Variable Editor

You create variables using the SAP HANA Studio variable editor. Settings are organized using the following tabs:

  • General

  • Replacement Path

  • Default Values

  • Currencies and Units

  • Dependencies

Only the General and Dependencies tabs always appear; the other tabs are shown depending on the context in which you are defining the variable.

The easiest way to create a new variable is as follows:

To find and open an existing variable, you can proceed as follows:

General Tab

You enter the technical name and the description of the variable. You enter the variable type and, depending on the context, you can choose one of the following methods to populate the variables:

  • Manual input/default value

  • Replacement path

  • Customer exit

  • SAP HANA Exit

  • BRF plus Exit

  • Authorization

Depending on the context, you also have to enter the reference characteristic.

Finally, choose the display area for the Var. Represents field.

Variable Represents

Variable Represents is used to select the display area that the variable represents. You can choose from the following options:

Variable Represents ValueResult
Single ValueThe variable represents one value only.
Multiple Single ValuesThe variable represents a range of single values. As an example, use this setting with hierarchy nodes to enable the user to enter several single nodes.
IntervalThe variable represents a from value and a to value.
Selection Option

The variable represents a combination of selected single values and intervals.

In addition, when you select values for variables, you can use operators (>,<,=, and so on), patterns (for example, A*), and exclude values.

Precalculated Value SetThe variable represents a precalculated value set of characteristic values. You can use this variable type to select value sets created for an InfoObject at query runtime.


Details ValueResult
Input Type

Used to specify whether the variable input is Optional, Mandatory With Initial, or Mandatory Without Initial. A mandatory variable entry means that the blank value # is permitted to signify an unassigned value. You can select all data records within which the characteristic has no characteristic value.


Used to determine whether the variable is input-enabled when the query is executed. When this option is active, the Variables screen opens when you execute the query. On the Variables screen, you enter the required values, confirm the default values, or change the default values.

Copy Personalization Data from Variable

Used to personalize variable values for input-enabled variables for each user. Personal values are saved for each variable and each user.

Replacement Path Tab

Use Replacement Path for text variables, formula variables, and characteristic value variables with the replacement path processing type. Replacement path options vary, according to the type of variable you are using.

With the Replacement Path Processing type, text variables and formula variables are replaced by a value from a corresponding characteristic or from a different variable. The value for a formula variable must be a number. The value for a text variable must be text.

Replacement Path: Replacement with

The table outlines the Replacement with options for text and formula variables.

KeyThe value of the variable is replaced with the internal characteristic key value, for example, 201612.
External CharacteristicThe value of the variable is replaced with an external characteristic value (external/internal conversion), for example, 12.2016.
NameThe value of the variable is replaced with the name of the characteristic value, for example, Dec 2016.
Attribute ValueThe value of the variable is replaced with the value of a key figure attribute, for example, 0GROSS_WT (Gross Weight).

Replacement Path: Details

The table outlines the Details options for text and formula variables.

Use if IntervalDetermine whether the from value, the to value, or the difference is used when the value to be replaced is an interval.
Offset Start and Offset LengthDetermine the start and the length of the text output. For example, if the first 10 characters of the text are to be used, the offset start value would be 0 and the offset length value would be 10.
Interpret Result as Boolean Value (True=1; False=0)

This function is only available for formula variables.

  • The value of the variable is 0 if the value to be replaced is a string with only blank characters or a zero.

  • The value of the variable is 1 if the value to be replaced is a string with characters that are not blank or a number that is not zero.

Characteristic value variables are replaced by a query result with the Replacement Path Processing type. Using a variable, you can reuse the data result of a selected query in another query as a prequery. Each time that the query is executed, the prequery is executed first.


Running a prequery may contribute to slow performance. If you do not need to run a prequery every time you run the query, use a variable that represents a precalculated value set, so that the variable values are stored over time.

Default Values

On the Default Values tab, when you define a variable, you enter one or more default values. The default values appear on the Variables screen when you execute the query.

Currencies and Units

On the Currencies and Units tab, you select from these dimensions when creating formula variables:

  • Amount

  • Quantity

  • Price (= currency/unit)

  • Number (= default setting)

  • Date

Managing Functions for Variables

In the SAP BW Repository tree, the variables are listed according to the variable type and whether they refer to a characteristic or are unassigned.

Variable maintenance functions can be accessed from the context menu, as shown in the following two figures.

The first figure shows Characteristic Value variables, Hierarchy variables, and Hierarchy Node variables. These variable types always refer to a characteristic, whereby Formula variables and Text variables can refer to a characteristic, for example, in case of the processing type Replacement Path.

The second figure shows Formula variables and Text variables without a reference to a characteristic, for example, in case of the processing type Manual Input / Default Value.

Log in to track your progress & complete quizzes