Professional Documents
Culture Documents
SELECTION-SCREENS: Designing Selection Screens
SELECTION-SCREENS: Designing Selection Screens
SELECTION-SCREENS: Designing Selection Screens
Variants:
Effect
Reports, that is, programs with type "1" in their attributes, usually have
a selectionscreen, 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.
Additionaly, 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, 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.
Additions:
1. ... WITH FRAME
2. ... TITLE title
3. ... NO INTERVALS
Effect
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.
You can nest blocks. The maximum depth for blocks in boxes is five levels.
Effect
Note
Effect
Blocks opened in the database selection include must also be closed in the
same program.
Example
TABLES SAPLANE.
(TEXT-001 = 'Block Charly').
Selection screen:
--Block Charly-----------------------------------
| PARM _____ |
| SEL ________ to ________ |
-------------------------------------------------
Effect
Example
Selection screen:
Note
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
newline (like SELECTION-SCREEN SKIP) between SELECTION-SCREEN
BEGIN OF LINE and SELECTION-SCREEN END OF LINE.
Effect
Additions:
1. ... fmt.
2. ... MODIF ID modid.
Effect
Addition 1
... fmt
Addition 2
Effect
Additions:
Effect
Example
Note
If you use the FOR FIELD addition, you can omit name . In this case, the
system displays the selection text for the parameter orselect-options.
Example
By specifiying a
Modif ID , you can assign the comment to a modification group.
Effect
The comment is displayed in the shortedned length vlen. However, you can
still scroll through its full length as specified in the format definition (similarly
to SELECT-OPTIONS and PARAMETERS).
Variant 8
Addition:
MODIF ID modid.
Effect
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).
By specifying a
Notes
You can create your own pushbuttons in the application toolbar using
the FUNCTION KEY n addition.
Example
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.
Effect
Effect
Notes
You can create your own pushbuttons directly on the screen using the
PUSHBUTTON addition.
Example
TABLES SSCRFIELDS.
...
SELECTION-SCREEN FUNCTION KEY 1.
...
INITIALIZATION.
MOVE 'My text' TO SSCRFIELDS-FUNCTXT_01.
...
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'FC01'.
...
ENDIF.
- Programmer gets a great deal of control on how to present the User Interface / Selection Screen to
the user. Using the options available with the SELECTION-SCREEN statement, the look of the screen
can be formatted as per the requirement.
- The standard selection screen of executable programs is predefined and has screen number 1000.
SYNTAX:
1)
SELECTION-SCREEN BEGIN OF LINE.
...........
...........
SELECTION-SCREEN END OF LINE.
This option is used to have several elements in a single line. It places multiple fields
immediately adacent to one another.
SELECT-OPTIONS cannot be used between SELECTION-SCREEN BEGIN OF LINE and SELECTION-SCREEN
END OF LINE
2)
The objects in the blocks can have SELECT-OPTIONS, PARAMETERS, COMMENTS, UNDERSCORES.
3)
SELECTION-SCREEN SKIP [ <n> ]
4)
This option is used to create under lines.. It places an underline on the screen at a location and length
specified.
5)
This option is used to place a comment which will be a user defined message on the screen at a
location and length specified.
6)
7)
SELECTION-SCREEN PUSHBUTTON [ / ] <pos ( len ) > <push>
USER-COMMAND <ucomm> [ MODIF ID <key> ].
This option is used to create pushbuttons on the selection screen. When the user clicks the pushbutton
on the selection screen, <ucomm> is entered in the UCOMM of the SSCRFIELDS structure..
8)
SELECTION-SCREEN FUNCTION KEY <n>.
This option is used to create pushbuttons on the application toolbar of the selection screen.
<n> must be between 1 and 5. Hence it is not possible to create more than 5 pushbuttons using this
method.
When the user clicks on one of the pushbuttons, FC0<n> is placed into the SSCRFIELDS-UCOMM field and
the AT SELECTION-SCREEN event is triggered.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN SKIP 1.
3)
SELECTION-SCREEN SKIP 1.
4)
AT SELECTION-SCREEN OUTPUT.
text = 'Please Note:Enter the details successfully'.
5)
SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.
PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.
SELECTION-SCREEN COMMENT /1(50) text-002.
6)
7)
9)
By: Hari
IF P_RAD2 = 'X'.
LOOP AT SCREEN.
CHECK SCREEN-GROUP1 = 'TL'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
Here both SELECT-OPTIONS & RANGES works for the same purpose. They both
are used for the range selection from selection screen. The main diff. between them
is, while we use SELECT-OPTIONS system implicitly creates the select options
internal table which contains the fields of SIGN,OPTION,LOW & HIGH. But in case
of RANGES, this internal table should be defined explicitly.
Eg. to SELECT-OPTIONS :
-----------------------------------------
REPORT YARSELECT.
TABLES YTXLFA1.
SELECT-OPTIONS : VENDOR FOR YTXLFA1-LIFNR.
INITIALIZATION.
VENDOR-LOW = 1000. " It specifies the range starting value.
VENDOR-HIGH = 2000. " It specifies the range ending value.
VENDOR-OPTION = 'BT'. " specifies ranges value is in between.
VENDOR-SIGN = 'I'. "specifies both inclussive.
APPEND VENDOR.
- - - -
- - - -
SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB
WHERE LIFNR IN VENDOR.
Eg. to RANGES:
-------------------------
REPORT YARRANGE.
TABLES YTXLFA1.
RANGES: VENDOR FOR YTXFLA1-LIFNR.
- - - -
- - - --
- - - -
Here with RANGES user has to design an internal table with fields -
SIGN,OPTION,LOW and HIGH EXPLICITLY.
--------------------------------------------------------------------------------------------------------
->
Example:
select-options: bukrs for zstock-bukrs.
Should the user fill in 'ABFI' in BUKRS on the selection screen, BUKRS will look
like this:
IEQABFI
This is because BUKRS is set as a table as follows:
begin of bukrs occurs 0,
SIGN(1) type c,
OPTION(2) type c,
LOW like bukrs,
HIGH like bukrs,
end of bukrs.
Now, when you create the following range, it will have the exact same fields set
inside its table:
Ranges: bukrs for zstock-bukrs.
The difference is, because ranges doesn't show on the selection screen, you will have
to fill it yourself, meaning you will have to fill bukrs-sign, bukrs-option, bukrs-low &
bukrs-high all manually.
Some tips:
Sign is always I (for Include) or E (for Exclude)
Option can be a whole range, which includes:
EQ (Equal)
BT (Between))
CP (Contain Pattern)
So let's say you want to have the range check for all company codes not starting with
AB, you will set your code as follow:
ranges: bukrs for zstock-bukrs.
bukrs-sign = 'E'. "Exclude
bukrs-option = 'CP'. "Pattern
bukrs-low = 'AB*'. "Low Value
bukrs-high = ''. "High Value
append bukrs.
Always remember to APPEND your range when you fill it, as the WHERE clause
checks against the lines of the range table, not against the header line.
Hope this explains it well enough.
--------------------------------------------------------------------------------------------------------
->
The "I" stands for Include, and the "E" for Exclude.
The easiest way to learn how the range selections work is, create the following
dummy program:
report dummy.
tables: mara.
select-options: matnr for mara-matnr.
start-of-selection.
loop at matnr.
write: / matnr-sign,
matnr-option,
matnr-low,
matnr-high.
endloop.
Run this program, and fill in a lot of junk into MATNR. Fill in some includes, some
excludes, some ranges, etc., and you will soon realise how the system builds ranges
(select-options). Once you know that, you can fill your own ranges quickly and
efficiently.
Here both SELECT-OPTIONS & RANGES works for the same purpose. They both
are used for the range selection from selection screen. The main diff. between them
is, while we use SELECT-OPTIONS system implicitly creates the select options
internal table which contains the fields of SIGN,OPTION,LOW & HIGH. But in case
of RANGES, this internal table should be defined explicitly.
Eg. to SELECT-OPTIONS :
-----------------------------------------
REPORT YARSELECT.
TABLES YTXLFA1.
SELECT-OPTIONS : VENDOR FOR YTXLFA1-LIFNR.
INITIALIZATION.
VENDOR-LOW = 1000. " It specifies the range starting value.
VENDOR-HIGH = 2000. " It specifies the range ending value.
VENDOR-OPTION = 'BT'. " specifies ranges value is in between.
VENDOR-SIGN = 'I'. "specifies both inclussive.
APPEND VENDOR.
- - - -
- - - -
SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB
WHERE LIFNR IN VENDOR.
Eg. to RANGES:
-------------------------
REPORT YARRANGE.
TABLES YTXLFA1.
RANGES: VENDOR FOR YTXFLA1-LIFNR.
- - - -
- - - --
- - - -
Here with RANGES user has to design an internal table with fields -
SIGN,OPTION,LOW and HIGH EXPLICITLY.
--------------------------------------------------------------------------------------------------------
->
Example:
select-options: bukrs for zstock-bukrs.
Should the user fill in 'ABFI' in BUKRS on the selection screen, BUKRS will look
like this:
IEQABFI
This is because BUKRS is set as a table as follows:
begin of bukrs occurs 0,
SIGN(1) type c,
OPTION(2) type c,
LOW like bukrs,
HIGH like bukrs,
end of bukrs.
Now, when you create the following range, it will have the exact same fields set
inside its table:
Ranges: bukrs for zstock-bukrs.
The difference is, because ranges doesn't show on the selection screen, you will have
to fill it yourself, meaning you will have to fill bukrs-sign, bukrs-option, bukrs-low &
bukrs-high all manually.
Some tips:
Sign is always I (for Include) or E (for Exclude)
Option can be a whole range, which includes:
EQ (Equal)
BT (Between))
CP (Contain Pattern)
So let's say you want to have the range check for all company codes not starting with
AB, you will set your code as follow:
ranges: bukrs for zstock-bukrs.
bukrs-sign = 'E'. "Exclude
bukrs-option = 'CP'. "Pattern
bukrs-low = 'AB*'. "Low Value
bukrs-high = ''. "High Value
append bukrs.
Always remember to APPEND your range when you fill it, as the WHERE clause
checks against the lines of the range table, not against the header line.
Hope this explains it well enough.
--------------------------------------------------------------------------------------------------------
->
The "I" stands for Include, and the "E" for Exclude.
The easiest way to learn how the range selections work is, create the following
dummy program:
report dummy.
tables: mara.
select-options: matnr for mara-matnr.
start-of-selection.
loop at matnr.
write: / matnr-sign,
matnr-option,
matnr-low,
matnr-high.
endloop.
Run this program, and fill in a lot of junk into MATNR. Fill in some includes, some
excludes, some ranges, etc., and you will soon realise how the system builds ranges
(select-options). Once you know that, you can fill your own ranges quickly and
efficiently.