There are situations when you need to run a report program and get its result list and display (or process if you need). This article helps you to achieve that.
At first, we are going to create a simple report with a selection
screen. The selection screen will be having a single input
which gets an integer. Once executed the numbers are generated from
1 upto the
end_val as the result.
Now we are going to create a report which runs this report program and
gets the result list in an internal table and writes it again on
its output using
SUBMIT command and
SUBMIT command has a vareity of options of which we are going to
use the following structure
SUBMIT <report_name> WITH SELECTION-TABLE <rspar_tab> EXPORTING LIST TO MEMORY AND RETURN.
EXPORTING LIST TO MEMORY phrase makes sure once the report is executed
the result is kept in a buffer which can be obtained by using the function
Now the selection screen data has to be passed to the
SUBMIT command through
a table of structure
|SELNAME||Name of the selection screen parameter|
|KIND||Pass value 'P' if parameter,'S' if select options|
|SIGN||'I' to include, 'E' to exclude (for select options only)|
|OPTION||Select option values such as 'EQ', 'BT', etc.|
|LOW||Selection Value (for parameter, pass the value here)|
|HIGH||Selection Value high|
RSPARAMS has 45 character length for
HIGH values. If you
need longer character length then use
LIST_FROM_MEMORY function module returns the output list in a table
ABAPLIST. This can be passed to
module which will print the result report of the called program in the
output of the current program.