Skip to Content
author's profile photo Former Member
Former Member

Refresh ALV field catalog

Hi,

I have developed one program with dynamic internal table. And also I have added another toolbar button to the standard ALV toolbar.

When I press ALV custom toolbar button, ALV field catalog should refresh.

Here is the situation:

After displaying output I am hiding few fields from the output. Then I am pressing ALV custom toolbar button.

But my ALV field catalog is not refreshing. I need updated fieldcatalog. I mean whatever I hide those fields should update in fieldcatalog table (i.e it_fieldcatalog-NO_OUT = 'X').

I am not using any custom containers / classes. Please help me.

I supposed to write the code in user_command subroutine based on the updated fieldcatalog.

Please help me.

Thanks

Raghu

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Feb 03, 2014 at 05:29 PM

    I know this thread is over 4 years old, but no one actually gave the correct answer, so here is the correct answer:

    In the user command subroutine, make the required changes to your field catalog (in this case, setting the NO_OUT values on the rows you want to show), then execute this code:

    DATA lv_ref_grid TYPE REF TO cl_gui_alv_grid.
    IF lv_ref_grid IS INITIAL.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    e_grid = lv_ref_grid.
    ENDIF.
    IF NOT lv_ref_grid IS INITIAL.
    CALL METHOD lv_ref_grid->set_frontend_fieldcatalog
    EXPORTING
    it_fieldcatalog = t_fcat1.
    ENDIF.
    ps_selfield-refresh = abap_true.

    This is assuming you are using the function module REUSE_ALV_GRID_DISPLAY_LVC to display your ALV grid; I have not tested this technique with the older SLIS grid. Now the next time someone searches Google or SCN for the answer to this question, a working solution will be found!

    Cheers,

    TerryB

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2009 at 07:13 PM

    Hi

    When ever u r user command is triggered, build another field catalog internal table.

    regards,

    Raghu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2009 at 09:12 PM

    Hi,

    Try this:

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

    EXPORTING

    • i_background_id = 'ALV_BACKGROUND'

    i_callback_program = g_repid

    i_callback_pf_status_set = 'PF_STATUS'

    i_callback_user_command = 'USER_COMMAND'

    is_layout_lvc = gs_layout

    it_fieldcat_lvc = gt_fieldcat[]

    i_save = g_save

    is_variant = g_variant

    it_events = gt_events[]

    it_event_exit = lt_event_exit

    i_default = 'X'

    TABLES

    t_outtab = itab_data.

    FORM user_command USING r_ucomm LIKE sy-ucomm

    rs_selfield TYPE slis_selfield.

    .......

    .......

    modify itab_data.

    rs_selfield-refresh = 'X'.

    Regards,

    José

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi

      Can u try this..

      Build two fieldcatalogs .

      IT_FIELDS1 - having d fields to be displayed initially

      IT_FIELDS2 - all fields ( including the hidden fields)

      In the form 'USER_COMMAND'.

      Write the code to call the FM REUSE_ALV_GRID_DISPLAY again using the fieldacatalog IT_FIELDS2 on clicking the refresh button on the custom toolbar.

  • author's profile photo Former Member
    Former Member
    Posted on Jun 12, 2014 at 12:53 AM

    Hi,

    You need to change the layout & save the same.

    Under user command you may set code to assign the changed layout & then try to refresh ALV output.

    Thanks!

    Anil Sahni

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.