The starting point for this was my client's request for a point-in-time inventory report. The way they use inventory does not allow for the few available GP reports to serve any useful purpose. So I had to hit the drawing board to come up with a reasonable facsimile.
I started with the Historical Stock Status report in GP as the model for this. It works fairly well in regards to quantities on-hand as of a prior date. The detail version of this report actually shows how to roll back the quantity from the current balance to the prior date by backing out transactions since that date. This was extremely helpful to me to adjust my logic to do - essentially - the same thing.
To establish the point-in-time quantity balance start with the current quantities in the IV00102 Item Quantity Master. Then back out transactions in the IV30300 Inventory Transaction Amounts History table that happened since the target report date. When backing out the IV30300 transactions keep in mind the following:
- Returns (DOCTYPE=5) are excluded. At this customer returns do not go directly to on-hand quantity.
- Transfers (DOCTYPE=3) between different locations are reduced at the FROM location and increased in the TO location. These transfers are in a single transaction that has both the from (TRXLOCTN) and to (TRNSTLOC) locations.
- Transfers at the same location are considered if they affect the on-hand quantities. The from and to location will be the same on these and you must examine the quantity type in either the from (TRFQTYTY) or to (TRTQTYTY) location. Quantity type 1 is "On-hand".