Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Selection Screens →  Create Selection Screens →  PARAMETERS →  PARAMETERS - value_options 

Selection Screens, Value Properties of Parameters

The example shows how to use the value_options additions of the PARAMETERS statement.

Other versions: 7.31 | 7.40 | 7.54

Source Code

REPORT demo_sel_screen_parameters_1.

SELECTION-SCREEN BEGIN OF SCREEN 100.

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.
PARAMETERS: value TYPE i DEFAULT 100,
            name  TYPE sy-uname DEFAULT sy-uname,
            date  TYPE sy-datum DEFAULT '19980627'.
SELECTION-SCREEN END OF BLOCK part1.

SELECTION-SCREEN BEGIN OF BLOCK part2 WITH FRAME TITLE text-002.
PARAMETERS: field1 TYPE c LENGTH 10 DEFAULT 'input1',
            field2 TYPE c LENGTH 10 DEFAULT 'input2' LOWER CASE.
SELECTION-SCREEN END OF BLOCK part2.

SELECTION-SCREEN BEGIN OF BLOCK part3 WITH FRAME TITLE text-004.
PARAMETERS p_carrid TYPE s_carr_id MATCHCODE OBJECT demo_f4_de.
SELECTION-SCREEN END OF BLOCK part3.

SELECTION-SCREEN BEGIN OF BLOCK part4 WITH FRAME TITLE text-003.
PARAMETERS p_prog TYPE sy-repid MEMORY ID rid.
SELECTION-SCREEN END OF BLOCK part4.

SELECTION-SCREEN BEGIN OF BLOCK part5 WITH FRAME TITLE text-005.
PARAMETERS p_carr TYPE spfli-carrid VALUE CHECK.
SELECTION-SCREEN END OF BLOCK part5.

SELECTION-SCREEN END OF SCREEN 100.

AT SELECTION-SCREEN OUTPUT.
  SET PARAMETER ID 'RID' FIELD 'TEST_PROGRAM'.

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: / 'FIELD1 is transported UPPERCASE      : ', field1,
           / 'FIELD2 is transported without changes: ', field2.
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  start=>main( ).

Description

This example program consists of five parts, each illustrating one of value_options additions of the statement PARAMETERS. Each example corresponds to a block on selection screen 100.

  • Part 1: The input fields of the parameters on the selection screen are filled with default values. The user may accept or change this value. The default value of the field name is the user name. The default value for date appears in the format defined in the user master record.
  • Part 2: Once parameters have been entered in the fields field1 and field2, they are output in uppercase (field1) and without any changes (field2) on a list.
  • Part 3: The search help DEMO_F4_DE is defined in the Dictionary. The search help reads the columns CARRID and CARRNAME of the database table SCARR. Only SCARRNAME is listed but CARRID is marked as an export parameter. Selecting a line places the ID of the airline CARRID in the input field.
  • Part 4: The parameter p_prog is linked with the SPA/GPA parameter rid which is used in the current AS ABAP version to store the name of the program processed last. The SPA/GPA parameter rid, for example, is also linked with the input fields for the program name on the screens of the transactions SE38 and SA38. For demonstration purposes, this parameter is explicitly set to the value "TEST_PROGRAM" in this example.
  • Part 5: The parameter p_carr is declared with reference to the field CARRID of the database table SPFLI. For this field, the check table SCARR is specified in the ABAP Dictionary. The user can only enter those values for the ID of the airline which are also contained in SCARR. The input help of the input field for p_carr shows exactly the permitted values.