05-06-2007 6:54 AM
hi firends
what is the variant in alv program .what is the use of it.
can u pls explain the evets on the varant like
reuse_alv_variant deaultget
reuse_alv_variant_f4
reuse_alv_variant_existance
reuse_alv_events_get
pls expalin few parameters reqd in theese fun modules.give one sample program
thanks in advance
05-06-2007 8:15 AM
hi,
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.
Check out these sample program for illustration of above FM
http://www.sap-img.com/abap/alv-reporting-z-list-materials.htm
05-06-2007 9:43 AM
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.