Why is r_data_line_descr of cl_salv_bs_runtime_info=>get_data_ref() not bound?

你说的曾经没有我的故事 提交于 2019-12-11 18:26:23

问题


I have this code, which has been working very nice for several months now:

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


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 one reports lr_data_descr is "NOT BOUND" if called via rfc.

It works if I run the function module via "test" in se80. But if I call it via rfc it is not bound. I use the very same user (type "service") for RFC and SE80.

With other words: Same input and same code. It works with normal debugging, but fails (not bound) with remote debugging.

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():

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.

If I test the function module in se80 sy-subrc is 0. If I do external debugging (same user), then sys-subrc is 4.

It is an adhoc report. It's name: AQZZZMM=========ZME80FN=======


回答1:


The only case where r_data_line_descr of cl_salv_bs_runtime_info=>get_data_ref() is not bound is:

  • The ALV is not called

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).

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).



来源:https://stackoverflow.com/questions/55845072/why-is-r-data-line-descr-of-cl-salv-bs-runtime-info-get-data-ref-not-bound

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!