To explain the solution as a sap consultant we must have basic knowledge regards Tables and Fields .
for this question we need to know TABLE -BKPF and EKBE
TABLES AND SOME IMPORTANT FIELDS
EKBE- Purchasing History Data table
BKPF-Purchasing Document Header table