📚 SAP Business One SDK Help

AccountCode Property
See Also  Example

Description

Sets or returns the G/L account code of the business partner as defined in Chart of Accounts. Field name: AcctCode.

Mandatory property.

Length: 15 characters.

Property type

Read-write property

Syntax

Visual Basic
Public Property AccountCode() As String

Remarks

To set the AccountCode value when working with segmentation, use the FormatCode to find its key value (for example, _SYS00000000010) as follows:

1. Find the account key using the method GetObjectKeyBySingleValue.

2. Use the returned Recordset to retrieve the value of the key (for example, _SYS00000000010).

Example

Setting the AccountCode value when working with segmentation (Visual Basic)Copy Code
Dim sStr As String
    Dim vRs As SAPbobsCOM.Recordset
    Dim vBOB As SAPbobsCOM.SBObob
    Dim vCH As SAPbobsCOM.ChartOfAccounts
    Set vCH = Vcmp.GetBusinessObject(oChartOfAccounts)
    Set vBOB = Vcmp.GetBusinessObject(BoBridge)
    Set vRs = Vcmp.GetBusinessObject(BoRecordset)
    Set vRs = vBOB.GetObjectKeyBySingleValue(oBusinessPartners, "CardName", "aaa", bqc_Equal)

    ' When working with segmentation use this function
    ' to find the account key in the ChartOfAccount object

    Set vRs = vBOB.GetObjectKeyBySingleValue(oChartOfAccounts, "FormatCode", "125100000100101", bqc_Equal)

    'The Recordset retrieves the value of the key (for example, sStr = _SYS00000000010).
    sStr = vRs.Fields.Item(0).Value

    'Use the sStr value to set the AccountCode

See Also