Sub topic 7
The storage location: where stock is physically kept
This chapter covers the storage location, the lowest organisational unit at which SAP holds stock quantities. It assumes you know what a client, a company code, and a plant are, and that you can read a simple Open SQL SELECT. It also assumes you understand relational tables and composite keys.
What a storage location is
A storage location is a subdivision of a plant. It marks a place where stock is physically kept, such as a high-bay rack area, a production supply area, a quarantine cage, or a returns bay. The unit exists so that SAP can answer the question "how much of this material is in this part of the plant?"
Three properties define it:
- It belongs to exactly one plant. You cannot assign a storage location to two plants.
- Its key is only unique within that plant. Plant
1000and plant2000can both have a storage location0001, and they are two different objects. - It carries quantities, not values. Inventory value is held higher up, at the valuation area (usually the plant). This is covered in a later chapter.
Because of the second property, a storage location can never be identified by its four-character key alone. The full identifier is the pair plant plus storage location.
Where it sits in the hierarchy
The chain of containment runs from the client down to the storage location. A plant is assigned to one company code, and a storage location is assigned to one plant.
Storage locations 0001 appear under three different plants in the diagram. They are three separate objects that happen to share a key.
A storage location has no company code of its own. Its company code is derived through its plant, and that link is what lets stock movements post to the correct ledger.
Why plant and storage location form a key
The key rule is easiest to see in the database. The table for storage locations is T001L. Its key fields are the client (MANDT), the plant (WERKS), and the storage location (LGORT).
The next query lists the storage locations defined for one plant.
DATA lv_werks TYPE werks_d VALUE '1000'.
SELECT lgort, lgobe
FROM t001l
WHERE werks = @lv_werks
INTO TABLE @DATA(lt_storage_locations).The WHERE condition filters on werks. Without it, the result would contain rows from every plant, and the same LGORT value could appear several times. Each of those rows would be a different storage location. The lgobe field is the description of the storage location.
Open SQL on a client-dependent table adds the client filter automatically, so you do not write mandt yourself.
Stock is held per material, plant, and storage location
Quantities are stored in the table MARD. Its key is client, material (MATNR), plant (WERKS), and storage location (LGORT). Each row therefore says "this much of this material sits in this storage location of this plant."
DATA lv_werks TYPE werks_d VALUE '1000'.
SELECT matnr, werks, lgort, labst
FROM mard
WHERE werks = @lv_werks
INTO TABLE @DATA(lt_stock).The field labst holds unrestricted-use stock. This is stock that can be used freely, as opposed to stock in quality inspection or blocked stock. Those other categories sit in other fields of the same row, for example insme for quality inspection and speme for blocked stock.
To see total unrestricted stock of a material in a plant, you add up labst over all storage locations of that plant. Plant-level totals are not stored in MARD. They are calculated, or read from the plant-level material data in MARC, which does not hold per-location quantities.
What a storage location is not
Several misunderstandings come up often.
- It is not a warehouse. A warehouse in Warehouse Management (WM) is a separate structure with storage types and bins. A storage location in Inventory Management (IM) tracks only a quantity. A warehouse number is assigned to a plant and storage location combination, so the two concepts connect but do not mean the same thing.
- It is not a valuation level. Two storage locations in the same plant share one price for a given material, because valuation is done at the valuation area. Moving stock from one storage location to another in the same plant is a transfer posting with no change of value, so it creates no accounting document in most configurations.
- It is not a planning level by default. MRP normally plans at plant level. Storage-location MRP exists, but you have to switch it on explicitly. It is the exception, not the standard.
- It is not always required. Some stock is held without a storage location, for example stock in transit, special stock held at a vendor, or stock for a material that is managed only at plant level. A material also needs a storage location view only if you want to hold stock in that location.
Storage location data in the material master
A material master record has several views. Each view stores data at a specific organisational level.
| Level | Where it applies | Example data |
|---|---|---|
| Client | Same for all plants | Base unit of measure, material description |
| Plant | One set per plant | MRP type, reorder point, procurement type |
| Plant and storage location | One set per plant and storage location | Unrestricted stock, storage bin, picking area |
The storage location view is created only when the material is extended to that location. Extension happens either when you maintain the storage location view in transaction MM01 or MM02, or automatically when a first goods receipt is posted to a location (if the configuration allows it). A plant can have a material without any storage location data yet. This is normal for a freshly created material.
Movements between storage locations
Stock moves between locations through transfer postings in Inventory Management. The most common movement type is 311, which transfers stock from one storage location to another within the same plant. A related movement type, 301, transfers stock between plants.
The consequences differ.
| Aspect | Between storage locations (311) | Between plants (301) |
|---|---|---|
| Plants involved | One | Two |
| Valuation area changes | No | Yes, if the plants have different valuation areas |
| Possible company code change | No | Yes, if plants belong to different company codes |
| Accounting effect | Usually none | Postings may be required, and intercompany logic may apply |
This difference is the practical reason the plant is the point at which finance becomes involved. Movements inside a plant are logistics events. Movements across plants can be financial events.
Defining storage locations in customizing
You create storage locations in the Implementation Guide (IMG) under the enterprise structure, in the Materials Management section. The usual transaction is OX09. You enter the plant, then the storage location key and its description. After saving, you can optionally assign a warehouse number to the plant and storage location pair in a separate step.
Two points to keep in mind:
- Storage locations are client-dependent. A location defined in client 100 does not exist in client 200 unless you transport the change.
- Creating a storage location is cheap, but deleting one is not. Once stock or documents reference it, you cannot remove it. Plan the keys carefully.
Design considerations
When you decide whether a requirement needs a new storage location, ask these questions.
- Do you need to know the quantity separately? If yes, a storage location is a candidate.
- Does the area need a different value? If yes, a storage location is the wrong tool, because values live at plant or valuation area level.
- Does the area need its own planning or procurement settings? Then a separate plant may fit better.
- Does the area belong to a different legal entity? Then it needs a plant in a different company code.
A frequent design mistake is to create a new plant for every warehouse building. That multiplies material master data, because each plant needs its own plant views, and it causes needless valuation and planning effort. If the buildings share one legal entity, one valuation, and one planning approach, one plant with several storage locations is usually enough.
The opposite mistake also occurs. Placing sites that need separate MRP runs, separate valuation, or different legal ownership into one plant as storage locations forces workarounds later.
Summary
The storage location is a plant-specific place where stock quantities are kept. Its key is unique only inside its plant, quantities are stored per material, plant, and storage location in MARD, and values are held above it. Movements between storage locations of one plant are usually accounting-neutral, while movements between plants may not be.
Exercise
Plant 1000 and plant 2000 both define storage location 0001. A colleague writes SELECT lgort, lgobe FROM t001l INTO TABLE @DATA(lt_loc). and then looks up the description of location 0001 in the result. What goes wrong, and how do you fix the query?
Show answer
The result contains one row with LGORT 0001 for each plant, so the lookup is ambiguous and may return the description of the wrong plant's location. The key of a storage location is plant plus storage location, not storage location alone. Select werks too and filter with WHERE werks = @lv_werks (or look up with both fields).
Exercise
A company wants to know the quantity of a material held in its returns bay separately from its main rack area, but both areas are in one building owned by one legal entity and valued at the same price. Which organisational unit should represent each area, and why?
Show answer
Each area should be a separate storage location in the same plant. Only quantities need to be tracked separately, and storage locations hold quantities per material in MARD. A new plant would be unnecessary, because valuation, planning, and legal ownership are shared.
Exercise
A transfer posting with movement type 311 moves 50 pieces from storage location 0001 to 0002 in plant 1000. Does the valuation of the material change, and why?
Show answer
No. Both locations are in the same plant, so they share the same valuation area and the same price for the material. Only the quantity per storage location in MARD changes.