SAP LVC_VARIANT_SAVE Function Module for
LVC_VARIANT_SAVE is a standard lvc variant save SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 lvc variant save FM, simply by entering the name LVC_VARIANT_SAVE into the relevant SAP transaction such as SE37 or SE38.
Function Group: SLVC
Program Name: SAPLSLVC
Main Program: SAPLSLVC
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function LVC_VARIANT_SAVE 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 'LVC_VARIANT_SAVE'".
EXPORTING
IT_FIELDCAT = "
* I_BYPASSING_BUFFER = "Character Field Length 1
IT_SORT = "
IT_FILTER = "
* IS_LAYOUT = "ALV Control: Layout Structure
* I_DIALOG = 'X' "
* I_OVERWRITE = ' ' "
* I_USER_SPECIFIC = ' ' "
* I_CUSTOMER_NAME_CHECK = 'X' "
* I_BUFFER_ACTIVE = "Character Field Length 1
IMPORTING
E_EXIT = "
CHANGING
CS_VARIANT = "
TABLES
* IT_DATA = "Data Table
EXCEPTIONS
WRONG_INPUT = 1 FC_NOT_COMPLETE = 2 FOREIGN_LOCK = 3 VARIANT_EXISTS = 4 NAME_RESERVED = 5 PROGRAM_ERROR = 6
IMPORTING Parameters details for LVC_VARIANT_SAVE
IT_FIELDCAT -
Data type: LVC_T_FCATOptional: No
Call by Reference: No ( called with pass by value option)
I_BYPASSING_BUFFER - Character Field Length 1
Data type: CHAR01Optional: Yes
Call by Reference: No ( called with pass by value option)
IT_SORT -
Data type: LVC_T_SORTOptional: No
Call by Reference: No ( called with pass by value option)
IT_FILTER -
Data type: LVC_T_FILTOptional: No
Call by Reference: No ( called with pass by value option)
IS_LAYOUT - ALV Control: Layout Structure
Data type: LVC_S_LAYOOptional: Yes
Call by Reference: No ( called with pass by value option)
I_DIALOG -
Data type: CDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_OVERWRITE -
Data type:Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_USER_SPECIFIC -
Data type:Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_CUSTOMER_NAME_CHECK -
Data type: CDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_BUFFER_ACTIVE - Character Field Length 1
Data type: CHAR01Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for LVC_VARIANT_SAVE
E_EXIT -
Data type: COptional: No
Call by Reference: No ( called with pass by value option)
CHANGING Parameters details for LVC_VARIANT_SAVE
CS_VARIANT -
Data type: DISVARIANTOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for LVC_VARIANT_SAVE
IT_DATA - Data Table
Data type:Optional: Yes
Call by Reference: Yes
EXCEPTIONS details
WRONG_INPUT -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FC_NOT_COMPLETE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FOREIGN_LOCK -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
VARIANT_EXISTS -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NAME_RESERVED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
PROGRAM_ERROR -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for LVC_VARIANT_SAVE 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_e_exit | TYPE C, " | |||
| lt_it_data | TYPE STANDARD TABLE OF C, " | |||
| lv_cs_variant | TYPE DISVARIANT, " | |||
| lv_it_fieldcat | TYPE LVC_T_FCAT, " | |||
| lv_wrong_input | TYPE LVC_T_FCAT, " | |||
| lv_i_bypassing_buffer | TYPE CHAR01, " | |||
| lv_it_sort | TYPE LVC_T_SORT, " | |||
| lv_fc_not_complete | TYPE LVC_T_SORT, " | |||
| lv_it_filter | TYPE LVC_T_FILT, " | |||
| lv_foreign_lock | TYPE LVC_T_FILT, " | |||
| lv_is_layout | TYPE LVC_S_LAYO, " | |||
| lv_variant_exists | TYPE LVC_S_LAYO, " | |||
| lv_i_dialog | TYPE C, " 'X' | |||
| lv_name_reserved | TYPE C, " | |||
| lv_i_overwrite | TYPE C, " ' ' | |||
| lv_program_error | TYPE C, " | |||
| lv_i_user_specific | TYPE C, " ' ' | |||
| lv_i_customer_name_check | TYPE C, " 'X' | |||
| lv_i_buffer_active | TYPE CHAR01. " |
|   CALL FUNCTION 'LVC_VARIANT_SAVE' " |
| EXPORTING | ||
| IT_FIELDCAT | = lv_it_fieldcat | |
| I_BYPASSING_BUFFER | = lv_i_bypassing_buffer | |
| IT_SORT | = lv_it_sort | |
| IT_FILTER | = lv_it_filter | |
| IS_LAYOUT | = lv_is_layout | |
| I_DIALOG | = lv_i_dialog | |
| I_OVERWRITE | = lv_i_overwrite | |
| I_USER_SPECIFIC | = lv_i_user_specific | |
| I_CUSTOMER_NAME_CHECK | = lv_i_customer_name_check | |
| I_BUFFER_ACTIVE | = lv_i_buffer_active | |
| IMPORTING | ||
| E_EXIT | = lv_e_exit | |
| CHANGING | ||
| CS_VARIANT | = lv_cs_variant | |
| TABLES | ||
| IT_DATA | = lt_it_data | |
| EXCEPTIONS | ||
| WRONG_INPUT = 1 | ||
| FC_NOT_COMPLETE = 2 | ||
| FOREIGN_LOCK = 3 | ||
| VARIANT_EXISTS = 4 | ||
| NAME_RESERVED = 5 | ||
| PROGRAM_ERROR = 6 | ||
| . " LVC_VARIANT_SAVE | ||
ABAP code using 7.40 inline data declarations to call FM LVC_VARIANT_SAVE
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.| DATA(ld_i_dialog) | = 'X'. | |||
| DATA(ld_i_overwrite) | = ' '. | |||
| DATA(ld_i_user_specific) | = ' '. | |||
| DATA(ld_i_customer_name_check) | = 'X'. | |||
Search for further information about these or an SAP related objects