Show TOC

Example: Employment OpportunitiesLocate this document in the navigation structure

Use

Suppose an employment opportunities transaction allows the user to enter qualifications on an HTML form. If users have more than one qualification, they can move from one to the next (or back) using the right and left arrows on the page. In the SAP system, the qualification screen is implemented with a single SAP system screen.

Since the Web page's arrow buttons use the POST method to post data to the SAP transaction, the resulting pages are cached. When going back and forth (using the browser's Back and Forward buttons), the pages are retrieved from the Web browser cache. The SAP transaction is not notified.

Here is an example scenario where an error can occur if the transaction program does not take the proper precautions:

  1. The user enters the first qualification and uses the right arrow to confirm.

  2. The user enters the second qualification and uses the right arrow to confirm.

    The Web browser now displays an empty form, so the user could enter a third qualification.

  3. The user goes back to the second qualification using the Web browser's Back button.

    The page with the second qualification can be retrieved from the Web browser cache since the page was generated by a POST operation when the right arrow was used to confirm the first qualification.

  4. In the second qualification page, the user changes the Rating field, and submits the changes using the right arrow button.

The user now expects that two qualifications have been entered. However, unless you use an additional hidden field to transfer the consecutive qualification numbers to the system as each new qualification is submitted, the user would have actually entered three qualifications for the following reasons:

When the user returned from the third, empty qualification screen to the second, the transaction is not notified since the page was retrieved from the Web browser cache. The SAP system screen number remains the same. Thus, when the user submits the change to the Rating field for qualification 2, the Web transaction assumes it is still editing the third qualification.

Synchronization does not help here, since the Internet Transaction Server (ITS) only compares which SAP system screen is needed with the current SAP system screen. Only if these two screens are different does the ITS send special OK codes to the transaction.

You can easily solve this problem by submitting a hidden field that contains the qualification number to the transaction. n our example, the Web browser submits the changed rating field together with the qualification number 2. The transaction can then recognize that the user has not submitted a new qualification, but is merely changing the existing qualification number 2.

Here is an example how an HTML template can make use of hidden HTML fields:

<form action="`wgateUrl()`" method="post">
<input type="hidden" name="qual_number"
                VALUE"`qual_NUMBER`">
<select name="qual">
`repeat with I from 1 to qual_value.dim`
<option value="`qualification_value[I]`>
`end`
</select>
<select name="qual_rating">
`repeat with I from 1 to qual_rating_value.dim`
<option value="`qual_rating_value[I]`>
`end`
</select>
</form>
         

In this example, the SAP system screen would contain two fields, QUAL and qual_rating, to display the qualification and the qualification rating entered by the user (on the HTML screen). The current qualification number, identified by the field QUAL_NUMBER on the SAP system screen, is merged into the HTML page using hidden fields.

Whenever the form results are posted back to the SAP system screen, the current qualification number is sent back to the transaction as well. This way, the transaction can determine whether a new qualification is being added or if an existing qualification (that was already entered in the system) is being changed.