Skip to Content
avatar image
Former Member

field labels in alv in webdynpro

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 08, 2010 at 04:37 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • avatar image
    Former Member
    Feb 09, 2010 at 09:02 AM

    Hi santhosh..

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

    Add comment
    10|10000 characters needed characters exceeded