cancel
Showing results for 
Search instead for 
Did you mean: 

how to add a ChartOfAccounts object into the database.

Former Member
0 Kudos

how to add a ChartOfAccounts object into the database. please shows sample code

thanks

Accepted Solutions (1)

Accepted Solutions (1)

barend_morkel2
Active Contributor
0 Kudos

Dim CoA As SAPbobsCOM.ChartOfAccounts

CoA = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oChartOfAccounts)

CoA.Code = 11223344

CoA.ExternalCode = "a1234"

CoA.ForeignName = "f Test Account"

CoA.Name = "Test Account"

CoA.AccountType = SAPbobsCOM.BoAccountTypes.at_Other

CoA.ActiveAccount = SAPbobsCOM.BoYesNoEnum.tYES

CoA.FatherAccountKey = 100001

If CoA.Add <> 0 Then

MessageBox.Show(oCompany.GetLastErrorDescription)

Else

MessageBox.Show("Added Account")

End If

-


Remember the father account key must be a valid account number in the company where you are trying to add the new account. (The G/L Account code seen in the SBO client)

Former Member
0 Kudos

hello Barend Morkel

CoA.Add Returns -2028 why?

Former Member
0 Kudos

Hi Peter,

Check oCompany.GetLastErrorDescription for a description of the error code.

Adele

Answers (1)

Answers (1)

Former Member
0 Kudos

very very thank you

Former Member
0 Kudos

Peter,

I think you will need to assign the value for FormatCode as well. It is one of those mandatory fields for ChartOfAccount.

Sunny