Tuesday, 6 October 2026

How to Check if a Purchase Order Is Partially Received in D365 F&O

In Dynamics 365 Finance & Operations, you may need to determine whether a Purchase Order (PO) is partially received — meaning some quantity has been received, while some quantity is still pending.

A simple way to determine this is by checking the PurchQty and RemainPurchPhysical fields on PurchLine.

The Logic

For each active PO line:

  • Received quantity = PurchQty - RemainPurchPhysical

  • If Received quantity > 0, something has been received.

  • If RemainPurchPhysical > 0, some quantity is still pending.

  • If both conditions are true, the PO is partially received.

We can implement this with a small X++ method:

public boolean isPOPartiallyReceived(PurchId _purchId)
{
    PurchLine purchLine;
    boolean   hasReceived  = false;
    boolean   hasRemaining = false;

    while select PurchQty, RemainPurchPhysical, PurchStatus
    from purchLine
    where purchLine.PurchId == _purchId
       && purchLine.PurchStatus != PurchStatus::Canceled
    {
        // Quantity already received on this line
        if (purchLine.PurchQty - purchLine.RemainPurchPhysical > 0)
        {
            hasReceived = true;
        }

        // Quantity still to be received
        if (purchLine.RemainPurchPhysical > 0)
        {
            hasRemaining = true;
        }

        // PO is partially received
        if (hasReceived && hasRemaining)
        {
            return true;
        }
    }

    return false;
}

Example

Suppose a PO line has:

PurchQty              = 100
RemainPurchPhysical   = 40

Then:

Received = 100 - 40
         = 60

Since 60 has been received and 40 is still remaining, the PO is partially received.

Why This Approach?

The method checks only the required PurchLine fields and exits immediately once both conditions are satisfied.

This makes it useful when you simply need a boolean answer:

if (this.isPOPartiallyReceived(purchId))
{
    // PO is partially received
}

Note: Canceled PO lines are excluded from the calculation.

Key Takeaway

To identify a partially received PO in D365 F&O, check for both:

Received Quantity > 0
AND
Remaining Physical Quantity > 0

Using PurchQty and RemainPurchPhysical on PurchLine provides a straightforward way to perform this validation in X++.

How to Check if a Purchase Order Is Partially Received in D365 F&O

In Dynamics 365 Finance & Operations, you may need to determine whether a Purchase Order (PO) is partially received — meaning some quan...