Delete Multiple Variants in ABAP
In order to delete numerous variants for an ABAP report, SAP user can choose different methods like deleting program variants using ABAP code or a better user interface instead of deleting each variant manually one by one.
To delete ABAP report variants will take time if menu options Goto > Variants > Delete selections are followed for a big number of variant deletion is required.
Delete Multiple Variants Programmatically in ABAP
First method to delete multiple variants even for different ABAP reports is creating an ABAP program using code shown below.
ABAP transparent table VARID Variant directory can be queried for fetching the list of target ABAP report variants to delete.
In VARID table, VARID-REPORT field is used for the variant's report name.
If we provide a specific report name here ABAP programmer can select all the variants for that ABAP program by filtering the program name in SELECT statement.
VARID-VARIANT field is for the variant name in VARID Variant directory table.
Following ABAP code fragment is showing how to execute a SELECT query on VARID variant directory ABAP table.
And then how to delete all report variants returned in the result list using ABAP function module RS_VARIANT_DELETE one by one in a ABAP LOOP statement.
The mass deletion of variants of ABAP programs can be implemented as shown in below screenshot as well. Below sample is used to delete all variants of a specific ABAP report and results listed on screen.
Delete Multiple Variants of an ABAP Report
Second method can be also used by SAP users, to delete multiple report variants. This method does not require additional coding but works only for variants of the same single ABAP program.
Launch SE38 ABAP Editor tcode.
Provide ABAP report name
On menu, follow options: Goto > Variants
When ABAP Variants screen is displayed,
Follow menu options: Variants > Catalog
Press "Selection criteria" button
Mark the variants you want to delete
Press F6 or Delete Variant button