cancel
Showing results for 
Search instead for 
Did you mean: 

Reduce column width of ALV in webdynpro ABAP

Former Member
0 Kudos

Hi Experts,

I am facing problem while reducing column width of column.

When i use code for setting layout of alv as  lv_alv_config_tab->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ) then all columns are collapsed at one place & after set width some then them adjusted and last column alv on screen it takes whole remaining space.


I want to reduce width of fileds so i code like this & used lv_alv_config_tab->if_salv_wd_table_settings~set_fixed_table_layout( abap_false ).


IF ls_columns-id = 'HOME_PC'.
       CREATE OBJECT ir_text_box
         EXPORTING
           value_fieldname = 'HOME_PC'.
        ir_text_box->set_read_only_fieldname( 'HOME_PC_OP' ).
       ls_columns-r_column->set_width( value = '10' ).
       ls_columns-r_column->set_cell_editor( ir_text_box ).

       lr_alv_header = ls_columns-r_column->get_header( ).
       lr_alv_header->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_none ).
       lr_alv_header->set_text('Home Profit Center').
   ENDIF.

when i set width as '02' then also its width is not reduced.


Accepted Solutions (0)

Answers (1)

Answers (1)

Szczerbowski
Active Participant
0 Kudos

Hi,

What i did in my solution is to keep that fixed layout: 

lr_table_settings->set_fixed_table_layout( abap_true ).

And then you can control the width by setting it like you did, but to prevent squeezing etc I set also the number of columns that should be on screen at a time:

  lr_table_settings->set_scrollable_col_count( 12 ).


Users can control that by using ALV prefs in the top right corner, and saving a custom layout - if it's not enough for them.