Sub topic 12
Defining and assigning units in customizing
This chapter assumes you know what the client, company code, plant, and storage location are, and how they relate to each other. It also assumes you can log on to an SAP system and open a transaction code. The focus here is how those units are created and linked in the system, in what order, and what goes wrong when the order or the environment is wrong.
Where the work happens: the IMG
Organisational units are not created in application transactions such as the ones for material or purchase order maintenance. They are configured in customizing, which is the set of settings that adapts SAP standard software to one company. You reach customizing through transaction SPRO, then the button SAP Reference IMG. IMG stands for Implementation Guide, a tree of configuration activities.
The units in this tutorial sit under Enterprise Structure in the IMG. That node has two main branches:
- Definition creates the unit itself: a key and a name, plus a few basic attributes such as address, currency, or country.
- Assignment links units that already exist, for example a plant to a company code.
This split matters. You first define every unit, then assign them. An assignment cannot refer to a unit that has not been defined yet.
The configuration activities
Each activity has an IMG path and usually a direct transaction code. The codes save navigation, but the IMG path is the reliable reference, because paths are documented in the system and codes can differ between releases.
| Unit or link | Typical transaction | IMG area under Enterprise Structure | Main table |
|---|---|---|---|
| Client | `SCC4` | Not in the IMG tree. Called directly. | `T000` |
| Company | `OX15` | Definition, Financial Accounting, Define Company | `T880` |
| Company code | `OX02` | Definition, Financial Accounting, Edit, Copy, Delete, Check Company Code | `T001` |
| Plant | `OX10` | Definition, Logistics General, Define, Copy, Delete, Check Plant | `T001W` |
| Storage location | `OX09` | Definition, Materials Management, Maintain Storage Location | `T001L` |
| Plant to company code | `OX18` | Assignment, Logistics General, Assign Plant to Company Code | `T001K` (valuation area link) |
Two entries need an extra note. The client is not defined in the enterprise structure at all. It is created with SCC4 and filled with a client copy. The plant-to-company-code assignment is stored indirectly: it writes the company code into the valuation area record in T001K, so the assignment you configure ends up in that table.
Step 1: the client settings in SCC4
Transaction SCC4 lists the clients of the system. Opening one shows settings that control how safe it is to change that client:
- Client role: production, test, customizing, demonstration, training/education, or SAP reference. This is a label that expresses intent.
- Changes and transports for client-specific objects: whether customizing may be changed in this client, and whether changes are recorded for transport.
- Cross-client object changes: whether objects that are valid in all clients may be changed from this client.
- Protection: client copier and comparison tool: blocks overwriting this client with a client copy.
Customizing data comes in two kinds. Client-dependent settings, such as the company code entries, exist per client. Cross-client settings are shared by every client in the system. Plants, company codes, and storage locations are client-dependent, so a company code defined in client 100 does not exist in client 200 of the same system. Plan this early: if you configure units in a development client, they must move on through a transport request, or they will not exist in quality assurance and production.
Step 2: define the company and the company code
Define the company first if you use one. In OX15 a company has an ID, a name, an address, and a currency. It exists to group company codes for consolidation, so it carries very little configuration.
Then define the company code in OX02. The key is four characters. The definition screen asks for:
- name and city,
- country,
- currency (the company code currency, used for its books),
- language.
Creating the company code is not enough for posting. It also needs global parameters, such as the chart of accounts, fiscal year variant, and posting period variant. Those are maintained in transaction OBY6. A company code with no global parameters exists in T001 but cannot be used for postings, which is a common reason for a "company code not fully set up" message later.
Most projects do not create a company code from scratch. OX02 offers Copy, Delete, Check. Copying an existing company code duplicates its settings and the dependent customizing, such as account determination and number ranges, which saves a great deal of work. After copying you only change what differs.
Then assign the company code to its company. The IMG node is in the Assignment branch under Financial Accounting. One company can hold many company codes. Each company code belongs to at most one company.
Step 3: define the plant
In OX10 you create the plant. A plant has a four-character key that is unique within the client, a name, and an address. The plant also has a country and a factory calendar, which later feed planning and delivery date logic.
Defining a plant in this transaction creates two records, which surprises many newcomers. One is the plant itself (T001W). The other is a valuation area record in T001K with the same key. The valuation area is created because plant and valuation area coincide when valuation is at plant level. At this point the plant is not yet connected to any company code.
Step 4: assign the plant to a company code
The assignment is in OX18. You list the plant and enter its company code. The rule from the earlier chapters applies here: each plant belongs to exactly one company code, but a company code can have many plants. The screen is a plain table with one row per plant, which makes the rule visible. A plant has only one place to put a company code.
The assignment effectively locks in once the plant is in use. When material master data or stock exists for the plant, valuation data refers to the company code through the valuation area. Changing the assignment then would require revaluing history in two ledgers. SAP blocks or strongly restricts the change in this situation. Treat the assignment as permanent after go-live, and decide it carefully during design.
The same reasoning applies to the valuation level setting that decides whether inventory is valued per plant or per company code. It is set once in customizing, early in the project. Switching it after material master records exist is not supported in practice.
Step 5: define storage locations
Storage locations are created in OX09. You first enter the plant, and then the storage location key and description. A key like 0001 can appear in many plants, because the unique identifier is the pair plant plus storage location. A storage location therefore cannot exist without a plant, and there is no separate assignment step for it.
Defining a storage location does not create any stock or material master data. It only makes the key valid as an entry. A material gets storage-location-level data when a storage location view is created for it in the material master, or when a goods movement first posts stock there.
The order of work
Because assignments depend on definitions, the sequence is fixed.
Checking the result with Open SQL
After configuration, read the tables to confirm what the system holds. The following report lists every plant with its company code and company code name. The left outer join also shows plants that have a valuation area with no company code, which means the assignment step was skipped.
REPORT z_check_plant_assignment.
SELECT w~werks,
w~name1,
k~bukrs,
c~butxt
FROM t001w AS w
LEFT OUTER JOIN t001k AS k ON k~bwkey = w~bwkey
LEFT OUTER JOIN t001 AS c ON c~bukrs = k~bukrs
ORDER BY w~werks
INTO TABLE @DATA(lt_plants)
UP TO 50 ROWS.
LOOP AT lt_plants INTO DATA(ls_plant).
IF ls_plant-bukrs IS INITIAL.
WRITE: / ls_plant-werks, ls_plant-name1, 'NOT ASSIGNED'.
ELSE.
WRITE: / ls_plant-werks, ls_plant-name1, ls_plant-bukrs, ls_plant-butxt.
ENDIF.
ENDLOOP.To check storage locations for one plant, read T001L by plant. The key is the pair, so the WHERE clause on werks is what scopes the result.
REPORT z_check_storage_locations.
PARAMETERS p_werks TYPE werks_d DEFAULT '1000'.
SELECT lgort, lgobe
FROM t001l
WHERE werks = @p_werks
ORDER BY lgort
INTO TABLE @DATA(lt_storage_locations).
IF lt_storage_locations IS INITIAL.
WRITE: / 'No storage locations found for plant', p_werks.
ELSE.
LOOP AT lt_storage_locations INTO DATA(ls_loc).
WRITE: / ls_loc-lgort, ls_loc-lgobe.
ENDLOOP.
ENDIF.Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Plant cannot be used in a material master or purchase order | Plant defined but not assigned to a company code | Assign it in `OX18` |
| Configuration saved in development is missing in quality assurance | The change was recorded in a local request or not recorded at all | Check the `SCC4` setting and the transport request, and re-record the change |
| Company code exists but postings fail | Global parameters in `OBY6` are missing | Maintain chart of accounts, fiscal year variant, and posting period variant |
| Storage location not offered for a plant | It was defined under a different plant | Look it up in `T001L` with both keys |
| Cannot change a plant's company code | Stock or valuation data already exists | Plan a new plant and migrate, rather than reassign |
Exercise
A project team defines plant 2000 in OX10 and storage location 0001 in OX09 for it. They then try to create a material master record for plant 2000, and the system rejects the plant. Which step did they skip, and which table would you read to confirm it?
Show answer
They skipped the assignment of plant 2000 to a company code in OX18. The plant exists in T001W, but its valuation area record in T001K has no company code, so the system cannot value inventory there. Reading T001K (or joining T001W and T001K) for the plant's BWKEY shows an empty BUKRS. The storage location is not the problem, because it only depends on the plant.
Exercise
Why does the same storage location key 0001 work in plants 1000 and 2000, but plant 1000 cannot have two storage locations with key 0001?
Show answer
A storage location is identified by the pair of plant and storage location key (WERKS and LGORT in T001L). Different plants make different pairs, so reuse across plants is allowed. Within one plant the pair would repeat, which breaks the primary key.