
Example: Creating a Customer Master Record
A model Microsoft Visual Basic project (
CALLBAPI.VBP) for calling the BAPI_Customer_CreateFromData BAPI of the object type Customer (KNA1) is stored in the ...\SAPforms\Samples directory. This method is used to create a customer master record in the SAP System.Process Flow
To use this example, you need to carry out the following steps:
The BAPI 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, therefore, have been completed.All of the parameters required for correct execution are listed in the following table:
|
Name |
Parameter |
Values |
|
Name |
PI_ADDRESS.Name |
Any |
|
First name |
PI_ADDRESS.First_Name |
Any |
|
Street |
PI_ADDRESS.Street |
Any |
|
Postal code |
PI_ADDRESS.Postl_Code |
5 digit numeric |
|
City |
PI_ADDRESS.City |
Any |
|
Reference customer |
PI_COPYREFERENCE.Ref_Custmr |
"*" |
|
Country |
PI_ADDRESS.Country |
US"*" |
|
Language |
PI_ADDRESS.Langu |
US |
|
Sales organization |
PI_COPYREFERENCE.Salesorg |
"*" |
|
Division |
PI_COPYREFERENCE.Division |
"*" |
|
Distribution channel |
PI_COPYREFERENCE.Distr_Chan |
"*" |

Not all attributes are filled by the SAPforms form. Instead, they are filled with initial values in the background by an import routine in Microsoft-Visual-Basic source text. 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.A customer master record has been successfully created in your SAP System.