cancel
Showing results for 
Search instead for 
Did you mean: 

Set Column title in ALV (better approach?)

Former Member
0 Kudos

Hey,

At the moment I change the title like this:


CALL METHOD alv_config_table->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN
     EXPORTING
       ID = 'VORG_NR'
     RECEIVING
       VALUE = column.

   DATA lo_header TYPE REF TO CL_SALV_WD_COLUMN_HEADER.

   CALL METHOD column->GET_HEADER
     RECEIVING
       VALUE = lo_header.

   CALL METHOD lo_header->set_text
     EXPORTING
       VALUE = 'Vorgangsnummer'.

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


Is there a better approach in WebDynpros to do that, maybe with an attribute?

Because this looks a bit inefficient to do this for every column.


Thanks you for your opinions on this topic



Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can either write the code which you have already written or the code which Abhishek Sharma suggested .

Thanks

KH

AbhishekSharma
Active Contributor
0 Kudos

Hi Dominic,

You can try to get all columns dynamically and write the code as below:

DATA lo_controller TYPE REF TO iwci_salv_wd_table .

lo_controller = wd_this->wd_cpifc_alv( ).

DATA lo_value TYPE REF TO cl_salv_wd_config_table.

lo_value = lo_controller->get_model( ).

DATA:lt_columns TYPE salv_wd_t_column_ref,

ls_columns TYPE salv_wd_s_column_ref.

*Get all the columns to make row editable

CALL METHOD lo_value->if_salv_wd_column_settings~get_columns

  RECEIVING

    value = lt_columns.

*Now loop the columns table and change the cell editor of a column

LOOP AT lt_columns INTO ls_columns.

  lr_column = ls_columns-r_column.

 

//// CALL YOUR CODE HERE WITH PROPER VALUES READING FROM LS_COLUMNS

ENDLOOP.

Hope this helps-

Thanks-

Abhishek