2012 Nov 20 4:30 AM
Hi,
We have a alv report containing around 110 columns. We are able to display. But the column titles are coming from data dictionary. We want to modify the column titles of all 110 fields. How to set the total columns titles at the same time ?
regards
Janaki Ram
2012 Nov 20 4:42 AM
Hello
Please look the following code.
data: lo_column type ref to cl_salv_column.
data: lo_columns_item type ref to cl_salv_columns_table.
data: lo_column_item type ref to cl_salv_column_table.
try.
lo_columns = go_alv->get_columns( ).
lo_column = lo_columns->get_column( 'CURRENT_NAME' ).
lo_column->set_long_text( 'NEW_NAME' ).
*repeat above code for all the columns
catch cx_salv_not_found. "#EC NO_HANDLER
endtry.
Better to make smal subroutine and pass the current name and new name of column ,
Also see the standard program like SALV_DEMO_TABLE_LAYOUT
Thanks
Sandeep
2012 Nov 20 7:01 AM
Just read the documentation of the class or some googling with simple keywords to find SAP documents like Change of DDIC Reference for a Column, Column Header or Sorting by Columns in Columns (General) of ALV Object Model.
Regards,
Raymond