cl_salv_bs_runtime_info=>get_data_ref() 不返回数据 [英] cl_salv_bs_runtime_info=>get_data_ref() returns no data
问题描述
我有这个代码,它适用于很多报告:
I have this code, which works very nice for a lot of reports:
if IV_SELECTION_SET_VARIANT is INITIAL.
SUBMIT (IV_REPORT_NAME)
WITH SELECTION-TABLE selection_table
AND RETURN.
ELSE.
SUBMIT (IV_REPORT_NAME)
WITH SELECTION-TABLE selection_table
USING SELECTION-SET IV_SELECTION_SET_VARIANT
AND RETURN.
endif.
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.
DATA lr_data_descr TYPE REF TO cl_abap_datadescr.
DATA lr_data_line_descr TYPE REF TO cl_abap_datadescr.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data_descr = lr_data_descr
r_data_line_descr = lr_data_line_descr ).
IF lr_data_descr IS NOT BOUND.
ev_result_json = '[]'.
EXIT.
ENDIF.
但对于 AdHoc 查询,行 IF lr_data_descr IS NOT BOUND.
为真,ev_result_json
为空.
But for AdHoc Queries the line IF lr_data_descr IS NOT BOUND.
is true and ev_result_json
is empty.
这可能是什么原因?
报告名称为AQZZZMM==========ZME80FN========
.
推荐答案
cl_salv_bs_runtime_info=>get_data_ref
方法仅在您的先例 SUBMIT
调用 ALV 网格时才提供数据控件已被调用,并且之前已请求写入数据(通过提交的报告在内部,或通过预先调用方法 cl_salv_bs_runtime_info=>set
显式).
The method cl_salv_bs_runtime_info=>get_data_ref
provides data only if in your precedent SUBMIT
call an ALV grid control had been called, and the writing of the data has been requested before (internally by the submitted report, or explicitly, by calling the method cl_salv_bs_runtime_info=>set
beforehand).
- 有些报告根本不调用 ALV 网格:对于这些,该方法不会提供任何结果数据.
- 有一些报告(如 ABAP 查询),用户可以自己决定如何显示数据 - 使用 ALV 网格控件,或作为 ALV 列表,或作为经典列表,甚至以其他方式.如果用户选择了ALV 网格"以外的其他显示方法,则方法
cl_salv_bs_runtime_info=>get_data_ref
将不会给您任何数据. - 如果报告没有选择任何结果数据,则可能会发生基本上应该显示 ALV 网格的报告不显示网格.在这些情况下,方法
cl_salv_bs_runtime_info=>get_data_ref
不会给你任何数据. - 有些报告一次显示多个 ALV 网格控件而不是一个,具有不同的数据.在这种情况下,方法
cl_salv_bs_runtime_info=>get_data_ref
将从最后显示的 ALV 网格控件(已调用方法SET_TABLE_FOR_FIRST_DISPLAY
的最后一个网格)检索数据.
- There are reports which don't call an ALV grid at all: for these, the method won't provide any result data.
- There are reports (like ABAP queries) where the user himself can determine how to display the data - with an ALV grid control, or as ALV list, or as classical list or even in some other way. If the user chose some other display method than "ALV grid", the method
cl_salv_bs_runtime_info=>get_data_ref
will give you no data. - It may happen that a report which basically should display an ALV grid, doesn't display the grid if it did not select any result data. In these cases, the method
cl_salv_bs_runtime_info=>get_data_ref
will give you no data. - There are reports which display not one but several ALV grid controls at once, with different data. In this case, the method
cl_salv_bs_runtime_info=>get_data_ref
will retrieve the data from the last displayed ALV grid control (the last grid for which the methodSET_TABLE_FOR_FIRST_DISPLAY
has been called).
这篇关于cl_salv_bs_runtime_info=>get_data_ref() 不返回数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!