Purchase Order Technical Flow in D365FO (Step-by-Step)
(From creation → approval workflow → posting → product receipt → invoice → accounting)
1. Purchase Order Creation
Tables involved
-
PurchTable → PO header
-
PurchLine → PO lines
-
VendTable → Vendor master
-
InventDim / InventDimCombination → Item dimensions
-
EcoResProduct / InventTable → Item master
Classes / Framework
-
PurchTableType / PurchLineType
-
Framework that controls creation, validation, defaulting.
-
Key methods
-
PurchTable.initValue() -
PurchLine.initFromPurchTable() -
PurchTable.validateWrite() -
PurchLine.validateWrite()
Events (Extension points)
-
PurchTableType.createPurchTable() -
PurchLineType.createPurchLine()
2. Purchase Order Confirmation
Document Status update
-
PurchTable.DocumentState → Confirmation
-
PurchParmBuffer tables used for versioning.
Posting Class
-
PurchFormLetter_Confirm-
Called internally via PurchFormLetter::construct(DocumentStatus::Confirm)
-
-
Methods:
-
run() -
update() -
initParmPurch()
-
Tables Updated
-
PurchTable
-
PurchLine
-
PurchTotals
-
PurchParmTable / PurchParmLine (temporary/posting parameters)
3. Purchase Order Workflow (If enabled)
Tables
-
WorkflowTrackingStatusTable
-
WorkflowWorkItemTable
-
WorkflowStepInstanceTable
Classes
-
Workflow classes for PO:
-
PurchReqWorkflow -
PurchOrderWorkflow
-
-
Approval/reject logic:
-
WorkflowWorkItemActionManager -
Event handlers on
canSubmitToWorkflow,submitToWorkflow(),approve()
-
Technical Flow
-
PO saved
-
canSubmitToWorkflow()event triggered -
PO submitted → Workflow instance created
-
Workflow step assigned to approver
-
Approver’s action updates status & triggers events
4. Product Receipt (GRN Posting)
Posting Class
-
PurchFormLetter_Receive-
Created via:
PurchFormLetter::construct(DocumentStatus::PackingSlip)
-
-
Technical flow of receiving lines:
-
Inventory transactions updated:
InventTrans(Status = Received) -
Ledger not posted (non-financial update)
-
Tables updated
-
InventTrans → Receipt status update
-
InventTransOrigin
-
InventSettlement (if needed)
-
VendPackingSlipJour (header)
-
VendPackingSlipTrans (lines)
Important methods
-
purchFormLetter.transWrite() -
purchFormLetter.sumBy() -
inventMov_Movement.receiptMovement()
5. Vendor Invoice Posting
Posting Class
-
PurchFormLetter_Invoice-
Called as:
PurchFormLetter::construct(DocumentStatus::Invoice)
-
-
Links product receipt & invoice using Match Framework.
Match Framework
Used to match:
-
PO → Product Receipt (3-way match)
-
PO → Invoice (2-way match)
-
Price match
Classes:
-
PriceDisc -
PurchPriceToleranceManager -
VendInvoiceInfoLinePost -
VendInvoiceInfoTable/VendInvoiceInfoLine
Tables updated
-
VendInvoiceJour (header of invoice)
-
VendInvoiceTrans (lines)
-
InventTrans (status = Purchased / financially updated)
-
Vendor ledger tables
-
VendTrans
-
VendSettlement
-
-
LedgerTrans / SubledgerJournalAccountEntry → Financial posting
Posting methods
-
purchFormLetter.run() -
VendInvoicePost.updateInvent() -
LedgerVoucher.commit()
6. Accounting Entries (Automatically generated)
Depending on item model group:
-
Inventory posting
-
Inventory account (DR)
-
GR/IR (accrual) account (CR)
-
-
Invoice posting
-
GR/IR reverse
-
Vendor pending invoice
-
Sales tax posting
-
Tables
-
SubledgerJournalAccountEntry
-
GeneralJournalEntry
-
GeneralJournalAccountEntry
-
GeneralLedger
7. Inventory Impact
During product receipt:
-
InventTransStatus::Received
During invoice:
-
InventTransStatus::Purchased
Inventory valuation handled by:
-
InventCostTrans -
InventSettlement(for weighted avg/ FIFO settlements)
8. Technical Events & Extension Points
Table Events
-
PurchTable.onModified() -
PurchLine.onValidatedField()
Class Extensions
-
class PurchFormLetter_Confirm_Extension -
class PurchFormLetter_Receive_Extension -
class PurchFormLetter_Invoice_Extension
Workflow Events
-
onCanSubmitToWorkflow() -
onSubmittingToWorkflow() -
onApproved() -
onRejected()
Comments
Post a Comment