Application Development and Automation 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: 
Read only

What is a Variant?

Former Member
0 Likes
10,807

What is a Variant?

7 REPLIES 7
Read only

Former Member
0 Likes
8,697

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.

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..

more on this http://help.sap.com/saphelp_nw04/helpdata/en/c0/980374e58611d194cc00a0c94260a5/frameset.htm

Read only

Former Member
0 Likes
8,697

In the selection screen, if we pass some data & save that data it is called as an variant. The use is, if u select the variant, no need of entering that data in all fields. It will automatically put the data which was saved

Reward if useful

Read only

Former Member
0 Likes
8,697

hi,

Test data or a particular test case required to test a report is saven in SAP as a variant.

When we want to run the report again and again with the same test data, we can avoid entering all the values by saving it in a variant and selecting it.

Regards,

Divya

Read only

Former Member
0 Likes
8,697

Hi

when u want to use some data in select-option every time u need to enter the sama data again and again , If u make those as variant (zname) then u just cleck that variant button so it display all data in select option.

Thanks...

Read only

Former Member
0 Likes
8,697

Hi,

Variant is actually a range of values.

You enter the range in ur selection screen for the output and those values are combiningly known as variant.

Thanks,

Shreya

Read only

Former Member
0 Likes
8,697

Hi,

For Variants

follow the link:

http://help.sap.com/search/highlightContent.jsp

Variants allow you to save sets of input values for programs that you often start with the same selections. You can use them for any programs except subroutine pools (type S).

Contents

Variants: Overview

Initial Screen

Displaying a Variant Overview

Creating and Maintaining Variants

Creating Variants

Attributes of Variants

Changing Variants

Deleting Variants

Printing Variants

Variable Values in Variants

Creating Variables for Date Calculations

User-specific Selection Variables

Creating User-specific Variables

Changing Values Interactively

Changing Values from the Program

Fixed Values from Table TVARV

Creating Table Variables from TVARV

Changing TVARV entries

Running a Program with a Variant

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

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

You access the variant maintenance tool from the initial screen of the ABAP Editor. Enter the name of the program, select Variants in the Sub-objects group box, and then choose Display or Change.

Functions

The above screen allows you to:

Create variants

Display the variant directory

Display and change values and attributes

Copy, delete, and rename variants

Before creating a new variant for a program, you should check whether you can use or adapt an existing variant instead.

There are two ways to display variants:

Position the cursor on the Variant field on the initial screen and press F4. The following dialog box lists all of the available variants:

Choose Variants ® Directory on the initial screen:

Creating Variants

Prerequisites

You must have defined one or more selection screens for the relevant program. The program may have any type except type S.

Procedure

On the initial screen of the ABAP Editor, enter the name of the program for which you want to create a variant, select Variants in the Sub-objects group box, and choose Change.

On the variant maintenance initial screen, enter the name of the variant you want to create.

Note the naming convention for variants (see below).

Choose Create.

If the program has more than one selection screen, a dialog box appears in which you can assign the variant to one or more screens. The dialog box does not appear if the program only has one selection screen. In this case, the selection screen of the program appears straight away.

If there is more than one selection screen, select the screens for which you want to create the variant.

Example:

If you choose Variant for all selection screens, the variant also applies to any selection screens that you create after creating the variant.

Otherwise, the variant only supplies values to the selection screens that you select in the list.

Choose Continue.

The (first) selection screen of the program appears.

If your program has more than one selection screen, use the scroll buttons in the left-hand corner of the application toolbar to navigate between them. If you keep scrolling forwards, the Continue button appears on the last selection screen.

Enter the required selections, including multiple and dynamic selections.

Choose Continue.

Result

When you have finished, an overview screen appears (ABAP: Save Attributes of Variant), on which you can enter the attributes of your variant and save it.

Note that when you create a new variant, you must enter both values and attributes.

Names of variants: Names can consist of up to 14 alphanumeric characters. The "% " character is not allowed. If you want the variant to be transported automatically with its program, you must create a system variant. The name of a system variant starts "CUS&" for customers, and "SAP&" for SAP system variants. You can only use the "&" character within this prefix in the name of a system variant. It may not occur in any other context. System variants are administered by the Workbench Organizer. Although you can create and access variants from any client, they are always stored in client "000".

Creating Variants

Prerequisites

You must have defined one or more selection screens for the relevant program. The program may have any type except type S.

Procedure

On the initial screen of the ABAP Editor, enter the name of the program for which you want to create a variant, select Variants in the Sub-objects group box, and choose Change.

On the variant maintenance initial screen, enter the name of the variant you want to create.

Note the naming convention for variants (see below).

Choose Create.

If the program has more than one selection screen, a dialog box appears in which you can assign the variant to one or more screens. The dialog box does not appear if the program only has one selection screen. In this case, the selection screen of the program appears straight away.

If there is more than one selection screen, select the screens for which you want to create the variant.

Example:

If you choose Variant for all selection screens, the variant also applies to any selection screens that you create after creating the variant.

Otherwise, the variant only supplies values to the selection screens that you select in the list.

Choose Continue.

The (first) selection screen of the program appears.

If your program has more than one selection screen, use the scroll buttons in the left-hand corner of the application toolbar to navigate between them. If you keep scrolling forwards, the Continue button appears on the last selection screen.

Enter the required selections, including multiple and dynamic selections.

Choose Continue.

Result

When you have finished, an overview screen appears (ABAP: Save Attributes of Variant), on which you can enter the attributes of your variant and save it.

Note that when you create a new variant, you must enter both values and attributes.

Names of variants: Names can consist of up to 14 alphanumeric characters. The "% " character is not allowed. If you want the variant to be transported automatically with its program, you must create a system variant. The name of a system variant starts "CUS&" for customers, and "SAP&" for SAP system variants. You can only use the "&" character within this prefix in the name of a system variant. It may not occur in any other context. System variants are administered by the Workbench Organizer. Although you can create and access variants from any client, they are always stored in client "000".

reward all help full answers

Read only

Former Member
0 Likes
8,697

Hi Sai,

A variant stores the selection screen field values.

All these variant names stores in tvarv table.

Regards,

Venkata Chalapathi