The code generated by the
SAPforms Designer does not contain any error handling routines. As is standard in Visual Basic, you must program your own error handling routines, for example by displaying a Visual Basic error message in a message window using MsgBox Err.Description . Error handling is important to inform form users in a suitable manner of any errors they might have arisen as a result of their inputs.There are two errors categories - warnings and errors:

The user enters a non-numeric input in a numeric field.
Logon to the R/3 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 VB code of the form.It is advisable to define a corresponding reference to help you program the errors generated by SAPforms:
If this reference is not listed, choose the Browse option in the References dialog box. Then load the file
You can use the following VB code to check user inputs, as described in the example above:

...
On Error GoTo trap
...
trap:
if err.number
= sapErr_IllegalNumeric thenMsgBox "[ErrorMessage]"
...
You can use an error number instead of a concrete name. In the same way, you can program all of the fields in the sapErrorCodes class in Visual Basic.