cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the column text of an ALV in WD?

former_member195355
Participant
0 Kudos

Hiya,

I have an ALV and it displays this in the column headings:

I'd like to change 'Name 1' to 'Name' and 'Boolean' to 'Selection', but I can't seem to figure out how to do this in the maze of all the classes and methods...

Could someone give me a few pointers please.

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

harsha_jalakam
Active Contributor
0 Kudos

Hi ,

We can change the column heading through if_salv_wd_column_settings interface. Please check the following code for changing the same.

data: l_ref_cmp_usage type ref to if_wd_component_usage.

  l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).

  if l_ref_cmp_usage->has_active_component( ) is initial.

    l_ref_cmp_usage->create_component( ).

  endif.

  data l_salv_wd_table type ref to iwci_salv_wd_table.

  l_salv_wd_table = wd_this->wd_cpifc_alv( ).

  data l_table type ref to cl_salv_wd_config_table.

  l_table = l_salv_wd_table->get_model( ).

  data l_column type ref to cl_salv_wd_column.

  l_column = l_table->if_salv_wd_column_settings~get_column( 'Name_1' ).

  data l_header type ref to cl_salv_wd_column_header.

  l_header = l_column->get_header( ).

  l_header->set_prop_ddic_binding_field(

    property =  if_salv_wd_c_ddic_binding=>bind_prop_text

    value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).

  l_header->set_text( `Name` ).

  l_column = l_table->if_salv_wd_column_settings~get_column( 'Boolean' ).

  data l_header type ref to cl_salv_wd_column_header.

  l_header = l_column->get_header( ).

  l_header->set_prop_ddic_binding_field(

    property =  if_salv_wd_c_ddic_binding=>bind_prop_text

    value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).

  l_header->set_text( `Selection` ).

Regards,

Harsha

former_member195355
Participant
0 Kudos

Thanks!

Could I ask if passing:

property =  if_salv_wd_c_ddic_binding=>bind_prop_text

is actually necessary? Do you know what this does?

I've found

set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_none )

work just as well.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi M,

This question has already been answered:

Please search scn before posting.

Regards,

Ashvin

former_member195355
Participant
0 Kudos

Thanks but the answer in that message didn't make any sense to me. So thought I'd ask.