Update Purchase Order Line

When an inbound e-invoice is linked to a Purchase Order, the Update Purchase Order Line feature synchronizes the PO with the invoice data — updating quantities, unit costs, line discounts, and item tracking reservations.

Entry points

The feature can be triggered manually or automatically.

Manual (user action)

On the Purchase Invoice Comparison page, two actions are available:

Action

What it does

Update Purchase Order Line

Applies the invoice data to the linked PO lines

Update Purchase Order Line And Post

Applies the invoice data and then posts the Purchase Order

Automatic

During auto-processing, the update runs automatically with SuspendRelease = true to prevent the PO from being released immediately.

How lines get matched

Before the update runs, the system needs to know which invoice line corresponds to which PO line. This matching happens when a user modifies an Integration Peppol Line record:

  1. The OnModify trigger fires

  2. FindMatchingPurchaseOrderLine() is called

  3. CheckForMatchingPurchaseOrderLine() matches by item number (PurchOrderItemNo)

  4. The Comparison table is updated with the invoice values: item number, line amount, quantity, discount, and base amount

The matched results are visible on the Purchase Order Comparison subpage.

Update process

The main procedure (UpdatePurchaseSalesOrder) processes each matched Comparison record through a series of steps.

Step 1 — Update matched lines

For each Comparison record with a non-zero invoice quantity:

Operation

What it does

Update quantity

Distributes the invoice quantity across PO lines with the same item. Handles partial quantities when the invoice spans multiple PO lines

Set receive/invoice quantities

Sets Qty. to Receive or Qty. to Invoice depending on the document type (Order vs. Return Order)

Update cost and discount

Applies the invoice Unit Cost and Line Discount % to the PO line

Create reservations

If the item uses lot tracking, creates or modifies reservation entries with lot numbers and expiration dates from the invoice

If the invoice quantity exceeds the available PO lines for an item, the system creates new PO lines to absorb the overflow.

Step 2 — Handle zero-quantity lines

For Comparison records where the invoice quantity is zero, the system either:

  • Deletes the matched PO line, or

  • Sets its quantity to zero

Step 3 — Process G/L Account lines

Additional charges or discounts from the invoice that don't correspond to item lines are inserted as new G/L Account lines on the Purchase Order.

Step 4 — Clean up empty lines

If the Remove Empty Lines setting is enabled, PO lines with zero quantity are deleted.

Step 5 — Update Purchase Header

The following header fields are updated from the invoice:

  • Vendor Invoice No. (or Credit Memo No.)

  • Posting Date

  • Original Approval User

  • eInvoice totals: VAT amount, tax-exclusive amount, tax-inclusive amount

Step 6 — Release or route to approval

Setting

Behavior

Manual Approvals enabled

The PO is submitted to the approval workflow

Manual Approvals disabled

The PO is released immediately

Settings that affect behavior

Setting

Effect

Update PO Quantity

Controls whether PO quantities can be updated from the invoice

Remove Empty Lines

Deletes PO lines with zero quantity after the update

Rounding Line Acc. No.

G/L account used for posting rounding differences between invoice and PO totals

Manual Approvals

Routes the updated PO to an approval workflow instead of releasing immediately

Enable Purch. Doc. Approvals

Enables purchase document approval features

Process flow

flowchart TD
    A[User Action / Auto-Process] --> B[UpdatePurchaseSalesOrder]
    B --> C[Read Comparison table]
    C --> D{Invoice qty > 0?}

    D -->|Yes| E[Update PO line quantity]
    E --> F[Update cost & discount]
    F --> G{Lot tracking?}
    G -->|Yes| H[Create reservation entries]
    G -->|No| I[Continue]
    H --> I

    D -->|No| J[Delete or zero PO line]

    I --> K{Invoice qty > PO lines?}
    K -->|Yes| L[Insert new PO lines]
    K -->|No| M[Continue]
    L --> M

    J --> M
    M --> N[Insert G/L Account lines]
    N --> O{Remove Empty Lines?}
    O -->|Yes| P[Delete zero-qty lines]
    O -->|No| Q[Continue]
    P --> Q

    Q --> R[Update Purchase Header]
    R --> S{Manual Approvals?}
    S -->|Yes| T[Submit to approval workflow]
    S -->|No| U[Release PO]

Next steps