Negative Stocks and Message (M7021) Deficit of SL Unrestricted-use during PGI
Recently got one issue that one user got the message “Deficit of SL Unrestricted-use 1.000 EA: Plant/Storage Location” during PGI for one delivery number (which contains single material) at VL02N. But it’s can be PGI for another delivery number with exactly the same material for another plant.
Generally, PGI means goods have been moved from the plant, and the system will not allow you to do the PGI without stock. But the colleague from the Function team mentioned one point: this material has set the flag of <Negative stocks allowed in plant>.
1. About Allowing Negative Stocks
This <Negative stocks allowed in plant >field(MARC-XMCNG) has been set at View of Plant Data/Storage location 2 of the Material Master:
What are the Negative stocks?
Negative stocks are required if, for example, goods issues are entered before the corresponding goods receipts for organizational reasons and the material is already physically located in the warehouse.
If the first movement of a material is an outward movement, in Customizing for Inventory Management, you can activate the automatic creation of storage location data at goods issue for plant and movement type.
Once the goods receipts have been posted, the book inventory balance must correspond to the physical stock, that is, the book inventory balance must no longer be negative.
The lesson here: If I check its prerequisites carefully before start looking for user exit, a few hours could be saved.
2. Prerequisites of Negative Stocks
To work with negative stocks, you have to:
- Explicitly allow this in the Customizing system for each valuation area and storage location.
- Set the indicator Neg. stocks in plant in the material master record of the individual materials (storage data).
- Negative stocks are allowed for special stocks if you have activated negative stocks in the valuation area and for the special stock concerned in the plant. You do not need to activate negative stocks in each material master record.
The question will be how to set “Allow Negative Stocks” for each valuation area and storage location against the above point 1?
The answer is Tcode OMJ1 (Allow Negative Stocks):
- Tick the checkbox of <Neg. Stocks allowed> at Valuation area level:
- Tick the checkbox of <Neg. Stocks> at Plants/Storage locations level:
After the above 2 settings at OMJ1 plus the ‘Negative stocks allowed in plant’ flag at material master data, Message (M7021) will disappear for this specific material during PGI at VL02N.
3. One more question here is how to check this if know nothing about this configuration from a technical perspective?
Before checking Tcode OMJ1, I suspect there were some enhancements set up for existing plants but missing the same setting for new plants as the issue happens for new plants only. Then I set a break-point for the error message and start to track back.
After comparing the stack between PGI successful one and failed one, I got the initial checkpoint which is step 10: MV50AF0F_FCODE_WABU.
Still, it’s a huge routine containing dozens of FM involving MB_CREATE_GOODS_MOVEMENT and MB_CREATE_GOODS_ISSUE_ITEM, as well as form routine: MATERIAL_LESEN in FM07MFM0. I try script RSTPDA_SCRIPT_BP_SELECT_TAB with some specific table but no idea why it’s not triggered.
Does anyone have any quick way to identify such during debugging? Please kindly let me know. Thanks in advance!