Variables for Characteristic Values

If you do not want to specify a fixed value for a characteristic in a report, you need to use a variable for a characteristic value. You can use these variables in both basic and form reports, and can define them in the form or in the report itself. Global variables of this sort are generally used in the form, and replaced with a characteristic value in the report definition or when the report is executed.

Certain variables for characteristic values, such as the current fiscal period &0FP, are delivered with the standard R/3 system. The standard variables differ from application to application. You can display these in variable maintenance. Use of variables for characteristic values

To define a variable for a characteristic value in a report, place the cursor on the entry field for the characteristic value and choose the function Edit ® Variable on/off.

If you want to use a variable for a characteristic value in a form, choose the pushbutton Variables on/off in the dialog box where you enter characteristic values.

The system automatically displays a checkbox before the entry field to indicate that the field contains a variable.

Global variables need to be defined in Customizing before you can use them in a report or form. For information about maintaining global variables, see Overview: Variables.

To define a local variable, you need to begin the name with a $. Local variables are unique within the given form and for the given characteristic. Consequently, you can use the same variable name for local variables for two different characteristics. Once you have entered a name for the local variable, you need to maintain it.

Variables for characteristic values which apply to numerical fields (such as &Y for the current fiscal year 1996) can be added to constants (&Y-1 for the previous year 1995). This is possible for both global and local variables for characteristic values.

You want to create a form in which you define the first column with a variable for the year. The second column should contain the previous year.

In the first column, choose the characteristic Fiscal year and specify it using the variable &Y. &Y was already defined as a global variable for much a manual entry must be made.

In the second column, choose the characteristic Fiscal year again, and enter &Y-1 as the variable. When you later create or execute a report which uses this form, the system will merely ask you to specify the variable &Y, and determine the previous year automatically.

Maintaining local variables for characteristic values

Once you have entered a name for a local variable, you have to maintain it.

On the screen Change form or Create form, you can specify for each local variable whether or not it must be replaced with a fixed value in the report. The function for this is found under Extras   ® Variables   ® Characteristic value ® Maintain variable.. . If you do not maintain this, the system will assume that it is a mandatory entry. To maintain the texts for the local variables for characteristic values, choose the menu option Extras ® Variables ® Characteristic values ® Identifier..

In the transaction Create report, you maintain local variables under the menu option Extras ® Maintain variables.

For an example of how to use variables for characteristic values, see Example: Use of Variables.