Selektionsbildschirm

www.4AP.de - alles über ABAP  -  Gestaltung des Selektionsbildschirmes

Beispielcoding: um die Gestaltung des Selektionsbildschirmes zu optimieren, vervollständigen (kopieren erlaubt aber auf eigene Gefahr :-))

 

*
* Coded by Thorsten Neubüser - www.4ap.de
*

* zwei Tabreiter mit getrenntem Inhalt

* Mit 2 Tabsprips
SELECTION-SCREEN BEGIN OF TABBED BLOCK tblk1 FOR 24 LINES.

SELECTION-SCREEN TAB (20)       tabstrp1
                 USER-COMMAND   ucomm1
                 DEFAULT SCREEN 1010.

SELECTION-SCREEN TAB (50)       tabstrp2
                 USER-COMMAND   ucomm2
                 DEFAULT SCREEN 1020.

SELECTION-SCREEN END OF BLOCK tblk1.

* 1. Tabstrip mit den 'eigentlichen' Auswahlfeldern
SELECTION-SCREEN BEGIN OF SCREEN 1010 AS SUBSCREEN.

* 1.1 Allgemeine Auswahlparameter
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
* ... Berichtszeitraum
SELECT-OPTIONS: s_datum  FOR z005sel-datum
                         OBLIGATORY
                         NO-EXTENSION.

SELECTION-SCREEN END OF BLOCK blk1.

SELECTION-SCREEN END OF SCREEN 1010.

 

* 2. Tabstrip mit den zusätzlichen Auswahlfeldern, die
*    nur für die Testphase gebraucht werden
SELECTION-SCREEN BEGIN OF SCREEN 1020 AS SUBSCREEN.

* selektiere was du willst :-))

SELECTION-SCREEN END OF SCREEN 1020.

~~~~~~~~~~~~~~~~~~

* 'ausblenden' von Selektionsoptionen
SELECT-OPTIONS:
  s_postp for t_daten-postp MODIF ID sel.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    if  screen-name = 'S_POSTP-LOW'
      or screen-name = 'S_POSTP-HIGH'.
        screen-input = '0'.
        MODIFY SCREEN.
    endif. " screen-name = S_BWART-LOW'
  ENDLOOP. " AT SCREEN

* auch mal die Hilfe zur Tabelle SCREEN lesen!

~~~~~~~~~~~~~~~~~~
*Status offen
PARAMETERS dy_ofn LIKE rihea-dy_ofn DEFAULT 'X'.
SELECTION-SCREEN COMMENT 3(11) text-101 FOR FIELD dy_ofn ID 101.


*Mit Kosten ausgeben? - Checkbox rechts!
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(24) text-008 FOR FIELD p_kost.
SELECTION-SCREEN POSITION pos_low.
PARAMETERS: p_kost AS CHECKBOX.
SELECTION-SCREEN END OF LINE .


*Partnerrolle-1 als Drop-Down-Box
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(31) text-005 FOR FIELD p_parvw1.
PARAMETERS  p_parvw1 LIKE ihpa-parvw AS LISTBOX VISIBLE LENGTH 22.
SELECTION-SCREEN END OF LINE.


~~~~~~~~~~~~~~~~~~

* Mehrere Reitertabs
selection-screen begin of tabbed block all for 22 lines.
selection-screen tab (20) sopt user-command 'SOPT' default screen 100.
selection-screen tab (20) spar user-command 'SPAR' default screen 200.
selection-screen tab (15) apar user-command 'APAR' default screen 300.
selection-screen tab (15) sort user-command 'SORT' default screen 400.
selection-screen tab (15) avar user-command 'AVAR' default screen 500.
selection-screen end of block all.

selection-screen begin of screen 100 as subscreen.
selection-screen begin of block sel with frame title text-001.
selection-screen skip.
select-options:
  s_kunnr for wa_result-kunnr, " Kundennummer
  s_spart for wa_result-spart. " Sparte
selection-screen end of block sel.
selection-screen end of screen 100.
*
selection-screen begin of screen 200 as subscreen.
selection-screen begin of block pars with frame title text-012.
selection-screen skip.
* Liferstatus
selection-screen begin of line.
selection-screen comment (20) for field p_lfgsa.
selection-screen position pos_low.
parameters: p_lfgsa type zzlsstat.
selection-screen end of line.
selection-screen end of block pars.
selection-screen end of screen 200.

* usw.


~~~~~~~~~~~~~~~~~~


* 4 Parameter in einer Zeile
SELECTION-SCREEN BEGIN OF LINE. "Bedarfsvorlaufkennzeichen
SELECTION-SCREEN COMMENT 1(25) text-004.
SELECTION-SCREEN POSITION 31.
PARAMETERS: p_shflgo AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN POSITION 38.
PARAMETERS: p_shflga(3).
SELECTION-SCREEN COMMENT 43(7) text-005.
PARAMETERS: p_shflgn(3). "  like marc-shflg.
SELECTION-SCREEN POSITION 59.
PARAMETERS: p_shflgd AS CHECKBOX.
SELECTION-SCREEN END OF LINE.

