本文介绍了内部表ALV上的添加/更改列名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我需要在这两列中添加标题(以黄色突出显示),我不知道该怎么做。

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

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( ).
ENDFORM.`


推荐答案

某些语法这些ALV方法中的一个非常挑剔。我非常确定您的代码正确,只是收入必须全部大写。参见下面的示例:

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.

这篇关于内部表ALV上的添加/更改列名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 19:54