Show TOC

 Variables

Definition

Variables allow you more flexibility in defining your forms and reports. Variables are report parameters which you do not want to specify until you define or execute the report. You can use different methods for replacing variables. Depending on how often you want to use them, you can define your variables globally or locally .

Global variables

If you use a variable frequently, you should define it globally . This makes it possible to use the variable in all your forms and reports.

The entries you need to make may differ depending on the variable type you choose.

Note that when you change an existing global variable, this may affect a number of reports and forms which already use it.

Note Note

You define global variables for most applications in Customizing by selecting Information System in the application in which you are working. The component EC-EIS is an exception. Here, you define global variables by choosing Start of the navigation path Information System Next navigation step Variables Next navigation step Define Variables End of the navigation path in the application menu.

End of the note.

Local variables

If you want to create a variable which you only need in one particular form or report, you can create a local variable. Local variables are only known within the relevant form or report. If you define a local variable in a form, it is also valid for every report which uses that form. On the other hand, if you define a variable in the report definition, it is only valid for that one report.

The entries you need to make may differ depending on the variable type you choose. For information about the entry fields, see the online help by pressing F1 for those fields.

Note Note

You maintain local variables when you define the form or report itself in your application.

End of the note.

Variable types

There are currently four different variable types:

Replacement types

You are required to enter a replacement type when you define a variable. The replacement type determines how the variable should be replaced -- automatically by the system or by manual entry.

The following replacement types are available:

  • automatic replacement (allowed only for variables for texts and formulas)

  • replacement by manual entry (when you execute the report)

  • replacement by user exit (see User Exits: Global Variables )

  • replacement by SAP exit

  • replacement by fixed value (taken from table TKESV)

Note Note

Online documentation exists for the field Replacement type as well as other fields available when you define variables.

End of the note.

Naming conventions

The following naming conventions apply for variables:

  • Global variables begin with & . Variables which are defined by SAP have a number in the second position. For user-defined global variables, the second character must be a letter.

  • Local variables which you define in the form begin with &$ .

However, if the symbol "variable on" appears before a field for a variable, do not enter " & ". In such cases, the sign is set automatically.

For information on how the different types of variables are used, see also Example: Use of Variables .