on 04-05-2011 4:39 AM
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();
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.