Sub topic 9
Client, plant, and storage location levels in material master data
This chapter assumes you know what a material master record is, can read basic Open SQL, and understand relational keys. It also assumes you have met the client, plant, and storage location as organisational units in earlier chapters. Here you will see how those units become the levels at which material data and stock are stored.
Why material data has levels
A material such as a bearing is one product, but different parts of the business need different facts about it. Every department needs the same description and base unit of measure. Only a particular plant knows its reorder point. Only a particular storage location knows how many pieces sit on a given shelf area.
SAP handles this by splitting the material master into organisational levels. Each level holds the data that is valid for one organisational unit and all of its lower units. You maintain data once at the level where it applies, and SAP does not duplicate it where it does not.
The three levels covered in this chapter are:
- Client level: data valid for the whole client, whatever the plant or company code.
- Plant level: data that depends on the plant, such as planning and procurement settings.
- Storage location level: data and stock quantities that depend on a storage location inside a plant.
Other levels exist, for example the sales organisation and warehouse number. Valuation data sits at the valuation area, which usually equals the plant (see the valuation area chapter). This chapter concentrates on client, plant, and storage location.
Client level: general material data
Client-level data is stored once per material in the whole client. It is the same for every company code, plant, and storage location. Typical fields are:
- Material number and material description
- Base unit of measure
- Material type and material group
- Gross and net weight
- Basic industry sector
The table for this level is MARA (general material data). Its key is the client plus the material number (MATNR). Descriptions in several languages are kept separately in MAKT, keyed by material number and language.
Because the data is held at client level, a change affects every plant at once. If you change the base unit of measure, every plant sees the change. SAP restricts such changes once stock or documents exist, because old postings were made in the old unit.
Plant level: planning, procurement, and production data
Plant-level data describes how one site deals with the material. The same material can be made in one plant and bought in another, so these settings cannot live at client level.
Typical plant-level fields:
- MRP type, reorder point, lot-sizing procedure
- Procurement type (in-house production, external procurement, or both)
- Planned delivery time and goods receipt processing time
- Availability check and batch management settings
- Storage-related settings such as the storage location view defaults
The table is MARC, keyed by client, material (MATNR), and plant (WERKS). A material must be extended to a plant before it can be used there. That extension creates a MARC row. If no row exists for a material and plant, you cannot post a goods movement or create a purchase order item for that combination.
Accounting data is kept in MBEW and is keyed by material and valuation area (BWKEY). Where the valuation area is the plant, as in most systems, it behaves like plant-level data. It is not the same level in the table design, though, and the valuation area chapter covers it.
Storage location level: stock quantities
A storage location is unique only within its plant. So the storage location level is identified by material, plant, and storage location (LGORT). Stock quantities are held here.
The table is MARD. Its key is client, material, plant, and storage location. Frequently used quantity fields:
| Field | Meaning |
|---|---|
| `LABST` | Unrestricted-use stock |
| `INSME` | Stock in quality inspection |
| `SPEME` | Blocked stock |
| `EINME` | Restricted-use batch stock |
| `UMLME` | Stock in transfer |
Storage location data also holds a few non-quantity settings, such as the storage bin entry used in simple warehouse setups.
MARD holds quantities only. It does not hold value. The value of the stock comes from the price and valuation data in MBEW, multiplied by the quantity. Stock is valued per valuation area, not per storage location, so two storage locations in one plant carry the same unit price.
How the levels fit together
Extending a material to a new level means creating the rows for that level. The levels depend on each other, so you extend from the top down.
- A MARA row must exist before any plant data.
- A MARC row must exist before a MARD row for any storage location in that plant.
- A MARD row is typically created when the first stock is posted to the storage location or when the storage location view is maintained.
This gives you a simple way to read a material's footprint. One MARA row, a MARC row for each plant using it, and a MARD row for each storage location where it has been stocked or maintained.
Reading the levels in Open SQL
The three examples below show the plant and storage location levels directly.
The first query lists storage locations of one plant. It shows that a storage location is identified by plant and storage location key together.
DATA lv_werks TYPE werks_d VALUE '1000'.
SELECT lgort, lgobe
FROM t001l
WHERE werks = @lv_werks
INTO TABLE @DATA(lt_storage_locations).The second query reads unrestricted-use stock per material, plant, and storage location. This is the level at which quantities are held.
DATA lv_werks TYPE werks_d VALUE '1000'.
SELECT matnr, werks, lgort, labst
FROM mard
WHERE werks = @lv_werks
INTO TABLE @DATA(lt_stock).To see the stock for one plant as a total, you aggregate across storage locations. The result then corresponds to plant level, even though the data lives at storage location level.
DATA lv_werks TYPE werks_d VALUE '1000'.
SELECT matnr, werks, SUM( labst ) AS total_unrestricted
FROM mard
WHERE werks = @lv_werks
GROUP BY matnr, werks
INTO TABLE @DATA(lt_plant_stock).Plant totals are not stored in a separate field in MARD. They are always computed by summing the storage location rows. Reports that show stock "per plant" do exactly this.
Common errors and edge cases
Material not maintained for the plant. A goods receipt or purchase order fails with a message that the material is not maintained in the plant. The MARC row is missing. Extend the material to the plant using the MRP, purchasing, or plant-related views.
Material not maintained for the storage location. The plant view exists but no MARD row does. Maintain the storage location view, or post a goods receipt, which can create the row if the settings allow.
Confusing the stock level with the value level. A report shows the same material in two storage locations with different quantities but one price. This is correct. Quantity is at storage location level. Price is at valuation area level.
Assuming the storage location key is global. Storage location 0001 can exist in plants 1000 and 2000 as two unrelated places with separate stock. Any query on MARD that filters by LGORT alone, without WERKS, mixes them together.
Changing client-level data in a live system. Fields such as the base unit of measure are shared by all plants. Changing them affects everyone, and SAP blocks the change when stock exists.
Missing plant filter in a join. Joining MARA to MARD on MATNR is correct. Joining MARC to MARD on MATNR only, without WERKS, creates a cross product across plants. Always join plant-level and storage-level tables on both material and plant.
SELECT c~matnr, c~werks, d~lgort, d~labst
FROM marc AS c
INNER JOIN mard AS d
ON d~matnr = c~matnr
AND d~werks = c~werks
WHERE c~werks = '1000'
INTO TABLE @DATA(lt_marc_mard).Choosing the right level: a decision guide
| Requirement | Level | Table |
|---|---|---|
| Description, base unit, weight | Client | MARA, MAKT |
| Reorder point, lot size, procurement type | Plant | MARC |
| Unrestricted-use stock quantity | Storage location | MARD |
| Moving average or standard price | Valuation area | MBEW |
| Each plant needs its own planning rule | Plant | MARC |
| Warehouse bin for one shelf area in a plant | Storage location | MARD |
Summary
The client level holds the facts that never change by location. The plant level holds how a site plans, buys, and produces the material. The storage location level holds the quantities. Tables follow the same split: MARA, MARC, and MARD, each with a key that adds one more organisational unit. Reading and joining these tables correctly depends on including every key field, especially the plant.
Exercise
A query joins MARC and MARD using only MATNR. The material is extended to plants 1000 and 2000, and each plant has storage locations 0001 and 0002. How many result rows does the join return for this one material, and what is the fix?
Show answer
The join returns 8 rows. Each of the 2 MARC rows matches all 4 MARD rows for that material, and 2 × 4 = 8. Only 4 rows are correct. The fix is to add AND d~werks = c~werks to the join condition, so each plant matches only its own storage locations.
Exercise
A material has the same base unit of measure in all plants, a reorder point of 50 in plant 1000 and 200 in plant 2000, and 30 pieces of unrestricted stock in storage location 0001 of plant 1000. At which level does each of these three facts live, and which table holds each?
Show answer
The base unit of measure is client level and lives in MARA. The reorder points differ per plant, so they are plant level and live in MARC. The 30 pieces are storage location level and live in the LABST field of MARD.