目前我的程序写出的结果,但我希望我可以输出到一个ALV列表。我可以使用reuse_alv_list_display
函数吗?
REPORT Z_TRANSFORMER_TOOL_BATCH.
TABLES zfit_map_account.
TYPES: BEGIN OF t_account,
saknr TYPE saknr,
txt20 TYPE txt20,
zznew TYPE new_saknr,
ntx20 TYPE zntx20,
END OF t_account.
DATA: gwa_account TYPE t_account.
DATA: gt_account TYPE TABLE OF t_account.
SELECT saknr txt20 zznew ntx20
FROM zfit_map_account
INTO gwa_account
WHERE zznew = '1010101998'.
APPEND gwa_account TO gt_account.
ENDSELECT.
Loop at gt_account INTO gwa_account.
Write :/ gwa_account-saknr, gwa_account-txt20, gwa_account-zznew, gwa_account-ntx20.
ENDLOOP.
一个简单的方法是使用cl_salv_table类。你可以这样做来替换整个循环部分
DATA alv TYPE REF TO cl_salv_table.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = alv
CHANGING
t_table = gt_account ).
CATCH cx_salv_msg INTO message.
" handle error
ENDTRY.
alv->display( ).