PARAMETERS

Basic form

PARAMETERS p.

Extras:

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

Effect

Defines Program Parameters

Objects that you define with this statement can have two functions:

  1. In executable (type 1) programs:

    You can run executable programs using the r SUBMIT statement. The PARAMETERS and SELECT-OPTIONS statements form their interface. This is usually the interface between the program and the user, that is, the parameters and select-options are filled out by the user on the selection screen (see also the NO-DISPLAY addition and the SUBMIT statement without the VIA SELECTION-SCREEN addition).

  2. In any program (apart from a subroutine pool, that is, a program with type S):

    Objects in a program, defined on a selection screen that is filled out by the user at runtime.

Notes

Example

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.

Additional help

Defining Input Fields for Single Values

Addition 1

... DEFAULT f

Effect

The parameter has the default value f.

Notes

  1. The default value f must be specified in internal format, that is, for example PARAMETERS DATUM LIKE SY-DATUM DEFAULT '19931224', not ... DEFAULT '24.12.1993'.

  2. The default value g should be a literal, since the value is placed in the parameter p so early in the SUBMIT sel statement that a field g would not actually have a value. The exception to this are some system fields, such as SY-DATUM, which already has a value when the report is started.

    In user-defined selection screens in programs that you do not start using SUBMIT, the DEFAULT value is not placed in the parameter until the selection screen is called for the first time. In this case, you can specify a field g as the default.


Addition 2

... TYPE type

Effect

The field in the program has the type type.

Example

PARAMETERS: NUMBER(4) TYPE P DEFAULT 999.

Addition 3

... LENGTH n

Effect

The field in the program is assigned the length n. n must be numeric.

Note

The addition LENGTH n is only allowed for parameters of the types C, N, X or P.

Example

PARAMETERS: WORT TYPE C LENGTH 4 DEFAULT 'WORT'.

Addition 4

... DECIMALS dec

Effect

The field in the program is defined with dec decimal places. dec must be a numeric value.

Notes

  1. You can only use the addition DECIMALS dec with the addition TYPE P.
  2. You cannot use types F (floating point), 1, or 2 (6-digit date formats). The same restriction applies to the LIKE addition.


Example

PARAMETERS: NUMBER(4) TYPE P DECIMALS 2 DEFAULT '123.45'.

Addition 5

... LIKE g

Effect

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.

Note

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).

Example

PARAMETERS PROGRAM LIKE SY-REPID.

Notes

  1. If g is an ABAP Dictionary field with type CHAR, length 1, and fixed values 'X' and ' ' (defined in its domain), the parameter is always displayed as a checkbox on the selection screen (see also the AS CHECKBOX addition).

  2. Field attributes on the selection screen:
    The input/output fields on the selection screen have the same attributes as the field g in the LIKE addition (that is, the same type, length, and in the case of ABAP Dictionary fields, the same conversion exit.

    If g is an ABAP Dictionary field, most of its field attributes are updated automatically if you change them in the Dictionary. The exceptions to this are the "Check table" and "Fixed values" attributes. If these change, you must reactivate the program in the ABAP Workbench. The selection screen is then automatically regenerated.

  3. PARAMETERS may not have a deep type. This applies to both the TYPE and LIKE additions.

  4. Parameters are displayed on the selection screen up to 45 characters long (scrollable to 132 charactrs). If you define a longer field, either explicitly (like p(200)) or implicitly (using LIKE), the parameter is truncated after the 132nd character on the selection screeen. However, in the SUBMIT statement, you can pass longer paraemters to an executable program if they have been excluded from the selection screen using the NO-DISPLAY addition. If you do not use NO-DISPLAY, the parameter is still truncated, even if you run the program without displaying the selection screen (seeSUBMIT without the VIA SELECTION-SCREEN addition).


Addition 6

... MEMORY ID pid

Effect

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.

Note

Enter the memory ID directly without inverted commas. It may be up to 20 characters long.

Addition 7

... MATCHCODE OBJECT mobj

Effect

Assigns the matchcode object mobj to the field on the selection screen.

Note

Enter the name of the matchcode object directly without inverted commas. It may be up to 4 characters long.

Addition 8

... MODIF ID modid

Effect

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).

Addition 9

... NO-DISPLAY

Effect

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).

Note

Since the parameter is not generated on the selection screen, you cannot use any formatting additions together with the NO-DISPLAY addition.

Addition 10

... LOWER CASE

Effect

The parameter allows case-sensitive input.

Addition 11

... OBLIGATORY

Effect

The user must enter a value on the selection screen.

Addition 12

... AS CHECKBOX

Effect

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.

