Skip to Content

ALV Grid optimization issue

Aug 29, 2017 at 11:57 AM


avatar image

Hello All,

I have an optimized ALV output where I can see all the columns are optimized. So far it is fine, but I would like to have fixed length output for a particular column(No optimization required). Can you please help me in providing how can we exclude optimization for a particular column in ALV output.


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Bertrand DELVALLEE Aug 29, 2017 at 12:59 PM


With SALV You shoud try something like :

  DATA: my_alv TYPE REF TO cl_salv_table, 
        lo_cols_tab TYPE REF TO cl_salv_columns_table,
        lo_col_tab  TYPE REF TO cl_salv_column_table.

lo_cols_tab = my_salv->get_columns( ). 
lo_col_tab ?= lo_cols_tab->get_column( 'COLNAME' ). 
lo_col_tab->SET_OPTIMIZED( abap_false ).
lo_col_tab->SET_OUTPUT_LENGTH( 20 ).

With ALV :

    DATA t_fieldcatalog	TYPE lvc_t_fcat.
    DATA grid TYPE REF TO cl_gui_alv_grid.
    FIELD-SYMBOLS <fieldcatalog>  TYPE LINE OF lvc_t_fcat.

    grid->get_frontend_fieldcatalog( IMPORTING et_fieldcatalog = t_fieldcatalog ).
    LOOP AT t_fieldcatalog ASSIGNING <fieldcatalog>.
      CASE <fieldcatalog>-fieldname.
        WHEN 'COLNAME'.
           <fieldcatalog>-COL_OPT = abap_false.
           <fieldcatalog>-OUTPUTLEN = 20.

    grid->set_frontend_fieldcatalog( t_fieldcatalog ).

Best regards


Show 5 Share
10 |10000 characters needed characters left characters exceeded

Hi Bertrand,

Thanks for your reply. I know that we can do using SALV Model, but in my report(Old existing report with modifications) we are using REUSE_ALV_GRID_DISPLAY, so for this minor change, I can't switch from REUSE_ALV_GRID_DISPLAY to SALV Model. Can you please help me how to do using this FM?

Best Regards,



Oh I'm sorry but, as far as I know, it will be more complicated.

With FM REUSE, optimization is from layout; not from fieldcat. So I'm afraid you have to do this in several steps :

- display ALV optimized,

- unactivate optimization, change column length

- actualize display.

I'm sorry I don't know much about REUSE FM since cl_salv_table is far more versatile.

Best regards



Or maybe you can map the SLIS-type parameters you are currently using to LVC-type parameters, using the function module LVC_TRANSFER_FROM_SLIS, adjust COL_OPT in the field catalog (of type LVC_S_FCAT), and call the function module REUSE_ALV_GRID_DISPLAY_LVC instead of REUSE_ALV_GRID_DISPLAY. The refactoring would be quick, but you'll have to test everything.


Thank you So much Sandra. I followed as suggested and I'm able to achieve now. Thanks again.


What better excuse do you need to rewrite it into SALV?

That's not meant as sarcasm; unless you have a lot of custom ALV UI features (not talking about business logic), an SALV rewrite should be a piece of cake and greatly simplify it. A basic layout should not take more than half a day, a day or two if you have some fancy buttons that do stuff.