Recently I came across the requirement to get inventory ageing directly from SAP ERP 6.0 instead of calculating it on excel sheets with batch isn't configured.
As a prerequisite, the company is using the FIFO method for ageing. So I used T-Code: MB5B to get stock value and quantity on a specific date.
How MB5B works.
MB5B is calculating stock on a specific date by reversing the usual equation of stock calculation
Ending balance = Begining balance + Input - Output
Current stock is known by kept on MBEW-LBKUM and value on MBEW-SALK3 and Input and output is known by material documents so we are left with only one unknown variable "Begining Stock" which is equivalent to "Stock on earlier date". so the stock equation will be
Stock on earlier date = Ending Balance ( Current Stock ) - In + Out
How is inventory ageing works
Based on the date in the selection, the ageing report will calculate the beginning date and end date for each interval and submit these parameters to MB5B along with material code and plant code, then the result will be retrieved to the ageing report and processed to be displayed in the ALV.
Report screenshots
How to create the report
The full illustration of how to create the report is available on the
Github
Thanks for reading.