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

Column Optimize on SALV

Former Member
0 Likes
23,498

I am building a SALV and my layout is Type ref to CL_SALV_LAYOUT.

I dont find any option there to optimize my column widths unlike we pass cwidth_opt = 'X' in regular ALV.

How do I optimize my columns width.

Thanks

Kiran

5 REPLIES 5
Read only

Former Member
0 Likes
11,385

Solved by passing:

gr_columns->SET_OPTIMIZE( ).

Read only

former_member194669
Active Contributor
11,385

Check this


data: gr_columns    type ref to cl_salv_columns_table.
data: gr_column     type ref to cl_salv_column_table.

  gr_columns = gr_table->get_columns( ).
  gr_column ?= gr_columns->get_column( text-102 ).  " MATNR
  gr_column->set_visible( abap_false ).
  gr_columns->set_optimize( abap_true ).

a®

Read only

0 Likes
11,385

Thaks ars.

Can you tell me how to align the values in each column also.

Thanks

Kiran

Read only

daniel_asperilla
Explorer
11,385

You may set the length by column as follow:

data gc_alv type ref to cl_salv_table.

gc_alv->get_columns( )->get_column( 'CHARG_MOSTO' )->set_output_length( value = 10 ).

Regards

Read only

0 Likes
11,385

This works perfectly. Thank you so much!!!