SAP Tutorials Blog

*&------------------------------------------------------------*
*& 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).

Serkan AKKAVAK
Computer Engineer BSc
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com