Entering content frame

Defining Selection Screens Locate the document in its SAP Library structure

There are three ABAP statements for defining selection screens:

·        PARAMETERS for single fields

·        SELECT-OPTIONS for complex selections

·        SELECTION-SCREEN for formatting the selection screen and defining user-specific selection screens

These ABAP statements are included in the declaration part of an ABAP program. When defining selection screens, you must distinguish between standard selection screens for executable programs and user-defined selection screens for all types of program.

Standard Selection Screens

The standard selection screen of executable programs is predefined and has the screen number 1000. All PARAMETERS, SELECT-OPTIONS, and SELECTION-SCREEN statements that do not occur in the definition of a user-defined selection screen in executable programs – that is, that are not included between the statements –

SELECTION-SCREEN BEGIN OF ...
...
SELECTION-SCREEN END OF ...

define the input fields and the formatting of the standard selection screen. For the sake of clarity, you should group together all statements that make up the standard selection screen before defining additional selection screens. You can define input fields of a standard selection screen only in executable programs. In all other programs, the PARAMETERS, SELECT-OPTIONS, and SELECTION-SCREENstatements must be included in the above statements.

User-defined selection screens

The two statements:

SELECTION-SCREEN BEGIN OF SCREEN numb [TITLE tit] [AS WINDOW].
  ...
SELECTION-SCREEN END OF SCREEN numb.

define a user-defined selection screen with screen number numb. All PARAMETERS, SELECT-OPTIONS, and SELECTION-SCREEN statements that occur between these two statements define the input fields and the formatting of this selection screen. Screen number numb can be any four-digit number apart from 1000, which is the number of the standard selection screen. You must also ensure that you do not accidentally assign a number to a selection screen which is already in use for another screen of the program.

The TITLE tit addition allows you to define a title for a user-defined selection screen. The title tit can either be a static text symbol or a dynamic character field. If you use a character field, you must not define it using the DATA statement - the system generates it automatically. The character field can be filled during the INITIALIZATION event. The title of standard selection screens is always the name of the executable program.

You can use the AS WINDOWaddition to call a user-defined selection screen as a modal dialog box. You enter the definition of the window only when you perform the call itself. The AS WINDOWaddition ensures that warnings and error messages associated with the selection screen are also displayed as modal dialog boxes, and not in the status bar of the selection screen.

If you define more than one selection screen in a program, you can re-use elements of one selection screen in another using the following statement: For this purpose, yse the statement:

SELECTION SCREEN INCLUDE          BLOCKS  block
                         |     PARAMETERS p  
                         | SELECT-OPTIONS selcrit
                         |        COMMENT comm  
                         |    PUSH-BUTTON push

You can specify any of the following elements that have already been declared in another selection screen:

·        Blocks with the name block

·        Parameters with the name p

·        Selection criteria with the name selcrit

·        Comments with the name comm

·        Pushbuttons with the name push

Example

Example

REPORT selscreendef.

...

PARAMETERS par1 ....
SELECT-OPTIONS sel1 FOR ... .
...

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.
  PARAMETERS par2 ... .
  SELECT-OPTIONS sel2 FOR ... .
  ...
SELECTION-SCREEN END OF SCREEN 500.

SELECTION-SCREEN BEGIN OF SCREEN 600 TITLE text-100.
  SELECTION-SCREEN INCLUDE: PARAMETERS par1,
                            SELECT-OPTIONS sel1.

  PARAMETERS par3 ... .
  SELECT-OPTIONS sel3 ... .
  ...
SELECTION-SCREEN END OF SCREEN 600.

Three selection screens - the standard selection screen and two user-defined selection screens - are defined. The program must be executable so that a standard selection screen can be defined. Selection screen 500 is defined to be called as a modal dialog box. Selection screen 600 contains text symbol 100 as its title, and uses elements par1 and sel1 from the standard selection screen.

 

 

Leaving content frame