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_gui_alv_tree_simple and optimize column width

Former Member
0 Likes
1,576

Hi,

I'm using cl_gui_alv_tree_simple like i've seen in the program 'BCALV_TREE_SIMPLE_DEMO'

and like in the demo the columns dont apear optimized for the width of it's content.

How can I do this?

edit

in the code we can found this

* optimize column-width
  CALL METHOD tree1->column_optimize
    EXPORTING
      i_start_column = tree1->c_hierarchy_column_name
      i_end_column   = tree1->c_hierarchy_column_name.

but it seems to do nothing...

5 REPLIES 5
Read only

Former Member
0 Likes
1,348

You need to give the column name of type LVC_FNAME.

CALL METHOD tree1->column_optimize

EXPORTING

I_START_COLUMN = nnnnnnnnnnnnnn

I_END_COLUMN = nnnnnnnnnnnn

I_INCLUDE_HEADING = 'X'

EXCEPTIONS

START_COLUMN_NOT_FOUND = 1

END_COLUMN_NOT_FOUND = 2

others = 3

Read only

0 Likes
1,348

can u be more specific? i dont understant what you mean

Read only

0 Likes
1,348

Forget the above post. you need to make the changes in field catalog..

in field catalog set this property.

ls_fieldcatalog-outputlen = '12'. *12 is the length of that column.

Read only

0 Likes
1,348

The above post would set the column width to a static width, which, I don't think is what you are looking for.

Try this:

ls_fieldcat-COL_OPT = 'X'

where ls_fieldcat is defined as:

DATA: ls_fieldcat TYPE lvc_s_fcat.

and you are in a loop through your field catalog.

Read only

0 Likes
1,348

col_opt didtn work...i have no idea why..

so i fixed it hardcoding it with the outputleght field