Skip to Content
Former Member
Mar 02, 2007 at 04:10 AM

how can i change the column label text in a alv table display


how can i change the column label text in a alv table display??

A similar kinda of question was posted previuosly where the requirement was the label text was needed and following below code was given as solution :

<i>* declare column, settings, header object

DATA: lr_column TYPE REF TO cl_salv_wd_column.

DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.

DATA: lr_column_header type ref to CL_SALV_WD_COLUMN_HEADER.

  • get column by specifying column name.

lr_column = lr_column_settings->get_column( 'COLUMN_NAME1' ).

  • set Header Text as null

lr_column_header = lr_column->get_header( ).

lr_column_header->set_text( ' ' ).</i>

My specific requirement is i have an input field on the screen and i want reflect that value as the column label for one of the column in the alv table. I have used he above code with slight modification in the MODIFYVIEW method of the view since it is a process after input. The component gets activated without any errors but while run time i get an error stating

<i>"The following error text was processed in the system CDV : Access via 'NULL' object reference not possible."</i>

i have checked in debugging and the error occured at the statement :

<i>lr_column = lr_column_settings->get_column( 'CURRENT_YEAR' ).</i>Please can you provide me an alternative for my requirement or correct me if i have done it wrong.