Defining and Generating a Binding: IDocs 
Prerequisites
You have maintained the plug-ins. You are in the main window of the SAPforms Designer. The top level of the IDoc structure (control record, data record, status record, segment definitions) are displayed in the top control of the Designer. The form controls are shown in the table displayed in the bottom control.
Procedure
Defining and Generating a Binding
You must now assign the individual segment attributes of the IDoc type to the fields in the current Visual Basic form ("binding definition"). This assignment is stored as part of the form and is used at runtime to transfer data from the form to the R/3 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 form and if the form does not already have these buttons. Otherwise, you might receive an error when compiling the form because some of the declarations and event procedures are contained twice in the form. You must remove duplicate code from the form by hand.
Modifying the VB code.
In addition to the values specified in the binding, the control record of the IDoc must also be filled with data. As already mentioned, the control record contains the header data of the IDoc. The necessary IDoc header data includes:
These values can be set with the following VB code:

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") = "*" 'receiver partner
objSAPForm.SAPData.Value("EDI_DC.RCVPRT") = "LS" 'receiver 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). Generating an IDoc Defining a Partner Profile and PortResult
Your form is now complete. You can now start it in Visual Basic by choosing Run or compile an EXE file.