
Defining and Generating a Binding: IDoc
Prerequisites
You have created a form in Microsoft Visual Basic and have launched the
SAPforms Designer as an add-in and the structure of the IDoc (control record, data record, status record, segment definitions.) The form controls are shown in the table displayed in the bottom screen area. You have selected the IDoc that you want to call. The interface description of the BAPI is displayed in the top screen area of the SAPforms Designer.
Procedure
Defining and Generating a Binding
You must now assign the individual segment attributes of the IDoc type to the fields in the current SAPforms form (binding definition). This assignment is stored as part of the SAPform form and is used at runtime to transfer data from the form to the SAP System.
The segment attributes are displayed
You can release the binding by selecting the required row in the table and choosing Binding
® Release.The General tab on the SAPforms Options screen is then displayed.

This is only recommended the first time you generate your SAPforms form and if it does not already have these pushbuttons. Otherwise, you receive an error when compiling the SAPforms form because the declarations and event procedures are contained twice in the source text. You must remove the duplicate source code from the SAPform form by hand.
Modifying Source Text in Microsoft Visual Basic
In addition to the values specified in the binding, the control record of the IDoc must also be filled with data. The control record contains the header data of the IDoc. The necessary IDoc header data includes:
These values can be set with the following source text:

objSAPForm.SAPData.Value("EDI_DC.MESTYP") = "*" 'Message type
objSAPForm.SAPData.Value("EDI_DC.SNDPRN") = "*" 'Send partner
objSAPForm.SAPData.Value("EDI_DC.SNDPRT") = "LS" 'Send partner type
objSAPForm.SAPData.Value("EDI_DC.SNDPOR") = "*" 'Sender port
objSAPForm.SAPData.Value("EDI_DC.RCVPRN") = "*" 'Recipient partner
objSAPForm.SAPData.Value("EDI_DC.RCVPRT") = "LS" 'Recipient partner type
A value is not required for the receiver port. Make sure to use the names you have selected (for
"*") for the message type, sender partner/receiver partner (partner number) and sender port (port). For more information, see Generating an IDoc and Defining a Partner Profile and Port.Result
The SAPforms form is now complete. You can now start it in Microsoft Visual Basic by choosing Run or create an
EXE file.
The procedure is the same if you are using the stand-alone version of the SAPforms Designer.