Sub topic 2
Company Codes, Controlling Areas, Charts of Accounts, and How They Connect
This chapter explains the organizational units that every posting in SAP S/4HANA refers to. It assumes you know basic accounting terms (debit, credit, general ledger, trial balance). It also assumes you can move around the SAP Fiori launchpad and know the main finance areas: accounts payable, accounts receivable, asset accounting, and controlling. The later chapters on master data, the Universal Journal, and period control all depend on the links described here.
Why organizational structure comes first
A journal entry line must answer several questions. Which legal entity owns it? In which currency is it kept? Which G/L account does it hit? Which fiscal calendar decides whether the period is open? Each answer comes from an organizational unit or a setting assigned to it. If these assignments are wrong, postings fail or land in the wrong place. Fixing them after go-live is expensive.
The core units
| Unit | What it represents | Key assignments |
|---|---|---|
| Client | The highest technical level. Data in one client is separate from data in another. | Contains all other units |
| Company code | The smallest unit that has its own complete, legally reportable set of books | Chart of accounts, fiscal year variant, company code currency, country |
| Chart of accounts | The list of G/L accounts and their numbers | Assigned to each company code (one per company code) |
| Controlling area | The unit in which cost and profit management is done | Assigned company codes, controlling area currency, fiscal year variant |
| Operating concern | The unit for profitability analysis (margin analysis) | Assigned controlling areas |
| Ledger | A set of books under one accounting principle | Assigned to company codes, with its own settings |
Company code
A company code is the central unit of external accounting. You can produce a balance sheet and a profit and loss statement for each one. Its main settings are:
- Country and company code currency. The company code currency is the local currency. Amounts in this currency are stored in the Universal Journal field
HSL. - Chart of accounts. The company code uses exactly one operating chart of accounts.
- Fiscal year variant. This defines the periods of the fiscal year and the special periods.
- Posting period variant. This controls which periods are open for posting.
- Field status variant. This controls which fields are required, optional, or hidden on a posting.
Chart of accounts
A chart of accounts is a list of G/L accounts that several company codes can share. It is a shared list. The account's data is split into two parts:
- Chart of accounts level. Account number, account type, and short and long text. These are the same in every company code that uses the chart.
- Company code level. Account currency, tax category, reconciliation account settings, and field status group. These can differ by company code.
Three kinds of chart of accounts exist:
- Operating chart of accounts. The one used for day-to-day postings in the company code. It is mandatory.
- Group chart of accounts. An optional chart that maps accounts to a corporate view for consolidation.
- Country chart of accounts. An optional chart for local legal reporting where the local rules require different account numbers.
In S/4HANA the chart of accounts also holds cost elements. Primary cost elements are G/L accounts of a certain account type. Secondary cost elements, used for allocations, are also created as G/L accounts. This is why the cost-element step of older SAP systems no longer exists as a separate master data object.
Controlling area
A controlling area is the unit for internal reporting. Cost centers, profit centers, and internal orders belong to it. Two settings matter most:
- Assignment of company codes. One controlling area can hold several company codes, but only if they share the same operating chart of accounts and the same fiscal year variant.
- Currency setting. The controlling area currency can be the company code currency, or a separate currency. Cross-company-code controlling needs a common currency.
The controlling area setting "cross-company-code cost accounting" allows costs to be allocated between company codes in the same controlling area. The system then posts the balancing entries between the company codes automatically.
How the units connect
The assignments form a hierarchy with a few firm rules. The diagram shows the usual structure.
The rules behind the diagram:
- Each company code has exactly one operating chart of accounts and exactly one fiscal year variant.
- Each company code belongs to at most one controlling area.
- All company codes in a controlling area must use the same operating chart of accounts and fiscal year variant as the controlling area.
- Each controlling area is assigned to an operating concern if you use margin analysis.
Rule 3 is the most common source of design errors. If two legal entities need different charts of accounts, they must be in different controlling areas, and cross-entity cost allocation then becomes harder. Most projects therefore choose one operating chart of accounts for the whole group and handle local needs with a country chart of accounts or with additional ledgers.
Currencies in the structure
Each company code stores amounts in several currencies in the Universal Journal.
| Currency | Journal field | Where it comes from |
|---|---|---|
| Transaction currency | `WSL` | The currency of the business document |
| Company code currency | `HSL` | The company code setting |
| Global currency | `KSL` | The controlling area currency (or a global currency, depending on the setup) |
| Additional currencies | `OSL`, `VSL`, and others | The ledger and company code settings |
Because the amounts are stored at posting time, reports do not convert them on the fly. A later change of the currency setup does not rewrite old lines.
Checking the structure with a query
You can see the effect of the structure in the data. The query below sums the signed company code currency amount per G/L account for one company code. The company code 1010, the year, and the leading ledger 0L are sample values. In production code, read from released CDS views and not from the table.
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).The WHERE clause uses the structure directly. rldnr is the ledger, rbukrs is the company code, gjahr is the fiscal year, and poper is the posting period defined by the fiscal year variant. A query that omits the ledger adds the lines of every ledger together and gives a wrong balance.
Common errors
- Assigning a company code to a controlling area with a different chart of accounts. The system rejects the assignment. Fix the design first. Do not work around it.
- Choosing the wrong fiscal year variant. It is hard to change once postings exist in the company code.
- Expecting different account numbers in company codes that share a chart. Account numbers are fixed at chart level. Use a country chart of accounts and account mapping when local numbering is required.
- Mixing up company code and business area thinking. In S/4HANA, use profit centers and segments for internal and segment reporting. Do not create extra company codes for that purpose.
- Creating a company code only for reporting. Each company code adds period-end work, so create one only when a legal entity needs separate books.
Exercise
A group has two company codes. Company code 1010 uses chart of accounts YCOA, and company code 2010 uses chart of accounts ZCOA. Both use the same fiscal year variant. Can both be assigned to one controlling area? What would you change if the business wants shared cost reporting?
Show answer
No. All company codes in one controlling area must use the same operating chart of accounts as the controlling area, so only one of them could join. For shared cost reporting, move both company codes to a single operating chart of accounts (and keep the same fiscal year variant). Local account requirements can then be covered with a country chart of accounts and account mapping. The alternative is to keep two controlling areas and accept that cost allocation between them is harder.
Exercise
Why does the balance query above filter on rldnr, and what could go wrong if you leave it out?
Show answer
Each ledger has its own lines in ACDOCA. The leading ledger 0L and any non-leading ledger can both carry copies of the same business transaction, so summing without a ledger filter counts those amounts more than once. The result would not match the trial balance of any single ledger.