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: 

Variant Function

Former Member
0 Kudos

Can anybody bhelp me out how to create variant functions.

1 REPLY 1

Former Member
0 Kudos

Hi Abhishek,

Check this info.

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

Check this Link :

http://help.sap.com/saphelp_47x200/helpdata/en/0a/af73ec76ac11d1ad670000e8a6353a/frameset.htm

Hope this resolves your query.

Reward all the helpful answers.

Regards