OACT table in SAP Business One (G/L Accounts (chart of accounts))
OACT is the SAP Business One table that stores the chart of accounts: one row per G/L account, both title accounts and postable (active) accounts, with the account hierarchy and the current balance. Journal lines in JDT1 point to it through JDT1.Account = OACT.AcctCode.
OACT key fields
| Field | What it holds |
|---|---|
AcctCode | Internal account key. JDT1.Account and the account fields on documents store this value. |
AcctName | Account name. |
FormatCode | The account number users see. With account segmentation it differs from AcctCode. |
Postable | Y = active account you can post to, N = title account (a heading in the tree). |
Levels | Level in the account tree (1 = drawer such as Assets, higher numbers = deeper). |
FatherNum | AcctCode of the parent title account. |
GroupMask | The drawer the account belongs to (assets, liabilities, equity, revenue, expenses and so on, numbered per localization). |
CurrTotal | Current balance in local currency. |
SysTotal | Current balance in system currency. |
FcTotal | Balance in the account currency. |
ActCurr | Account currency. |
LocManTran | Y = control account (for example accounts receivable). |
Frozen | Y = account on hold. |
How OACT relates to other tables
OACT is master data. Every posting is in JDT1 (journal lines) with JDT1.Account = OACT.AcctCode, and the header is in OJDT. Business partner control accounts (OCRD.DebPayAcct) and the account fields on items, warehouses and tax codes also store AcctCode. The account tree is built from FatherNum and Levels.
Common joins
OACT T0 INNER JOIN JDT1 T1 ON T1.Account = T0.AcctCode (journal lines)OACT T0 LEFT JOIN OACT T2 ON T2.AcctCode = T0.FatherNum (parent title account)OCRD T3 INNER JOIN OACT T0 ON T0.AcctCode = T3.DebPayAcct (BP control account)
When you use the OACT table
Use OACT for a quick trial balance, an account list for the accountant, mapping accounts to a reporting structure, or to check that every account in a report is postable. For balances at a date or for a period, sum JDT1 instead of reading CurrTotal.
Example query: balance per postable account at a date (from jdt1)
SQL Server
SELECT T0.FormatCode, T0.AcctName, SUM(T1.Debit - T1.Credit) AS Balance FROM OACT T0 INNER JOIN JDT1 T1 ON T1.Account = T0.AcctCode WHERE T0.Postable = 'Y' AND T1.RefDate <= '[%0]' GROUP BY T0.FormatCode, T0.AcctName ORDER BY T0.FormatCode
SAP HANA (column names in double quotes)
SELECT T0."FormatCode", T0."AcctName", SUM(T1."Debit" - T1."Credit") AS "Balance" FROM OACT T0 INNER JOIN JDT1 T1 ON T1."Account" = T0."AcctCode" WHERE T0."Postable" = 'Y' AND T1."RefDate" <= '[%0]' GROUP BY T0."FormatCode", T0."AcctName" ORDER BY T0."FormatCode"
Paste either version in Tools → Queries → Query Generator. Need the other dialect for your own query? Use the SQL to HANA converter.
Common pitfall: FormatCode vs. AcctCode, and CurrTotal is today only
Users know accounts by the number on screen, which is FormatCode. JDT1.Account stores AcctCode, which with account segmentation is an internal code, so filtering JDT1.Account on the number users see can find nothing. Join to OACT and filter on FormatCode. CurrTotal is the balance right now; it ignores dates, so it cannot give you last month's balance. Sum JDT1 up to the date you need. See JDT1 table (journal lines).
Ready-made queries that use OACT
- G/L account balances: Current balance of every postable G/L account, grouped by account level.
- G/L account transactions: Journal lines for one G/L account in a period, with debit, credit and reference.
Related tables
JDT1 (Journal Entry Lines) · OJDT (Journal Entry (header)) · OCRD (Business Partners) · search all SAP Business One tables
Sources: SAP Business One documentation and SDK (DI API database tables reference), SAP Help Portal.
Ready to get started?
Tell us what you need. You get a clear technical answer, a fixed scope and a price, usually within 24 hours.
