cancel
Showing results for 
Search instead for 
Did you mean: 

Change the List Headings in the ALV output

Former Member
0 Kudos

Hi,

I am trying to bind dynamic attributes to a dynamically created Node.

The code is as follows



 build a structure description from the list of single fields
  comp-name = 'CARRID'.
  comp-type ?= cl_abap_datadescr=>describe_by_name( 'S_CARR_ID' ).
  APPEND comp TO comp_tab.

  comp-name = 'CONNID'.
  comp-type ?= cl_abap_datadescr=>describe_by_name( 'S_CONN_ID' ).
  APPEND comp TO comp_tab.

* not this structure contains the fields "CONNID" and "CARRID"
  struct_type = cl_abap_structdescr=>create( comp_tab ).

* now the nodeinfo is created
  node_info = wd_context->get_node_info( ).
  node_info = node_info->add_new_child_node(
    name                         = 'MY_NODE'
    IS_MANDATORY                 = ABAP_true
    IS_MULTIPLE                  = ABAP_true
    STATIC_ELEMENT_RTTI          = struct_type
    IS_STATIC                    = ABAP_false
       ).

But in the output I want my custom List Headings for each of the column.

How to achieve the same.

Edited by: SAP LEARNER on Jan 4, 2010 8:11 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member206441
Contributor
0 Kudos

Hi

Try with this code:


l_column = l_table->if_salv_wd_column_settings~get_column( 'CARRID' ).
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( `CARRIER ID` ).

Thanks & Regards

Arun.P

Former Member
0 Kudos

Hi,

Could you please explaion me the code



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 ).

What happens exactly . Because if we do not use this statement the Text is not being reflected.

Regards

former_member206441
Contributor
0 Kudos

Hi

SET_PROP_DDIC_BINDING_FIELD is used to define the DDIC Field Label for Title and Tooltip

having the parameters of PROPERTY and VALUE, im just putting the default values for it.

Do you get the solution?

Regards

Arun.P

Former Member
0 Kudos

Thnq for the solution.

I works fine......

Former Member
0 Kudos

Hi,

You can set the column titles when you initialize your ALV as follows,

* Data declarations for instantiation
  DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table   ,
        l_ref_cmp_usage           TYPE REF TO if_wd_component_usage.

* Instantiate the ALV
  l_ref_cmp_usage =   wd_this->wd_cpuse_usg_alv_feclm( ) ." alv_feclm is your usage name
  IF l_ref_cmp_usage->has_active_component( ) IS INITIAL .
    l_ref_cmp_usage->create_component( )                 .
  ENDIF                                                  .

* Get model
  l_ref_interfacecontroller = wd_this->wd_cpifc_usg_alv_feclm( ).
  l_value = l_ref_interfacecontroller->get_model( )             .
  wd_this->l_value_feclm = l_value                              .

*to make ALV table editable
  lr_table_settings ?= l_value                  .
  lr_table_settings->set_read_only( abap_false ).

* Column Settings
  lr_column_settings ?= l_value                  .
  lt_columns = lr_column_settings->get_columns( ).

  LOOP AT lt_columns INTO ls_column.
    CASE ls_column-id.
      WHEN 'CA_TEXT'.
        lr_column_header = ls_column-r_column->get_header( )  .
        lr_column_header->set_ddic_binding_field(
           if_salv_wd_c_column_settings=>ddic_bind_none )     .
        lr_column_header->set_text( 'Column Header' )      . " this is your coulmn header

    WHEN OTHERS.
   ENDCASE.
ENDLOOP.