cancel
Showing results for 
Search instead for 
Did you mean: 

changing the header text in the alv displayed in web dynpro abap

sahai
Contributor
0 Kudos

hello ,

In a scenario i have to get the header text diplayed by default in alv changed with the text i want. like generally in an alv we get the decription which is present in the db table displayed say the displayed name of the header column is N.CHAR...becauseit is preent as the field lable in db table but as per my requirement i want to change the column header to say " Charecterstic name" how will i acheive this....

i am using the set_text method present in class CL_SALV_WD_COLUMN_HEADER

i am reading this column using GET_COLUMN and den when i m using SET_TEXT in debugger it shows that the name is changed but when the output is shown he name is still N.CHAR but i want it to be changed to CHARECTERSTIC NAME......please suggest me why this is happening

thanks,

sahai.s

Accepted Solutions (1)

Accepted Solutions (1)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Try like below.

DATA lo_value TYPE REF TO cl_salv_wd_config_table.

lo_value = lo_interfacecontroller->get_model( ).

DATA: lr_field TYPE REF TO cl_salv_wd_field.

lr_field = lo_value->if_salv_wd_field_settings~get_field(

'FNAME' ).

  • change the label of the report.

DATA: lr_weeknum TYPE REF TO cl_salv_wd_column.

CALL METHOD lo_value->if_salv_wd_column_settings~get_column

EXPORTING

id = 'FNAME'

RECEIVING

value = lr_weeknum.

  • SET THE LABEL OF THE COLUMN

DATA: hr_weeknum TYPE REF TO cl_salv_wd_column_header.

CALL METHOD lr_weeknum->get_header

RECEIVING

value = hr_weeknum.

CALL METHOD lr_weeknum->set_resizable

EXPORTING

value = abap_false.

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

          • set the text of the column

CALL METHOD hr_weeknum->set_text

EXPORTING

value = 'Characteristic Value'.

Answers (2)

Answers (2)

sahai
Contributor
0 Kudos

hi both,

thanks i got my problem resolved.

Former Member
0 Kudos

Hi Sahai,

I think you just try this:-

1->

use create component:-

2.->

then call get model from alv methods

3->

DATA:

lr_alv_column TYPE REF TO CL_SALV_WD_COLUMN,

lr_alv_header TYPE REF TO CL_SALV_WD_COLUMN_HEADER,

lr_alv_config TYPE REF TO cl_salv_wd_config_table.

lr_alv_column = lr_alv_config->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'YOUR FIELD NAME' ).

lr_alv_header = lr_alv_column->get_header( ).

lr_alv_header->set_ddic_binding_field( IF_SALV_WD_C_DDIC_BINDING=>DDIC_BIND_NONE ).

lr_alv_header->set_text( 'CHARECTERSTIC NAME').

I hope this will work.

sahai
Contributor
0 Kudos

no its not working i have tried this

Former Member
0 Kudos

Hi

I have done this before and it works fine. I think you might have some other issues.

Can you post the code you have written.

So that i can check it out proprely.

Thanks & Regards ,

Monishankar C

former_member198064
Participant
0 Kudos

Hi,

I have tried with this below code about which u have given but i didn't understand about lr_alv_header->set_text( 'CHARECTERSTIC NAME').what we have to provide CHARACTERISTIC NAME here or we have to provide name which we want to see the output.Please solve the above problem here.

DATA:

lr_alv_column TYPE REF TO CL_SALV_WD_COLUMN,

lr_alv_header TYPE REF TO CL_SALV_WD_COLUMN_HEADER,

lr_alv_config TYPE REF TO cl_salv_wd_config_table.

lr_alv_column = lr_alv_config->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'YOUR FIELD NAME' ).

lr_alv_header = lr_alv_column->get_header( ).

lr_alv_header->set_ddic_binding_field( IF_SALV_WD_C_DDIC_BINDING=>DDIC_BIND_NONE ).

lr_alv_header->set_text( 'CHARECTERSTIC NAME').

Former Member
0 Kudos

Hi durgavenkatesh ,

Just check that was raised by Sahai. he wants to change the name to 'CHARECTERSTIC NAME'.

lr_alv_header->set_text( 'CHARECTERSTIC NAME').

In the above line you have to put the name you want to display in header.

Just go to SE24 check the class documentaion , method SET_TEXT and its parameters.

Regards,

Monishankar C

soldner
Participant
0 Kudos

Worked first time for me!  Great and thanks!