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.
But for AdHoc Queries the line IF lr_data_descr IS NOT BOUND. is true and ev_result_json is empty.
What could be the reason for this?
The name of the report is AQZZZMM=========ZME80FN=======.
The method
cl_salv_bs_runtime_info=>get_data_refprovides data only if in your precedentSUBMITcall 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 methodcl_salv_bs_runtime_info=>setbeforehand).cl_salv_bs_runtime_info=>get_data_refwill give you no data.cl_salv_bs_runtime_info=>get_data_refwill give you no data.cl_salv_bs_runtime_info=>get_data_refwill retrieve the data from the last displayed ALV grid control (the last grid for which the methodSET_TABLE_FOR_FIRST_DISPLAYhas been called).