PARAMETERS p.
1. ...
DEFAULT f
2. ...
TYPE type
3. ...
LENGTH n
4. ...
DECIMALS dec
5. ...
LIKE g
6. ...
MEMORY ID pid
7. ...
MATCHCODE OBJECT mobj
8. ... MODIF ID modid
9. ...
NO-DISPLAY
10. ...
LOWER CASE
11. ...
OBLIGATORY
12. ...
AS CHECKBOX
13. ...
RADIOBUTTON GROUP radi
14.
... FOR TABLE dbtab
15.
... FOR NODE node
16.
... AS SEARCH PATTERN
17.
... VALUE-REQUEST
18.
... HELP-REQUEST
19.
... VISIBLE LENGTH vlen
20.
... VALUE CHECK
21.
... LIKE (g)
22. ...
AS LISTBOX
23. ... USER-COMMAND ucom
Defines Program Parameters
Objects that you define with this statement can have two functions:
PARAMETERS SUM(1).
This creates a field
SUM with type 'C'.
If the program is an executable program, a selection screen with an input field for
SUM appears directly after the SUBMIT
statement. If the statement occurs between
SELECTION-SCREEN BEGIN OF SCREEN scrn
and SELECTION-SCREEN
END OF SCREEN
scrn, SUM
is displayed on the selection screen scrn when you call
it from the program using the CALL SELECTION-SCREEN scrn statement.
Defining Input Fields for Single Values
... DEFAULT f
The parameter has the default value f.
... TYPE type
The field in the program has the type type.
PARAMETERS: NUMBER(4) TYPE P DEFAULT 999.
... LENGTH n
The field in the program is assigned the length n. n must be numeric.
The addition LENGTH n is only allowed for parameters of
the types C, N, X or P.
PARAMETERS: WORT TYPE C LENGTH 4 DEFAULT 'WORT'.
... DECIMALS dec
The field in the program is defined with dec decimal places. dec must be a numeric value.
PARAMETERS: NUMBER(4) TYPE P DECIMALS 2 DEFAULT '123.45'.
... LIKE g
Creates the field p with the same attributes as the field
g, which has already been declared. g can be an ABAP Dictionary field, or a field in the program that has already been declared.
You cannot use the
LIKE g and TYPE type
additions together. Neither can you specify an explicit length (so, for example, PARAMETERS p(len) LIKE g is not allowed).
PARAMETERS PROGRAM LIKE SY-REPID.
... MEMORY ID pid
Assigns the memory ID pid to the parameter on the selection
screen. This means that when the selection screen appears, the input field contains the last value entered by the user in a field with memory ID pid.
Enter the memory ID directly without inverted commas. It may be up to 20 characters long.
... MATCHCODE OBJECT mobj
Assigns the matchcode object mobj to the field on the selection screen.
Enter the name of the matchcode object directly without inverted commas. It may be up to 4 characters long.
Assigns the screen fields to the modification group (SCREEN-GROUP1),
which you can use to modify the screen in the AT SELECTION-SCREEN OUTPUT event (for example, to make fields display only).
... NO-DISPLAY
The parameter is not displayed on the selection screen. The corresponding data object is created like
a "normal" parameter, and you can pass a value to it in the
SUBMIT statement.
This type of parameter
is part of the interface of the program, but it is not displayed to the user. You can either set values
for these parameters internally (using the INIT routine
in
SAPDBldb or the INITIALIZATION
event in the program), or pass them in the SUBMIT statement.
These parameters are also stored in variants.
If you want the user to be able to fill out the
parameter under certain conditions (for example, depending on the values in other parameters or select-options),
you can do so in the PAI routine of the database program SAPDBldb
(for database-specific parameters), or in the
AT SELECTION-SCREEN event (for program-specific parameters)
by calling a function module (CALL
FUNCTION) or a separate screen (CALL SCREEN).
Since the parameter is not generated on the selection screen, you cannot use any formatting additions together with the NO-DISPLAY addition.
... LOWER CASE
The parameter allows case-sensitive input.
... OBLIGATORY
The user must enter a value on the selection screen.
... AS CHECKBOX
The parameter appears as a checkbox on the selection screen.
Checkbox parameters must have type
C and length 1.
The checkbox is displayed to
the left of its corresponding text. You can rearrange this using the SELECTION-SCREEN statement.
... RADIOBUTTON GROUP radi
The parameter appears on the selection screen as a radio button. All parameters assigned to the same
group radi in this way, form a group of radio buttons
on the selection screen. When one is selected, all of the others are not selected. The name of the radio
button group can be up to four characters long.
When you define a radio button parameter, you cannot
specify a length. However, you can use the LIKE addition
to refer to a field with length 1 and type
C or the TYPE
addition to specify length 1 and type C.
The
addition does not affect the way in which the parameter is displayed (as in the
AS CHECKBOX additino). You can arrange the parameters as
you like using the SELECTION-SCREEN statement.
... FOR TABLE dbtab
Assigns the database-specific parameter p to the database
table dbtab.
It only makes sense to use this addition
in the database access program of a logical database.
With database-specific parameters, you need
the addition to ensure that the selection screen of an executable program only contains the relevant parameters (that is, those that correspond to tables that are used in the program).
... FOR NODE node
Assigns the database-specific parameter p to the node
node.
This addition has the same effect as addition 14. You use it for nodes declared with the NODES statement.
... AS SEARCH PATTERN
The database-specific parameter p is created as a complex
data object with type SYLDB_SP (defined in type group SYLDB) with the fields HOTKEY (short
name for single search helps), STRING (search string) and a complex
data object TRANGE that can contain complex selections.
You use it to select data using search
help selections.
On the selection screen, the first two components appear, along with a pushbutton
for entering complex selections, in a box with the text "Selection using search help".
The
user can display possible entries using both the HOTKEY and a search
string using F4. Once the user
has chosen a single search help or pressed F4
in the "Search string" field, a special dialog box appears, in which he or she can enter a search string.
The search string is interpreted generically for each subfield.
As well as the 'simple' selection,
you can also enter complex selections (such as "all cities beginning with 'ABC'") when you press this button.
You can only use the AS SEARCH PATTERN addition in the
database access program of a logical database. You must use the FOR
TABLE
addition with it. You can also use it in conjunction with the MODIF
ID addition, but not with any other additions. The search help
to which the single search helps and the search string refer is specified in the definition of the logical database.
Input on selection screen:
This selects all customers whose names begin with "Daniel".
Performance:
Search help selection allows you to improve the performance of a program
considerably, since it is often easier to describe the set of records you want to select using a search
help than using the technical key fields of the tables. For example, it is easier to search for a name
("Daniel") than for a customer number ("000043010"). As a result, you are likely to read less data from the database.
If a logical database (called, for example, ldb) contains
a parameter
p defined using AS SEARCH
PATTERN, the system always creates an internal table ldb_SP
containing all key fields of the records selected using search help selection. The structure of
ldb_SP is determined by the relevant collective search help,
and is created automatically. The structure is displayed as a comment in the database program in the Logical Database Builder.
Search help for table
T1 with key field T1-K1.
The table ldb_SP would then have the following structure:
DATA: BEGIN OF ldb_SP OCCURS 100,
T1_K1
LIKE T1-K1,
END OF ldb_SP.
If the user has entered values for the parameter of the search help, the key fields of the actual database
tables are read in the START-OF-SELECTION
event according to the selections, and made available to the logical database program in the internal
table ldb_SP. After this, the database program can process
the records in the subroutine
PUT_ldb_SP and use PUT
to trigger the corresponding GET
events in the executable program. Processing then continues in the same way as with normal data sleection directly from the database.
With search help selection, all fields of the internal table that were filled by the matchcode are flagged
in the table SP_FIELDS (the field name is contained in
SP_FIELDS-FIELDNAME). The flag is in SP_FIELDS-SUPPLIED).
A field F0 has been filled by the search help if the following
condition is met:
IF SP_FIELDS-FIELDNAME EQ 'F0'
AND SP_FIELDS-SUPPLIED NE SPACE.
Further documentation:
... VALUE-REQUEST
You can only use this addition for database-specific parameters in the DBldbSEL
include. It allows you to program your own value help. You can do this for program-specific parameters
using the event keyword AT SELECTION-SCREEN ON VALUE-REQUEST FOR .... The effects of this addition are as follows:
* INCLUDE DBXYZSEL
...
PARAMETERS PL_TYPE LIKE SAPLANE-PLANETYPE
VALUE-REQUEST.
...
REPORT SAPDBXYZ DEFINING DATABASE XYZ.
...
TABLES SAPLANE.
...
FORM PL_TYPE_VAL.
...
CALL FUNCTION ...
...
ENDFORM.
... HELP-REQUEST
Like the VALUE-REQUEST addition, this addition is only
valid for database-specific parameters in the DBldbSEL
include. It allows you to program your own field help. You can do this for program-specific parameters
using the event keyword AT
SELECTION-SCREEN ON HELP-REQUEST FOR ...
erreicht). When the user presses F1,
the FORM routine p_HLP
in the database access program SAPDBldb is triggered (if
it exists). This always happens when you use this addition; even if the parameter is defined with reference
to an ABAP Dictionary field, the data element documentation for the field is not displayed. Instead,
you can, for example, call a function moduel from the routine p_HLP that displays your documentation.
The routine
p_HLP is called when you press F1
either on the field p or on a comment belonging to it
(SELECTION-SCREEN COMMENT ... FOR FIELD p).
* INCLUDE DBXYZSEL
...
PARAMETERS PL_TYPE LIKE SAPLANE-PLANETYPE
HELP-REQUEST.
...
REPORT SAPDBXYZ DEFINING DATABASE XYZ.
...
TABLES SAPLANE.
...
FORM PL_TYPE_HLP.
...
CALL FUNCTION ...
...
ENDFORM.
... VISIBLE LENGTH vlen
Shortens the visible length of a parameter field on the selection screeen to vlen.
... VALUE CHECK
Ensures that the value entered in the field is checked against the check table or fixed values defined
in the ABAP Dictionary. There must be a LIKE reference to an ABAP Dictionary field.
If there is a check table, the full foreign key check is generated. Consequently, all of the ABAP Dictionary
fields involved in the check must be filled for the check to be meaningful.
The check is also
performed if the field is empty. You should therefore use the OBLIGATORY addition as well when you use VALUE CHECK.
TABLES SBOOK.
...
PARAMETERS CARRID LIKE SPFLI-CARRID.
PARAMETERS CONNID LIKE SBOOK-CONNID VALUE CHECK.
...
AT SELECTION-SCREEN OUTPUT.
IF
CARRID IS INITIAL.
SBOOK-CARRID = 'LH'.
ELSE.
SBOOK-CARRID = CARRID.
ENDIF.
The foreign key check for SBOOK-CONNID uses the current
contents of
SBOOK-CARRID:
SELECT * FROM SPFLI WHERE
CONNID = CONNID
AND CARRID = SBOOK-CARRID.
In the example, the AT SELECTION-SCREEN OUTPUT event makes sure that a value is placed in field SBOOK-CARRID.
... LIKE (g)
In this case, the name of the reference field is specified as the contents of field
g at runtime. This allows you to set the attributes of p dynamically.
TABLES SBOOK.
...
DATA FNAME LIKE TABFIELD-LFIELDNAME.
PARAMETERS PARDYN LIKE (FNAME).
...
INITIALIZATION.
FNAME = 'SBOOK-CARRID'.
The parameter PARDYN appears on the selection screen with
the technical attributes of
SBOOK-CARRID. The F1 and
F4 help are also inherited from SBOOK-CARRID. If
FNAME has its own selection text, the system displays
it on the selection screen. If it does not have a text, the text for SBOOK-CARRID from the ABAP Dictionary is displayed instead.
... AS LISTBOX
Generates a dropdown list box for the parameter p input field on the selection screen. If the parameter is created with a data type from the ABAP Dictionary and the data type is linked with an input help from the ABAP Dictionary, the system displays the first input help column in the list box.
You must always specify the VISIBLE LENGTH addition with
the AS LISTBOX addition, to define a suitable list box width for the input help.
PARAMETERS p TYPE spfli-carrid AS LISTBOX VISIBLE LENGTH 20.
... USER-COMMAND ucom
This addition is only supported for parameters that are defined as checkboxes
or
radio buttons. In this case, clicking the parameter
triggers the user command ucom, similarly to SELECTION-SCREEN PUSHBUTTON.
SELECT-OPTIONS, SELECTION-SCREEN, AT SELECTION-SCREEN, CALL SELECTION-SCREEN