Adding a Program Variable  

To add a program variable:

  1. Select the field in the field list.
  2. The Generator suggests a variable name for the field in the Name field.

  3. In the Name field, modify the variable name, if desired.
  4. Ensure that the Name Type field is set correctly to Input or Output
  5. Choose Add Name.

The Generator inserts a variable declaration and related code. This code varies depending on whether you requested an input or output variable. For an input variable, the Generator assumes you want to transfer a value to an input field in an SAP screen. As a result, you get code like:

Dim DevClassVal As String
bOK = Sap.SetControlValue(iCtrl, DevClassVal)

where the requested variable is used as the source field for an assignment to the currently selected control. When adapting the program, of course, you must ensure that the input variable has the correct value (probably from an external interface).

For an output value, the Generator assumes you want a variable to be used as a target field. The corresponding control is the source field in the assignment:

Dim PostalCode As String
PostalCode = Sap.Controls(iCtrl).Value