Application Development 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: 

cl_salv_table - optimise only one column

Former Member
0 Kudos

dear all

I have an issue with the cl_salv_table function

im trying to optimise only one column but the column is not being optimised, using

lv_cols = lv_rep->get_column( columname = 'AS4TEXT' ).

lv_cols->set_optimize( value = 'X' ).

its not being optimized

does anybody know

6 REPLIES 6

Former Member
0 Kudos

Hi,

Not sure how you have defined lv_cols. Try this code

DATA
     : ITAB TYPE TABLE OF T000.

SELECT *
FROM T000
INTO TABLE ITAB.

DATA :
     GR_SALV_TABLE TYPE REF TO CL_SALV_TABLE.

CL_SALV_TABLE=>FACTORY(  IMPORTING R_SALV_TABLE = GR_SALV_TABLE
                         CHANGING T_TABLE      = ITAB ).

DATA
     : LR_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE.

LR_COLUMNS = GR_SALV_TABLE->GET_COLUMNS( ).

DATA
     : LR_COLUMN TYPE REF TO CL_SALV_COLUMN_TABLE.

LR_COLUMN ?= LR_COLUMNS->GET_COLUMN( 'MANDT' ).
LR_COLUMN->SET_OPTIMIZED( 'X' ).

GR_SALV_TABLE->DISPLAY( ).

Edited by: Rajvansh Ravi on May 25, 2009 10:06 AM

0 Kudos

by writing '?' to get the column name, it will optimise it?

Former Member
0 Kudos

Hi,

No. That is just a different syntax.

I think you need to use the method SET_OPTIMIZED(For single column) of class CL_SALV_COLUMN_TABLE.

The method you have used is set_optimize of CL_SALV_COLUMNS_TABLE (For all columns).

Regards

0 Kudos

i tried for the single column as well, it doesnt get optimized

0 Kudos

Hi Sia,

Have a look at this link where there was a discussion about similar issue.

[CL_SALV_TABLE Problem - Optimize single Column |;

I completely forgot about this thread till now.

See the reply given by Naimesh Patel.

The code which i posted previously seems to work as the client field always has 3 characters.

I tried with one other table and the method did not work.

If this ia actually a bug then the only other way is to use either

lr_column->set_output_length( 40 ).

or optimise all the columns

lr_columns->set_optimize( 'X' ).

Regards

0 Kudos

thanks

i'll try to find an alternative situation