04-25-2007 9:34 AM
Dear all,
I am working on alv reports using Function modules. In grid display we will get CHANGE LAYOUT icon.Here i want to change that CHANGE LAYOUT to LAYOUT SETTINGS which allow us to select layout, save layout,change layout and manage layout. My intension is to save a layout. So, can anybody suggest me how can i do this.
Thanks,
Vineel
04-25-2007 9:40 AM
Hi Vineel,
Just pass the 'A/U' to the I_SAVE parameter to your REUSE_ALV_GRID_DISPLAY Function module. Then you problem will be solved.
<b> A=all, U = user-specific</b>
Warm Regards,
Vijay
Message was edited by:
Vijaya Bhaskarudu Gangisetty
04-25-2007 9:44 AM
try this
data: variant type disvariant.
variant-report = sy-repid.
variant-username = sy-uname.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = fieldcat
is_variant = variant
i_save = 'A'
tables
t_outtab = itab.
04-25-2007 11:14 AM
Hi chndrashekar,
Thanks for ur valuble reply. Now i got what exactly i want. Can u plz explain me how that logic got worked out.
Thnks,
Vineel
04-25-2007 11:20 AM
hi vineel,
This variant structure is only relevant if display variants are to be saved
and/or read.
Variant information including the name of the list variant that is use
to output the list.
If you also want to allow display variants to be saved, you must
additionally fill parameter I_SAVE accordingly.
<b>
Reward points for helpful answers</b>
04-25-2007 9:55 AM
hi
good
as per your requirement you have to create a button similar to change layout in menu painter and you have to use that as per your requirement.
thanks
mrutyun^
04-25-2007 10:09 AM
Hi,
data: v_variant type disvariant.
v_variant-report = 'YPMR4100_OIMS'.
V_VARIANT-USERNAME = SY-UNAME.
CALL METHOD details_grid->set_table_for_first_display
EXPORTING i_structure_name = 'YWO_OIMS_DETAIL'
is_layout = layout
is_variant = v_variant
i_save = 'U'
the above code will help you.
regards,
LKK
04-25-2007 10:16 AM
Hi,
U can do this by selectiong what all u want in the display and then clicking on the <b>save layout</b> button.
for that, the menu painter must contain all required fields. U can do it by copying the standard sap menu from se41.
Thanks,
Shreya
04-25-2007 10:18 AM
And yes, for saving a particular layout,
try this
FORM Z_DEFAULT_VARIANT .
I_VARIANT-REPORT = V_PROGNAME.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = 'A'
CHANGING
CS_VARIANT = I_VARIANT
EXCEPTIONS
WRONG_INPUT = 1
NOT_FOUND = 2
PROGRAM_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
P_VARI = I_VARIANT-VARIANT.
ENDIF.