简体   繁体   English

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.

But for AdHoc Queries the line IF lr_data_descr IS NOT BOUND.但是对于 AdHoc 查询, IF lr_data_descr IS NOT BOUND.该行IF lr_data_descr IS NOT BOUND. is true and ev_result_json is empty.为真且ev_result_json为空。

What could be the reason for this?这可能是什么原因?

The name of the report is AQZZZMM=========ZME80FN======= .报告的名称是AQZZZMM=========ZME80FN=======

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).方法cl_salv_bs_runtime_info=>get_data_ref仅当在您的先例SUBMIT调用中调用了 ALV 网格控件时才提供数据,并且之前已请求写入数据(在内部由提交的报告,或显式地,通过调用方法cl_salv_bs_runtime_info=>set预先cl_salv_bs_runtime_info=>set )。

  • There are reports which don't call an ALV grid at all: for these, the method won't provide any result data.有些报告根本不调用 ALV 网格:对于这些,该方法不会提供任何结果数据。
  • 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.有一些报告(如 ABAP 查询),用户可以自己决定如何显示数据 - 使用 ALV 网格控件,或作为 ALV 列表,或作为经典列表,甚至以其他方式。 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.如果用户选择了除“ALV 网格”之外的其他显示方法,则方法cl_salv_bs_runtime_info=>get_data_ref将不会给您任何数据。
  • 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.可能会发生基本上应该显示 ALV 网格的报告,如果它没有选择任何结果数据,则不显示网格。 In these cases, the method cl_salv_bs_runtime_info=>get_data_ref will give you no data.在这些情况下,方法cl_salv_bs_runtime_info=>get_data_ref不会给你任何数据。
  • There are reports which display not one but several ALV grid controls at once, with different data.有一些报告同时显示多个 ALV 网格控件,而不是一个,并且具有不同的数据。 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 method SET_TABLE_FOR_FIRST_DISPLAY has been called).在这种情况下,方法cl_salv_bs_runtime_info=>get_data_ref将从最后显示的 ALV 网格控件(已调用方法SET_TABLE_FOR_FIRST_DISPLAY的最后一个网格)检索数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM