SAP CodeJam Discussions
Visit the SAP CodeJam group to connect and collaborate with other CodeJam attendees, instructors, and experts. Join ongoing discussions and start your own.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Backdated inventory stock report - ALV report

0 Likes
55

Using ALV abap code I want to extract backadated inventory stock report 

SAP ABAP ALV report in SAP S/4HANA to display the material stock as on a selected backdated date using standard SAP tables.  
 
TablePurpose
MARDHHistorical storage location stock (Previous period stock, Monthly historical stock)
MBEWHHistorical valuation data(Historical Stock value, Std Price history)
MCHBHHistorical batch stock(Historical batch quantities)
MKPFMaterial document header
MSEGMaterial document items (ECC)
MATDOCMaterial movements (S/4HANA)
MARAGeneral Material Data
MAKTMaterial Description
 
  The report should calculate and display the historical stock position of materials based on the user-selected date range.  
 
Selection Screen Input: 
1. Material
2. Plant
3. Storage Location
4. Batch 
5. Valuation Type.
6. Special stock Indicator
7. Selection date range (From and To Date)
 
Output ALV Field:
1. Material
2. Material Description,
3. Plant
4. Storage Location
5. Batch
6. Valuation Type.
7. Unit of Measure
8. Opening Stock 
9. Closing Stock
1 REPLY 1
Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
17

Hello @vanajakshi_raghavendra 

As you have mentioned MATDOC in your question, let me assume you are on S/4HANA already.

MARDH, MBEWH, MCHBH, MKPF, MSEG are not really DB tables anymore. They are simulated by replacement objects with MATDOC data. See the note 2206980 - Material Inventory Management: change of data model in S/4HANA So at the end of the day you get your data from MATDOC, even if you select from MKPF, MSEG, etc.

MARDH, MBEWH, MCHBH provide historical stock on monthly basis. You could get stock level at the end of a month from there and then calculate back to the exact date with MATDOC movement types.

You could also use Material Stock at Posting Date C_MaterialStockByKeyDate CDS view to get the data for your report.

Also consider SAP standard Stock for Posting Date report, transaction MB5B.

Best regards

Dominik Tylczynski