Add/Change Column Name on Internal Table ALV

What I need is to add titles to these two columns (highlighted in yellow) and I don't know how to do that.

Columns without the titles

FORM display_alv. 
    DATA: gr_functions TYPE REF TO cl_salv_functions.
    DATA: gr_display TYPE REF TO cl_salv_display_settings.    
    DATA: gr_columns TYPE REF TO cl_salv_columns_table.    
    DATA: gr_column TYPE REF TO cl_salv_column_table.    
    DATA: gr_sorts TYPE REF TO cl_salv_sorts.    
    DATA: gr_agg TYPE REF TO cl_salv_aggregations.    
    DATA: gr_selections TYPE REF TO cl_salv_selections.
    gr_functions = alv->get_functions( ).    
    gr_functions->set_all( abap_true ).
    gr_display = alv->get_display_settings( ).    
    gr_display->set_striped_pattern( cl_salv_display_settings=>true ).    
    gr_display->set_list_header( 'Relatório RVs' ).
    gr_columns = alv->get_columns( ).    
    gr_columns->set_optimize( 'X' ).    
    gr_columns = alv->get_columns( ).
    gr_column ?= gr_columns->get_column( 'revenue' ).    
    gr_column->set_short_text( 'Revenue' ).    
    gr_column->set_medium_text( 'Revenue' ).
    alv->display( ).


  • The syntax for some of these ALV-methods are pretty finicky. I'm pretty sure that your code is right, except that revenue needs to be in all caps. See the example below:

    alv->get_columns( )->get_column( 'REVENUE' )->set_short_text( 'Revenue' ) ##NO_TEXT.
    alv->get_columns( )->get_column( 'REVENUE' )->set_medium_text( 'Revenue' ) ##NO_TEXT.
    alv->get_columns( )->get_column( 'REVENUE' )->set_long_text( 'Revenue' ) ##NO_TEXT.