Trial Balance
Every G/L account's opening balance, period debits and credits, and closing balance — with total debits equal to total credits, the check that the ledger is mathematically sound. Built on I_GLAccountLineItemCube.
Sample build of the Trial Balance — opening, movements, and closing by account, proving total debits equal total credits, and rendered tool-neutral so it runs in Power BI, SAC, or Tableau.
| Account | Opening | Debits | Credits | Closing |
|---|---|---|---|---|
| 113100 · Bank | 8,400,000 | 415,020,800 | 414,961,520 | 8,459,280 |
| 140000 · Inventory | 22,100,000 | 6,300,000 | 5,900,000 | 22,500,000 |
| 160000 · Accruals | (1,200,000) | — | 2,813,400 | (4,013,400) |
| 400000 · Revenue | — | — | 31,001,500 | (31,001,500) |
Each account's closing balance is its opening balance — the Period 0 carryforward — plus period debits minus credits. Total debits equal total credits, so the whole ledger ties to zero.
Account 160000 (Accruals) is moving one-sided — credits only, opening already negative and growing. A clearing or accrual account that isn't clearing distorts the balance sheet until it's reversed.
Opening balances come from Period 0 (the balance carryforward run), not from postings. If an opening looks wrong, check the carryforward run and fiscal config (SAP Note 2458367) before touching journals.
The report's query logic — it aggregates I_GLAccountLineItemCube by account, summing the carryforward and the period movements into opening and closing balances. The same SQL becomes a dbt model in your warehouse.
Show / hide SQL
WITH bal AS (
SELECT c.RACCT AS gl_account,
c.FiscalPeriod AS poper, -- 0 = balance carryforward
c.DebitCreditCode AS drcrk, -- S = debit, H = credit
c.AmountInCompanyCodeCurrency AS hsl
FROM I_GLAccountLineItemCube AS c
WHERE c.Ledger = :P_LEDGER -- 0L leading / local / IFRS
AND c.CompanyCode = :P_COMPANY_CODE
AND c.FiscalYear = :P_FISCAL_YEAR
)
SELECT gl_account,
SUM(CASE WHEN poper = 0 THEN hsl ELSE 0 END) AS opening_balance,
SUM(CASE WHEN poper BETWEEN 1 AND :P_TO_PERIOD
AND drcrk = 'S' THEN hsl ELSE 0 END) AS period_debits,
SUM(CASE WHEN poper BETWEEN 1 AND :P_TO_PERIOD
AND drcrk = 'H' THEN hsl ELSE 0 END) AS period_credits,
SUM(CASE WHEN poper <= :P_TO_PERIOD THEN hsl ELSE 0 END) AS closing_balance
FROM bal
GROUP BY gl_account
ORDER BY gl_account;The data-warehouse model — one fact surrounded by conformed dimensions (what you slice by) and measures (what you aggregate), expressed as dbt so it migrates with you. Grain: one row per account · ledger · period.
| Element | Type | Definition |
|---|---|---|
| dim_gl_account | dimension | Account & financial-statement hierarchy (SKA1 / SKAT) |
| dim_cost_center | dimension | CO assignment — cost center / profit center / segment |
| dim_company_code | dimension | Company code & ledger context (RLDNR) |
| dim_date | dimension | Conformed calendar — fiscal year & period |
| opening_balance | measure | Period 0 carryforward at the start of the range |
| period_debits | measure | Sum of debit movements in the period range |
| period_credits | measure | Sum of credit movements in the period range |
| closing_balance | measure | Opening + debits − credits, cumulative to the period |
Every source object behind this report. Each linked object has its own page — with its fields and its real S/4HANA status, so you build on the right thing.
| Object | Role | Key fields | S/4HANA status |
|---|---|---|---|
| I_GLAccountLineItemCube | Released cube over ACDOCA incl. the Period 0 carryforward — the read object | released | Released CDS view |
| ACDOCA | Universal Journal — movements plus the Period 0 carryforward | 6 PK · 360+ | Transparent table |
| SKA1 / SKAT | G/L account master & financial-statement hierarchy | SAKNR | Transparent table |
| C_TrialBalanceQ0001 | SAP's standard Trial Balance query (Trial Balance app, F0996) — reference | released | Released CDS view |
| FAGLFLEXT / GLT0 | Legacy G/L balance tables — reference only, do not extract | — | Compat view → ACDOCA |
- Trial balance
- Every account's balance for a period, where total debits must equal total credits.
- Opening balance
- An account's balance at the start of the range — carried forward from before.
- Closing balance
- Opening plus the period's debits minus its credits.
- Balance carryforward
- The year-end run that brings balance-sheet openings into the new year.
- Period 0
- How ACDOCA stores the carryforward — a special "period zero" document.
- ACDOCA
- SAP's single table holding every finance posting (the "Universal Journal").
- CDS view
- Core Data Services — an SAP-supplied, upgrade-safe view onto the data.
- I_GLAccountLineItemCube
- The released view that includes the carryforward, so balances come out right.
- Ledger
- A parallel set of books (local GAAP, IFRS, group) — 0L is the leading ledger.
- FAGLFLEXT / GLT0
- The old G/L balance tables — now compatibility views; don't extract them.
- ODP-RFC
- An older extraction route SAP now bans for non-SAP tools (Note 3255746).