Notes

  1. You can assign a user command to a checkbox parameter using the USER-COMMAND ucomm addition.
  2. A parameter can also be displayed as a checkbox even if you do not use the AS CHECKBOX addition. This occurs under the following condition:
    You must have used the LIKE or TYPE addition to define a parameter with reference to an ABAP Dictionary type with field type CHAR and length 1. The corresponding domain must have the two fixed values 'X' and ' '.

    The addition USER-COMMAND ucomm can also cause a parameter to be displayed as a checkbox, even if you have not used the AS CHECKBOX addition.


Addition 13

... RADIOBUTTON GROUP radi

Effect

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.

Notes

  1. You can assign a user command to the radio button group using the USER-COMMAND ucomm addition. Since all of the buttons in the same group have the same command, you can only use this addition with the first parameter in the group.
  2. A RADIOBUTTON group must have at least two parameters, of which only one (at most) can have a DEFAULT addition. The DEFAULT value must be 'X'.
  3. In the database INCLUDE DBldbSEL, RADIOBUTTON parameters, like all others, must have the addition FOR TABLE dbtab. All of the parameters in a group must belong to the same table dbtab.
  4. You cannot use a group name radi in a program if it has already been used in DBldbSEL.
  5. Unlike in the case of "normal" parameters, the system does not jump to the AT SELECTION-SCREEN ON p event (in fact, it is syntactically not allowed). Instead, there is an event AT SELECTION-SCREEN ON RADIOBUTTON GROUP radi for the entire group. If this event contains a Error or Warning message, the entire radio button group is ready for input when the selection screen is redisplayed.


Addition 14

... FOR TABLE dbtab

Effect

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).

Addition 15

... FOR NODE node

Effect

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.

Addition 16

... AS SEARCH PATTERN

Effect

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.

Note

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.


Example

Input on selection screen:

Single search help:
Customers
Search string:
Daniel

This selects all customers whose names begin with "Daniel".

Note

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.

Note

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.

Example

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.

Note

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.

Example
FORM PUT_ldb_SP.
  SELECT * FROM T1
    WHERE K1 = ldb_MC-T1_K1
    FOR ALL ENTRIES IN ldb_SP.
    PUT T1.
  ENDSELECT.
ENDFORM.

Note

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).

Example

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.

Note

Further documentation:

Addition 17

... VALUE-REQUEST

Effect

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:

  1. The field on the selection screen is displayed with a pushbutton for F4 value help.
  2. When you press the button or F4, the FORM routine p_VAL in the database access program SAPDBldb is triggered (if it exists). This happens even if the paraemter is defined using a LIKE reference to an ABAP Dictionary field - this FORM routine is processed instead of the check table or fixed values of the ABAP Dictionary field being displayed. From the routine p_VAL, you can call a function module that displays a selection of possible values. The contents of the field p at the end of the FORM routine are placed in the corresponding input/output field.


Example


* INCLUDE DBXYZSEL
...
PARAMETERS PL_TYPE LIKE SAPLANE-PLANETYPE VALUE-REQUEST.
...

REPORT SAPDBXYZ DEFINING DATABASE XYZ.
...
TABLES SAPLANE.
...
FORM PL_TYPE_VAL.
...
  CALL FUNCTION ...
...
ENDFORM.


Addition 18

... HELP-REQUEST

Effect

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.

Note

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).

Example


* INCLUDE DBXYZSEL
...
PARAMETERS PL_TYPE LIKE SAPLANE-PLANETYPE HELP-REQUEST.
...

REPORT SAPDBXYZ DEFINING DATABASE XYZ.
...
TABLES SAPLANE.
...
FORM PL_TYPE_HLP.
...
  CALL FUNCTION ...
...
ENDFORM.


Addition 19

... VISIBLE LENGTH vlen

Effect

Shortens the visible length of a parameter field on the selection screeen to vlen.

Addition 20

... VALUE CHECK

Effect

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.

Note

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.

Example



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.


Addition 21

... LIKE (g)

Effect

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.

Notes

Example



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.


Addition 22

... AS LISTBOX

Effect

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.

Note

You must always specify the VISIBLE LENGTH addition with the AS LISTBOX addition, to define a suitable list box width for the input help.

Example

PARAMETERS p TYPE spfli-carrid AS LISTBOX VISIBLE LENGTH 20.

Addition 23

... USER-COMMAND ucom

Effect

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.

Notes

  1. Since all parameters of a radio button group have the same user command, you can only use this addition with the first parameter in the group. The user command is then triggered when you click any button in the group.
  2. If the parameter does not have the RADIOBUTTON GROUP or AS CHECKBOX addition, it must have type Character and length 1. It is then displayed as a checkbox.


Related

SELECT-OPTIONS, SELECTION-SCREEN, AT SELECTION-SCREEN, CALL SELECTION-SCREEN