04-24-2007 7:45 AM
Hi,
Can any one explains me the difference between Variant in normal reports and Variant we get using REUSE_ALV_VARIANT_F4.
i have checked in one alv program BALVSD01, it is going to give a value at one selection screen field..
where does this variant value be written from? and what's the use of it?
Pra
04-24-2007 7:53 AM
Hi,
The variants we create at selection screen is different from the ALV variant. The ALV variant stores the layout of the output that the ALV is displaying. You need to create an ALV variant by selecting a layout with the fields you need in the displayed output and saving it. While executing the ALV report in the next run, you can give the name of the variant you have created as the ALV variant and the output will be as per the layout you have saved in your variant.
Regards,
Sharmila
04-24-2007 7:52 AM
Re: REUSE_ALV_VARIANT_F4' how to use it when we iuse it
Posted: Apr 12, 2007 8:30 AM in response to: kumar jami Reply E-mail this post
Hi..
Display variant selection dialog box
Functionality
Possible entries help, if the variant is defined explicitly as an input
field on a screen. The selection must be specified by at least partially
filling the parameter structure IS_VARIANT.
Variant information
Description
This structure is only relevant if display variants are to be saved
and/or read.
Variant information including the name of the list output variant.
The access path must be specified in the fields REPORT (required field),
HANDLE (optional) and/or LOG_GROUP (optional) to allow ALV to read
display variants.
If display variants are also to be saved, the parameter I_SAVE must also
be entered.
See also the documentation of the IMPORTING parameter I_SAVE.
A variant is identified uniquely by:
o the program to which it is assigned (REPORT)
o the handle if, e.g. several lists with various structures and data
are called (HANDLE) in a program (I_CALLBACK_PROGRAM)
The handle is a unique user-assigned CHAR(4) field, which assigns
the call to the current internal output table structure.
Example:
Various lists can be output in program x, depending on a user
action.
Display variants are to be able to be defined for each of these
lists.
Header Table Name
Description
Name of the internal table in the program containing the output data of
the highest hierarchy level.
Item Table Name
Name of the internal table in the program containing the output data of
the lowest hierarchy level.
Field catalog containing descriptions of the list output fields (usually
a subset of the internal output table fields).
A field catalog is required for every ALV list output.
The field catalog for the output table is built-up in the caller's
coding. The build-up can be completely or partially automated by calling
the REUSE_ALV_FIELDCATALOG_MERGE module
Regards
Sudheer
04-24-2007 7:53 AM
Hi,
The variants we create at selection screen is different from the ALV variant. The ALV variant stores the layout of the output that the ALV is displaying. You need to create an ALV variant by selecting a layout with the fields you need in the displayed output and saving it. While executing the ALV report in the next run, you can give the name of the variant you have created as the ALV variant and the output will be as per the layout you have saved in your variant.
Regards,
Sharmila
04-24-2007 8:32 AM
Hi sharmila,
Thanks for the clarification.
I would like to know how to create an ALV variant?
what details are going to be stored into ALV?
How can we know which one is default variant?
where this variant is going to be store?
If we want to retrive those variants..Is that only way to use Reuse_alv_variants_F4 by defining a selection screen parameter?
could you please clarify the above?
Pra
04-24-2007 8:05 AM
hi
good
REUSE_ALV_VARIANT_F4=>
Short Text
Display variant selection dialog box
Functionality
Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.
Parameters
IS_VARIANT
I_TABNAME_HEADER
I_TABNAME_ITEM
IT_DEFAULT_FIELDCAT
I_SAVE
I_DISPLAY_VIA_GRID
E_EXIT
ES_VARIANT
In case of the normal varinat we use to create as per your requirement,and the output type that we want.
Thanks
mrutyun^
04-24-2007 8:51 AM
Hi Praneet
Normal Variants will create the selection-screen fields with the saved values.
Where as REUSE_ALV_VARIANT_F4. is used for diffrent purpose.
Suppose in alv list you have 40 columns. By executing without REUSE_ALV_VARIANT_F4.
But let your requirement is one time you have to display 20 selected columns and second time you want to display 25 columns like that.
After getting the list by selecting required columns and save you can create one variant with that name. This can be carried by REUSE_ALV_VARIANT_F4 FM.
For detialed explanation have a look on:
alv_repid = sy-repid.
alv_variant-report = alv_repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = alv_variant
i_save = 'A'
IMPORTING
es_variant = alv_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.
p_layout = alv_variant-variant.
ENDIF.
Regards,
Sreeram
04-24-2007 10:11 AM
Hi sree,
If we have 40 cols, we can reduce it to 20 cols by choosing change layout..But how to save it as variant ...as i could not see any save button or way to name the changed layout a variant name...
how can we acheieve that..?
Pra
04-24-2007 10:16 AM
In you r call to the reuse_diplay_alv_grid function module, yo uhave to pass I_SAVE = 'A'.
Then yo ucan find a buton on the lav tool bar to change and save layouts.
Check the programs BCALV_GRID_11 , BCALV_GRID_10 and BCALV_GRID_09 for examples.
Regards,
ravi
04-24-2007 2:38 PM
Ravi,
Thanks,
Actually what are the situations we go for Variants? We can do the same thing by choosing option of changing layout?
Y specifically we go for creation of variants and using related FMs??
Pra
04-24-2007 2:49 PM
The variants in the list display can be both user-specific and general.
The user can programmatically set the initial (default) variant for list display.
The default variant can be found using the function module 'REUSE_ALV_VARIANT_DEFAULT_GET'.
Sample code:
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = variant save condition ( A=all, U = user-specific )
CHANGING
cs_variant = internal table containing the program name (and the default variant---optional )
EXCEPTIONS
not_found = 2.
The user can also choose from the list of existing variants using the function module REUSE_ALV_VARIANT_F4.
also chk this REUSE_ALV_VARIANT_EXISTENCE