Variants: Overview 

Use

Whenever you start a program in which selection screens are defined, the system displays a set of input fields for database-specific and program-specific selections. To select a certain set of data, you enter an appropriate range of values.
For further information about selection screens, see
Working with selection screens in the ABAP User's Guide.

If you often run the same program with the same set of selections (for example, to create a monthly statistical report), you can save the values in a selection set called a variant.

You can create any number of variants for any program in which selection screens are defined. Variants are assigned exclusively to the program for which they were created.

You can also use variants to change the appearance of the selection screen by hiding selection criteria. This is particularly useful when you are working with large selection screens on which not all of the fields are relevant.

Reports, module pools, and function groups may have several selection screens. It is therefore possible to create a variant for more than one selection screen.

Variants are an interface between the user and the selection screen. They can be used both in dialog and in background mode, although their uses are slightly different.

Variants in Dialog Mode

In dialog mode, variants make things easier for the user, since they save him or her from continually having to enter identical values. They can also make the selection screen easier to read, because you can use them to hide input fields. Running an executable program with a variant containing an optimal set of values also reduces the capacity for user error. The optimized database selections speed up the runtime of the program.

Variants in Background Mode

Variants are the only method for passing values to a report program in a background job. Therefore, when you run a program in the background, you must use a variant (or SUBMIT... VIA JOB). To avoid you having to create a new variant each time you run the report, ABAP contains a mechanism allowing you to pass variable values to variants. See variable values in variants.

To ensure that an executable program is always started using a variant, you can specify in the program attributes that the program may only be started in this way.

Features