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: 

How to change column name heading thru Class method in ALV report

Former Member
0 Kudos

When I Select LayOut on Selection screen then Display ALV Output columnname display Quantity but I want change this name to Carats.

I set Short, Medium and Long text is Carats.

5 REPLIES 5

0 Kudos

Hi.

Let me see the source code.

What class are you using?

CL_SALV_TABLE or CL_GUI_ALV_GRID

0 Kudos

CL_SALV_TABLE

Former Member
0 Kudos

DATA: lt_fcat type lvc_t_fcat,

lv_fname type fieldname value '<Your FName>'.

FIELD-SYMBOLS: <fcat> type lvc_s_fcat.

CALL METHOD alv_grid->get_frontend_fieldcatalog

IMPORTING

et_fieldcatalog = lt_fcat.

read table lt_fcat assigning <fcat> with key fieldname = lv_fname.

if sy-subrc is initial.

<fcat>-COLTEXT = <fcat>-SCRTEXT_L = <fcat>-SCRTEXT_M = <fcat>-SCRTEXT_S = <fcat>-SELTEXT = '<Your new Description>'.

endif.

CALL METHOD alv_grid->set_frontend_fieldcatalog

EXPORTING

it_fieldcatalog = lt_fcat.

call method alv_grid->REFRESH_TABLE_DISPLAY.

0 Kudos

I m using CL_SALV_TABLE. give in a detail

0 Kudos

Please refer to the program "SALV_DEMO_TABLE_COLUMNS" which is an example of how to access the columns.

the important part is:


data: gr_table   type ref to cl_salv_table.

data: lr_columns type ref to cl_salv_columns_table,
        lr_column  type ref to cl_salv_column_table.

  lr_columns = gr_table->get_columns( ).

  try.
      lr_column ?= lr_columns->get_column( 'COLUM_TECNICAL_NAME' ).
      lr_column->set_short_text( 'S TEXT' ).
      lr_column->set_medium_text( 'MEDIUM TEXT' ).
      lr_column->set_long_text( 'LONG DESCRIPTION' ).
    catch cx_salv_not_found.           
  endtry.

Regards,

Juda