cancel
Showing results for 
Search instead for 
Did you mean: 

Fix ALV column width independent of content

Former Member
0 Kudos

Hi All,

I need to fix ALV column width independent of content. If I set the width of column as 10 and when the content is 20 characters long, the column expands to 20. I want the width of column to be fixed irrespective of content. I tried all properties available for ALV column and table but couldn't figure it out. We are on ECC 6.0 ENHP4. Any ideas how to achieve this.

Thanks,

Tom

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Have you tried working with fixed table layout?

Former Member
0 Kudos

Robert,

I did try but it doesn't work.

Thanks,

Tom

Former Member
0 Kudos

I believe that I have done this setting fixed layout to true, and then manually setting the column widths in the code.

lo_model->if_salv_wd_table_settings~set_fixed_table_layout( abap_true )

lt_alv_column_table = lo_alv_model->if_salv_wd_column_settings~get_columns( ).
LOOP AT lt_alv_column_table INTO ls_alv_one_column.
 ls_alv_one_column-r_column->set_width( '90' ).

Former Member
0 Kudos

Robert,

When I implement the steps that you suggested, the ALV is displayed with all the dots without any content inside it.

Thanks,

Tom

Former Member
0 Kudos

Most likely 90 is not wide enough. Simply change that value to the fit you want. Try 400 to really blow it out, and then minimize from there to get the size you think fits best.

Former Member
0 Kudos

Hi,

When the width is less then the content length, you will get dots only. Width should be atleast minimum enough to contain the content length.

Answers (0)