Application Development 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: 

Apply ALV layout(hide columns,filter,etc) before displaying data in ALV grid

jitendra_it
Active Contributor
0 Kudos
1,380

Hello,

My requirement is to download data in a file on application/presentation server with layout entered on selection screen before displaying data on ALV.

so here I need to hide columns,apply filter based on layout entered on selection screen.

eg: say in a report I have 10 columns. User creates a variant(var1) which has 4 columns hidden.

so next time user enters Var1 on selection screen then i need to read this variant apply this on the data fetched. Download file on application/presentation sever. Email this file.

Then display the data in ALV grid.

I know that ALV will take care of variant by passing it in REUSE_ALV_GRID_DISPLAY FM but I want those filtered data before grid display.

Or any way i can read data from alv grid post applying filter by SAP itself ? then i can download and mail them ?

Thanks a lot for your help.

3 REPLIES 3

Jelena_Perfiljeva
Active Contributor
0 Kudos
355

I don't think there is other way than, essentially, executing a program via SUBMIT with that ALV layout and then capturing the results. (How to do that has been discussed on SCN before, search in Google.)

Purely from the UI standpoint, it seems to be a bit of a "backwards" process though. If the program has already downloaded (where?) and emailed the data then why are you even displaying ALV afterwards? Normally data would be presented to the user first and then they could make a decision whether to download/email it.

Sandra_Rossi
Active Contributor
0 Kudos
355

Why do you "want those filtered data before grid display"? (anyway, this is always true, those data are effectively filtered before grid display)

0 Kudos
355

DATA : is_variant LIKE disvariant.

is_variant-report = sy-repid.
is_variant-variant = '/LAYOUT_NAME'. "Layout Name Saved in the Report

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_user_command = 'USER_COMMAND'
i_html_height_top = '77'
is_layout = lwa_layout
it_fieldcat = t_fieldcatalog1[]
is_print = l_print
is_variant = is_variant " Load this variant while calling ALV
i_save = 'A'
it_events = gt_events[]
TABLES
t_outtab = t_data11
EXCEPTIONS
program_error = 1
OTHERS = 2.