通过GUI调用的分层ALV报告有18列,但通过RFC只有6列.为什么



我想导出报告RM07MLBS(tcode mb52(。如果我通过SAP-GUI调用这个报告,它有18列,如果我用以下代码调用它,它只返回maktx, werks, matkl, matnr, name1, mtart列:

cl_salv_bs_runtime_info=>set(
EXPORTING
display  = abap_false
metadata = abap_false
data     = abap_true
).
SUBMIT (IV_REPORT_NAME)
WITH SELECTION-TABLE selection_table
AND RETURN.
DATA: lo_data TYPE REF TO data.
cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = lo_data ).
IF lo_data IS NOT BOUND.
ev_result_json = '[]'.
EXIT.
ENDIF.
field-SYMBOLS <lv_data> type any table.
ASSIGN lo_data->* TO <lv_data>.
ev_result_json = /ui2/cl_json=>serialize( data = <lv_data> pretty_name = /ui2/cl_json=>pretty_mode-low_case ).
cl_salv_bs_runtime_info=>clear_all( ).

如何获取所有列?

用户JozsefSzikszai向我提供了解决此问题所需的提示。

通过这种方式,我可以从分层ALV 中读取所有列

SUBMIT (IV_REPORT_NAME)
WITH SELECTION-TABLE selection_table
AND RETURN.
FIELD-SYMBOLS <lt_data>             TYPE ANY TABLE.
FIELD-SYMBOLS <lt_data_line>        TYPE ANY TABLE.
DATA          lr_data               TYPE REF TO data.
DATA          lr_data_line          TYPE REF TO data.
cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data_descr      = DATA(lr_data_descr)
r_data_line_descr = DATA(lr_data_line_descr) ).
CREATE DATA lr_data         TYPE HANDLE lr_data_descr.
CREATE DATA lr_data_line    TYPE HANDLE lr_data_line_descr.
ASSIGN lr_data->*           TO <lt_data>.
ASSIGN lr_data_line->*      TO <lt_data_line>.
cl_salv_bs_runtime_info=>get_data(
IMPORTING
t_data      = <lt_data>
t_data_line = <lt_data_line>
).
IF <lt_data> IS INITIAL.
ev_result_json = '[]'.
EXIT.
ENDIF.
ev_result_json = /ui2/cl_json=>serialize( data = <lt_data_line> pretty_name = /ui2/cl_json=>pretty_mode-low_case ).
cl_salv_bs_runtime_info=>clear_all( ).
ENDFUNCTION.

欢迎反馈和提示如何改进这一点。

相关内容

  • 没有找到相关文章

最新更新