Using a select option range variable in a selection has a limitation. It adds to the size of the select option statement, which can cause the DBIF_RSQL_INVALID_RSQL
dump. Specifically for "The maximum size of an SQL statement was exceeded" So how could that be done ? Simply put too many lines in a range variabele, by e.g. uploading values from a file or calling the statement with a range variabele that was automatically composed.
A range variable or select options variable can be defined on the report selection screen or directly in a data definition. It holds selection information in the form of Sign, Option, Low and High value sets. Here's an example report that demonstrates the dump.
REPORT ZABAPCADABRA_SELOP_DUMPDEMO. data: lt_mara type standard table of matnr, gr_matnr type range of mara-matnr. * The range variable is set up to hold 10.000 article numbers do 10000 times. append 'IEQ' to gr_matnr. enddo. *select matnr from mara into table lt_mara * where matnr IN gr_matnr and <== Will cause DUMP * lvorm = space. select matnr from mara into table lt_mara for all entries in gr_matnr where matnr = gr_matnr-low and lvorm = space.
The root cause here is the simple fact that there is a limit to the total length of an SQL select instruction, and using select options will consume this limited bit of resource with every line that is passed to it. It can handle nearly 10.000 lines, so not a limitation that would be met easily, but in an automated fashion: sure
This is effectively a dump that could be caused by an end user with any report. Can it be caught ? Sure it can. The dump comes with exception CX_SY_OPEN_SQL_DB
so apply this to your coding to close the door to dumps:
TRY. select matnr from mara into table lt_mara where matnr IN gr_matnr and lvorm = space. CATCH cx_sy_open_sql_db. MESSAGE 'TOOOOOOOO MUCH ! Really, behave now.. ' TYPE 'I'. ENDTRY.