SAP RRS_VARIANT_CREATE Function Module for BW: Save Variants
RRS_VARIANT_CREATE is a standard rrs variant create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for BW: Save Variants processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for rrs variant create FM, simply by entering the name RRS_VARIANT_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: RRS0
Program Name: SAPLRRS0
Main Program: SAPLRRS0
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function RRS_VARIANT_CREATE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'RRS_VARIANT_CREATE'"BW: Save Variants.
EXPORTING
* I_GENUNIID = "...
* I_INFOCUBE = "InfoCube
* I_COMPID = "Tech. Name of Query
I_VARIANT = "Variant Name
I_THX_VALUES = "Variable Values
* I_TEXT = "Long Description
EXCEPTIONS
REPORT_NOT_FOUND = 1 NO_VARIANTS_POSSIBLE = 2 FAILED = 3
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLRRS0_001 Customer Exit Global Variables in Reporting
IMPORTING Parameters details for RRS_VARIANT_CREATE
I_GENUNIID - ...
Data type: RSR_S_COMPKEY-GENUNIIDOptional: Yes
Call by Reference: No ( called with pass by value option)
I_INFOCUBE - InfoCube
Data type: RSR_S_COMPKEY-INFOCUBEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_COMPID - Tech. Name of Query
Data type: RSR_S_COMPKEY-COMPIDOptional: Yes
Call by Reference: No ( called with pass by value option)
I_VARIANT - Variant Name
Data type: COptional: No
Call by Reference: No ( called with pass by value option)
I_THX_VALUES - Variable Values
Data type: RRO01_THX_VAR_BUFOptional: No
Call by Reference: Yes
I_TEXT - Long Description
Data type: RSTXTLGOptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
REPORT_NOT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_VARIANTS_POSSIBLE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FAILED -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for RRS_VARIANT_CREATE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_i_genuniid | TYPE RSR_S_COMPKEY-GENUNIID, " | |||
| lv_report_not_found | TYPE RSR_S_COMPKEY, " | |||
| lv_i_infocube | TYPE RSR_S_COMPKEY-INFOCUBE, " | |||
| lv_no_variants_possible | TYPE RSR_S_COMPKEY, " | |||
| lv_failed | TYPE RSR_S_COMPKEY, " | |||
| lv_i_compid | TYPE RSR_S_COMPKEY-COMPID, " | |||
| lv_i_variant | TYPE C, " | |||
| lv_i_thx_values | TYPE RRO01_THX_VAR_BUF, " | |||
| lv_i_text | TYPE RSTXTLG. " |
|   CALL FUNCTION 'RRS_VARIANT_CREATE' "BW: Save Variants |
| EXPORTING | ||
| I_GENUNIID | = lv_i_genuniid | |
| I_INFOCUBE | = lv_i_infocube | |
| I_COMPID | = lv_i_compid | |
| I_VARIANT | = lv_i_variant | |
| I_THX_VALUES | = lv_i_thx_values | |
| I_TEXT | = lv_i_text | |
| EXCEPTIONS | ||
| REPORT_NOT_FOUND = 1 | ||
| NO_VARIANTS_POSSIBLE = 2 | ||
| FAILED = 3 | ||
| . " RRS_VARIANT_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM RRS_VARIANT_CREATE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single GENUNIID FROM RSR_S_COMPKEY INTO @DATA(ld_i_genuniid). | ||||
| "SELECT single INFOCUBE FROM RSR_S_COMPKEY INTO @DATA(ld_i_infocube). | ||||
| "SELECT single COMPID FROM RSR_S_COMPKEY INTO @DATA(ld_i_compid). | ||||
Search for further information about these or an SAP related objects