You use the PARAMETERS statement to declare variables in a similar manner to the DATA statement Variables declared with the PARAMETERSstatement are called parameters. For each parameter declared, an input field appears on the corresponding selection screen. On the left hand side of the input field, the name of the parameter is displayed as text. You can modify this text as selection text. Values entered into the input field by the user are assigned to the corresponding variable while the system processes the selection screen. The position of the statement in the declaration part of the program determines the selection screen to which the input field belongs.
The basic form of the PARAMETERS statement is as follows:
PARAMETERS p[(length)] [TYPE type|LIKE obj] [DECIMALS d].
This statement creates parameter p. Currently, parameter names are limited to eight digits. The additions length, TYPE|LIKE and DECIMALS are the same as for the DATA statement. Note that the data types valid for parameters include all elementary ABAP types except data type f. You cannot use data type f, references and aggregate types.
If the parameter refers to data types from the Dictionary, it adopts all attributes of the Dictionary field. Currently, parameters can only refer to fields of database tables, views and structures. In particular, the field help (F1) and the possible entries help (F4) defined for these fields in the Dictionary are available to the user. To check a user entry against a value list in the Dictionary, you must use the special addition VALUE CHECK.
Parameters are used for simple queries of single values. For example, you can use parameters to control the program flow. However, if you want to restrict database accesses or perform complex selections, you should use selection criteria.
PARAMETERS: word(10) TYPE c,
date TYPE d,
number TYPE p DECIMALS 2,
connect TYPE spfli-connid.
Four parameters are created for the standard selection screen, a character field, word, of length 10; a date field, date, of length 8; a packed number field, number, with two decimals; and a field, connect, that refers to the SPFLI-CONNID type in the ABAP Dictionary. When the user starts the program, the input fields appear as follows on the standard selection screen: