Using Dropdown List Boxes

Use

You can use dropdown list boxes to present the user with a list of options from which he or she may choose one. It is only possible to choose items from the list. Dropdown list boxes can trigger an event selected when the user selects an entry.

Prerequisites

You must already have created a dynamic document and added a form to it using the add_form method.

Procedure

  1. In the declaration part of your program, declare an object reference variable with the type REF TO cl_dd_select_element .
  2. In a local class in your program, write a handler method for the selected event of class cl_dd_select_element . It does not matter whether it is a static method or an instance method. The method should contain the processing logic for what will happen when the user selects an item from the list.

    Remember to include the special parameter sender in the interface of the method. If you have more than one dropdown list box in the dynamic document, you will need sender to identify the one in which the user actually made a selection

  3. Call the add_select_element method for the form instance with which you are currently working.

    The method returns an object reference to the list box, which you should assign to the reference variable you declared in step 1.

  4. Use the object reference to the list box to register its selected event.

See also:

add_select_element