[英]Why values are not displayed for some columns of an ALV List?
I am trying to create an ALV report with list display but some of the contents are not displaying in the output list.我正在尝试创建带有列表显示的 ALV 报告,但某些内容未显示在输出列表中。 I created a classical report and an ALV report with grid display and I was successful.我创建了一个经典报告和一个带有网格显示的 ALV 报告,我成功了。 But this list display is creating a problem.但是这个列表显示产生了问题。
I've included the REUSE_ALV_LIST_DISPLAY
function, with the right internal table name.我已经包含了REUSE_ALV_LIST_DISPLAY
函数和正确的内部表名。 I've debugged and all my data is coming in the final internal table correctly but it is not displaying in output list:我已经调试并且我的所有数据都正确地进入了最终的内部表,但它没有显示在输出列表中:
Here is my code (note that the flight demo data is to be generated via the program SAPBC_DATA_GENERATOR
, once):这是我的代码(请注意,飞行演示数据将通过程序SAPBC_DATA_GENERATOR
生成一次):
REPORT ztest.
SELECT scarr~carrid, spfli~connid
FROM scarr INNER JOIN spfli ON scarr~carrid = spfli~carrid
INTO TABLE @DATA(it_f).
DATA(it_fcat) = VALUE slis_t_fieldcat_alv(
( tabname = 'SCARR'
fieldname = 'CARRID'
seltext_l = 'Carrier code'
col_pos = 1
outputlen = 20 )
( tabname = 'SPFLI'
fieldname = 'CONNID'
seltext_l = 'Connection ID'
col_pos = 2
outputlen = 20 ) ).
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = it_fcat
TABLES
t_outtab = it_f.
In a simple ALV table, you don't have to fill the component TABNAME
of the field catalog.在简单的 ALV 表中,不必填写字段目录的组件TABNAME
。 TABNAME
is only needed for the hierarchical-sequential lists (function module REUSE_ALV_HIERSEQ_LIST_DISPLAY
for instance) which are an output of two tables. TABNAME
仅用于作为两个表的输出的分层顺序列表(例如功能模块REUSE_ALV_HIERSEQ_LIST_DISPLAY
)。
If you omit it, or if you give the same value (any value) for all columns, you will get a correct output:如果您省略它,或者如果您为所有列提供相同的值(任何值),您将获得正确的输出:
Code with the correction:带有更正的代码:
SELECT scarr~carrid, spfli~connid
FROM scarr INNER JOIN spfli ON scarr~carrid = spfli~carrid
INTO TABLE @DATA(it_f).
DATA(it_fcat) = VALUE slis_t_fieldcat_alv(
( " do not fill TABNAME // tabname = 'SCARR'
fieldname = 'CARRID'
seltext_l = 'Carrier code'
col_pos = 1
outputlen = 20 )
( " do not fill TABNAME // tabname = 'SPFLI'
fieldname = 'CONNID'
seltext_l = 'Connection ID'
col_pos = 2
outputlen = 20 ) ).
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = it_fcat
TABLES
t_outtab = it_f.
EDIT: I see that you two already solved the problem in comments.编辑:我看到你们两个已经在评论中解决了这个问题。
As Sandra wrote, you could try using cl_salv_table.正如 Sandra 所写,您可以尝试使用 cl_salv_table。 It should look like this:它应该是这样的:
cl_salv_table=>factory(
* EXPORTING
* list_display = if_salv_c_bool_sap=>true
* r_container =
* container_name =
IMPORTING
r_salv_table = DATA(lr_alv)
CHANGING
t_table = it_f
).
lr_alv->display( ).
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.