Copyright 2024 - BV TallVision IT

When a (any) report is called, information about the actual call can be picked up from your report with function module RS_SUBMIT_INFO.. Was the report started via the selection screen or maybe as a background job ? Is the EXPORT LIST TO MEMORY option used ? Is web-reporting active ?

Or would you like to report the values that were entered on the report selection screen ? There's functionality available for that too...

Detailed info on your Report call

The RS_SUBMIT_INFO module returns a set of variables as listed here:

MODE_NORML	Normal SUBMIT
MODE_VARI	SUBMIT for variant maintenance
MODE_JOB	SUBMIT for job scheduling
VIA_SELSCR	SUBMIT VIA SELECTION-SCREEN
LIST_2_MEM	SUBMIT: X: ... EXPORTING LIST TO MEMORY
WWW_ACTIVE	Web Reporting is active
SELS_HIDDN	Invisible objects hidden (start with variant)
SELPARNAME	ABAP/4: Name of SELECT-OPTION / PARAMETER
MODE_CALLD	ABAP Program Call Mode

Which parameters and select-options have been used (ready to report)

Function module PRINT_SELECTIONS will prepare that for you, information in an internal table, ready to be output with the WRITE statement. The type of the INFOTAB is a bit tricky to determine, just check the example below. A ready-to-be reported internal table is passed back, which looks something like this:

-------------------------------------------------------------------------------
|   Program selections            ZHRI_OUTBOUND_INTERFACE_                    |
|   Date      07.07.2015          Time       11:19:51                         |
-------------------------------------------------------------------------------
--Objects for selection screen 1000--------------------------------------------
| Receiving partner                                                           |
|                                     0000XI09                                |
| Max. nr. of segments in Idoc                                                |
|                                     001000                                  |
| Hiring                                                                      |
|               Single Value          01                                      |
|    or         Single Value          08                                      |
|    or         Single Value          93                                      |
|    or         Single Value          CV                                      |
| Rehire                                                                      |
|               Single Value          12                                      |

The FLAG field indicates H - for header lines (in example above --Objects for selection screen.... ) and D for the date/time line (3rd line from the top). A coding example that could be inserted after the START-OF-SELECTION:

END-OF-SELECTION.

types: begin of ty_infotab,
         FLAG,
         OLENGTH TYPE X,
         LINE  LIKE RSVAR-INFOLINE,
       end of ty_infotab.
data: lt_infotab type STANDARD TABLE OF ty_infotab.

CALL FUNCTION 'PRINT_SELECTIONS'
  EXPORTING
    MODE            = SPACE
    RNAME           = SY-REPID
    RVARIANTE       = SY-SLSET
  TABLES
    INFOTAB         = lt_infotab.

Make sure you note this one too: RS_REPORTSELECTIONS_INFO, returns information about the selection parameters on your report. That's names of the parameter (or select option) fields along with default values. These default values are not updated with the values your end user has just supplied though ! Beware. 

Which parameters and select-options have been used (internally)

Function module RS_REFRESH_FROM_SELECTOPTIONS returns a list of selection data information for your report, as value-sets (structure RSPARAM). Consider the following example: a test report is created with only 2 fields, a parameter field and a select-option field.

REPORT ZABAPCADABRA_REPORT_PARS.

tables: mara. "Selection-screen purpose only

parameters: p1 type c length 4 default 'QW'.
select-options: s1 for mara-matnr.

data: gt_rsparams type standard table of rsparams.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
  EXPORTING
    CURR_REPORT               = sy-repid
  TABLES
    SELECTION_TABLE           = gt_RSPARAMS.

The selection screen will show 2 selection fields, for the select option field a few values are entered and the report is run (the last statement on the report is in fact a BREAK-POINT so the content of GT_RSPARAMS can be viewed in the debugger). The output as shown in the debugger:

Row     Selname Kind    Sign    Option  Low     High
1	P1	P			QW
2	S1	S	I	EQ	HELLO
3	S1	S	I	EQ	LOVELY
4	S1	S	I	EQ	WORLD
5	S1	S	E	BT	Y	Z

Notice the function module also caters for large parameter values, for this the parameter SELECTION_TABLE_255 can be used. Another nice feature of this module is the fact that the actual parameter names can be specified, so when you are using this on a large report and it's only a few parameters you would like to log, this can be specified with parameter SP

Selection screen settings for the Business Application log

The downloadable - ready to run - example code holds a local class that can be used to compose the list of progress messages and errors for your e.g. interface report. The messages can be displayed or saved and selection screen parameter settings can be made part of the logging, all in under 200 lines of ready-to-use coding. Check it out !

.