Skip to Content

ALV Grid optimization issue

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.

Thanks,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 29, 2017 at 12:59 PM

    Hello,

    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.
          ENDCASE.
        ENDLOOP.
    
        grid->set_frontend_fieldcatalog( t_fieldcatalog ).
    

    Best regards

    Bertrand

    Add comment
    10|10000 characters needed characters exceeded