Sub topic 3
Organizational structure: the skeleton every module hangs on
This chapter assumes you know what an ERP system is, that you can read a relational table with keys and joins, and that you have met the module landscape from the previous chapter. Here you learn the organizational units that every module in S/4HANA refers to. You also learn what each unit controls and the errors that appear when units are combined badly.
Why organizational units exist
An organizational unit is a configured entity that represents a part of the company. Documents and master data records are always created in the context of one or more of these units. A purchase order belongs to a purchasing organization and a plant. A billing document belongs to a company code. The units decide who can post what, in which currency, and in which legal entity.
The units are set up in Customizing, the configuration area of SAP. They change rarely, because thousands of documents refer to them. Treat them as the schema of your business, not as data.
The main units
| Unit | Represents | Used mainly by |
|---|---|---|
| Client | The top-level technical and legal container of one system | All modules |
| Company code | A legal entity that produces its own balance sheet and profit and loss statement | Finance, and indirectly all modules |
| Plant | A site where goods are produced, stored, or procured | Procurement, Inventory, Manufacturing, Sales |
| Storage location | A place inside a plant where stock is kept | Inventory |
| Purchasing organization | The unit that negotiates purchasing conditions with suppliers | Procurement |
| Sales organization | The unit responsible for selling and for customer terms | Sales |
| Distribution channel and division | A route to the customer, and a product line | Sales |
| Controlling area | The unit for internal cost and profit accounting | Controlling |
Client
The client is the highest level. Almost every table has a client field (MANDT in classic tables), and ABAP Open SQL adds the client filter for you. Data in one client is invisible to another client in the same system. A typical landscape has separate systems for development, test, and production, and each system holds its own clients.
In SAP S/4HANA Cloud Public Edition, you do not choose the client structure yourself. The provider manages it for you.
Company code
The company code is the smallest unit for which a complete, legally required set of accounts can be drawn up. Each company code has a local currency, a chart of accounts assignment, and a fiscal year variant. In the Universal Journal table ACDOCA, the company code appears as the field RBUKRS. The Universal Journal is covered in a later chapter.
Rule of thumb: one legal entity maps to one company code.
Plant
A plant is an operational site. It might be a factory, a distribution center, or a store. A plant is assigned to exactly one company code. Stock is valuated at plant level in most configurations, so the plant is also the link between logistics and accounting.
Storage locations sit below the plant. They split stock physically, for example into raw materials and finished goods. Storage locations do not carry their own valuation.
Purchasing and sales organizations
A purchasing organization negotiates with suppliers. A sales organization sells goods and services. Both are assigned to a company code. Both can also be linked to plants. These links determine which combinations are valid in a document.
A sales area is a combination of three units: sales organization, distribution channel, and division. Customer master data and sales documents are held per sales area. The field VKORG in the sales order header (VBAK) holds the sales organization. This is the field used in the example query below.
How the units relate
The assignments form a tree with a few cross-links. A company code is the anchor for the accounting side. Plants and organizations hang below it.
Solid arrows show a hierarchy. Dotted arrows show an assignment that you can configure in more than one way. A purchasing organization can be assigned to several plants, and a plant can be served by several purchasing organizations. A purchasing organization may also be assigned to just one company code, or to none, if it purchases for several company codes. Do not assume a strict tree.
Seeing the structure in data
The organizational unit shows up as a column in nearly every table. This query reads Finance line items in the Universal Journal, restricted to one company code and the leading ledger.
SELECT rbukrs, racct, SUM( hsl ) AS balance
FROM acdoca
WHERE rldnr = '0L'
AND rbukrs = '1010'
AND gjahr = '2024'
GROUP BY rbukrs, racct
INTO TABLE @DATA(balances).The company code (RBUKRS) is in the WHERE clause because accounting is always evaluated per legal entity. The amount field HSL is in the company code currency, so it is meaningful only inside one company code. Summing HSL across company codes that use different currencies gives a number without a unit.
The sales side uses the sales organization in the same way.
SELECT FROM vbak
INNER JOIN vbap ON vbap~vbeln = vbak~vbeln
FIELDS vbak~vbeln, vbak~kunnr, vbap~posnr, vbap~matnr, vbap~netwr
WHERE vbak~vkorg = '1010'
INTO TABLE @DATA(order_items)
UP TO 100 ROWS.Here the sales organization VKORG selects the orders. Note that the company code is not a column in VBAK. A sales document finds its company code through the sales organization assignment.
What each unit controls
Each unit is a switch for rules:
- Currency and calendar. The company code sets the local currency and fiscal year variant.
- Valuation. The plant (and its valuation area) determines how stock value is held and which accounts are posted.
- Pricing and terms. The sales organization and sales area determine which price lists, payment terms, and delivery rules apply to a customer.
- Purchasing conditions. The purchasing organization determines which info records and contracts apply to a supplier.
- Authorizations. Roles can be restricted by company code, plant, sales organization, or purchasing organization. A user may see one plant and not another.
Common errors
- Unassigned combination. Creating a purchase order for a plant that is not assigned to the purchasing organization produces an error stating that the combination is not allowed. The fix is configuration, not data.
- Master data missing for the unit. A material exists, but has not been extended to the plant. Most documents then fail with a message that the material is not maintained in that plant. Master data is extended per organizational unit, which the next chapter covers.
- Mixed currencies in reports. Summing amounts across company codes without converting them. Use the transaction currency or a group currency when you need cross-company totals.
- Wrong unit granularity. Using a company code per department. Company codes force separate balance sheets and intercompany postings, so they are expensive to operate. Use other structures, such as cost centers or profit centers, for internal splits.
- Late changes. Changing the assignment of a plant that already holds stock or documents. This is usually blocked or requires a controlled migration project.
Choosing a structure
Ask these questions in order:
- Which legal entities need their own books? Each one gets a company code.
- Where is stock held or produced? Each such site is a plant.
- Who negotiates with suppliers? Define purchasing organizations on that basis, not on site boundaries.
- How do you sell, and to which customer groups? Define sales organizations, distribution channels, and divisions.
- What needs internal reporting without a legal split? Use Controlling objects, not new company codes.
Exercise
A company has two legal subsidiaries, one in Germany and one in France. Both buy from the same group-wide supplier contracts and operate three plants each. How many company codes are needed at minimum, and how can purchasing be organized?
Show answer
Two company codes, one per legal entity, because each needs its own balance sheet. The six plants are each assigned to the company code of their subsidiary. Purchasing can use one purchasing organization that is assigned to both company codes (a cross-company-code purchasing organization), so the group-wide contracts apply to all six plants.
Exercise
Why can a query that sums HSL in ACDOCA over all company codes give a misleading result, and how would you fix it?
Show answer
HSL holds amounts in each company code's local currency. Adding values in different currencies gives a total without a meaningful unit. Restrict the query to one company code with RBUKRS, or use a field in a common currency, such as the group currency amount, for cross-company totals.
Exercise
A user reports that a sales order cannot be created because the material "is not maintained in the plant". Is this an organizational structure problem or a master data problem?
Show answer
A master data problem. The plant and sales organization exist and are valid. The material record has not been extended to that plant, so the system cannot find the plant-level data it needs.