Evaluating Form Input

Use

With web forms you can do more than merely display them in a browser. You can use the Web Attributes tab of text nodes to flag fields as input elements. SAP Smart Forms encloses all input elements of a form in an HTML form. The procedure below describes how to use a BSP application to evaluate input into a web form.

Prerequisites

You uses SAP Smart Forms to create a web form in a BSP application (see: Integration Into BSP Applications). The form contains at least one field that is flagged as a Submit pushbutton (see also: Web Attributes).

You call the Smart Form in the event handler OnInitialization of your BSP page, for example, on the page FORM.HTM .

Procedure

  1. To enable SAP Smart Forms to generate the target URL, to which you want the data input to be passed, into the HTML output, you must specify this URL in the XSFACTION parameter. Before calling the Smart Form, assign to this parameter the name of the BSP page that you want to call as soon as the user presses the Submit button:

    data: ls_output_options type ssfcompop.

    ls_output_options-xsfaction = 'PAGE.HTM'.

    If you do not fill the XSFACTION parameter, the browser loads the current page again when the user clicks the Submit button (that is FORM.HTM ).

  2. Fetch the form input on the next page in the event handler OnInitialization ( PAGE.HTM in this example). To do so, use method get_form_fields of the request object:

    data: http_fields type TIHTTPNVP.
    call method request->get_form_fields
               changing fields = http_fields.

  3. Evaluate table http_fields in your application. Each table line consists of the fields Name and Value (that is, a name/value pair). The input elements in the table are sorted by their appearance in the form.

Some HTML elements are passed only if they are 'active' (marked checkbox, clicked Submit button). Otherwise they are not contained in table http_fields . See also: Digression: HTML Forms and the BSP sample application SF_WEBFORM_02 .