cancel
Showing results for 
Search instead for 
Did you mean: 

Optimize ALV Column Size

former_member393151
Participant
0 Kudos

I apologize if this question has been asked and answered.

I'm looking for a way of replicating the "optimize columns" functionality of cl_gui_alv_grid with the WDA ALV. This automatically sets the output width of a column to be the width of the longest value in the column - but the user can also change the width manually.

If I set the following:

lo_alvmodel->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ). - the user is able to manually change the size of the column

If I don't set this the column with is fixed to the length of the field - but the user can't change the column with.

So - essentially the users want a combination of both - so that they can resize as needed - and also be able to save this with the layout.

Thanks,

Heather

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

you want to set width manually?? create one input field, eneter your width in that and code based on this input.

hope it helps

cheers,

Kris.

former_member393151
Participant
0 Kudos

Not really.

So say field MAKTX is 40 characters long. Currently the ALV either displays the field as the 40 characters all the time, even if say the longest contets are 30 characters - and the user cannot resize. When I set set_fixed_table_layout = true, the field is flexible in size - but doesn't automatically sense the longest it should be is 30 characters - it might only show 25 - forcing the user to manually resize the column all the time.