Material Change report is based on two major tables, CDHDR and CDPOS.
CDHDR - Change document header
CDPOS - Change document items
For custom report, need to add material description with this. Material description is from MAKTX field in MAKT.
MAKT - Material Description
To achieve the Material change report, need to join the above 3 tables.
Join CDPOS, CDHDR with MARA, MAKT.
List the available columns in all the tables.
CDPOS table structure
CDHDR table structure
Join between CDHDR and CDPOS tables
MAKT table structure
Joining CDHDR & CDPOS with MAKT is the problem, we can't see any proper join except language key in SQVI. Joining is possible by identifying the table records.
Check all the above table records. CDHDR & CDPOS are huge tables so make sure to use properly.
Based on the data, we can join all the tables together.
Check the below SQL Script to join CDHDR & CDPOS tables.
SELECT TOP 10 * FROM SAPSR1.CDHDR C INNERJOIN SAPSR1.CDPOS CD
ON C.CHANGENR=CD.CHANGENR AND C.OBJECTID=CD.OBJECTID AND C.OBJECTCLAS=CD.OBJECTCLAS
Next step is to join with MAKT. Here ObjectID is matching with MATNR field. So objectID is nothing but Material Number.
SELECT TOP 10 C.OBJECTID as MaterialNo, MAKTX as MaterialDescription, C.UDATE, CD.VALUE_OLD, CD.VALUE_NEW
FROM SAPSR1.CDHDR C INNERJOIN SAPSR1.CDPOS CD
ON C.CHANGENR=CD.CHANGENR AND C.OBJECTID=CD.OBJECTID
INNER JOIN SAPSR1.MAKT M
ON M.MATNR=C.OBJECTID
Check the below output