Sunday, April 16, 2017

Changing Column Names in ALV Display using SALV model (LIST or GRID display)

Data  : alv_table_obj   TYPE REF TO cl_salv_table,
     obj_columns TYPE REF TO cl_salv_columns_table,
     obj_single_column TYPE REF TO cl_salv_column.

CALL METHOD cl_salv_table=>factory
        IMPORTING
          r_salv_table =  alv_table_obj  
        CHANGING
          t_table      = itab_final    "Internal table holding final data to display in report output


*to change the name of the column in ALV.  

obj_columns  =  alv_table_obj->get_columns().

    obj_single_column   =  obj_columns->get_column( 'CARRID' ).

   obj_single_column ->set_long_text ( 'Flight Name' ).

    obj_single_column ->set_medium_text ( 'Flight Name' ).

    obj_single_column ->set_short_text ( 'Flight' ).

obj_single_column->set_optimize().



alv_table_obj ->display( ).    "Method to display internal table  itab_final data as ALV Report(Either list or Grid                                                     based on the parameter value passed to FACTORY method)

No comments:

Post a Comment