cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a new (Customer) Business Partner

Former Member
0 Kudos

Hello,

I am trying to add a new (Customer) Business Partner, however, "Invalid Control Account Type" error occurs. Is there something I'm missing out or do I have to configure something first before this could work.

The following is my script, hope anyone can help.

Thanks

SAPbobsCOM.BusinessPartners _oBusinessPartners = (SAPbobsCOM.BusinessPartners)OrderApp.oCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners);

_oBusinessPartners.CardCode = pCustomerID;

_oBusinessPartners.CardName = pCustomerName;

_oBusinessPartners.CardType = BoCardTypes.cCustomer;

_oBusinessPartners.CompanyPrivate = BoCardCompanyTypes.cPrivate;

_oBusinessPartners.GroupCode = 100; //Customers Group Code

_oBusinessPartners.AccountRecivablePayables.SetCurrentLine(0);

oBusinessPartners.AccountRecivablePayables.AccountType = BoBpAccountTypes.bpatReceivable;

_oBusinessPartners.AccountRecivablePayables.AccountCode = "140000";

_errNum = _oBusinessPartners.Add();

Accepted Solutions (1)

Accepted Solutions (1)

former_member689126
Active Contributor
0 Kudos

Hi

Try this sample from SDK help

Dim nErr As Long
   Dim errMsg As String

   '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 = "email"
   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 = "email"
   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

Hope this helps you

Regards

Arun

Answers (0)