1. SELECTION-SCREEN
BEGIN OF BLOCK block.
2.
SELECTION-SCREEN BEGIN OF TABBED BLOCK block FOR n LINES.
3. SELECTION-SCREEN
END OF BLOCK block.
4. SELECTION-SCREEN TAB (len) tabname USER-COMMAND ucomm.
5. SELECTION-SCREEN
BEGIN OF LINE.
6. SELECTION-SCREEN
END OF LINE.
7.
SELECTION-SCREEN POSITION pos.
8.
SELECTION-SCREEN ULINE.
9.
SELECTION-SCREEN COMMENT fmt name.
10.SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom.
11.SELECTION-SCREEN
SKIP n.
12.SELECTION-SCREEN FUNCTION KEY n.
Reports, that is, programs with type "1" in their attributes, usually have a
selection screen
, which is generated from the SELECT-OPTIONS
and PARAMETERS statements
from the report and the access routines for the logical database, where one line of the selection screen
is taken up by each of these objects.
Additionally, you can define your own selection screen in
any
ABAP
programs (except type "S" programs), using
SELECTION-SCREEN BEGIN/END OF SCREEN. You call them
in your program using the CALL
SELECTION-SCREEN
statement.
You design selection screens using the SELECTION-SCREEN
statement. In the standard selection
screen of a report, the SELECTION-SCREEN
statement in the report, and the selection include of the logical
database ldb assigned to the report in its attributes,
control the screen design. The logical database section is controlled by
special additions.
SELECTION-SCREEN
allows you to create blocks and tabstrip controls, combine several parameters and comments into a single
line, create pushbuttons on the screen or in the application toolbar, and include spaces, underlines
and comments on the screen.
There are other variants
on SELECTION-SCREEN, which have been designed exclusively
for logical databases, and can therefore only be used in the selection include.
SELECTION-SCREEN BEGIN OF BLOCK block.
1. ... WITH
FRAME
2. ...
TITLE title
3. ... NO INTERVALS
The system opens a logical block on the selection screen. If you use the
WITH FRAME addition, the block is enclosed in a box. You
can only use the TITLE title addition in conjunction with WITH FRAME.
... WITH FRAME
... TITLE title
The title
title can be defined either statically
or at runtime
(see also the COMMENT, PUSHBUTTON
and SELECTION-SCREEN BEGIN OF SCREEN variants).
At runtime, the event AT SELECTION-SCREEN
ON BLOCK block is triggered in the PAI phase for each block of the selection screen.
(In database-specific blocks, the PAI routine is started in program SAPDBldb,
passing the parameters
FNAME = BLOCK_block and MARK = SPACE). If an error message is output, the fields in this block are ready for input.
You can nest blocks. The maximum depth for blocks in boxes is five levels.
... NO INTERVALS
All SELECT-OPTIONS
within the block are displayed in simplified form on the selection screen without a 'to' field (corresponds
to the "
NO INTERVALS
" addition for the SELECT-OPTIONS statement). The frame for the block (if applicable) is made smaller accordingly.
The "NO INTERVALS" attribute is not inherited by blocks
without boxes nested deeper. However, if the blocks are in boxes, the attribute is inherited, since a smaller box is generated, in which there is no room for the 'to' field.
SELECTION-SCREEN BEGIN OF TABBED BLOCK block FOR n LINES.
Creates a subscreen area on the selection screen in which you can include a tabstrip control. n determines the number of lines in the subscreen area.
SELECTION-SCREEN END OF BLOCK block.
Closes the block opened in SELECTION-SCREEN BEGIN OF BLOCK block. If the block has a box, this is also closed.
Blocks opened in the database selection include must also be closed in the same program.
DATA SAPLANE_WA TYPE SAPLANE.
SELECTION-SCREEN BEGIN OF BLOCK CHARLY
WITH FRAME TITLE TEXT-001.
PARAMETERS PARM(5).
SELECT-OPTIONS SEL FOR SAPLANE_WA-PLANETYPE.
SELECTION-SCREEN END OF BLOCK CHARLY.
(TEXT-001 = 'Block
Charly').
Selection screen:
--Block
Charly-----------------------------------
| PARM
_____ |
| SEL ________
to ________ |
-------------------------------------------------
SELECTION-SCREEN TAB (len) tabname USER-COMMAND ucomm.
Creates a tab page with the name
tabname and length len,
and assigns the function code ucomm to it. You can only use this variant between
BEGIN OF TABBED BLOCK ... and END OF BLOCK ....
... DEFAULT PROGRAM prog SCREEN scr.
Use this addition to specify the subscreen that appears by default when the tab page is displayed. If
you specify the default addition, you must use SCREEN.
If you specify
SCREEN but not PROGRAM,
the system uses the current program as the default program. If you do not specify a screen, a runtime error occurs.
You can fill the tab title with text and icons in the INITIALIZATION or AT SELECTION-SCREEN OUTPUT event.
The assignment of tabs to screens is not static, but can be changed at runtime. There is a structure
with the fields prog, dynnr, and activetab assigned to
each tab block. You can change the assignment between blocks and the screen and set an active tab by assigning values to these fields.
SELECTION-SCREEN BEGIN OF TABBED BLOCK tabb1 FOR 14 LINES.
SELECTION-SCREEN TAB (15)
tabs1 USER-COMMAND ucomm1
DEFAULT SCREEN 12.
SELECTION-SCREEN TAB (15) tabs2 USER-COMMAND ucomm2
DEFAULT SCREEN 2000.
SELECTION-SCREEN END OF BLOCK tabb1.
INITIALIZATION.
tabs1
= TEXT-001.
tabs2 = TEXT-002.
AT SELECTION-SCREEN
CASE SSCRFIELDS-UCOMM.
WHEN 'UCOMM1'.
tabb1-program = 'SAPLSVAR'.
tabb1-dynnr
= 100.
tabb1-activetab = 'TABS2'.
ENDCASE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN END OF LINE.
This enables you to arrange several parameters, comments, pushbuttons or underline blocks, included
between the
SELECTION-SCREEN BEGIN OF LINE and SELECTION-SCREEN END
OF LINE
statements, in a single line. The automatic new line after each
PARAMETER is suppressed. Furthermore, the system does not output selection texts for parameters.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(10) TEXT-001 FOR FIELD P1.
PARAMETERS: P1 LIKE SAPLANE-PLANETYPE, P2(5), P3(1).
SELECTION-SCREEN END OF LINE.
Selection screen:
Comment 1________ _____ _
You cannot include SELECT-OPTIONS
between
SELECTION-SCREEN BEGIN OF LINE and SELECTION-SCREEN END
OF LINE
, since the system generates more than one object on the selection screen in a
SELECT-OPTION (like fields for lower and upper limits).
You
cannot use any variants of SELECTION-SCREEN that generate
a new line (like
SELECTION-SCREEN SKIP) between SELECTION-SCREEN BEGIN OF LINE and SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN POSITION pos.
The next object on the current line (parameter,
comment, pushbutton or underline) is positioned at pos.
You may only use this variant between SELECTION-SCREEN BEGIN
OF LINE und SELECTION-SCREEN END OF LINE.
You
can specify the position pos as a number (relative to
the box) if you use the statement between the SELECTION-SCREEN BEGIN
OF BLOCK ... WITH FRAME ... and SELECTION-SCREEN END OF
BLOCK ...
statements. You can also use the symbolic positions POS_LOW
and POS_HIGH. These are the positions on the screen at
which the system places the input fields for
SELECT-OPTIONS. (POS_LOW
is also the screen position for PARAMETERS).
If the co-ordinates are too big, a syntax error occurs.
Within the
selection include
: Additions FOR NODE
node and FOR TABLE dbtab.
SELECTION-SCREEN ULINE.
1. ... fmt
2. ... MODIF ID modid
Generates an underline (similar to ULINE).
By specifying the format,
you can control length, position and new lines.
By specifying a Modif ID you can assign the underline to a modification group.
Within the
selection include
: Additions FOR NODE
node, FOR
TABLE dbtab and ID id.
SELECTION-SCREEN COMMENT fmt name.
1. ... FOR
FIELD f
2. ... MODIF ID modid
3. ... VISIBLE LENGTH vlen.
Generates a comment on the selection screen.
You can define the content (
name) either statically
or at runtime (as in the BEGIN OF BLOCK,
PUSHBUTTON
and SELECTION-SCREEN
BEGIN OF SCREEN variants). If you use the FOR FIELD addition, you can omit name (see below).
When you use comments, you must always specify a format fmt.
... FOR FIELD f
The comment is assigned to either a parameter or a select-option
f. When the user displays help, the documentation for
the reference field of the parameter or select-option is displayed.
The comment is hidden if the reference object is set to 'invisible' in a selection variant.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 10(20) TEXT-001
FOR
FIELD PARM.
SELECTION-SCREEN POSITION POS_LOW.
PARAMETERS PARM LIKE SAPLANE-PLANETYPE.
SELECTION-SCREEN END OF LINE.
The comment appears with length 20 in the normal position (POS_LOW,
and in the same line as the parameter. If the user presses
F1 for either object, the system displays the documentation for SAPLANE-PLANETYPE.
If you use the
FOR FIELD addition, you can omit name.
In this case, the system displays the selection text for the parameter or the select-option f.
SELECTION-SCREEN BEGIN OF LINE
PARAMETERS PARM LIKE SAPLANE-PLANETYPE.
SELECTION-SCREEN COMMENT (20) FOR FIELD PARM.
SELECTION-SCREEN END OF LINE.
The parameter is displayed, followed immediately (the example specifies the length, but no position)
by up to 20 characters of its selection text.
By specifiying a Modif ID, you can assign the comment to a modification group.
... VISIBLE LENGTH vlen.
The comment is displayed in the shortened length vlen.
However, you can still scroll through its full length as specified in the format definition (similarly
to SELECT-OPTIONS and PARAMETERS).
Within the
selection include
: Additions FOR NODE
node, FOR
TABLE dbtab and ID id.
SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom.
Generates a pushbutton on the selection screen. When you define the button, you also define a user command
ucom (no inverted commas), up to 20 characters long, which
is triggered when the user pushes the button. The rest of the syntax is the same as for SELECTION-SCREEN COMMENT.
You can define the name
name either statically
or at runtime (see also the BEGIN OF BLOCK,
COMMENT and SELECTION-SCREEN BEGIN OF SCREEN variants).
When you define a pushbutton, you must always specify a format fmt.
By specifying a Modif ID, you can assign the pushbutton to a modification group.
Within the
selection include
: Additions FOR NODE
node,FOR
TABLE dbtab und ID id.
TABLES SSCRFIELDS.
...
SELECTION-SCREEN PUSHBUTTON /10(20) CHARLY USER-COMMAND ABCD.
...
INITIALIZATION.
MOVE 'My text' TO CHARLY.
...
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'ABCD'.
...
ENDIF.
A pushbutton appears on the selection screen with the text 'My text'.
In the AT SELECTION-SCREEN
event, the field SSCRFIELDS-UCOMM has the contents ABCD after the button has been pushed.
SELECTION-SCREEN SKIP n.
Generates
n blank lines (similar to SKIP)
n can have any value from 1 to 9. If you only want to insert one blank line, you can leave out n.
Within the
selection include
: Additions FOR NODE
node, FOR
TABLE dbtab and ID id.
SELECTION-SCREEN FUNCTION KEY n.
Activates a pushbutton (one of a maximum of 5) in the application toolbar of the selection screen (where
n is between 1 and 5).
At runtime, you must insert
the text for the pushbutton into the appropriate ABAP Dictionary field SSCRFIELDS-FUNCTXT_01
... SSCRFIELDS-FUNCTXT_05. If you want to assign an icon
to the pushbutton, you must fill SSCRFIELDS-FUNCTXT_01
...
SSCRFIELDS-FUNCTXT_05 using the structure SMP_DYNTXT.
The function code placed in field SSCRFIELDS-UCOMM
is 'FC01' ... 'FC05'.
You can query this function code in the
AT SELECTION-SCREEN event or the PAI routine in the database access program SAPDBldb.
Within the
selection include
: Additions FOR NODE
node, FOR
TABLE dbtab and ID id.
TABLES SSCRFIELDS.
...
SELECTION-SCREEN FUNCTION KEY 1.
...
INITIALIZATION.
MOVE
'My text' TO SSCRFIELDS-FUNCTXT_01.
...
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'FC01'.
...
ENDIF.
Generates a pushbutton in the application toolbar of the selection screen with the text
'My text'. In the AT
SELECTION-SCREEN event, SSCRFIELDS-UCOMM has the contents FC01 when the button has been pushed.
Formatting Selection Screens