2008 Feb 27 7:12 AM
Hi,
In my requirement,i want to save layout of the ALV Report with data in it.So that i can use this variant and get the same data again.I tried with the code below,but its saving only layout,but not the data.
CALL METHOD grid1->set_table_for_first_display
EXPORTING i_structure_name = 'ty_fields_final'
i_save = 'A'
is_variant = g_variant
is_layout = gt_layout
it_toolbar_excluding = lt_exclude
I_DEFAULT = PDEFAULT
CHANGING it_fieldcatalog = gt_fieldcat_lvc[]
it_outtab = i_fields_final.
And also tried it with function module 'LVC_VARIANT_SAVE'.
Can any one help me in this.
Regards
Shibin
Hi,
In my requirement,i want to save layout of the ALV Report with data in it.So that i can use this variant and get the same data again.I tried with the code below,but its saving only layout,but not the data.
CALL METHOD grid1->set_table_for_first_display
EXPORTING i_structure_name = 'ty_fields_final'
i_save = 'A'
is_variant = g_variant
is_layout = gt_layout
it_toolbar_excluding = lt_exclude
I_DEFAULT = PDEFAULT
CHANGING it_fieldcatalog = gt_fieldcat_lvc[]
it_outtab = i_fields_final.
And also tried it with function module 'LVC_VARIANT_SAVE'.
Can any one help me in this.
Regards
Shibin
2008 Feb 27 7:19 AM
Hi,
While calling FM for output display, pass the variant and save that u have used.
Refer to the following code.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gf_repid
it_fieldcat = gt_catalog
it_sort = gt_sort
it_events = gt_events
i_save = gf_save
is_variant = gwa_variant
TABLES
t_outtab = gt_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
Hope this helps.
Regards,
ramya
2008 Feb 27 7:31 AM
Hi Ramya
Thanks for your fast reply.I my case i have tried all the things,which you have mentioned and layout is also getting saved.But when we call this variant next time,only layout is there,but data is not there.
Regards
Shibin
2008 Feb 27 7:36 AM
Hi,
Are you using same selection screen parameters or with different selection screen parameters.
ALV layout will contain only the layout not data, you cannot save the layout with data.
Thanks,
Sriram Ponna.
2008 Feb 27 7:27 AM
hi,
Try this.
data: gwa_variant1 LIKE disvariant,
gwa_variant LIKE disvariant,
gf_repid LIKE sy-repid,
gf_exit(1) TYPE c,
gf_save(1) TYPE c.
INITIALIZATION.
gf_repid = sy-repid.
gf_save = 'A'.
CLEAR gwa_variant.
gwa_variant-report = gf_repid.
gwa_variant1 = gwa_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = gf_save
CHANGING
cs_variant = gwa_variant1
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = gwa_variant1-variant.
ENDIF.
AT SELECTION-SCREEN.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gwa_variant
i_save = gf_save
IMPORTING
e_exit = gf_exit
es_variant = gwa_variant1
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 gf_exit = space.
p_vari = gwa_variant1-variant.
ENDIF.
ENDIF.
IF NOT p_vari IS INITIAL.
MOVE gwa_variant TO gwa_variant1.
MOVE p_vari TO gwa_variant1-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = gf_save
CHANGING
cs_variant = gwa_variant1.
gwa_variant = gwa_variant1.
ELSE.
CLEAR gwa_variant.
gwa_variant-report = gf_repid.
ENDIF.
end-of-selection.
gf_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gf_repid
it_fieldcat = gt_catalog
it_sort = gt_sort
it_events = gt_events
i_save = gf_save
is_variant = gwa_variant
TABLES
t_outtab = gt_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
Hope this helps.
Regards,
Ramya
2008 Feb 27 7:27 AM
U can use thse 3 FMs
'REUSE_ALV_VARIANT_DEFAULT_GET'
'REUSE_ALV_VARIANT_F4'
'REUSE_ALV_VARIANT_EXISTENCE'
Reward if useful
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |