Getting Started 

This chapter provides a brief example of how to design a Visual Basic form for starting a workflow in the R/3 System. This form could start a workflow that handles approval of a leave application. The form that we are about to design represents the leave application.

Prerequisites

You have installed SAPforms.

Procedure

To familiarize yourself with Visual Basic gradually, you should start with a simple Visual Basic project that contains a form with controls and no Visual Basic code.

SAP Forms Designer will add all the definitions you need for starting a workflow with this form. You do not need to write any code for this purpose.

Work through the following steps:

  1. Start Visual Basic.
  2. Check whether the Add-Ins menu contains the SAPforms entry. If this is the case, skip the next step.
  3. Choose Add-Ins ® Add-In Manager and select the SAPforms entry.
  4. In some cases, the SAP Forms add-in might not be listed in the Add-Ins menu of Visual Basic or in the Add-In Manager. This can happen, for example, if you installed Visual Basic after you installed SAPforms. In this case please do the following:

    a) Close Visual Basic

    b) Open the MD DOS command prompt.

    c) Open the Bin directory under SAPforms

    d) Enter WDFDES.EXE /R ..

    e) Start Visual Basic again.

  5. Open the project Demo3a in the ...\ SAPforms\Samples directory.
  6. Open the form frmTst3a.frm in the project window. This is an absence form that triggers a workflow in the R/3 System.
  7. Choose Add-Ins ® SAPforms ® Designer.
  8. The main window of the SAPforms Designer is then displayed. This window essentially consists of two large controls.

    The top control is still empty.

    The bottom control - a table control - contains a list of the elements in the "leave request" form.

  9. Choose Tools ® Options.
  10. The Options dialog box of the SAPforms Designer is then displayed.

  11. Select the tab page Plug-Ins.
  12. Enter SAP Forms Data Plug-In Demo in the Active Plug-In field in the SAP Forms Data Plug-In box. Choose this entry from the list of possible entries (F4).
  13. In the frame SAP Transmit Plug-In the value for the SAP Forms Transmit Plug-In Demo is now entered automatically in the Active Plug-In field.

  14. Click OK to exit this dialog box.
  15. The main window of the SAPforms Designer is then displayed again.

  16. Open the SAP data structure via File ® Demo Structure.
  17. The top control of the main window contains a tree structure of the demo data. Click on the "+" to display the fields in the structure.

    Since you chose the SAPforms Data Plug-In Demo plug-in in step 8, a data structure stored for demonstration purposes is now displayed in the top control.

    If you had chosen the SAPforms Data Plug-In for Workflow Container plug-in in step 8, the structure displayed would comprise the contents of the workflow container.

  18. Define which form field is to be linked to which field in the SAP data structure ("Binding Definition".
  19. Choose a data field in the structure tree of the top control and drag it to the line in the table that contains the required control. If the binding was successful, the name of the SAP data field that is now linked to the control in the form appears in the Data Element column.

  20. Generate the binding by choosing the File ® Generate.
  21. A dialog box with generation options is then displayed. Select the first two options Insert initialization code in Load()- method and button to trigger the insert action.

  22. Choose OK.
  23. Choose File ® Exit to exit the main window of the SAPforms Designer.
  24. You will then return to the Visual Basic development environment.

  25. Choose Run ® Start to start the form directly from the Visual Basic development environment.
  26. The runtime version of the form is displayed. The controls are empty initially.

  27. Enter your data in the fields.
  28. Click the Submit button to send the form.

Result

Normally this would start the SAP Workflow functionality.

Since you chose the SAPforms Data Plug-In Demo in step 8, the form is running in Demo mode. This means that a window displaying the data that would normally be transferred to your R/3 System appears when you send the form.

If you had chosen the SAPforms Data Plug-In for Workflow Container in step 8, sending this form would have started a workflow. Since this would require extensive changes to settings in SAPforms and in the R/3 System, you should only use the Demo mode initially. The workflow examples demonstrate how a workflow is started.