ABAP report to display all the selection screen fields and any values input by the user

The following ABAP code uses SAP function module RS_REFRESH_FROM_SELECTOPTIONS to capture and display a formated report of all the report selection screen fields (select-options, parameters) and any values that have been input by user.

The report also shows how to use the WRITE statement to draw lines around a report and change the color of the background.

*&------------------------------------------------------------*
*& Report  ZREPORT_SELSCREEN                                  *
*&                                                            *
*&------------------------------------------------------------*
*&                                                            *
*& Demonstrate FM 'RS_REFRESH_FROM_SELECTOPTIONS'             *
*& ..............................................             *
*&                                                            *
*& Capture and display selection screen and values input      *
*& by user                                                    *
*&------------------------------------------------------------* 
REPORT  ZREPORT_SELSCREEN  no standard page heading.
*Data Declaration
************************************************************************
TABLES: ekpo.
DATA: it_seltab TYPE TABLE OF rsparams,
      wa_seltab  TYPE rsparams.
*Selection screen
************************************************************************
SELECT-OPTIONS:so_ebeln FOR ekpo-ebeln.
PARAMETERS:p_ebelp TYPE ekpo-ebelp.
PARAMETERS:p_aedat TYPE ekpo-aedat.
************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
  EXPORTING
    CURR_REPORT               = sy-repid
*    IMPORTING
*    SP                        =
  TABLES
    SELECTION_TABLE           = it_seltab[]
*   SELECTION_TABLE_255       =
 EXCEPTIONS
   NOT_FOUND                 = 1
   NO_REPORT                 = 2
   OTHERS                    = 3.
IF SY-SUBRC EQ 0.
* Implement suitable error handling here
  SORT it_seltab BY kind.
  WRITE:/ 'Selection screen Select-Options'.
  WRITE:/ '-------------------------------'.
  WRITE:/ sy-uline(101).
  FORMAT COLOR COL_HEADING.
  WRITE:/   sy-vline,
     (10) 'NAME', sy-vline,
     (5)  'Sign' , sy-vline,
     (10) 'Option', sy-vline,
     (30) 'Low', sy-vline,
     (30) 'High', sy-vline.
  FORMAT COLOR COL_NORMAL.
  WRITE: sy-uline(101).
  LOOP AT it_seltab INTO wa_seltab WHERE kind = 'S'.
    WRITE:/    sy-vline,
        (10) wa_seltab-selname , sy-vline,
        (5)  wa_seltab-sign , sy-vline,
        (10) wa_seltab-option, sy-vline,
        (30) wa_seltab-low, sy-vline,
        (30) wa_seltab-high, sy-vline.
  ENDLOOP.
  FORMAT COLOR COL_BACKGROUND.
  WRITE: sy-uline(101).
  SKIP 2.
  WRITE:/ 'Selection Screen Parameters'.
  WRITE:/ '---------------------------'.
  WRITE:/ sy-uline(22).
  WRITE:/   sy-vline,
       (10) 'Name' COLOR COL_HEADING, sy-vline,
       (5)  'Value' COLOR COL_HEADING, sy-vline.
  WRITE:/ sy-uline(22).
  LOOP AT it_seltab INTO wa_seltab WHERE kind = 'P'.
    WRITE:/    sy-vline,
          (10) wa_seltab-selname COLOR COL_NORMAL, sy-vline,
          (5)  wa_seltab-low COLOR COL_NORMAL, sy-vline.
  ENDLOOP.
  WRITE:/ sy-uline(22).






Colours available via the COLOR statement used in the ABAP code above:

COL_BACKGROUND
COL_HEADING
COL_NORMAL
COL_TOTAL
COL_KEY
COL_POSITIVE
COL_NEGATIVE
COL_GROUP


Related Articles

SAP ALV Reports - ABAP or Advanced List Viewer reports
ALV grid reports using the object methods functionality
ALV TREE Example ABAP code and information for creating ALV tree based reports
SAP Dynamic documents in ABAP objects
SAP dynamic document example screens
ABAP report Progress indicator - When added also Stops report timeout
SAP progress indicator bar to count number of records processed within ABAP report and stop timeout
SAP percentage complete progress indicator bar for your ABAP reports
Prevent ABAP report timeout by Reseting the SAP runtime value using TH_REDISPATCH
ABAP Reporting - Example code and information on various areas of ABAP reporting
ABAP Automatic refresh report to retrieve real time live data from SAP database
Automatic Refresh Report - periodically refreshes results
Capture ABAP report using WRITE statement to internal table with SAP
Write report straight to printer
Convert Spool request to PDF and send as e-mail
Convert Spool request to PDF and send as e-mail
Execute ABAP Report using the SUBMIT statement