cancel
Showing results for 
Search instead for 
Did you mean: 

Personalization of headers of ALV

Former Member
0 Kudos

Hi everyone,

I need to change column´s header of an ALV in Web dynpro for abap app, but when I click right button and select settings for current configuration, I don't see de columns of the table in the UI element tree. How can I change the header text of the columns in ALV?

Regards

Eduardo Campos.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Eduardo,

You can dynamically change the column header of the alv using this piece of code.

First of all you have to get the column name for which u r changing the header. Then you have to populate the header of that particular column.

DATA : ob_header TYPE REF TO cl_salv_wd_column_header.

DATA : ob_config_model TYPE REF TO cl_salv_wd_config_table.

DATA : ob_column TYPE REF TO cl_salv_wd_column.

lv_column_header = 'NAME'.

ob_column =

ob_config_model->if_salv_wd_column_settings

~get_column( 'EMPLOYEE' ).

CALL METHOD ob_column->create_header

RECEIVING

value = ob_header.

CALL METHOD ob_header->set_text

EXPORTING

value = lv_column_header.

Hope it helps you.

Regards...

Arun.

Answers (2)

Answers (2)

former_member515618
Active Participant
0 Kudos

Hi Eduardo,

After you defing the configuration model of the ALV, do the following to set the column header.

Assume that l_value holds the configuration model of the ALV.



  l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
  l_value = l_ref_interfacecontroller->get_model(  ).

DATA: lr_column_settings   TYPE REF TO if_salv_wd_column_settings,
          lr_column                 TYPE REF TO cl_salv_wd_column,
          lr_column_heading    TYPE REF TO cl_salv_wd_column_header,

  lr_column_settings ?= l_value.
  lr_column = lr_column_settings->get_column( '<COLUMN_NAME>' ).
  lr_column_heading = lr_column->get_header( ).
  lr_column_heading->set_ddic_binding_field(  ).
  lr_column_heading->set_text( '<Column Heading text>' ).

Hope this is what you want.

Regards,

Sravan Varagani

Yashpal
Active Contributor
0 Kudos

Hi ,

You need to get the model of alv ........see the below link

http://help.sap.com/saphelp_nw70/helpdata/en/f7/924a3de0384c2c893ca867cb936551/frameset.htm

Regards

Yash