Skip to Content

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

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.

Add comment
10|10000 characters needed characters exceeded

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

  • Get RSS Feed

2 Answers

  • Feb 23 at 10:01 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 26 at 07:20 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded