SELECTION-SCREEN - Defining Selection Screens

Variants:

1a. SELECTION-SCREEN BEGIN OF SCREEN scr.
1b. SELECTION-SCREEN END   OF SCREEN scr.


2. SELECTION-SCREEN BEGIN OF SCREEN scr AS SUBSCREEN.

Effect

Defines a selection screen with the number scr. scr may be up to 4 digits.

Variant 1a

SELECTION-SCREEN BEGIN OF SCREEN scr.


Extras:

1. ... TITLE title

2. ... AS WINDOW

Notes

  1. In reports (type 1 programs), a selection screen with number 1000 is created automatically when you use the SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN statements. This selection screen appears when you SUBMIT the report.

  2. In any type of program (apart from subroutine pools - type S), you can define further selection screens using SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN. You enclose these statements between the SELECTION-SCREEN BEGIN OF SCREEN and SELECTION-SCREEN END OF SCREEN statements.
    You call these screens using the CALL SELECTION-SCREEN statement.
    Screen number 1000 is not allowed (reserved for standard selection screen).

  3. When you generate the program, all user-defined selection screens are also generated.

  4. Within a report (type 1 program), all SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN statements outside a SELECTION-SCREEN BEGIN/END OF SCREEN block form part of selection screen 100 (standard selection screen)


Addition 1

... TITLE title

Effect

Assigns the title title to the selection screen.
title may be defined either statically or at runtime.

Addition 2

... AS WINDOW

Effect

Defines the screen as a modal dialog box (addition STARTING AT ... in CALL SELECTION-SCREEN). The effect of this is that error messages are also sent in dialog boxes.

Note

If you use the NO INTERVALS addition in SELECTION-SCREEN BEGIN OF BLOCK and SELECT-OPTIONS, the selection screens will be smaller, and particularly suitable for use as modal dialog boxes.

Example

DATA SPFLI_WA TYPE SPFLI.

SELECT-OPTIONS SEL0 FOR SY-TABIX.
PARAMETERS PAR0(5).

SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-456.
  SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1
                                      NO INTERVALS.
    SELECT-OPTIONS SEL1 FOR SY-SUBRC.
    PARAMETERS     PAR1 LIKE SPFLI-CARRID.
    SELECTION-SCREEN COMMENT /10(20) TEXT-COM.
  SELECTION-SCREEN END OF BLOCK BL1.
SELECTION-SCREEN END OF SCREEN 123.

SELECTION-SCREEN ULINE.

SELECTION-SCREEN BEGIN OF SCREEN 99.
  SELECTION-SCREEN PUSHBUTTON 15(25) PUBU
                   USER-COMMAND US01.
  SELECT-OPTIONS SEL2 FOR SPFLI_WA-CONNID.
  PARAMETERS     PAR2 TYPE I.
SELECTION-SCREEN END OF SCREEN 99.

This example can only be syntactically correct if the program has type 1, since this is the only case in which SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN statements are allowed outside a SELECTION-SCREEN BEGIN/END OF SCREEN block.

In the example, the report would have three selection screens:

  1. Screen 100 with the Select-option SEL0, parameter PAR0 and an underline.
    This is the standard selection screen that is displayed when you SUBMIT the report.
  2. Screen 123 with a block in a box, containing the Select-option SEL1, parameter PAR1 and a comment.
    This screen is designed to be called using CALL SELECTION-SCREEN STARTING AT ... (addition AS WINDOW). The screen is small because of the NO INTERVALS addition in the SELECTION-SCREEN BEGIN OF BLOCK.
  3. Screen 99 with a pushbutton, the Select-option SEL2 and the parameter PAR2.


Variant 2
SELECTION-SCREEN BEGIN OF SCREEN scr AS SUBSCREEN.


Extras:

1. ... NESTING LEVEL n

2. ... NO INTERVALS

Effect

Defines the selection screen as a subscreen.

Addition 1

... NESTING LEVEL n

Effect

Only relevant if you want to include the subscreen in a tabstrip control on the selection screen and the tabstrip control is already surrounded by a frame. Rule: If the tabstrip control is not framed, the subscreen has NESTING LEVEL 0. Each frame that encloses the tabstrip control increases the NESTING LEVEL by 1.

Addition 2

... NO INTERVALS

Effect

When you use the NO INTERVALS addition, the system creates a smaller subscreen that does not contain the HIGH fields of the selection criteria.

Note

If you want to display a selection screen on any other screen or as part of a tabstrip control on a selection screen, you must create it as a subscreen.

Note

You can use SELECTION-SCREEN INCLUDE ... to include objects in a selection screen that have already been defined in a different selection screen.

Example

In the above example, you could define a further selection screen as follows:

SELECTION-SCREEN BEGIN OF SCREEN 1111.
  SELECTION-SCREEN BEGIN OF BLOCK BL1.
    SELECT-OPTIONS SEL0 FOR SY-REPID.
    PARAMETERS     PAR0.
  SELECTION-SCREEN END  OF  BLOCK BL1.
  SELECT-OPTIONS SEL1 FOR SY-REPID.
  PARAMETERS     PAR1.
  SELECTION-SCREEN PUSHBUTTON /10(30) PUBU USER-COMMAND US03.
SELECTION-SCREEN END OF SCREEN 1111.

SELECTION-SCREEN BEGIN OF SCREEN 1234.
  SELECTION-SCREEN INCLUDE BLOCKS BL1.
  SELECTION-SCREEN INCLUDE SELECT-OPTIONS SEL1.
  SELECTION-SCREEN INCLUDE PARAMETERS     PAR1.
  PARAMETERS PAR2.
  SELECTION-SCREEN INCLUDE PUSHBUTTON /10(30) PUBU
                           USER-COMMAND US03.
SELECTION-SCREEN END OF SCREEN 1234.

This screen contains the entire block BL1, containing the box, title ( TEXT-BL1), SEL1, PAR1 and comment. Below are the selection criterion SEL0, the parameter PAR2, the newly-defined parameter PAR4 and the pushbutton.

Note

In this example, the box BL1 remains small, as oiginally defined (NO INTERVALS). You can make wider blocks small in an include by including them in small blocks. For further details, see SELECTION-SCREEN INCLUDE ....