cancel
Showing results for 
Search instead for 
Did you mean: 

problem while setting the property of column in ALV

Yashpal
Active Contributor
0 Kudos

Hi ,

I have created a alv dynamically and setting the properties of the column like column header text but its not getting updated .

see the below code for ref.

lr_column_settings ?= lr_config_table.

data:

lt_columns type salv_wd_t_column_ref.

lt_columns = lr_column_settings->get_columns( ).

data: lr_column type ref to cl_salv_wd_column,

lr_header type ref to cl_salv_wd_column_header,

ls_column type salv_wd_s_column_ref.

loop at lt_columns into ls_column.

case ls_column-id.

when 'MOIST'.

lr_column = ls_column-r_column.

lr_header = lr_column->get_header( ).

lr_header->set_text( 'Moisture %' ).

I am able to set the alv properties like visible row count etc ..

can anybody help out in this issue

Regards

Yash

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I was just able to change my headers with the following:

data:

lt_columns type salv_wd_t_column_ref,

ls_column type salv_wd_s_column_ref,

lr_header type ref to cl_salv_wd_column_header.

lt_columns = lo_value->if_salv_wd_column_settings~get_columns( ).

loop at lt_columns into ls_column.

lr_column = ls_column-r_column.

lr_header = lr_column->get_header( ).

lr_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_title ).

lr_header = lr_column->create_header( ).

case ls_column-id.

when 'CNT_LINEITEMS'.

lr_column->r_header->set_text( 'Line Items' ).

when 'VAL_OPEN'.

lr_column->r_header->set_text( 'Open Amount' ).

when others.

endcase.

endloop

former_member182190
Active Participant
0 Kudos

Hi Yashpal,

I had faced this problem earlier.

You can overcome this on lines of this code

DATA: lr_col TYPE REF TO cl_salv_wd_uie_text_view.

  • Set heading for

lr_column = lr_column_settings->get_column( 'ROLE_TXT' ).

lr_column_hdr = lr_column->create_header( ).

lr_column_hdr->set_text( 'ROLE' ).

This works pretty perfect.

Hope this solves your problem.

Regards,

Ismail.

Former Member
0 Kudos

Hi Yash,

Did you checked the spelling of Moist in caps and small ? . And also check ls_column-id, whether its getting values correctly.

Regards

Sarath

Yashpal
Active Contributor
0 Kudos

Yes they are perfect. i have debugged the code and the method is executed .

russell_day2
Participant
0 Kudos

Yash,

You need one more step...

. lr_column_header = lr_column->get_header( ).

. lr_column_header->set_text( 'X' ).

      • This is the magic step.

. lr_column_header->set_prop_ddic_binding_field( ).

***

You need to disable the data element binding which is currently overriding your text.

Russ.