How to Create Variants in SAP

WalkMe Team
By WalkMe Team
Updated March 22, 2024

If you want to tailor any SAP transaction or report, you should know how to create variants in SAP. Variants, which are used to customize SAP standard transactions to ensure the transaction fits your company’s business needs, are known as transaction variants. 

You can use variants of that nature to hide screens, menu functions, and fields. On the other hand, variants that are used for saving selection field values in reports are known as report variants.

You should learn how to create a variant in SAP regardless of whether you want to utilize report or transaction variants. The best approach would be to learn how to use both, whichever you prefer, when necessary.

How to Create Variants in SAP

Before you start creating a transaction variant, you need to define the selection screen for the program in which the variant will be made. All types except S are allowed for the program you intend to use. You can use the transaction code SHD0 to generate the transaction variant. 

1. You need to access the Initial Screen of the ABAP Editor. You can then create the program name for the variant to be made. 

2. Once you select the program, select the Variants option and then choose Change. 

3. The Variant Maintenance Initial Screen will then come up. You can then input the name of the variant that you intend to create. There is a convention for naming variants, which you must follow. First, you can use a name with up to 14 alphanumeric characters. You should never use % as one of the characters, though. You can only use & within the characters when you want to create a system variant. This variant allows for automatic transportation of the program and the variant. 

4. Once you input the variant name, select the Create option. 

5. If the program you want to create a variant has only one selection screen, that screen will appear. However, if a program has more than one screen, a screen assignment dialog box will appear with a list of the available selection screens. 

6. You then need to select one or more selection screens in which the variant will be created. 

7. After screen selection, you need to select the Continue option. This option appears on the last selection screen in a program with multiple screens. 

8. After that, you need to input the desired selection values. These values can include dynamic and multiple selections. 

9. After inputting the required values, select the Continue option. 

10. The ABAP: Save Variant overview screen will then appear. You will be required to save the attributes of your variants before saving them. Variant attributes: what are they? Many variant attributes exist. 

You must select the right ones when creating variants because they will help define their characteristics.

  • You will need to input a short Description of the variant. It needs to be meaningful.
  • If you want your variant to be ready to use for background processing but not in dialog mode, select the Only for Background Processing field.
  • If you do not want other system users to change your variant, select the Protect Variant field.
  • If you want the name of your variant to be displayed on the variant catalog, select Only Display in Catalog. However, this option will prevent the users from seeing the name displayed if they use the F4 help value, so bear that in mind.
  • In the Type section, you can indicate whether a field is a Selection Option (S) or Parameter (P) type.
  • To write-protect certain fields on the selection screen, select the Protected column for the individual selections you want to make. After that, no user can input or change your protected variant.
  • If you select the Invisible column, the selected fields on the selection screen will be hidden by the system.
  • The Selection Variable attribute allows the selection value at runtime to be set dynamically.

There are other variant attributes. However, the above listed are important and may or may not be selected during the creation of a variant. 

After they have been set, the variant can be saved and used later. When learning how to create variants in SAP, remember that report variants can be made even before a report has been made. You can use a transaction code,/nzstm, or follow the right navigation path. 

1. You need to use the following navigation path: User menu>Role ZMIT>Reports 

2. When you select Reports, you must choose the type of report you are making a variant. 

3. Once you select the report, you need to input the values that should go into the various fields of the report. 

4. Select the Save as Variant option. An ABAP window will appear. 

5. On the available ABAP window, input the variant name you desire. The name must follow all the necessary conventions. 

6. You need to input a Description attribute. The description should make it easy for other users to identify the variant that you have created. 

7. Accept the default option in the field: Created for Selection Screens. 

8. You can also select the Protect Variant attribute option if you want to prevent unauthorized users from being able to change your report variant. 

9. Click on the Save option to save the variant. 

Bottom Line

Creating variants is not very difficult, provided you follow all the instructions. You must, however, follow the naming conventions. You should also select the right attributes. The attributes you choose for the variants you create will affect those variants and any data after the creation process. 

When you learn how to create variants in SAP, you can tailor some standard reports and transactions to suit your business needs properly.

WalkMe Team
By WalkMe Team
WalkMe pioneered the Digital Adoption Platform (DAP) for organizations to utilize the full potential of their digital assets. Using artificial intelligence, machine learning and contextual guidance, WalkMe adds a dynamic user interface layer to raise the digital literacy of all users.