Sunday 23 June 2019

Selection Screen Variants – Part I

What are variants?


In SAP ABAP reports have a mechanism for entering values for database selection or for performing different calculations through SELECTION SCREENS.

Selection screen provides a user an option to execute the reports or transactions as per his requirements and thus provide a range of values as an input.

Whenever there is a requirement to execute a report with the same set of input values again and again, for large selection screens entering the same values can be a tiresome and boring task. Thus SAP has provided a functionality to save these values in a set called as VARIANTS.

In order to save a variant just key in the values on selection screen and click on save button.

SAP ABAP Development, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Tutorials and Materials

Variants can prove to be useful in various ways:

1. As mentioned above, when there is a requirement to execute a report with a same set of values every time.

2. When a report needs to be executed in background mode, variants are the only way to pass values to the report.

3. Variants can ensure the integrity of the data being passed as an input and thus minimize the risk of incorrect data entry.

TYPES OF VARIANTS:


Variants values can be Static or Dynamic.

STATIC: Static values are fixed values and do not change over the course of time.

Example: Let us suppose there is an organization with 10,000 employees and the HR executes a  monthly report having the personnel number as input ,each month. Then in this case we can use the static value giving the range as 1 to 10,000 for this.

DYNAMIC: Dynamic values in a variant can change over time.

Example: The HR wants to execute the report daily and gives the current date as the input. The requirement is that next day when the report is executed the date should be changed to current date.

In such case we can use dynamic values. If the dynamic value is a date , we can use the different date calculation options provided by SAP.

In other cases we can use the values stored in table TVARVC.

PROTECTION OF VARIANTS:

Variants can be saved as protected variants so that only the creator has the authority to change the variant at a later point of time. This can be done by selecting the checkbox for variant protection at the time time of saving variant attributes.

SAP ABAP Development, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Tutorials and Materials

Variants are client dependent.

VARIANT VALUES: The variant values are stored in a table named VARI.

VARIANT DIRECTORY: The table VARID is a directory of  variants present in system.

This table stores values such as : Variant Name , Report name for which variant is created , Information about when and by whom the variant was created ,version of variant , protected , transport and environment information.

1. Protected: This tells whether the variant is protected or not.If a variant is a protected variant then it can be modified only by the user who has created it.

2. Transport: This gives the information whether a variant can be transported to other systems or not.

3. Environment: Gives information about the variants usage in foreground or only in background processing.

How to change protected variants? : To change protected variants we need to remove the protected flag from VARID table for a given variant. SAP has provided a standard program for this purpose.

Program: RSVARENT can be used to unprotect the variants. It takes report and variant name as input. This report is used to cancel variant protection.

SAP ABAP Development, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Tutorials and Materials

No comments:

Post a Comment