When you work with SAP Business Warehouse (BW) variables and SAP HANA variables and input parameters, it's a good idea to review how Tableau uses these variables and input parameters, as described in this article.
SAP BW variables
SAP BW supports single value and multiple single value variable types.
Initialize the SAP BW variable’s default value in the Variables dialog box
When a single default value is specified for a variable by the BW view designer, Tableau uses that value to initialize the variable’s default value in the Variables dialog box.
However, for BW variables of type "multiple single value" with default values configured, Tableau does not initialize the variable. For variables of this type, you can enter values as usual, but you don't see the default values established by the BW view designer.
Avoid prompting for an optional SAP BW variable with a default value
When you create a workbook that includes prompts, if you prompt for an optional variable that is configured with a default value, you might get unexpected results. Consider the following scenario:
- The workbook author specifies a value for the variable that is different from the configured default, sets the variable to prompt, and then publishes the workbook.
- The user opens the workbook, is prompted, accepts the provided value, views the visualization, and sees that the domain is restricted, as expected.
- The user prompts for the variable again, deletes the provided value and views the visualization, expecting to see that the domain is not restricted, but instead finds that it is restricted without any indication that it should be.
This occurs because BW uses the configured default value in the query if the user doesn't specify a value for the variable.
SAP HANA variables and input parameters
SAP HANA supports only a single default value for variables, so Tableau uses that value to initialize the variable.
SAP HANA also supports input parameters. For optional input parameters configured with a default value, if you don't specify a value (for example, you delete the value in the Variables and Input Parameters dialog box, or in the prompt dialog box), SAP HANA uses the configured default value when it executes the query.
For example, suppose the input parameter represents a currency exchange rate, and it is configured with a default value of 2.0. If the user responds to the prompt by deleting this value, the user might expect corresponding computed dollar amounts in the resulting visualization to use an exchange rate value of 1.0. But SAP HANA uses the value of 2.0 in this case.
Delete or rename a variable
When you create a Tableau workbook that uses a variable or input parameter, any values you specify for it are saved in the Tableau workbook file (.twb) so that Tableau retains the values when you reopen the workbook. The SAP view designer, however, might choose to delete or rename the variable before you next open the workbook.
If the SAP view designer deletes or renames the variable, it can result in invalid queries each time you open the workbook. To prevent this, Tableau checks that the variables still exist in the view configuration each time you open the workbook, and deletes non-existent variables from the workbook without notifying you.
Tableau similarly removes non-existent variables from workbooks and data sources published to Tableau Server. Consider the following scenario:
- You create a data source that uses a BW cube or a HANA view that has variables. For one of the variables you provide a value and do not prompt for it.
- You publish the data source to Tableau Server.
- Another Tableau user creates a workbook using your published data source, saves the new workbook, and exits Tableau.
- The SAP view designer deletes the variable for which you specified a value and republishes the cube or view.
- The user reopens the new workbook; but the queries no longer include the variable because Tableau removed it after the designer deleted the variable.
The SAP view designer can change or delete a variable at any time. The best way to make sure that users can see that a variable is no longer in use is to use the Tableau Title and Caption features to display variable values on the visualization. For example, if you set the Title to show the variable name followed by its value, and then the variable is deleted or renamed, the next time you open the workbook you will see only the variable name with nothing after it, which is an indication that the variable has been deleted or renamed. For more information, see Titles and Captions in the Tableau Desktop Help.
Use Tableau titles and captions to display variable values on the visualization
Titles and captions can make it easy for users to see the current values for each variable, which is especially useful when the user is prompted for required variables that have default values.
You can choose the variables to display. For example, suppose you plan to publish a workbook to Tableau Server that uses variables and that prompts the user for some, but not all, of the variables. You can add titles to the worksheets to display only the variables that the user is prompted for.