ABAP Keyword Documentation → ABAP - Reference → User Dialogs → Selection Screens → Create Selection Screens → PARAMETERS → PARAMETERS - screen_options
Selection Screens, Display Properties for Parameters
The example shows how to use the select_options
additions of the PARAMETERS
statement.
Other versions: 7.31 | 7.40 | 7.54
Source Code
REPORT DEMO_SEL_SCREEN_SCREEN_OPT.
SELECTION-SCREEN BEGIN OF SCREEN 100.
SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.
PARAMETERS field(10) TYPE c OBLIGATORY.
SELECTION-SCREEN END OF BLOCK part1.
SELECTION-SCREEN BEGIN OF BLOCK part2 WITH FRAME TITLE text-002.
PARAMETERS: p1(10) TYPE c VISIBLE LENGTH 1,
p2(10) TYPE c VISIBLE LENGTH 5,
p3(10) TYPE c VISIBLE LENGTH 10.
SELECTION-SCREEN END OF BLOCK part2.
SELECTION-SCREEN BEGIN OF BLOCK part3 WITH FRAME TITLE text-003.
PARAMETERS: a AS CHECKBOX USER-COMMAND flag,
b AS CHECKBOX DEFAULT 'X' USER-COMMAND flag.
SELECTION-SCREEN END OF BLOCK part3.
SELECTION-SCREEN BEGIN OF BLOCK part4 WITH FRAME TITLE text-004.
PARAMETERS: r1 RADIOBUTTON GROUP rad1,
r2 RADIOBUTTON GROUP rad1 DEFAULT 'X',
r3 RADIOBUTTON GROUP rad1,
s1 RADIOBUTTON GROUP rad2,
s2 RADIOBUTTON GROUP rad2,
s3 RADIOBUTTON GROUP rad2 DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK part4.
SELECTION-SCREEN BEGIN OF BLOCK part5 WITH FRAME TITLE text-005.
PARAMETERS p_carrid TYPE spfli-carrid
AS LISTBOX VISIBLE LENGTH 20
DEFAULT 'LH'.
SELECTION-SCREEN END OF BLOCK part5.
SELECTION-SCREEN BEGIN OF BLOCK part6 WITH FRAME TITLE text-006.
PARAMETERS: test1(10) TYPE c MODIF ID sc1,
test2(10) TYPE c MODIF ID sc2,
test3(10) TYPE c MODIF ID sc1,
test4(10) TYPE c MODIF ID sc2.
SELECTION-SCREEN END OF BLOCK part6.
SELECTION-SCREEN END OF SCREEN 100.
DATA screen_wa TYPE screen.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN INTO screen_wa.
IF a <> 'X' AND
screen_wa-group1 = 'SC1'.
screen_wa-active = '0'.
ENDIF.
IF b <> 'X' AND
screen_wa-group1 = 'SC2'.
screen_wa-active = '0'.
ENDIF.
IF screen_wa-group1 = 'SC1'.
screen_wa-intensified = '1'.
MODIFY SCREEN FROM screen_wa.
CONTINUE.
ENDIF.
IF screen_wa-group1 = 'SC2'.
screen_wa-intensified = '0'.
MODIFY SCREEN FROM screen_wa.
ENDIF.
ENDLOOP.
CLASS start DEFINITION.
PUBLIC SECTION.
CLASS-METHODS main.
ENDCLASS.
CLASS start IMPLEMENTATION.
METHOD main.
CALL SELECTION-SCREEN 100 STARTING AT 10 10.
IF sy-subrc <> 0.
RETURN.
ENDIF.
WRITE: / 'P1:', p1,
/ 'P2:', p2,
/ 'P3:', p3.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
start=>main( ).
Description
This example program consists of six parts, each illustrating one of the
screen_options
additions of the statement PARAMETERS
. Each example corresponds to a block on the selection screen 100.
- Part 1: If the cursor is not on the input field, a symbol appears in the input field of the parameter
p
which tells the user that an entry in this field is required and that the program cannot continue if no entry is made in this field.
- Part 2: The three parameters
p1
,p2
, and p3 have the same length of 10 but are displayed with a different length on the selection screen. The user can nevertheless enter 10 characters in each field.
- Part 3: Two checkboxes are displayed on the left side of the selection screen with the selection
text appearing to the right of the boxes. The checkbox
b
has the default value "X". The elements of the modification groupssc1
andsc2
(see part 6) can be shown and hidden together with the two checkboxes. The display is switched immediately since the eventAT SELECTION-SCREEN
is triggered if one of the checkboxes is chosen. The function code is not needed. Instead, the content ofa
orb
is evaluated at PBO.
- Part 4: The radio buttons
r1
,r2
, and r3 form the grouprad1
;s1
,s2
, ands3
constitute the grouprad2
. Onlyr2
ands3
are selected on the selection screen, all others are not selected.
- Part 5: The parameter
p_carrid
is displayed with a length of 20 and filled with the label "Lufthansa". The user can select another airline; in this case, the three-character airline ID is assigned to the parameter. Assigning the function codeonli
which is assigned to the Execute function in the GUI status of the selection screen triggers first the eventAT SELECTION-SCREEN
and thenSTART-OF-SELECTION
.
- Part 6: The parameters
test1
andtest3
are assigned to the groupsc1
;test2
andtest4
to the groupsc2
. At the eventAT SELECTION-SCREEN OUTPUT
, the field INTENSIFIED of the internal tablescreen
is set to 1 or 0, depending on the contents of the fieldgroup1
. On the selection screen, the lines fortest1
andtest3
are highlighted whereas those fortest2
andtest4
are not.