Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV layout

Former Member
0 Likes
433

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

3 REPLIES 3
Read only

Former Member
0 Likes
400

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'.

Read only

0 Likes
400

Hi PBS,

It is raising an exception saying NO_INFOS and resulting to short dump.

Regards,

Mr.A

Read only

Former Member
0 Likes
400

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.