Product Receipt Default Quantity to Zero

You want your logic just for Product receipt and Ordered quantity, but you don’t have either in your code. It would run for all types of posting (confirmation, invoice…) and with any quantity specification.

The type of posting will be handled when you put your logic at the right place. There are subclasses for each type of posting and you just need to do it in the right subclass. For quantity, you need to use a condition in code.

For example, you could put your logic to PurchFormletterParmDataPackingSlip.setParmLine() and run it only if purchParmUpdate.SpecQty == PurchUpdate::All.