Sub topic 15
Material status, blocking, and deletion
This chapter covers how to restrict, block, and retire a material without breaking open documents or history. It assumes you know the material master's organizational levels (client, plant, sales organization), the view structure, and how to read material data from MARA and MARC. Basic SAP GUI navigation is also assumed.
Why materials need a lifecycle
A material is rarely useful forever. Products get replaced, plants close, and suppliers stop delivering. You cannot simply delete the record, because purchase orders, stock, invoices, and bills of material still point to it. The material master therefore offers several controls, ordered here from mildest to strictest:
- A status that restricts the material in specific processes.
- A deletion flag that marks the material for later removal.
- Archiving and deletion that physically removes the data.
The controls apply at different organizational levels. Choosing the right level is the main decision in this chapter.
Status fields and where they live
The material master has two status fields that restrict how a material can be used. Each has a validity date.
| Field | Name | Level | Table field | Typical scope |
|---|---|---|---|---|
| Cross-plant material status | X-plant matl status | Client | MARA-MSTAE, MARA-MSTDE | Everything the status controls, in all plants |
| Plant-specific material status | Plant-sp.matl status | Plant | MARC-MMSTA, MARC-MMSTD | One plant only |
| Distribution-chain-specific status | DChain-spec. status | Sales organization and distribution channel | MVKE-VMSTA, MVKE-VMSTD | One sales area |
The status is stored as a two-character key that you define in customizing. The validity date field says from when the status applies. Before that date, the material behaves as if no status were set.
What a status does
A status key does not block anything by itself. It carries a severity setting for each business area, called a usage in customizing. For each usage, the key can have one of three behaviors:
- No message, so the process continues normally.
- A warning message, so the user can continue after confirming.
- An error message, so the process stops.
Typical usages include purchasing, material requirements planning (MRP), goods movements, and sales documents. A status such as "blocked for procurement" can raise an error in purchase orders but allow goods issues, so remaining stock can still be consumed. You maintain the keys in customizing under Logistics - General, Material Master, Settings for Key Fields, Define Material Statuses.
Cross-plant versus plant-specific
The plant-specific status is checked first for plant-level processes. If a plant status exists and is valid, it is used. If the plant field is empty, the cross-plant status applies. This lets you block a material at one plant, for example during a plant ramp-down, while the other plants continue normally.
Deletion flags
A deletion flag (also called a deletion indicator) marks a material for deletion. It is not deletion. The data stays in the database, and the flag mainly prevents the material from being used in new documents and tells the archiving run that the material is a candidate.
The flag exists at several levels:
| Level | Field | Effect |
|---|---|---|
| Client | MARA-LVORM | Flags the whole material in all plants |
| Plant | MARC-LVORM | Flags the material in one plant |
| Storage location | MARD-LVORM | Flags the material in one storage location |
| Sales organization / distribution channel | MVKE-LVORM | Flags the material for one sales area |
| Valuation area | MBEW-LVORM | Flags the valuation data |
You set a flag in transaction MM06 (flag for deletion), or through the Fiori app or the Change Material transaction MM02 with a flag option at the relevant level. Setting the flag at client level also affects all lower levels.
A flagged material can usually still be displayed, and existing documents continue to work. Typical behavior for new documents is a warning or error, depending on the process. The flag can be removed again by clearing it, so it is reversible until archiving removes the data.
Typical sequence
A sound retirement process follows these steps:
- Set a plant-specific or cross-plant status to stop new purchasing and planning, with a validity date.
- Consume remaining stock and close open orders, requests, and planned orders.
- Set the deletion flag at the lowest suitable level, then at higher levels when no plant still uses the material.
- Run the deletion program, which archives and deletes flagged materials that pass the checks.
Deleting and archiving
Physical removal is done with the archiving framework. The material master archiving object is MM_MATNR. It runs in two steps: a write program that copies eligible records to an archive file, and a delete program that removes them from the database. In the first stage, a preprocessing run checks whether the material is still used, and sets a deletion indicator that confirms the material qualifies. Only materials with that confirmation are written.
Checks include whether the material still has stock, open purchase documents, reservations, open sales documents, or is used in bills of material or routings. If any check fails, the material stays.
Some practical consequences:
- Archiving needs a residence time. Customizing sets how long a material must be flagged before it can be archived.
- Archived material data can still be read through archive information structures, but it is no longer in the active tables.
- A material number that was archived and deleted can be reused only if your number assignment allows it, which is rarely wise.
Reading status and flags with ABAP SQL
You can find affected materials with a query. The following lists materials flagged for deletion at client level, together with their cross-plant status.
SELECT matnr,
mtart,
mstae,
mstde,
lvorm
FROM mara
WHERE lvorm = @abap_true
INTO TABLE @DATA(lt_flagged)
UP TO 100 ROWS.
IF sy-subrc = 0.
cl_demo_output=>display( lt_flagged ).
ENDIF.To check one plant instead, read the plant table. This is useful when a material is blocked in one plant only.
SELECT matnr,
werks,
mmsta,
mmstd,
lvorm
FROM marc
WHERE werks = '1010'
AND ( mmsta <> @space OR lvorm = @abap_true )
INTO TABLE @DATA(lt_plant_restricted)
UP TO 100 ROWS.A common mistake is checking only MARA. A material can be fully active at client level and still blocked at plant level.
Status, flags, and S/4HANA
In SAP S/4HANA, the material master keeps these mechanisms. Two points are worth knowing:
- The business partner and product concepts changed other master data, but the status and deletion flag fields keep their meaning. Fiori apps such as Manage Product Master Data show these fields on the product's general and plant screens.
- Because S/4HANA stores the inventory in a simplified way, a material with a flag but with open stock still cannot be archived. The checks are unchanged in principle.
Check the release you run, since apps and archiving behavior differ between versions.
Common mistakes
- Using the deletion flag as a block. The flag is a candidate marker. For a controlled restriction, set a status with the desired message severity.
- Setting only the client-level flag. It may hide the material broadly while a plant still holds stock. Review open stock first.
- Forgetting the validity date. A status without a date applies as defined by the customizing and the system date. Set the date deliberately.
- Expecting a status to stop every process. Only the usages configured in the status key are checked.
- Deleting data in tables directly. Always use archiving.
Exercise
A plant in your company is closing. Purchasing must stop for a material in that plant starting on 1 January, but goods issues must still work so that remaining stock can be used, and other plants keep buying the material. Which control do you use, at which level, and what is configured in it?
Show answer
Set a plant-specific material status (MARC-MMSTA) with a validity date of 1 January, for that plant only. The status key in customizing must give an error for the purchasing usage and no message for goods movements. The cross-plant status and the client-level deletion flag stay untouched so the other plants are not affected.
Exercise
A query on MARA shows a material with no deletion flag and no cross-plant status, but users report that they cannot order it in plant 1010. Where do you look next, and why?
Show answer
Look at MARC for plant 1010. The plant-specific status (MMSTA with its date MMSTD) or the plant-level deletion flag (MARC-LVORM) can restrict the material even when the client-level data is clean. You can also check the status key's usage settings in customizing to see which processes it blocks.