Detect if report is a SAP query

767 Views Asked by At

I have an ABAP program which calls a report and converts its output to JSON.

Unfortunately this does not work for SAP Queries like described in this question.

How can I detect if a report is an SAP Query or not if have the name of the report as string. e.g. AQZZZMM=========ZME80FN=======

Up to now I called reports like this:

  SUBMIT (IV_REPORT_NAME)
     WITH SELECTION-TABLE selection_table
    AND RETURN.
1

There are 1 best solutions below

4
On BEST ANSWER

You can use the function module RSAQ_DECODE_REPORT_NAME, as in the following test report.

report zz_test_query_report.
parameters: p_repid type repid.
call function 'RSAQ_DECODE_REPORT_NAME'
  exporting
    reportname = p_repid
  exceptions
    no_query_report = 1.
if sy-subrc eq 0.
  write: / p_repid, 'is a query report'.
else.
  write: / p_repid, 'is not a query report'.
endif.