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: 

ALV Grid: dynamic/new fields by default hidden when using a layout

Former Member
0 Kudos

Hi,

I have an ALV Grid whose field catalog partially contains dynamically generated fields (i.e. columns) like "_200802" for months.

Furthermore, I have set a default layout to enforce an excel inplace view with a specific template.

However, it seems that all dynamic columns that were not present at the time the layout was saved, are automatically hidden and have to be "unhidden" manually. Whenever a "new" month is to be displayed, it is hidden.

Is there a way either to declare field catalog entries as obligatory (i.e. a quasi opposite of NO_OUT) or tell the stored layout to change its behavior regarding unknown columns?

A possible workaround might be to call the set_frontend_fieldcatalog at an appropriate event after the initial grid creation..?

Thanks for your ideas,

David

2 REPLIES 2

former_member194669
Active Contributor
0 Kudos

May be u can try this way.


  call method g_grid->get_frontend_fieldcatalog
      importing
        et_fieldcatalog = gt_fieldcat[].
    perform f_rebuild_fieldcat changing gt_fieldcat. " Here u rebuild ur field catalog
    call method g_grid->set_frontend_fieldcatalog
      exporting
        it_fieldcatalog = gt_fieldcat[].

    call method g_grid->set_frontend_layout
      exporting
        is_layout = gs_layout.

    call method g_grid->refresh_table_display.
 

Former Member
0 Kudos

Thanks, this was pretty much what I was thinking about as a workaround. However, I am still wondering whether there is a way to change the grid behavior regarding this issue.

Should I just insert this code after the initial grid call or is there a suitable event that I could use?