cl_salv_bs_runtime_info => get_data_ref()不返回任何数据 [英] cl_salv_bs_runtime_info=>get_data_ref() returns no data

查看:308
本文介绍了cl_salv_bs_runtime_info => get_data_ref()不返回任何数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这段代码,它对很多报告都非常有用:

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查询,如果lr_data_descr没有绑定,则行为真, 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 =>已设置)。

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 method SET_TABLE_FOR_FIRST_DISPLAY has been called).

这篇关于cl_salv_bs_runtime_info =&gt; get_data_ref()不返回任何数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