简体   繁体   English

CL_SALV_BS_RUNTIME_INFO 通过 RFC 返回空引用

[英]CL_SALV_BS_RUNTIME_INFO returns empty reference via RFC

This code has been working nicely for several months now:这段代码几个月来一直运行良好:

SUBMIT (IV_REPORT_NAME)
   WITH SELECTION-TABLE selection_table
   USING SELECTION-SET IV_SELECTION_SET_VARIANT
AND RETURN.

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( 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 in one of the cases it is called through RFC and throws但在其中一种情况下,它通过 RFC 调用并抛出

lr_data_descr is NOT BOUND lr_data_descr 未绑定

It works fine via SE37, but if executed via RFC throws the error despite I use the very same user (type "service") for RFC and SE37, same input and same code.它通过 SE37 工作正常,但如果通过 RFC 执行会抛出错误,尽管我对 RFC 和 SE37 使用完全相同的用户(类型“服务”)、相同的输入和相同的代码。

Why is there a difference?为什么会有差异? Is there a way to get some error message?有没有办法得到一些错误信息?

This would really help, if I could get the reason why it is not bound.如果我能找到它不受约束的原因,这真的很有帮助。 I debugged into get_data_ref() and found out this line behaves different:我调试了 get_data_ref() 并发现这一行的行为不同:

import t_component to lt_component from memory id
cl_salv_bs_runtime_info=>c_memid_data_def.
if sy-subrc eq 0.

If I test the function module in se37 then sy-subrc is 0, and if I do external debugging with the same user then sy-subrc is 4.如果我在se37测试功能模块那么sy-subrc就是0,如果我用同一个用户进行外部调试那么sy-subrc就是4。

It is an adhoc report, its name is AQZZZMM=========ZME80FN=======这是一个临时报告,它的名字是AQZZZMM=========ZME80FN=======

The only case where r_data_line_descr of cl_salv_bs_runtime_info=>get_data_ref() is not bound is:唯一没有绑定cl_salv_bs_runtime_info=>get_data_ref()r_data_line_descr的情况是:

  • The ALV is not called不调用 ALV

With SAPquery queries, it happens when no data is extracted (in the query program, the variable %runmode-show_on is empty when there's no data, the ALV is not shown, cf screenshot below).对于 SAPquery 查询,当没有数据被提取时会发生这种情况(在查询程序中,当没有数据时变量%runmode-show_on为空,ALV 未显示,请参见下面的屏幕截图)。

So, your issue is probably due to selection values passed by your pyRFC program which correspond to nothing.因此,您的问题可能是由于您的 pyRFC 程序传递的选择值不对应。 When you call the query from SAP, these values are different and return some data (check it by debug to verify which values are different).当您从 SAP 调用查询时,这些值不同并返回一些数据(通过调试检查以验证哪些值不同)。

在此处输入图像描述

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

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