Using Input Fields

Prerequisites

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

Context

You can use input fields to allow the user to enter data in a dynamic document. An input field can also trigger an event when the user presses F1 (field help), or ENTER.

Procedure


  1. In the declaration part of your program, declare an object reference variable with the type REF TO cl_dd_input_element.

  2. If you want to react to any of the events that can be triggered by an input field, create a local class in your program and write handler methods for the required events. Remember to import the special interface parameter sender, so that you can tell on which input field the event was triggered.

    User action

    Event triggered (event of class cl_dd_input_element)

    User presses F1

    help_f1

    User presses ENTER

    entered

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

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

  5. Using the object reference returned by the method call, register the instance for the required events for which you defined event handler methods in step 2.