Entering content frameThis graphic is explained in the accompanying text Example: Creating a Customer Master Record Using an IDoc

A model Microsoft Visual Basic project SENDIDOC.VBP for calling the BAPI_Customer_CreateFromData BAPI of the object type Customer (KNA1) using IDoc is stored in the ...\SAPforms\Samples directory. This method is used to create a customer master record in the SAP System.

Process Flow

  1. Generate an IDoc. For more information, see Generating an IDoc.
  2. Enter KNA1 as the object and the method Createfromdata.

    Enter your message type: Customercreate

  3. Define the partner profile and port. For more information, see Defining a Partner Profile and Port
  4. Enter Createcust in the Partner number field.

    Name your port Portcucr.

    Enter $TMP (local object) as the package.

  5. Start Microsoft Visual Basic and load the SENDIDO.VBP project from the directory ...\SAPforms\Samples.
  6. The IDoc structure is displayed in the top screen area. The form controls are shown in the table displayed in the bottom screen area. The binding is already defined and generated. The steps for Maintaining Plug-Ins and Opening a Structure and Defining and Generating a Binding have been completed.

    All of the segment attributes required to execute the BAPI are listed in the table below:

    Name

    Segment Attribute

    Values

    Name

    E1BPKNA101000.NAME

    Any

    First name

    E1BPKNA101000.FIRST_NAME

    Any

    Street

    E1BPKNA101000.STREET

    Any

    Postal code

    E1BPKNA101000.POSTL_CODE

    5 digit numeric

    City

    E1BPKNA101000.CITY

    Any

    Reference customer

    E1BPKNA102000.REF_CUSTMR

    "*"

    Country

    E1BPKNA101000.COUNTRY

    US"*"

    Language

    E1BPKNA101000.LANGU

    US

    Sales organization

    E1BPKNA102000.SALESORG

    "*"

    Division

    E1BPKNA102000.DIVISION

    "*"

    Distribution channel

    E1BPKNA102000.DISTR_CHAN

    "*"

    Caution

    Not all attributes are filled by the SAPforms form. Instead, they are filled with initial values in the background by an import routine in the source text of Microsoft Visual Basic. These values are stored in the CUSTOMER.TXT file in the directories ...\SAPforms\Samples or ...\SAPforms\Forms. It is important that the file is in the same directory as the EXE file read for this purpose.

    It concerns the data for state, reference customer sales organization, division and distribution channel ("*"). Except for state, this data is system-specific and must be determined separately. For the example to work, you must maintain the appropriate data for your system in the file CUSTOMER.TXT. For more information, see Determining a Reference Customer.

  7. Modify the source text. For more information, see Defining and Generating a Binding.
  8. This has already been done in our example.

  9. Test your SAPforms form by choosing Run in Microsoft Visual Basic or compile and start an EXE file.
  10. Enter meaningful data (see above) and choose Execute. You are then logged on to your SAP System automatically. After a short period of time, the message sendidoc "The IDoc has been sent successfully" is displayed.

This means that the IDoc generated by the SAPforms form was successfully sent to the SAP System.

Leaving content frame