SELECTION-SCREEN - Including Objects on Selection Screens

Variants:

1. SELECTION-SCREEN INCLUDE PARAMETERS p.

2. SELECTION-SCREEN INCLUDE SELECT-OPTIONS sel.

3. SELECTION-SCREEN INCLUDE COMMENT fmt name.

4. SELECTION-SCREEN INCLUDE PUSHBUTTON fmt name.

5. SELECTION-SCREEN INCLUDE BLOCKS block.

Effect

Objects declared using SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN on another selection screen are copied into the current selection screen .
Both the source and target screen can be either the standard selection screen 1000 or one defined using SELECTION-SCREEN BEGIN/END OF SCREEN. All that is important is that source and target are different screens.
The effect of this statement is as if the "original coding" of the copied portion appeared on the target screen.

Variant 1

SELECTION-SCREEN INCLUDE PARAMETERS p.

Extras:

1a. ... OBLIGATORY

1b. ... OBLIGATORY OFF

2. ... MODIF ID modid.
3. Within the selection include: ID id.

Effect

The parameter par is copied onto the current screen.

Note

Since the data object defined in the PARAMETERS statement only exists once (it is not copied), you cannot change its technical attributes (type, length, reference field).
The parameter par can also only contain one value at runtime, that is, the content entered on the selection screen. This means that this value appears on every other screen containing the parameter par.

Addition 1a

... OBLIGATORY

Addition 1b

... OBLIGATORY OFF

Effect

You can use the OBLIGATORY addition to the PARAMETERS statement to make the parameter a required field on the screen on which it is defined. You can set this attribute (or remove it, using OBLIGATORY OFF) for each copy of the parameter. If you do not use either of the additions, the attribute is derived from the 'original' parameter definition.

Addition 2

... MODIF ID modid.

Effect

If you specify a MODIF-ID, you can assign the comment to a modification group. This is also supported even if you did not specify a modification group (or specified a different group) when you defined par using the PARAMETERS statement. If you do not use the addition, any modification group specified in the 'original' definition is used.

Note

All further attributes of par that are set using additions to the PARAMETERS statement, are copied from the 'original'. In other words, you cannot set them separately for a copy.

Variant 2

SELECTION-SCREEN INCLUDE SELECT-OPTIONS sel.


Extras:

1a. ... OBLIGATORY

1b. ... OBLIGATORY OFF

2a. ... NO INTERVALS

2b. ... NO INTERVALS OFF

3a. ... NO-EXTENSION

3b. ... NO-EXTENSION OFF

4. ... MODIF ID modid
5. Within the selection include: ID id.

Effect

The select-option sel is copied onto the current screen.

Note

Since the data object defined in the SELECT-OPTIONS statement only exists once (it is not copied), you cannot change its technical attributes (type, length, reference field).
The select-option sel can also only have one content at runtime, namely the contents entered on the selection screen. These contents appear on every screen that uses the select-option sel.

Addition 1a

... OBLIGATORY

Addition 1b

... OBLIGATORY OFF

Addition 4

... MODIF ID modid

Effect

As in INCLUDE PARAMETERS.

Addition 2a

... NO INTERVALS

Addition 2b

... NO INTERVALS OFF

Addition 3a

... NO-EXTENSION

Addition 3b

... NO-EXTENSION OFF

Effect

As with OBLIGATORY and OBLIGATORY OFF, you can enable and disable the attribtes set using NO INTERVALS and NO-EXTENSION in the SELECT-OPTIONS statement separately for each copy. If you do not use these additions, the corresponding attribute is determined by the 'original' setting.

Note

All further attributes of sel, set using additions to the SELECT-OPTIONS statement, are copied from the 'original' settings. You cannot set them separately for individual copies.

Variant 3

SELECTION-SCREEN INCLUDE COMMENT fmt name.


Extras:

1. ... FOR FIELD f

2. ... MODIF ID modid.
3. Within the selection include: ID id.

