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

CL_SALV_TABLE Column

Former Member
0 Likes
1,015

Hi there,

Is seems like it is not possible to optimize columns selectively with the new OO ALV. Ive tried switching on the optimize flag for selected columns in my table but they still appear in full column width. Any one has any idea?

Also, is it possible to build a multi-line column header?

Thanks,

Audrey

Hi there,

Is seems like it is not possible to optimize columns selectively with the new OO ALV. Ive tried switching on the optimize flag for selected columns in my table but they still appear in full column width. Any one has any idea?

Also, is it possible to build a multi-line column header?

Thanks,

Audrey

5 REPLIES 5
Read only

Former Member
0 Likes
858

1. Optimize column, I think, depends on two things, either on the length of the data or on the length of the heading of the column. So, probably you have lengthier heading because of which full length of the column is being displayed.

2. It is not possible to have multi line heading for the columns.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

Former Member
0 Likes
858

Hi,

Try this one for optimizing column

DATA LR_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE.

lr_columns = r_salv_table->get_columns( ).

lr_columns->set_optimize(abap_true).

To my knowledge u can't create a multi line column in OOALV.

Thanks,

Anand

Read only

0 Likes
858

Hi,

Thanks for all the replies.

Anand,

That optimizes the entire table (ie. ALL columns). What I hope to do is to optimize selected columns.

Cheers,

Audrey

Read only

Former Member
0 Likes
858

Hi,

For optimizing selected columns.

here i tried it for single column matnr. u can try for all the selected columns.

try this.

DATA LR_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE.

DATA LR_COLUMN TYPE REF TO CL_SALV_COLUMN_TABLE.

LR_COLUMNS = r_salv_table->GET_COLUMNS( ).

LR_COLUMNS->SET_OPTIMIZE( ABAP_FALSE ).

TRY.

LR_COLUMN ?= LR_COLUMNS->GET_COLUMN( 'MATNR' ).

LR_COLUMN->SET_OPTIMIZED(ABAP_TRUE).

CATCH CX_SALV_NOT_FOUND.

CATCH CX_SALV_EXISTING.

CATCH CX_SALV_DATA_ERROR.

ENDTRY.

Thanks,

Anand

Read only

0 Likes
858

Hi,

I tried your suggestion and it did not work. I found one of the demo program SALV_TEST_TABLE and selective column optimization didnt work there too.

Cheers,

Audrey