Sub topic 17
Reporting on journal entry data and reconciling balances to line items
This chapter assumes you know debits, credits, the general ledger and the trial balance. It also assumes you can navigate the Fiori launchpad and read basic SQL. You have already seen that the Universal Journal (table ACDOCA) holds one line item for each posting. Here you will use that table for reporting. You will also learn how to prove that a reported balance equals the sum of its line items.
Why reconciliation matters in S/4HANA
In older SAP releases, balances lived in separate totals tables, such as GLT0, and line items lived in other tables. Those two sources could drift apart, so reconciliation was a routine job. In S/4HANA, balances are calculated from the line items when you read them. A trial balance and a line item list therefore start from the same data.
Reconciliation still matters. Reports differ in how they filter, convert currency and select ledgers, so two correct reports can show different numbers for legitimate reasons. Your job is to find which setting explains a difference.
The reporting stack
Reports on journal entry data are built in layers. Knowing the layers tells you where to look when a number looks wrong.
- ACDOCA stores the line items. It is the persistent source.
- CDS views (Core Data Services views) sit on top of the table. Released interface views, such as I_JournalEntryItem, give a stable and supported way to read the data. Some other views are for internal use only.
- Analytical query views add parameters, currency conversion and aggregation. Fiori apps and embedded analytics use them.
- Fiori apps present the results. Examples are Display G/L Account Balances, Trial Balance, and Manage Journal Entries.
Parameters that change the numbers
Most differences between two reports come from a small set of selections. Check these first.
| Selection | Effect if it differs between reports |
|---|---|
| Ledger | Leading ledger 0L and a non-leading ledger can hold different values, for example because of local GAAP adjustments |
| Company code | Reports for a group of company codes can add up amounts in different currencies |
| Fiscal year and period | A cumulative balance includes the carryforward. A period activity report does not |
| Currency type | Company code currency, group currency and transaction currency give different amounts |
| Posting date and key date | A key date report uses the posting date. A period report uses the posting period |
| Account hierarchy | A report grouped by a hierarchy can hide accounts that are not assigned to any node |
Reading the data directly
Direct queries help you test a number. The first query below sums the signed company code currency amount (HSL) for each G/L account. It uses sample values for company code, year and ledger.
SELECT racct,
SUM( hsl ) AS balance
FROM acdoca
WHERE rldnr = '0L'
AND rbukrs = '1010'
AND gjahr = '2025'
AND poper <= '012'
GROUP BY racct
ORDER BY racct
INTO TABLE @DATA(lt_balances).Debits are positive and credits are negative in HSL, so the sum is a signed balance. The condition poper <= '012' makes this a cumulative figure for the year up to period 12. It does not include a balance carried forward from the prior year. Balance sheet accounts need that carryforward, which the system posts as period 000 entries after year-end closing. Because this query filters on the fiscal year, those prior-year balances are only included if the carryforward has been run.
In production code, read released CDS views instead of the table. A table read ties your code to the internal structure, which SAP may change.
Checking that every document balances
A journal entry must net to zero within a ledger. The next query finds entries that do not. For a single-currency company code it should return no rows.
SELECT rldnr, rbukrs, gjahr, belnr,
SUM( hsl ) AS doc_balance
FROM acdoca
WHERE rbukrs = '1010'
AND gjahr = '2025'
GROUP BY rldnr, rbukrs, gjahr, belnr
HAVING SUM( hsl ) <> 0
INTO TABLE @DATA(lt_unbalanced).The grouping includes the ledger. This matters because one document can have lines in several ledgers, and each ledger must balance on its own.
A step-by-step reconciliation
When a reported balance looks wrong, work from the top down. Each step removes one possible cause.
- Fix the selections. Write down the ledger, company code, fiscal year, period range and currency type of both numbers. Align them before you compare.
- Compare at account level. Run the trial balance and your query for the same account. If they match, the difference is at a higher level, such as the hierarchy or the report layout.
- Drill down to line items. In the Display G/L Account Line Items app, list the entries for the account and period. Check that the total matches the balance.
- Check for unposted or parked documents. Parked and held documents are not in ACDOCA, so they do not appear in any balance.
- Check the currency. If the numbers differ by a stable ratio, you probably compared different currency types.
- Check the ledger. If a non-leading ledger carries extra adjustment postings, its balance differs from 0L by those entries.
- Check the carryforward. If balance sheet accounts differ by a fixed amount, the prior year may not be carried forward yet.
Reconciling to the subledger
Subledger accounts, such as customers and vendors, have a reconciliation account in the G/L. The sum of the open and cleared items of the subledger should equal the G/L balance for that account. Differences usually come from one of these causes:
- A manual posting made directly to the reconciliation account, which most systems block.
- A posting date in a different period for the subledger document and its G/L effect.
- A valuation entry, such as foreign currency revaluation, that exists only in the G/L.
For the last case, compare the subledger balance before valuation to the G/L balance and then add the valuation entries.
Performance and design tips
ACDOCA can hold hundreds of millions of rows. Keep queries efficient.
- Always filter on the ledger, company code and fiscal year, as the examples do. These fields lead the primary key.
- Select only the columns you need. The table is wide.
- Use aggregation in the database, as
SUMwithGROUP BYdoes, instead of looping over rows in ABAP. - Read through released CDS views in custom reports so that upgrades do not break them.
Common errors
- Comparing a cumulative balance with a period activity amount.
- Summing amounts across company codes that use different currencies.
- Forgetting the ledger filter, which adds the amounts of every ledger together and doubles values.
- Assuming a sum of zero proves the books are right. A document can balance and still use the wrong account.
Exercise
A trial balance shows 120,000 for account 400000 in ledger 0L, but your query on ACDOCA returns 240,000 for the same company code, year and periods. What is the most likely cause, and how do you confirm it?
Show answer
The query most likely lacks a ledger filter, so it adds the lines of 0L to those of another ledger that holds the same postings. Confirm this by grouping on RLDNR and checking that two ledgers each show 120,000, then add rldnr = '0L' to the WHERE clause.
Exercise
Why does the unbalanced-document query group by ledger as well as document number, and what result do you expect for a single-currency company code?
Show answer
Each ledger must balance on its own, and one document number can have lines in several ledgers. Grouping by ledger checks each separately. A consistent company code returns no rows.