Entering content frameProcedure documentation Defining and Generating a Binding: IDoc

Prerequisites

You have created a form in Microsoft Visual Basic and have launched the Structure linkSAPforms 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.

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

  3. Using Drag&Drop assign the segment attributes that you want to fill with the SAPforms 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. Caution

    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.

  10. Choose File ® Exit to exit the SAPforms Designer.
  11. Modify the source text in Microsoft Visual Basic.

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:

Syntax

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.

Note

The procedure is the same if you are using the stand-alone version of the SAPforms Designer.

Leaving content frame