Use
You can also use variables in your reports. A variable is a placeholder for data that you can enter as required, when you run a report.
You can use general selection variables in your reports. General selection variables determine the data that is selected for a report. General selection variables include the following variable categories:
These variables represent specific values. You enter a value variable in a basic set and you determine the value for the variable when you run a report that uses the set containing the variable. You can only use value variables in basic sets.
These variables represent formulas that determine a value for the variable. You can only use formula variables in basic sets.
These variables represent sets and the values in those sets. You can only use set variables in multi-dimension sets. You cannot use multi-dimension sets that contain set variables as column blocks in your report.
Features
Value variables
A value variable is a user-defined variable that you can enter directly into a set. You can only use value variables in basic sets.

You can create a variable called YEAR. If you enter the YEAR variable in a basic set and then use the basic set in a report, the system prompts you to enter a year when you run the report.
Value variables that you use for the Report Writer, are displayed on the selection screen when you select the records for the report. When you use a value variable in a report, the value that you choose for the variable is valid for only one report run. Each time you run the report, you can enter a different value for the variable. You can also enter a default value for a variable; this value then appears each time a report is run.
For more information, see
Creating Value Variables.Formula variables
A formula variable represents a user-defined formula, which determines a value for the variable. You can only use formula variables in basic sets.

You want to create a formula that automatically calculates the previous year based on the variable for the current year. To do this, proceed as follows:
If you use both variables YEAR and PR-YEAR in a report, the system only prompts you to enter the current year, with the default current year being taken from the system date. The value for PR-YEAR is automatically calculated by the system (by subtracting 1 from the year you entered for YEAR). You can also define PR-YEAR by using the user exit S001 in a formula (‘#S001’ 1) .
For more information, see
Creating Formula Variables.If you use formula variables in report columns, you can also create more than one new report category. For more information, see
using formula variables in reports: examples.Set variables
A set variable represents a basic or single-dimension set that was created for a particular characteristic. You can enter set variables in a multi-dimension set, or directly as a selection set in a report.

You create a set variable called CNTR-V for the "Cost Center" characteristic. When you create the set variable, enter a set name (such as TD-RCNTR-12 for the characteristic Cost Center) as the default value for the set variable.
You can then use the set variable for either of the following objects:
When you enter the CNTR-V set variable in a set that is used in a report, the Report Writer prompts you to enter a set name when you select the report data. In this case, the default value for the set name is TD-RCNTR-12. If required, you can enter another set and/or single cost centers.

You can enter set variables whose default set uses a table that differs from the report table. However, the table field of the default set must be the same as the relevant characteristic of the report table.
Set variables that are used by the Report Writer are displayed on the selection screen when you select the data for your report. For each set variable used in a report, the Report Writer creates an entry field on the selection screen. You can enter either a set, or single value or an interval of values in this field.
For more information, see
Creating Set Variables.