目前我的程序写出结果,但我希望我可以输出到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.
答案 0 :(得分:1)
一种简单的方法是使用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( ).