‎2009 May 27 1:32 PM
Hi,
My user want me to download data when he change the alv layout.
For example there are 10 fields in a alv report ,and the user change the layout setting to 5 fields,I need to know which are displayed on grid, how can I get it ?
Pls help me ,thanks a lot !
Regards,
Mr.A
‎2009 May 27 1:52 PM
use the below function module, this will bring based on the number of fields selected in the layout
CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
IMPORTING
es_layout = gs_layout
et_fieldcat = g_fieldcat[]
et_sort = gt_sort
et_filter = gt_filter
es_variant = gs_variant.
DELETE g_fieldcat WHERE no_out = 'X'.
‎2009 May 27 2:18 PM
Hi PBS,
It is raising an exception saying NO_INFOS and resulting to short dump.
Regards,
Mr.A
‎2009 May 27 1:53 PM
Hi once the Layout is set, you can use the function module 'REUSE_ALV_VARIANT_F4' to get the name of the layout that is set, based on these variants you can declare field symbols of type table and you can populate them with the required data.
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = ls_variant
i_save = 'A'
it_default_fieldcat =
importing
e_exit = l_exit
es_variant = ls_variant
exceptions
not_found = 2.
Else in the ALV Output screen itself you will have a button to save the data, this will save the data based on the Layout that is selected. (You can change the layout and save the layout) after that you can download the data based on the selected layout.
Regards,
S.Dakshna Nagaratnam.