Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

optimizing ALV columns

Former Member
0 Likes
601

I have designed an ALV report using cl_salv_table. I want to be able to optimize the column length. For e.g. MATNR usually returns no more than 10 characters for material number but the column length is always set to 20 as that is the length for matnr.

I have tried the code below but it does not seem to work. I can set output length set_output_length to 10 but that will then disqualify > 10 material numbers

lr_column->set_optimized( 'X' ).

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
527

Try calling the SET_OPTIMIZE method from the COLUMN Table object.

Like:


  data: lr_columns type ref to cl_salv_columns_table.

  lr_columns = gr_table->get_columns( ).
  lr_columns->set_optimize( gc_true ).

Regards,

Naimesh Patel

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
528

Try calling the SET_OPTIMIZE method from the COLUMN Table object.

Like:


  data: lr_columns type ref to cl_salv_columns_table.

  lr_columns = gr_table->get_columns( ).
  lr_columns->set_optimize( gc_true ).

Regards,

Naimesh Patel

Read only

0 Likes
527

That worked. Thank you.