'Create the BusinessPartners object
Dim vBP As SAPbobsCOM.BusinessPartners
Set vBP = vCompany.GetBusinessObject(oBusinessPartners)'Calls BusinessPartners object
'Set values of the BusinessPartners object's mandatory and optional properties
vBP.CardCode = "HU1003" 'Mandatory property in the BusinessPartners object
vBP.CardName = "ABCD"
vBP.CardType = cCustomer
vBP.CommissionGroupCode = 0
vBP.CommissionPercent = 15
vBP.Company_Private = cPrivate
vBP.ContactPerson = "C1"
vBP.Currency = "$"
vBP.DiscountPercent = 15
vBP.VatLiable = vLiable
vBP.ShippingType = 3
Call vBP.ContactEmployees.Add
Call vBP.ContactEmployees.SetCurentLine(0)
vBP.ContactEmployees.Name = "C1"
vBP.ContactEmployees.Address = "LN"
vBP.ContactEmployees.E_Mail = "c1@abcd.com"
vBP.ContactEmployees.Fax = "8433777778"
vBP.ContactEmployees.MobilePhone = "8388888"
vBP.ContactEmployees.Phone1 = "88880000"
Call vBP.ContactEmployees.SetCurentLine(1)
vBP.ContactEmployees.Name = "C2"
vBP.ContactEmployees.Address = "BJ"
vBP.ContactEmployees.E_Mail = "c2@abcd.com"
vBP.ContactEmployees.Fax = "84338"
vBP.ContactEmployees.MobilePhone = "877388888"
vBP.ContactEmployees.Phone1 = "8888300"
If (0 <> vBP.Add()) Then
MsgBox ("Failed to add an business partner")
Else
Dim objCode As String
MsgBox ("Succeeded add a business parnter, new objcode=" + vBP.CardCode)
vBP.SaveXml ("c:\temp\BP" + vBP.CardCode + ".xml")
End If
'Check Error
Call vCompany.GetLastError(nErr, errMsg)
If (0 <> nErr) Then
MsgBox ("Found error:" + Str(nErr) + "," + errMsg)
End If