Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

variants

Former Member
0 Kudos

hi all,

i am new to SAP and want to know more details on the importance of variants and its use in ABAP programs .

4 REPLIES 4

Former Member
0 Kudos

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.

<b>Variants in Dialog Mode</b>

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.

<b>Variants in Background Mode</b>

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.

<b>Features</b>

Creation of variants

Display, change, copy, print, and delete variants

Use and definition of variables in variants

Variable date calculation

User-specific fixed values

Fixed values in table TVARV

http://help.sap.com/saphelp_nw04/helpdata/en/c0/980389e58611d194cc00a0c94260a5/content.htm

reward if useful

Former Member
0 Kudos

Hi Carol,

In layman's terms,whenever one runs a report, he gets a selection screen where the input values are entered so that the report behaves in a certain way.

If in case, you think that the same input values will have to be input again and again and you don't want to remember and manually input them everytime,then this is where variants come into picture.

The steps for creating the same are:

1.Run the report and enter the input values on the selection screen.

2.Click on GoTo on the menu bar and then Variants and then select Save as Variant.

3. On the next window, enter the Variant name and description and all the other options that you want for your report and click on save at the top.

4. Next time whenever you have to run the report, there is a symbol just below the menu bar which says either variant or Get,click on that and select the variant you have saved.

5. The input values appear in the input boxes automatically and yo`u do not have to remember them everytime.

6. One can save any number of variant for a particular report.

The variants cannot be transported across clients.

One has to maually create them in all the clients.

I hope I have tried to answer your query.

For any further info, please let me know.

Regards,

Puneet Jhari.

Former Member
0 Kudos

Hi,

Basically below mentioned are the uses.

1. When you run T codes, you will enter some selection screen values, which you dont have to re enter every time you run tcodes. Instead you can store under a name and when ever you want to run you can select the variant and run the transaction. The variant symbol will be shown next to your execute button on tool bar

2. When you schedule jobs in background you want to specify the selection screen parameters before actually u execute, for this you will create a variant and while scheduling you will setup the particular job to be run for program x and variant y (say)