Sub topic 5
The plant: the operational site for production, procurement, and planning
This chapter assumes you know what a client and a company code are (covered in earlier chapters), that you can read basic relational tables and keys, and that you have seen simple Open SQL. It covers what a plant is, what it is used for, how it is identified, and where it sits in the hierarchy. It also covers the errors people most often make when they model one.
What a plant is
A plant is an organisational unit in logistics. It is the place where a company produces goods, procures goods, plans requirements, or keeps stock. Depending on the business, one plant might be a factory, a distribution centre, a regional warehouse, a maintenance site, or a group of sites that are planned together.
The company code answers the question "which legal entity does the bookkeeping?" The plant answers "where does the operational work happen?" Most logistics processes need a plant in order to run at all:
- Material requirements planning (MRP) runs per plant. A plant has its own planning parameters, lot sizes, and planned orders.
- Procurement places purchase order items against a plant. The plant is the receiving site.
- Production orders are created and executed in a plant, using that plant's work centres, routings, and bills of material.
- Inventory management books goods movements against a plant and a storage location.
- Sales and distribution uses a plant as the delivering site for sales order items.
- Plant maintenance and quality management also work at plant level.
A plant is a business concept, not necessarily a physical one. Two buildings on one campus can be one plant, and one building can be configured as two plants if the business needs separate planning or valuation.
How a plant is identified
A plant has a four-character alphanumeric key, such as 1000 or DE01. In the data dictionary the key uses the data element WERKS_D, and the field is usually called WERKS. The key is unique within the client. Because the client is the top-level unit, a plant key is therefore unique in the whole client, regardless of company code. This is different from the storage location, whose key is unique only within its plant (see the later chapter on storage locations).
Besides the key, a plant has:
- a name (
NAME1) - an address
- a country and a region
- a factory calendar, which determines working days for planning and scheduling
- a language
- a valuation area link (
BWKEY), which determines how inventory is valued
Most of this is maintained in customizing, not by end users in daily work.
Where the plant sits in the hierarchy
A plant belongs to exactly one company code. A company code can have many plants. A plant is never shared between two company codes.
The reason is accounting. Every goods movement in a plant has a value, and that value must be posted in one company code's ledgers. If a plant belonged to two company codes, the system could not decide which legal entity owns the inventory. The assignment of a plant to a single company code removes that ambiguity.
The hierarchy, from top to bottom, looks like this:
Note that storage location 0001 appears under both plant 1000 and plant 1100. These are two different storage locations, because the plant is part of their identity. Plant keys, in contrast, are never repeated.
Reading plants and their company codes in a query
The assignment of a plant to a company code is not stored directly on the plant table T001W. It goes through the valuation area. Table T001K holds the valuation areas, and each row links a valuation area (BWKEY) to a company code (BUKRS). In the usual setup, valuation takes place at plant level, so the valuation area equals the plant key.
The following query joins the two tables and returns up to 20 plants with their company codes:
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.Read it in three steps:
T001Wsupplies the plant keyWERKSand the plant nameNAME1.- The join condition
k~bwkey = w~bwkeyconnects each plant to its valuation area. T001Ksupplies the company codeBUKRSthat owns that valuation area.
Because a plant has exactly one valuation area, and a valuation area has exactly one company code, each plant appears at most once in the result. If you ever see the same plant twice, you have probably joined on the wrong field or mixed data from different clients.
On a system with several clients, Open SQL adds the client restriction for you. You do not need to filter on MANDT yourself.
What is defined at plant level
Many kinds of data and settings are tied to the plant. Knowing which ones helps you decide whether a requirement belongs at plant level or somewhere else.
| Area | Plant-level information |
|---|---|
| Material master | Plant data views such as MRP, work scheduling, purchasing, and storage |
| Planning | MRP type, lot-sizing procedure, planning calendar, planned delivery time |
| Production | Work centres, routings, production versions, production orders |
| Procurement | Source lists, purchasing info records with plant data, goods receipt site |
| Inventory | Stock quantities summed from storage location level, goods movements |
| Valuation | Link to the valuation area, which holds the moving average or standard price when valuation is at plant level |
| Calendar | Factory calendar for working days |
A material is first created at client level. It then has to be extended to each plant in which it is used. A material that has not been extended to a plant cannot be planned, bought, produced, or stocked there. Trying to post a goods receipt for such a material is one of the most common error messages a new user meets.
A worked example
Imagine a company that makes bicycles. It has one legal entity in Germany and one in the United States.
- Company code
DE10is the German legal entity. - Company code
US10is the American legal entity. - Plant
DE01is the factory in Munich. It is assigned toDE10. - Plant
DE02is a distribution centre near Hamburg. It is also assigned toDE10. - Plant
US01is a factory in Ohio. It is assigned toUS10.
The company wants to sell frames made in Munich to the Ohio factory. Because the two plants belong to different company codes, this is an intercompany transaction. The system treats it as a sale between two legal entities, with invoicing and tax implications. If the Hamburg centre needs frames from Munich, both plants sit in DE10, so the movement is a stock transfer inside one legal entity, and there is no sale.
This shows why the plant-to-company-code assignment matters. It decides whether a movement of goods between two sites is just a transfer or a legal sale.
Stock at plant level
Stock is physically held in storage locations, but it is reported and planned at plant level. Table MARD holds stock quantities per material, plant, and storage location. The unrestricted-use quantity is in field LABST.
DATA lv_werks TYPE werks_d VALUE '1000'.
SELECT matnr, werks, lgort, labst
FROM mard
WHERE werks = @lv_werks
INTO TABLE @DATA(lt_stock).Each row is one combination of material, plant, and storage location. To get the total unrestricted stock of a material in the plant, you add up LABST over all storage locations. MRP does this: it sees the plant total, not the individual storage locations (unless you configure it to plan a storage location separately).
Common mistakes and edge cases
- Confusing the plant with the company code. The company code is a legal and accounting unit. The plant is an operational unit. A requirement such as "this site has its own planning calendar" is a plant requirement. A requirement such as "this entity files its own balance sheet" is a company code requirement.
- Creating too many plants. Each plant multiplies the master data to maintain, because every material must be extended to every plant that uses it. If you only need to separate physical stock, use a storage location instead.
- Creating too few plants. If two sites need separate MRP runs, separate production scheduling, or separate valuation, they need separate plants. A storage location cannot carry its own planning.
- Assuming a storage location is global. Storage location
0001in plant1000is a different object from0001in plant1100. Always handle plant and storage location together as a key pair. - Forgetting that the assignment is hard to change. After goods movements or accounting documents exist for a plant, moving it to another company code is not a normal configuration step. It is a migration project. Decide the assignment before you go live.
- Treating the valuation area as always equal to the plant. It usually is, but valuation can also be set at company code level. In that case, several plants share one valuation area. Always join through
BWKEYrather than assumingBWKEY = WERKS.
Summary of the plant's role
The plant is the central operational unit in logistics. It has a unique four-character key in the client, belongs to exactly one company code through its valuation area, contains one or more storage locations, and is the level at which planning, procurement, and production work. The next chapter looks at how plants are assigned to company codes in more detail.
Exercise
A company has plants 1000 and 1100 in company code A, and plant 2000 in company code B. The warehouse team wants to move stock from plant 1000 to plant 1100, and a different team wants to move stock from plant 1000 to plant 2000. Which of the two moves is an intercompany transaction, and why? Also, why does a query that lists plants with their company codes join T001W to T001K and not read the company code from T001W?
Show answer
The move from 1000 to 2000 is intercompany, because the two plants belong to different company codes (A and B), so the stock changes legal entity. The move from 1000 to 1100 stays inside company code A and is a plain stock transfer. T001W does not hold the company code. A plant is linked to a company code through its valuation area: T001W gives the valuation area BWKEY, and T001K maps BWKEY to the company code BUKRS.
Exercise
Storage location 0001 exists in plant 1000 and in plant 1100. Is this a data error? What must you include in a query on table MARD to identify exactly one storage location?
Show answer
It is not an error. A storage location key is unique only within its plant. To identify one storage location you must give both the plant (WERKS) and the storage location (LGORT), and for stock rows also the material (MATNR).