‎2007 Aug 06 7:25 AM
Hi all,
How can I save the alv test data?
To save it as a variant, what is the whole procedure?
Thanks.
‎2007 Aug 06 7:31 AM
Hi,
variants is a concept in SAP used for saving data and can be used for no. of times.
for ex : if we want to check our program with sam data for no. of times then variants are very useful for us.
to create a variant first give the input to your prgm and click on save button then system creates a variant and give desc and name for that variant.then for next times on wards u no need to giv sam data just click on variant then it will automatically giv es data to required fields .
variants r useful in alv also.some of FM's in alv r
1. REUSE_ALV_F4_VARIANTS.
2. REUSE_ALV_VARIANTS_GET
at selection-screen on value-request for p_vari.
**-- Display all existing variants
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = g_variant
i_save = g_save
importing
e_exit = g_exit
es_variant = gx_variant
exceptions
not_found = 2.
if sy-subrc = 2.
message id sy-msgid type 'S' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
if g_exit = space.
p_vari = gx_variant-variant.
endif.
endif.
Variants are used to save the data and retrieve the same when required. This is an option used in ALV.
SAP provides standard interfaces for initializing and retrieving the display variant information. This includes three function modules and four subroutines.
1. REUSE_ALV_VARIANT_DEFAULT_GET.
This FM is used to get the default variant for the report if it has been set.
EXPORTING
I_SAVE : Controls the storage mode. Allowed values are :
A : Standard and user specific variants
U : User specific variants
X : Standard Variants
CHANGING
CS_VARIANT : Gets the default variant in a structure like DISVARIANT.
2. REUSE_ALV_VARIANT_F4
This FM is used to get the possible values of the variants on the selection screen.
EXPORTING
IS_VARIANT : Structure of this parameter is like DISVARIANT. Pass the program name through this.
I_SAVE : Controls type of variant to be displayed in value help. Allowed values are
A Standard and user specific variants
U User specific variants
X Standard Variants
IMPORTING
E_EXIT : If this parameter is blank then user has selected some variant.
ES_VARIANT :
Selected variant is populated in this work area. Its of structure like DISVARIANT.
3.REUSE_ALV_VARIANT_EXISTENCE
This FM is used to check existence of a
display variant.
EXPORTING
I_SAVE : Type of variant. Allowed values are
A Standard and user specific variants
U User specific variants
X Standard Variants
CHANGING
CS_VARIANT : Pass on variant details. The structure of this field is like DISVARIANT.
 DATA AREAS TO BE DECLARED FOR VARIANTS :
Data, which will be, used by the standard function modules in ALV for variants. A sample data deceleration is as mentioned below.
DATA: WS_X_VARIANT LIKE DISVARIANT,
WS_VARIANT LIKE DISVARIANT,
WS_SAVE TYPE C,
WS_EXIT TYPE C,
WS_REPID LIKE SY-REPID.
Check out these sample program for illustration of above FM
http://www.sap-img.com/abap/alv-reporting-z-list-materials.htm
http://www.sap-img.com/abap/what-is-alv-programming.htm
Regards
‎2007 Aug 06 7:26 AM
I mean search test data.
When we enter some values into parameters os select-options, the same selection criteria would be applied times by times.
I need this.
‎2007 Aug 06 7:31 AM
Hi,
variants is a concept in SAP used for saving data and can be used for no. of times.
for ex : if we want to check our program with sam data for no. of times then variants are very useful for us.
to create a variant first give the input to your prgm and click on save button then system creates a variant and give desc and name for that variant.then for next times on wards u no need to giv sam data just click on variant then it will automatically giv es data to required fields .
variants r useful in alv also.some of FM's in alv r
1. REUSE_ALV_F4_VARIANTS.
2. REUSE_ALV_VARIANTS_GET
at selection-screen on value-request for p_vari.
**-- Display all existing variants
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = g_variant
i_save = g_save
importing
e_exit = g_exit
es_variant = gx_variant
exceptions
not_found = 2.
if sy-subrc = 2.
message id sy-msgid type 'S' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
if g_exit = space.
p_vari = gx_variant-variant.
endif.
endif.
Variants are used to save the data and retrieve the same when required. This is an option used in ALV.
SAP provides standard interfaces for initializing and retrieving the display variant information. This includes three function modules and four subroutines.
1. REUSE_ALV_VARIANT_DEFAULT_GET.
This FM is used to get the default variant for the report if it has been set.
EXPORTING
I_SAVE : Controls the storage mode. Allowed values are :
A : Standard and user specific variants
U : User specific variants
X : Standard Variants
CHANGING
CS_VARIANT : Gets the default variant in a structure like DISVARIANT.
2. REUSE_ALV_VARIANT_F4
This FM is used to get the possible values of the variants on the selection screen.
EXPORTING
IS_VARIANT : Structure of this parameter is like DISVARIANT. Pass the program name through this.
I_SAVE : Controls type of variant to be displayed in value help. Allowed values are
A Standard and user specific variants
U User specific variants
X Standard Variants
IMPORTING
E_EXIT : If this parameter is blank then user has selected some variant.
ES_VARIANT :
Selected variant is populated in this work area. Its of structure like DISVARIANT.
3.REUSE_ALV_VARIANT_EXISTENCE
This FM is used to check existence of a
display variant.
EXPORTING
I_SAVE : Type of variant. Allowed values are
A Standard and user specific variants
U User specific variants
X Standard Variants
CHANGING
CS_VARIANT : Pass on variant details. The structure of this field is like DISVARIANT.
 DATA AREAS TO BE DECLARED FOR VARIANTS :
Data, which will be, used by the standard function modules in ALV for variants. A sample data deceleration is as mentioned below.
DATA: WS_X_VARIANT LIKE DISVARIANT,
WS_VARIANT LIKE DISVARIANT,
WS_SAVE TYPE C,
WS_EXIT TYPE C,
WS_REPID LIKE SY-REPID.
Check out these sample program for illustration of above FM
http://www.sap-img.com/abap/alv-reporting-z-list-materials.htm
http://www.sap-img.com/abap/what-is-alv-programming.htm
Regards