If you want tailor any SAP transaction or report, then you should know how to create variant in SAP.
Variants, which are used to customize SAP standard transactions in order to ensure the transaction fits the business needs of your company, are known as transaction variants. You can use variants of that nature to hide screens, menu functions, and fields among other things. 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 variants or transaction variants. The best approach would be to learn how to do both so that you can use whichever you prefer when the necessity arises.
How to Create Variant in SAP
Before you start the process of creating a transaction variant, you need to define the selection screen for the program in which the variant will be created. All types except S are allowed for the program you intend to use.
You can use the transaction code SHD0 to create the transaction variant.
1. You need to access the Initial Screen of the ABAP Editor. You can then create the name of program in which the variant is to be created.
2. Once you select the program, select the Variants option, and then select 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 that has up to 14 alphanumeric characters. You should never use % as one of the characters though. The only time you can use & within the characters is 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, you should select the Create option.
5. If the program in which you want to create a variant has only one selection screen, then that screen will appear. However, if a program has more than one screen of this kind, 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 where you have multiple selection screens.
8. After that, you need to input the selection values that you desire. 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 need to ensure that you 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 a dialog mode, select the Only for Background Processing field.
- If you do not want other users of the system to change your variant, then select the Protect Variant field.
- If you want the name of your variant to be displayed on the variant catalog, select the 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.
- On the Type section, you can indicate whether a field is a Selection Option (S) or Parameter (P) type.
- In order for you to write protect certain fields on the selection screen; you need to select the Protected column for individual selections that you want to make. After that, no user can make any inputs or changes to your protected variant.
- If you select the Invisible column, then 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 in a dynamic way.
There are other variant attributes. However, the above listed are important and may be selected or not during the creation of a variant. After they have been set, the variant can then be saved, and used later on.
Creating Report Variants
When learning how to create variant in SAP, bear in mind that report variants can be created even before a report has been created. You can choose to 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 need to select the type of report for which 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 ABAP window that appears input the variant name that 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 and the variant will be saved.
The process of creating variants is not very difficult provided you follow all the instruction. You must however, take care to follow the naming conventions. You should also select the right attributes. The attributes that you select for the variants that you create, will affect those variants and any data that comes after the creation process. When you learn how to create variant in SAP, you will be able to tailor some standard reports and transactions to suit your business needs properly.