Entering content frameBackground documentation Error Handling Routines Locate the document in its SAP Library structure

The source code generated by the SAPforms Designer does not contain any error handling routines. As is standard in Microsoft Visual Basic, you program your own error handling routines, for example by displaying a Microsoft Visual Basic error message in a message window using MsgBox Err.Description . An error handling is important to inform SAPforms form users in a suitable manner of any errors they might have caused as a result of their inputs.

There are two errors categories - warnings and errors:

Example

The user enters a non-numeric input in a numeric field.

Logon to the SAP System fails because the password was incorrect. A message window to this effect is to be displayed.

The SAP Forms components give you full control over the errors that are specific to SAPforms.

An example of an error generated by SAPforms are those output for field checks that are carried out on user inputs by the SAPData Plug-In. If a non-numeric value is entered in a numeric field, for example, an error is output. This error should be recorded and processed in the Microsoft Visual Basic source code of the SAPforms form.

It is advisable to define a corresponding reference to help you program the errors generated by SAPforms:

  1. In Microsoft Visual Basic, choose Project ® References...
  2. The References dialog box is displayed.

  3. Choose the SAPforms constants reference.
  4. If this reference is not listed, choose the Browse option in the References dialog box. Then load the file WDFCONT.TLB from the ...\SAPforms\Bin directory to your reference library.

  5. Choose View ® Object Browser and choose the SAPformsConstants library. The sapErrorCodes class contains the errors generated by SAPforms.

You can use the following Microsoft Visual Basic code to check user inputs, as described in the example above:

Syntax

...
On Error GoTo trap
...
trap:
if err.number = sapErr_IllegalNumeric then
MsgBox "[error message]"
...

You can use an error number instead of a fixed name. In the same way, you can program all of the fields in the sapErrorCodes class in Microsoft Visual Basic.

Leaving content frame