The width of the column in the SAP ALV List is controlled through the fields OUTPUTLEN and COL_OPT of the field catalog. The field OUTPUTLEN of the field catalog sets the size of the column with an Integer value. By setting the field COL_OPT of the field catalog to ABAP_TRUE, the width of the column is adjusted according to the text content of the column.
So the content with the maximum value defines the width of the column. If both the fields of the field catalog is used, then the optimized column width option is preferred automatically.
Let us look at the following example.
FIELD-SYMBOLS <ls_field_cat> TYPE lvc_s_fcat.
LOOP AT lt_field_cat ASSIGNING <ls_field_cat> WHERE fieldname = ‘CONTACT_ADDRESS’.
<ls_field_cat>-outputlen = 50.
<ls_field_cat>-col_opt = ‘X’.
ENDLOOP.