How to Apply Business Content Variables in SAP BW/4HANA Queries with Examples
SAP BW/4HANA is a data warehouse solution that allows you to analyze and report on large volumes of data from various sources. One of the features of SAP BW/4HANA is the availability of business content variables that can be used in queries. Business content variables are predefined variables that are delivered by SAP as part of the SAP BW/4HANA Content Add-On. Business content variables can help you to make your queries more flexible, dynamic and user-friendly.
In this blog post, we will explain how to apply business content variables in SAP BW/4HANA queries. Business content variables are classified into different types, such as characteristic value variables, text variables, formula variables, hierarchy variables and hierarchy node variables. Each type of variable has a specific purpose and can be used in different scenarios, such as filtering, calculating, displaying or referencing data.
We will also show you some examples of how to apply business content variables in different scenarios, such as filtering by fiscal year variants, displaying the current date or user name, calculating the sales growth rate or using hierarchies and hierarchy nodes.
Applying Business Content Variables in SAP BW/4HANA Queries
To apply business content variables in queries in SAP BW/4HANA, you need to use the Query Designer tool. The Query Designer allows you to drag and drop InfoObjects or reusable query elements from the InfoProvider screen to the query rows and columns. You can also edit the properties of the variables using the Properties pane.
Here are the steps to apply business content variables in queries in SAP BW/4HANA:
- Open the Query Designer and select the InfoProvider that you want to use for your query.
- Click on Variables on the toolbar to open the Variables screen.
- Select the business content variable that you want to use from the list of available variables. You can filter the list by variable type or by application component.
- Drag and drop the variable from the Variables screen to the query rows or columns. You can also use it as a filter or a formula element.
Applying Characteristic Value Variables in SAP BW/4HANA Queries
Characteristic value variables represent characteristic values and can be used wherever characteristic values can be used. For example, you can use a characteristic value variable to restrict a characteristic to a specific value or a range of values.
Here are some examples of how to apply characteristic value variables in SAP BW/4HANA queries:
- To filter by fiscal year variants using a characteristic value variable called 0FISCVARNT, drag and drop 0FISCVARNT from the Variables screen to the Filters screen. In the Properties pane, select Single Value as the selection type and Equal To as the comparison operator. For example, if you want to filter your query by fiscal year variant K4 (Calendar Year), you can drag and drop 0FISCVARNT to the Filters screen and select Single Value as the selection type and Equal To as the comparison operator. Then enter K4 as the default value for 0FISCVARNT.
- To use a characteristic value variable in a calculated key figure formula, drag and drop the variable from the Variables screen to the Calculated Key Figures screen. In the Properties pane, enter a formula for the calculated key figure and include the variable name enclosed by & signs (for example, &VAR_NAME&). For example, if you want to calculate the sales per employee using a characteristic value variable called 0EMPLOYEE that represents the employee number, you can drag and drop 0EMPLOYEE to the Calculated Key Figures screen and enter a formula like this:
1 |
Sales / &0EMPLOYEE& |
- To use a characteristic value variable in a selection or a formula of a structural component, drag and drop the variable from the Variables screen to the Selections or Formulas screen. In the Properties pane, enter a selection or a formula for the structural component and include the variable name enclosed by & signs (for example, &VAR_NAME&). For example, if you want to create a selection that shows only sales orders with a certain document type using a characteristic value variable called 0DOC_TYPE that represents the document type, you can drag and drop 0DOC_TYPE to the Selections screen and enter a selection like this:
1 |
Document Type = &0DOC_TYPE& |
Applying Text Variables in SAP BW/4HANA Queries
Text variables represent a text and can be used in descriptions of queries, calculated key figures and structural components (selections and formulas). For example, you can use a text variable to display the current date or the user name in the query title.
Here are some examples of how to apply text variables in SAP BW/4HANA queries:
- To display the current date in the query title using a text variable called 0DATE, drag and drop 0DATE from the Variables screen to the Title screen. In the Properties pane, enter a prefix or a suffix for the variable if needed. For example, if you want to display the current date in the query title using 0DATE, you can drag and drop 0DATE to the Title screen and enter a prefix like “Sales Report as of “.
- To display the user name in the calculated key figure description using a text variable called 0USER, drag and drop 0USER from the Variables screen to the Calculated Key Figures screen. In the Properties pane, enter a formula for the calculated key figure and include the variable name enclosed by & signs (for example, &VAR_NAME&). For example, if you want to display the user name in the calculated key figure description using 0USER, you can drag and drop 0USER to the Calculated Key Figures screen and enter a formula like this:
1 |
Sales[Current Year] * 0.1 |
And then enter a description like this:
1 |
Bonus for &0USER& |
- To display the current fiscal year in a selection or a formula of a structural component using a text variable called 0FISCYEAR, drag and drop 0FISCYEAR from the Variables screen to the Selections or Formulas screen. In the Properties pane, enter a selection or a formula for the structural component and include the variable name enclosed by & signs (for example, &VAR_NAME&). For example, if you want to display the current fiscal year in a selection using 0FISCYEAR, you can drag and drop 0FISCYEAR to the Selections screen and enter a selection like this:
1 |
Fiscal Year = &0FISCYEAR& |
Conclusion
In this blog post, we have shown you how to apply business content variables in SAP BW/4HANA queries with examples. By using business content variables, you can make your queries more flexible, dynamic and user-friendly. You can also reduce maintenance efforts by reusing variables across different queries.
We hope you found this blog post helpful and informative. If you have any questions or feedback, please feel free to leave a comment below.
Disclaimer: This content is generated by AI.