1
votes

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

lr_data_descr is NOT BOUND

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?

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.

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.

It is an adhoc report, its name is AQZZZMM=========ZME80FN=======

1
SALV is tightly coupled with dialog processing. If you call the code by RFC, then there is no GUI connected to the server. Maybe this is the reason?Jagger
@Jagger. If I test it via se80 it runs non interactively and works. I have two questions: First: How to make debugging via se80 act like running without gui? Second question: Is there a way to provide a virtual GUI to pretend to have a GUI?guettli
Could put this function module of yours in a program and then start it in background (F9 instead of F8) to see whether it crashes (or delivers this empty json table)? Then one might be sure that the problem is with the process type dialog vs. background.Jagger
Could you try the RFC case by running it via SE37 with the same user and entering the RFC destination NONE (screen field above the parameters)? PS: a "service" user is dialog-capable, and the OP said he debugged both cases with the same user so I think it's not a user problem; moreover RFC is GUI-capable provided that you select it when you open the RFC connection (activated by default with SAP)Sandra Rossi
@SandraRossi other reports/programs work fine via pyRFC. Just these reports starting with AQ and containing a lot of === signs do not work.guettli

1 Answers

3
votes

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

enter image description here