cancel
Showing results for 
Search instead for 
Did you mean: 

field labels in alv in webdynpro

Former Member
0 Kudos

hi all,

I am using standard table as dictionary structure for my context node .

So when i m seeing the ouput in ALV the header is coming up with field names . But I want to display field lables so that it can be understood by users .

Could you please send information on this .

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Santosh,

As i understood you want to change the columns headers and if this is right then you can make use of CL_SALV_WD_COLUMN_HEADER class to achieve it.

1. get the ref to all the columns

data: lt_columns type salv_wd_t_column_ref.

data: ls_column type salv_wd_s_column_ref.

lt_columns = lo_value->if_salv_wd_column_settings~get_columns().

2. read the column you want to add custom header

loop at lt_columns into ls_column.

case ls_column-id.

when 'MATNR'.

data lr_col_header type ref to cl_salv_wd_column_header.

lr_col_header = ls_column-r_column->create_header().

lr_col_header->set_text('Test Header').

endcase.

endloop.

this will set the column header as "test header" for the field matnr.

Thanks,

Abhishek

Former Member
0 Kudos

HI

can you say what is lo_value is here and in which methods this code needs to be written

Former Member
0 Kudos

Hi,

lo_value here refers to class cl_salv_wd_config_Table.

This is how you get ta reference to this class.

DATA: lo_cmp_usage type ref to if_wd_component_usage.
  DATA: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
  DATA: lo_value TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
 
*create an instance of your ALV component 
  lo_cmp_usage =   wd_this->wd_cpuse_OVERVIEW_POTENT_ALV( ). " replace it by your ALV name 
* if not initialized, then initialize
  if lo_cmp_usage->has_active_component( ) is initial.
    lo_cmp_usage->create_component( ).
  endif.
 
* get ALV component
  lr_salv_wd_table = wd_this->wd_cpifc_OVERVIEW_POTENT_ALV( ).  "replace it by your ALV usage name
  lo_value = lr_salv_wd_table->get_model( ).

You can write this code in doinit of view.

Regards

Manas Dua

Answers (1)

Answers (1)

rameshkumar_ramasamy2
Participant
0 Kudos

Hi santhosh..

Check the Type of all the attributes within tat node..Whether it refers to the dictionary element.. like MARA-MATNR..