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.
但在其中一种情况下,它通过 RFC 调用并抛出
But in one of the cases it is called through RFC and throws
lr_data_descr 未绑定
lr_data_descr is NOT BOUND
它通过 SE37 工作正常,但如果通过 RFC 执行会抛出错误,尽管我对 RFC 和 SE37 使用了相同的用户(类型服务"),相同的输入和相同的代码.
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.
为什么会有不同?有没有办法得到一些错误信息?
Why is there a difference? Is there a way to get some error message?
如果我能找到它不受约束的原因,这真的很有帮助.我调试到 get_data_ref() 并发现此行的行为不同:
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:
import t_component to lt_component from memory id
cl_salv_bs_runtime_info=>c_memid_data_def.
if sy-subrc eq 0.
如果我在se37中测试功能模块则sy-subrc
为0,如果我用同一个用户进行外部调试则sy-subrc
为4.
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.
这是一个临时报告,它的名字是AQZZZMM==========ZME80FN========
It is an adhoc report, its name is AQZZZMM=========ZME80FN=======
推荐答案
cl_salv_bs_runtime_info=>get_data_ref()
的 r_data_line_descr
未绑定的唯一情况是:
The only case where r_data_line_descr
of cl_salv_bs_runtime_info=>get_data_ref()
is not bound is:
- 未调用 ALV
对于SAPquery查询,它发生在没有提取数据时(在查询程序中,变量%runmode-show_on
在没有数据时为空,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).
因此,您的问题可能是由于您的 pyRFC 程序传递的选择值与空无对应.当您从 SAP 调用查询时,这些值不同并返回一些数据(通过调试检查以验证哪些值不同).
So, your issue is probably due to selection values passed by your pyRFC program which correspond to nothing. 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).
这篇关于CL_SALV_BS_RUNTIME_INFO 通过 RFC 返回空引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!