Process of Sales order in Technical terms in D365Fo

 🔥 Sales Order Technical Flow in D365FO

(Creation → Confirmation → Picking → Packing Slip → Invoice → Accounting)


1. Sales Order Creation

Tables

  • SalesTable → SO header

  • SalesLine → SO lines

  • CustTable → Customer master

  • InventDim / InventDimCombination → Dimensions

  • InventTable / EcoResProduct → Item master

Framework Classes

  • SalesTableType / SalesLineType

    • Responsible for validation, defaulting, creation logic

Key Methods

  • SalesTable.initValue()

  • SalesLine.initFromSalesTable()

  • SalesTable.validateWrite()

  • SalesLine.validateWrite()

Events (Extensions)

  • SalesTableType.createSalesTable()

  • SalesLineType.createSalesLine()


2. Reservation (Optional)

If reservation is done:

Tables

  • InventTrans (Reservation status)

  • InventReservation

Classes

  • InventUpd_Reservation

  • InventTransReservation

Reservations impact picking and inventory availability.


3. Sales Order Confirmation

Confirms order and freezes price/quantity.

Posting Class

  • SalesFormLetter_Confirm

    • Created using: SalesFormLetter::construct(DocumentStatus::Confirmation)

Tables Updated

  • SalesTable (DocumentState changes)

  • SalesLine

  • SalesTotals

  • SalesParmTable / SalesParmLine (temporary posting buffer)

Key Posting Methods

  • salesFormLetter.run()

  • salesFormLetter.update()

  • salesFormLetter.initParmSales()


4. Picking (If warehouse management enabled)

WM flow uses WHS tables/modules.

Tables

  • WHSWorkTable / WHSWorkLine

  • WHSLoadTable / WHSLoadLine

  • InventTrans (status = Picked)

Classes

  • WHSWorkExecuteDisplay

  • WHSPostEngine

  • WHSLoadPostPrepare

Picking may be automatic or via scanner (mobile device).


5. Packing Slip Posting (Delivery Note)

This is the product delivery equivalent.

Posting Class

  • SalesFormLetter_PackingSlip

    • Created using: SalesFormLetter::construct(DocumentStatus::PackingSlip)

Technical Steps

  1. Create posting buffers (SalesParm*)

  2. Update inventory (InventTrans = Deducted)

  3. Create packing slip journal

Tables Updated

  • CustPackingSlipJour (header)

  • CustPackingSlipTrans (lines)

  • InventTrans (physical update)

  • InventSettlement (physical cost updates depending on model group)

Key Methods

  • salesFormLetter.transWrite()

  • inventMovement.issue()

  • salesFormLetter.sumBy()


6. Sales Invoice Posting

Final financial update.

Posting Class

  • SalesFormLetter_Invoice

    • Called via: SalesFormLetter::construct(DocumentStatus::Invoice)

Technical Flow

  • Matches packing slip

  • Applies prices/charges

  • Finalizes financial inventory update

  • Creates sub-ledger and Ledger posting

Tables Updated

  • CustInvoiceJour

  • CustInvoiceTrans

  • CustTrans (customer ledger entry)

  • InventTrans (financial update = Sold)

  • SubledgerJournalAccountEntry

  • GeneralJournalEntry / GeneralJournalAccountEntry

  • SalesTaxTrans

Key Methods

  • salesFormLetter.run()

  • salesFormLetter.updateInvent()

  • LedgerVoucher.commit()

  • InventCostTransPosting.postInventTrans()


7. Accounting Entries Generated

Depending on item model group and posting profiles:

At Packing Slip (optional, if physical cost posting enabled)

  • COGS (if physical posting)

  • Inventory deduction

At Invoice

  • Debit: Accounts Receivable

  • Credit: Sales Revenue

  • Credit: Sales Tax Payable

  • Debit: COGS

  • Credit: Inventory

Tables

  • SubledgerJournalAccountEntry

  • GeneralJournalEntry

  • GeneralJournalAccountEntry


8. Workflow (if enabled)

Sales Orders can have workflows (rare but supported).

Tables

  • WorkflowTrackingStatusTable

  • WorkflowWorkItemTable

Classes

  • SalesWorkflow

  • WorkflowWorkItemActionManager

Events

  • onCanSubmitToWorkflow()

  • onSubmited()

  • onApproved()

  • onRejected()


9. Inventory Impact Summary

ReservPhysical → after reservation

Picked → after picking

Deducted → after packing slip

Sold → after invoice

Main table:

  • InventTrans

Cost calculations use:

  • InventCostTrans

  • InventSettlement

  • InventCostAmountCalc


10. Extension Points / Events

Technical customizations rely on:

Table Events

  • SalesTable.onModifiedField()

  • SalesLine.onValidatedField()

Class Extensions

  • SalesFormLetter_Confirm_Extension

  • SalesFormLetter_PackingSlip_Extension

  • SalesFormLetter_Invoice_Extension

Post/Pre Handlers

  • SalesFormLetter.preRun()

  • SalesFormLetter.postRun()

Comments

Popular Posts