SAP RRS_VAR_EXIT Function Module for Calling BADI from the variables exit
RRS_VAR_EXIT is a standard rrs var exit SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Calling BADI from the variables exit 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 var exit FM, simply by entering the name RRS_VAR_EXIT 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_VAR_EXIT 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_VAR_EXIT'"Calling BADI from the variables exit.
EXPORTING
I_VNAM = "Name of Variable to be Replaced
I_VARTYP = "Variable Type (Characteristic Value, Text, Formula etc.)
I_IOBJNM = "InfoObject that the Variable Refers to
I_S_COB_PRO = "InfoObject Properties
I_S_RKB1D = "Query Reporting Attribute
I_PERIV = "Query Definition Attribute
I_T_VAR_RANGE = "
* I_STEP = 0 "
IMPORTING
E_T_RANGE = "Variables Value Table
E_NO_SCREEN = "Do Not Display Variable
E_CHECK_AGAIN = "Call again in I_step = 2
CHANGING
* C_S_CUSTOMER = "Structure for Customer Exit
EXCEPTIONS
ERROR = 1
IMPORTING Parameters details for RRS_VAR_EXIT
I_VNAM - Name of Variable to be Replaced
Data type: RSZGLOBV-VNAMOptional: No
Call by Reference: No ( called with pass by value option)
I_VARTYP - Variable Type (Characteristic Value, Text, Formula etc.)
Data type: RSZGLOBV-VARTYPOptional: No
Call by Reference: No ( called with pass by value option)
I_IOBJNM - InfoObject that the Variable Refers to
Data type: RSZGLOBV-IOBJNMOptional: No
Call by Reference: No ( called with pass by value option)
I_S_COB_PRO - InfoObject Properties
Data type: RSD_S_COB_PROOptional: No
Call by Reference: No ( called with pass by value option)
I_S_RKB1D - Query Reporting Attribute
Data type: RSR_S_RKB1DOptional: No
Call by Reference: No ( called with pass by value option)
I_PERIV - Query Definition Attribute
Data type: RRO01_S_RKB1F-PERIVOptional: No
Call by Reference: No ( called with pass by value option)
I_T_VAR_RANGE -
Data type: RRS0_T_VAR_RANGEOptional: No
Call by Reference: No ( called with pass by value option)
I_STEP -
Data type: IOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for RRS_VAR_EXIT
E_T_RANGE - Variables Value Table
Data type: RSR_T_RANGESIDOptional: No
Call by Reference: No ( called with pass by value option)
E_NO_SCREEN - Do Not Display Variable
Data type: RS_BOOLOptional: No
Call by Reference: No ( called with pass by value option)
E_CHECK_AGAIN - Call again in I_step = 2
Data type: RS_BOOLOptional: No
Call by Reference: No ( called with pass by value option)
CHANGING Parameters details for RRS_VAR_EXIT
C_S_CUSTOMER - Structure for Customer Exit
Data type: RRO04_S_CUSTOMEROptional: Yes
Call by Reference: Yes
EXCEPTIONS details
ERROR -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for RRS_VAR_EXIT 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_error | TYPE STRING, " | |||
| lv_i_vnam | TYPE RSZGLOBV-VNAM, " | |||
| lv_e_t_range | TYPE RSR_T_RANGESID, " | |||
| lv_c_s_customer | TYPE RRO04_S_CUSTOMER, " | |||
| lv_i_vartyp | TYPE RSZGLOBV-VARTYP, " | |||
| lv_e_no_screen | TYPE RS_BOOL, " | |||
| lv_i_iobjnm | TYPE RSZGLOBV-IOBJNM, " | |||
| lv_e_check_again | TYPE RS_BOOL, " | |||
| lv_i_s_cob_pro | TYPE RSD_S_COB_PRO, " | |||
| lv_i_s_rkb1d | TYPE RSR_S_RKB1D, " | |||
| lv_i_periv | TYPE RRO01_S_RKB1F-PERIV, " | |||
| lv_i_t_var_range | TYPE RRS0_T_VAR_RANGE, " | |||
| lv_i_step | TYPE I. " 0 |
|   CALL FUNCTION 'RRS_VAR_EXIT' "Calling BADI from the variables exit |
| EXPORTING | ||
| I_VNAM | = lv_i_vnam | |
| I_VARTYP | = lv_i_vartyp | |
| I_IOBJNM | = lv_i_iobjnm | |
| I_S_COB_PRO | = lv_i_s_cob_pro | |
| I_S_RKB1D | = lv_i_s_rkb1d | |
| I_PERIV | = lv_i_periv | |
| I_T_VAR_RANGE | = lv_i_t_var_range | |
| I_STEP | = lv_i_step | |
| IMPORTING | ||
| E_T_RANGE | = lv_e_t_range | |
| E_NO_SCREEN | = lv_e_no_screen | |
| E_CHECK_AGAIN | = lv_e_check_again | |
| CHANGING | ||
| C_S_CUSTOMER | = lv_c_s_customer | |
| EXCEPTIONS | ||
| ERROR = 1 | ||
| . " RRS_VAR_EXIT | ||
ABAP code using 7.40 inline data declarations to call FM RRS_VAR_EXIT
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 VNAM FROM RSZGLOBV INTO @DATA(ld_i_vnam). | ||||
| "SELECT single VARTYP FROM RSZGLOBV INTO @DATA(ld_i_vartyp). | ||||
| "SELECT single IOBJNM FROM RSZGLOBV INTO @DATA(ld_i_iobjnm). | ||||
| "SELECT single PERIV FROM RRO01_S_RKB1F INTO @DATA(ld_i_periv). | ||||
Search for further information about these or an SAP related objects