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.

  1. Expand the segment types ( E1 ..., bzw. Z1 ...).
  2. The segment attributes are displayed

  3. Assign (using "drag and drop") the segment attributes that you want to fill with the form to the form controls.
  4. You can release the binding by selecting the required row in the table and choosing Binding ® Release.

  5. Choose File ® Generate.
  6. The General tab on the SAPforms Options screen is then displayed.

  7. Select Insert initialization code in Load()- method and button to trigger the insert action.
  8. Choose OK.
  9. 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.

  10. Choose File ® Exit to exit the SAPforms Designer.
  11. Modify the VB code.

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 Port

Result

Your form is now complete. You can now start it in Visual Basic by choosing Run or compile an EXE file.