Sub topic 13
Design considerations and common mistakes
This chapter assumes you know the client, company code, plant, and storage location, and the assignments between them. It also assumes you can read a simple Open SQL query. It covers how to decide where a requirement belongs, and the mistakes that are costly to fix later.
Start from the requirement
Each organisational unit answers a different question. Ask the question first, then pick the unit.
| Requirement | Unit |
|---|---|
| Separate legal entity with its own balance sheet and tax reporting | Company code |
| Fully isolated data and configuration, such as a test environment | Client |
| Site that plans, produces, or procures | Plant |
| Physical area where stock is counted and kept | Storage location |
| Group several company codes for consolidated reporting | Company |
Common mistakes
Creating a plant when a storage location is enough
A plant carries its own material master views, planning runs, and valuation. If two areas share the same planning and procurement, add a storage location to the existing plant. A new plant adds master data maintenance and splits stock that should be planned together.
Treating a storage location as globally unique
A storage location is identified by plant and storage location key together. Plant 1000 and plant 2000 can both have storage location 0001. Any custom code that reads LGORT without WERKS can mix up two different places.
This query lists keys that are reused across plants. Reuse is legal, so use the result to find code that assumes uniqueness.
REPORT z_lgort_reuse.
SELECT lgort,
COUNT(*) AS plant_count
FROM t001l
GROUP BY lgort
HAVING COUNT(*) > 1
INTO TABLE @DATA(lt_reused).
LOOP AT lt_reused INTO DATA(ls_reused).
WRITE: / ls_reused-lgort, ls_reused-plant_count.
ENDLOOP.Assuming a plant can serve two company codes
A plant belongs to exactly one company code. If two legal entities both operate at one physical site, model two plants, one for each. Stock transfers between them then become inter-company transactions, which is correct for the accounting.
Mixing up the valuation level
Valuation is usually at plant level, so the valuation area equals the plant. Changing the valuation level later is a major conversion project. Decide it before go-live and treat it as fixed.
Using the client for separation that company codes can provide
Clients isolate data completely. Cross-client reporting and shared master data are limited. Use separate clients for development, test, and production. Do not use them to separate two business units that need to trade with each other.
Forgetting the related units
Purchasing organisation, sales organisation, and controlling area have their own assignments to company codes and plants. A plant with no purchasing organisation assigned cannot be used for purchasing. Check these assignments when you add a plant.
Checking stock against the design
Stock is held in table MARD per material, plant, and storage location. This query shows how much unrestricted stock sits in each storage location of one plant. A storage location that holds nothing, or one that holds everything, can point to a design problem.
REPORT z_stock_by_location.
DATA lv_werks TYPE werks_d VALUE '1000'.
SELECT lgort,
SUM( labst ) AS total_stock
FROM mard
WHERE werks = @lv_werks
GROUP BY lgort
INTO TABLE @DATA(lt_stock).
LOOP AT lt_stock INTO DATA(ls_stock).
WRITE: / ls_stock-lgort, ls_stock-total_stock.
ENDLOOP.Summing LABST across materials with different units of measure is only meaningful as a rough check. Use it to spot empty locations, not for reporting.
Design checklist
- Name the legal entities first. Each gets a company code.
- List the sites that plan, produce, or procure separately. Each gets a plant, assigned to one company code.
- Add storage locations only where stock must be tracked separately inside a plant.
- Confirm the valuation level and the purchasing, sales, and controlling assignments.
- Keep test and production in separate clients.
Exercise
A company has one warehouse building. Two legal entities store goods there, and each must report its own inventory value. How do you model it?
Show answer
Create two plants, one assigned to each company code, even though they share the building. A plant belongs to exactly one company code, so one plant cannot serve both entities. Storage locations alone would not work, because they sit inside a single plant and so inside a single company code.