Effect

The comment name is copied to the position given in the format specification fmt.

Note

This is only useful, and only supported, for comments whose contents are set at runtime, that is, where name is not a text element with the form TEXT-xxx.

Addition 1

... FOR FIELD f

Effect

The comment is assigned to the parameter or select-option f (see also the FOR FIELD option in SELECTION-SCREEN COMMENT). If you do not use the addition, the assignment from the 'original' is used, if one exists.

Addition 2

... MODIF ID modid

Effect

As in INCLUDE PARAMETERS.

Variant 4

SELECTION-SCREEN INCLUDE PUSHBUTTON fmt name.


Extras:

1. ... USER-COMMAND ucom

2. ... MODIF ID modid
3. Within the selection include: ID id.

Effect

The pushbutton name is copied onto the screen at the position given in the format specification fmt.

Note

As with ... INCLUDE COMMENT, this only makes sense, and is only supported, for pushbuttons whose text is set at runtime, that is, where it is not a text element with the form TEXT-xxx.

Addition 1

... USER-COMMAND ucom

Effect

Clicking the pushbutton triggers the function code ucom. You can change this from the original definition (see SELECTION-SCREEN PUSHBUTTON). If you do not use the addition, the function code from the 'original' definition is used.

Addition 2

... MODIF ID modid

Effect

As in INCLUDE PARAMETERS.

Variant 5

SELECTION-SCREEN INCLUDE BLOCKS block.

Effect

The entire block block is copied to the current screen, along with all objects contained in it.

Addition:

Within the selection include: ID id.

Notes

  1. If the block block contains an object that you have already copied onto the current screen in a previous SELECTION-SCREEN INCLUDE statement, a syntax error occurs.

  2. Blocks with frames that have been made smaller using the NO INTERVALS addition are copied as such. Larger blocks are made smaller if you copy them into a small block. If the original block contains objects at a position too large for the block, a syntax error occurs.

Example

TABLES 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 INCLUDE PARAMETERS PAR0.
    SELECTION-SCREEN COMMENT /10(20) TEXT-COM.
    SELECTION-SCREEN COMMENT /10(20) COMM01.
  SELECTION-SCREEN END OF BLOCK BL1.
SELECTION-SCREEN END OF SCREEN 123.

SELECTION-SCREEN ULINE.
SELECTION-SCREEN INCLUDE: SELECT-OPTIONS SEL1,
                          COMMENT /5(15) COMM01.
SELECTION-SCREEN PUSHBUTTON 15(25) PUBU
                 USER-COMMAND US01.

SELECTION-SCREEN BEGIN OF SCREEN 99.
  SELECTION-SCREEN INCLUDE PUSHBUTTON 20(20) PUBU
                           USER-COMMAND US02.
  SELECT-OPTIONS SEL2 FOR SPFLI_WA-CONNID.
  SELECTION-SCREEN INCLUDE BLOCKS BL1.
  PARAMETERS     PAR2 TYPE I.
SELECTION-SCREEN END OF SCREEN 99.

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

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

  1. Screen 1000, containing the select-option SEL0, the parameter PAR0, an underline, and the pushbutton PUBU with function code US01. Between the underline and the pushbutton, the select-option SEL1 and the comment COMM01 are copied from the corresponding objects in screen 123.
    This is the standard selection screen that appears when you SUBMIT the report.

  2. Screen 123, containing a block with frame. This contains SELECT-OPTION SEL1, the parameter PAR1, a comment containing text symbol TEXT-COM and another containing the contents of field COMM01. Between PAR1 and the first comment, the parameter PAR0 has been copied from screen 1000.

  3. Screen 99, containing the pushbutton PUBU, copied from screen 1000, but here with function code US02 instead of US01), the select-option SEL2 and parameter PAR2. Between SEL2 and PAR2, the whole block BL1 (along with its components) has been copied from screen 123).

Additional help

Defining Selection Screens