Sub topic 3
The company code: the legal entity for financial accounting
This chapter assumes you know what a client is, can read basic relational tables and keys, and have a general idea of what financial accounting does. It covers what a company code is, what it owns, how it relates to other units, and the errors people commonly make with it.
What a company code is
A company code is the smallest organisational unit for which a complete, self-contained set of accounts can be drawn up. In practice it represents a legal entity, such as a limited company or a subsidiary. It has its own balance sheet and profit and loss statement. These are the statements that legal reporting requires.
A company code lives inside one client. Its key is a four-character ID, for example 1000. Because the client is part of the key in the database, the same ID can exist in two clients without conflict.
What the company code controls
Many settings and postings depend on the company code:
- Currency. Each company code has a local currency. Every posting is stored in that currency, and it can also be stored in other currencies.
- Chart of accounts. The company code is assigned one operating chart of accounts. It can share that chart with other company codes.
- Fiscal year variant. This defines the posting periods used by the company code.
- Country and language. These drive tax rules, legal forms, and print layouts.
- Document numbers. Accounting documents are numbered within a company code and fiscal year. The document key therefore includes company code, document number, and year.
Every financial posting names a company code. A posting cannot balance across two company codes unless the system generates clearing lines. These lines keep each company code balanced by itself.
Where it sits in the hierarchy
The arrows show the typical direction of assignment. One client holds many company codes. Several company codes can be grouped under one company for consolidated reporting, which a later chapter covers. Plants are assigned to company codes, and each plant has exactly one company code. That rule is why inventory can be valued and posted to the right legal entity.
Reading company codes in the database
Company codes are stored in table T001. The key is the client (MANDT) and the company code (BUKRS). Other useful fields are the name (BUTXT), the city (ORT01), the currency (WAERS), and the chart of accounts (KTOPL).
SELECT bukrs,
butxt,
ort01,
waers
FROM t001
INTO TABLE @DATA(lt_company_codes)
UP TO 20 ROWS.
cl_demo_output=>display( lt_company_codes ).Open SQL adds the client filter for you. The query returns only company codes of the client you are logged on to. This is the client separation described in the previous chapter.
Plants link to company codes through the valuation area table T001K. In the query below, T001W supplies the plant name and T001K supplies the company code:
SELECT w~werks,
w~name1,
k~bukrs
FROM t001w AS w
INNER JOIN t001k AS k ON k~bwkey = w~bwkey
INTO TABLE @DATA(lt_plants)
UP TO 20 ROWS.BWKEY is the valuation area. It usually equals the plant. The join returns one company code per plant, which confirms the one-company-code rule.
Defining a company code
In customizing, transaction OX02 edits and creates company codes. The Implementation Guide path is Enterprise Structure, Definition, Financial Accounting, Edit, Copy, Delete, Check Company Code. The usual approach is to copy an existing company code with EC01. The copy brings the dependent settings with it, so you only change what differs.
Common errors
| Error | Result | Better approach |
|---|---|---|
| Using one company code for several legal entities | Legal statements cannot be separated | Create one company code per legal entity |
| Changing the currency after posting | Not possible once documents exist | Settle the currency before go-live |
| Assuming a plant can serve two company codes | A plant has exactly one | Create a second plant |
| Testing in the wrong client | Company code appears missing | Check the logon client |
Exercise
A group has two legal subsidiaries that must each publish their own balance sheet. Both operate from the same factory. How many company codes and how many plants do you need, and why?
Show answer
You need two company codes, one per legal entity, because each needs its own balance sheet. A plant belongs to exactly one company code, so you also need two plants, one assigned to each company code. The two plants can represent the same physical site.
Exercise
Which table holds company codes, and which key fields identify a row?
Show answer
Table T001. The key fields are MANDT (client) and BUKRS (company code).