* 4 Checkboxen in einer Zeile
SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME TITLE text-004.
SELECTION-SCREEN BEGIN OF LINE.
*Status offen
PARAMETERS dy_ofn LIKE rihea-dy_ofn DEFAULT 'X'.
SELECTION-SCREEN COMMENT 3(11) text-101 FOR FIELD dy_ofn ID 101.
*Status zurückgemeldet
PARAMETERS dy_rst LIKE rihea-dy_rst DEFAULT 'X'.
SELECTION-SCREEN COMMENT 16(10) text-102 FOR FIELD dy_rst ID 102.
*Status in Arbeit
PARAMETERS dy_iar LIKE rihea-dy_iar DEFAULT 'X'.
SELECTION-SCREEN COMMENT 29(10) text-103 FOR FIELD dy_iar ID 103.
*Status abgeschlossen
PARAMETERS dy_mab LIKE rihea-dy_mab DEFAULT 'X'.
SELECTION-SCREEN COMMENT 42(10) text-104 FOR FIELD dy_mab ID 104.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK block0.



~~~~~~~~~~~~~~~~~~

* Selektionsvariante sichern
AT SELECTION-SCREEN.
  data:
    h_repid LIKE sy-repid.
    seltab TYPE TABLE OF rsparams WITH HEADER LINE.
  h_repid = sy-repid.
* Selektionsvariante für Protokollierung sichern
  IF sy-ucomm EQ 'ONLI'.
    REFRESH seltab.
    CLEAR seltab.
*   selektionen lesen und merken
    CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
         EXPORTING
              curr_report     = h_repid
         TABLES
              selection_table = seltab.
  ENDIF. " sy-ucomm eq 'ONLI'

~~~~~~~~~~~~~~~~~~

* Einzel-Parameter nicht eingabebereit machen
AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-name = 'P_BLANK'.
      screen-input = '0'.
      MODIFY SCREEN.
    ENDIF. " screen-name = 'P_BLANK'
  ENDLOOP. " AT SCREEN

~~~~~~~~~~~~~~~~~~

*Umschalten / Toggle mit Radiobutton

SELECTION-SCREEN BEGIN OF BLOCK block_3 WITH FRAME TITLE text-004.
PARAMETER:
  pa_ohne RADIOBUTTON GROUP net USER-COMMAND radio,
  pa_mit RADIOBUTTON GROUP net DEFAULT 'X'.
SELECT-OPTIONS:
  so_matnr FOR gs_daten-matnr.
SELECTION-SCREEN END OF BLOCK block_3.


AT SELECTION-SCREEN OUTPUT.
  loop at SCREEN.
    if    screen-name = 'SO_MATNR-LOW'
       or screen-name = 'SO_MATNR-HIGH'.
      if pa_ohne = 'X'.
        screen-input = '0'.
        modify screen.
      endif.
    endif.
  ENDLOOP.

~~~~~~~~~~~~~~~~~~

* Selektionsbildschirm mit mehreren Tabs

selection-screen begin of tabbed block all for 24 lines.
selection-screen tab (20) sopt user-command 'SOPT' default screen 100.
selection-screen tab (20) spar user-command 'SPAR' default screen 200.
selection-screen tab (15) apar user-command 'APAR' default screen 300.
selection-screen tab (15) sort user-command 'SORT' default screen 400.
selection-screen tab (15) avar user-command 'AVAR' default screen 500.
selection-screen end of block all.

* Registerblatt Selektionsoptionen
selection-screen begin of screen 100 as subscreen.
selection-screen begin of block sel with frame title text-001.
select-options:
  s_kunnr for wa_result-kunnr. " Kundennummer
selection-screen end of block sel.
selection-screen end of screen 100.


~~~~~~~~~~~~~~~~~~

*Eingrenzen der Selektionsoptionen (zum Zeitpunkt INITIALIZATION)
* Werke, VKORGs, VTWEGs dürfen nur einzeln definiert werden um
* später über s_werks loopen zu können
SELECT-OPTIONS: s_werks FOR t_daten-werks NO INTERVALS, s_vkorg FOR t_daten-vkorg NO INTERVALS, s_vtweg FOR t_daten-vtweg NO INTERVALS. *&---------------------------------------------------------------------*
* Form initialization
*---------------------------------------------------------------------*
FORM initialization. * Inkludieren des Typepools SSCR TYPE-POOLS sscr. * Definition des Objekts, das an den Parameter RESTRICTION übergeben
* wird.
DATA restrict TYPE sscr_restrict. * Hilfsobjekte zum Füllen von RESTRICT DATA opt_list TYPE sscr_opt_list. DATA ass TYPE sscr_ass. * EQ_AND_CP: nur EQ und CP erlaubt CLEAR opt_list. MOVE 'EQ_AND_CP' TO opt_list-name. MOVE 'X' TO: opt_list-options-cp, opt_list-options-eq. APPEND opt_list TO restrict-opt_list_tab. * Angabe der betroffenen Selektionsoptionen CLEAR ass. MOVE: 'S' TO ass-kind, 'S_VKORG' TO ass-name, 'I' TO ass-sg_main, 'EQ_AND_CP' TO ass-op_main. APPEND ass TO restrict-ass_tab. MOVE: 'S_VTWEG' TO ass-name. APPEND ass TO restrict-ass_tab. MOVE: 'S_WERKS' TO ass-name. APPEND ass TO restrict-ass_tab. * Eingrenzung der möglichen Selektionsoptionen CALL FUNCTION 'SELECT_OPTIONS_RESTRICT' EXPORTING * PROGRAM = restriction = restrict * DB = ' ' EXCEPTIONS too_late = 1 repeated = 2 selopt_without_options = 3 selopt_without_signs = 4 invalid_sign = 5 empty_option_list = 6 invalid_kind = 7 repeated_kind_a = 8 OTHERS = 9 . " Punkt IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. " sy-subrc <> 0 - CALL FUNCTION 'SELECT_OPTIONS_RESTRICT' ENDFORM. " initialization ~~~~~~~~~~~~~~~~~~