Programming Forms 

Use

In the case of Visual Basic forms, SAPforms Designer inserts a few lines of code into your form to handle communication between the form and the R/3 System ( Code inserted by the SAPforms Designer). This code is sufficient to support communication with the R/3 System.

For more complex forms, however, you may need to insert your own code. Typical situations where you may have to add code are:

Input Checks

In the Process notification of absence example ( Workflow Examples), the system checks whether a leave request was accepted or rejected. For this purpose, a specific value ( A for "Accept", R for "Reject") is assigned to a container variable ( CheckResult ) in the VB code. The assignment is made via the following code:

objSAPForm.sapdata.Value("CheckResult") = "A"

and

ObjSAPForm.sapdata.Value("CheckResult") = "R"

This variable is interrogated when the workflow is executed and is evaluated accordingly.

Data Retrieval

In the examples on Creating a customer master record and Creating a customer master record via IDoc, the information required to call the BAPI but is not to be entered on the form but rather imported from a local file called CUSTOMER.TXT via a VB routine.

For more information see Error Handling Routines

You can also call the SAPforms interface directly. In this case, you add the required operations (initialize interface, define binding) directly in the code of the Visual Basic form.

Prerequisites

You need a thorough knowledge of programming with Visual Basic.

If the code you want to insert references SAPforms objects, you also need to be extremely familiar with the properties and methods of these objects.

Detailed explanations of the properties and methods is available under the Object Browser in Visual Basic (View ® Object Browser). You must include the references to the required SAPforms components in your project (Project ® References..). The most important properties and methods are also explained in this documentation. See Plug-Ins.