Symptom
A Material Master record has been created incorrectly with the 'Batch Management Requirement Indicator' set. Business documents have been created for the material and/or initial stock has been posted while the indicator was set. If the user goes to the Product Master and tries to remove the 'Batch Management Requirement Indicator' the system raises errors such as 'Batches already exist' and the indicator cannot be removed.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Open the tile Change Material - MM02
- Enter the material and press return
- Choose the Purchasing TAB and enter the Plant
- Untick the Batch Management flag(s)
- Press return
- Message 'Batch management requirement cannot be changed; choose "Display errors"
- Choose "Display errors"
- Message 'Batches already exist' is shown
Cause
It is not allowed to change the Batch management indicator of a material while there are open documents or open stock or if batches already exist for the material.
Resolution
If documents exist for the material or there are batch stocks, there are a number of steps that need to be executed to be able to change the 'Batch management indicator' of a material. Each step is dependent on the previous step being successful.
The steps in order are outlined below:
1) You have to configure the system to enable archiving of the batches and batch stock
The complete documentation for the Information lifecycle Management is here
Basic steps below
Link the archiving objects LO_BATCH and MM_STO_BATCH to an 'ILM Audit Area'
Open the ILM Audit Areas app
Choose audit area ARCHIVING (with policy category RST – Residence Rules) and press Continue.
Press Edit. Then search for ILM object LO_BATCH and MM_STO_BATCH set the flag Object Assignment for both objects and press save.
Repeat the step for audit area GENERAL (with policy category RTP – Retention Rules)
linking the archiving objects LO_BATCH and MM_STO_BATCH to audit area GENERAL
Create an ILM Policy assigning the above 'ILM audit areas' Archiving RST and General RTP
and archiving objects LO_BATCH and MM_STO_BATCH to each under the new policy
Start ILM Policies app
Choose Residence Rules, audit area ARCHIVING and ILM object LO_BATCH.
Press New - choose policy name - save - then press Edit Rules
Enter policy rules - press save - press change status and set as LIVE
Repeat for the all entries
Choose Residence Rules, audit area ARCHIVING and ILM object LO_BATCH
Choose Residence Rules, audit area ARCHIVING and ILM object MM_STO_BATCH.
Choose Retention Rules, audit area GENERAL and ILM object LO_BATCH
Choose Retention Rules, audit area GENERAL and ILM object MM_STO_BATCH.
Result: Based on your retention period you are now able to archive batch stocks and batches.
Note: There is a minimum retention period covering the current period, you cannot archive batches until the start of the next period.
2) You have to close all business documents that have the material and bring the stock for the material to zero (If you have stock in the previous period it must also be cleared)
3) You have to mark the batches concerned for deletion and then to delete the stock segments for the material.
Via the APP 'Change Batch' (MSC2N) mark the material and all it's batches for deletion
Schedule the data destruction for object MM_STO_BATCH_DEST via the 'ILM Data destruction' APP
'ILM Data destruction' - choose NOT scheduled - find and choose object MM_STO_BATCH_DEST -
choose 'Schedule' - In the pop up choose DELETE. (The object now appears in the scheduled TAB)
This scheduled job is triggered by a technical job which runs once per week, normally Thursday or Sunday.
Result - the stock segments for the batch are deleted (table MCHB)
4) Run/schedule the archive write job for LO_BATCH for your Material
Open the APP 'Manage Archiving Variants' - choose 'Add New Variant' - complete the mandatory fields and add the material you would like to archive the batches for. Choose action 'Archiving' and
leave the 'test mode' flag empty - press save. The variant is saved from the all variants view choose the new variant and then press schedule archiving.
This scheduled job is triggered by a technical job which runs every Thursday or Sunday after the job in step 3.
Result - the batches are written to an archive file ready to be deleted.
5) When the archive file has been created successfully from step 4 and you are ready to delete the batches completely Run/schedule the data destruction job for LO_BATCH for your material. The steps here are identical to step 4 only that you choose action 'Data Destruction' for this step. This is a scheduled job that runs once a week every Thursday or Sunday at the same time as the write job. Schedule this job for the following weekend.
Result - the batches are all deleted from the database tables MCHB MCHA MCH1
** Please note you can run steps 4 & 5 in test mode. The test job for each of these is executed
every 24 hours so you can see the likely outcome of a variant before your do the production run.
6) You can now change the 'Batch management indicator'
Open the APP 'Change Material' (MM02) go to the Purchasing TAB remove the batch indicators and press save.
Keywords
MARA-XCHPF, MM_STO_BATCH_DES, BATCH_WRI, BATCH_DEL, MM_STO_BATCH, LO_BATCH, ILM Audit Area, ARCHIVING, Archive, Batch management, indicator, flag , KBA , MM-IM-GF-ARC-2CL , Archiving / Storage (Public Cloud) , LO-BM-2CL , Batch Management (Public Cloud) , BC-ILM-RW , Retention Warehouse , Problem