Auto Finish Production Orders
This feature automatically finishes Released Production Orders that meet your configured completion criteria. It reduces manual administration, closes completed orders promptly, and highlights exceptions for review.
How it works
A scheduled report reviews all Released Production Orders with a Due Date on or before the current Work Date. For each order, it evaluates every production order line against configurable rules. If all lines pass their checks, the order status is changed from Released to Finished. If any line fails, the order is flagged for manual review.
Processing flow
- The report selects all Released Production Orders where Due Date is on or before the Work Date.
- Orders previously flagged as Status Change Failed are skipped. You must finish these manually.
- Each production order line is evaluated against the rule assigned to its item, item category, or location.
- If all lines pass, the order is automatically finished.
- If any line fails, the order is flagged as Validation Failed and skipped.
- A log entry is created for every order and every line evaluated.
Setting up rules
A rule is a set of conditions that define when a production order line is considered ready to finish. Configure rules on the Auto Finish Production Order Rules page.
| Field | What it does |
|---|---|
| Code | A unique identifier for this rule. |
| Description | A friendly description of when this rule applies. |
| Enabled | Turn the rule on or off without deleting it. |
| Validate Output | Check that produced quantity meets expected quantity within tolerance. |
| Validate Consumption | Check that component consumption meets expected quantities within tolerance. |
| Validate Routing | Check that all routing operations are finished. |
| Validate Variance | Check that cost variance between actual and expected output is within tolerance. |
Tolerance settings
For Output and Consumption, you can set tolerance by:
| Tolerance Type | Meaning |
|---|---|
| Quantity | Actual quantity must be at least Expected minus the tolerance quantity. |
| Percentage | Actual quantity must be at least Expected multiplied by (1 − tolerance %). |
| Both | Both the quantity and percentage thresholds must be met. |
When Validate Consumption is enabled, the system always checks that at least one consumption transaction has been posted for each required component, regardless of the tolerance type.
Actual consumption is always stored in the item's base unit of measure, for example KG. Enter the Consumption Tolerance Qty value in the same base unit of measure, regardless of what unit of measure the component line uses.
For Variance, the same tolerance type options apply:
| Tolerance Type | Meaning |
|---|---|
| Percentage | Cost variance % must be within the configured Variance Tolerance %. |
| Quantity | Absolute cost deviation, in LCY, must be within the configured Variance Tolerance Amt. |
| Both | Both the percentage and absolute amount thresholds must be met. |
Assigning rules
Rules are assigned at three levels, in priority order:
| Priority | Level | Where to set it |
|---|---|---|
| 1 (highest) | Item | Item Card, AFPO Rule Code field |
| 2 | Item Category | Item Categories page, AFPO Rule Code field |
| 3 (lowest) | Location | Location Card, AFPO Rule Code field |
The system checks Item first. If no rule is set, it checks the item's Item Category. If still empty, it checks the Location of the production order line. If no rule is found at any level, the line is not evaluated and the order will not auto-finish.
Validation checks explained
Output validation
Compares the Finished Quantity on the production order line against the Quantity, the expected output. The line passes if the finished quantity is within the configured tolerance.
Consumption validation
For each component on the production order line:
- Components with a Backward flushing method are always skipped. Their consumption is posted automatically when the production order is finished, so they cannot block the auto-finish process.
- For all other components with Expected Quantity greater than zero, at least one consumption transaction must be posted. This check always applies when Validate Consumption is enabled.
- The Consumption Tolerance Type then determines the quantity comparison. Actual consumption and the expected quantity threshold are both evaluated in the item's base unit of measure.
- If a line has no components, consumption validation automatically passes.
Routing validation
Checks that all routing operations linked to the production order line have a status of Finished. If the line has no routing assigned, this check automatically passes.
Variance validation
Cost variance is calculated as:
Variance % = |Actual Cost − Expected Cost| ÷ |Expected Cost| × 100
Variance Amt = |Actual Cost − Expected Cost|
Where:
- Expected Cost = Line Quantity × Unit Cost
- Actual Cost = the sum of Cost Amount (Actual) from posted Output item ledger entries
The line passes based on the configured Variance Tolerance Type:
- Percentage — Variance % must be within the Variance Tolerance %.
- Quantity — Variance Amt must be within the Variance Tolerance Amt.
- Both — both conditions must be satisfied.
Warehouse validation
Always performed. Open warehouse activities block auto-finish regardless of any other rule settings. The check confirms that no open warehouse activity lines exist for the production order line, covering both component picks and output put-aways.
Running the report
Manual run
- Search for Auto Finish Production Orders in Tell Me.
- Optionally set filters on the request page for Production Order No., Source No., Description or Due Date.
- Choose whether to run in Simulate Only mode.
- Run the report.
Simulate Only mode
When enabled, the report evaluates all orders and logs what would happen, but does not change any production order status. Use this to preview results before running for real.
Scheduling with the job queue
You can schedule the report to run automatically using a Job Queue Entry. Set up a recurring entry pointing to report AutoFinish Prod. Orders.
Exception handling
Validation Failed
If any line on a production order fails its rule checks, the order is flagged with AFPO Status Validation Failed. These orders are automatically retried on the next run, since conditions may have changed.
Status Change Failed
If all lines pass but the system encounters an error when changing the order status to Finished, for example a posting error, the order is flagged with AFPO Status Status Change Failed. These orders are not retried automatically. You must investigate and clear the flag before the order is processed again.
Reviewing the log
After each run, the Auto Finish Production Order Log page opens automatically when the report is run interactively. You can also search for it in Tell Me.
The log shows:
- Order-level entries, with Line No. 0, showing whether the order was finished or skipped and any error text.
- Line-level entries, showing the rule that was applied and the result of each individual check as Passed, Failed or Skipped.
- A Simulated flag, indicating entries from a simulation run where no actual changes were made.
Extensibility
The codeunit publishes an OnAfterCheckFinishConditions event after evaluating all conditions on a production order line. Other apps, such as a shop floor system, can subscribe to this event to override or extend the ready-to-finish decision.
[IntegrationEvent(false, false)]
local procedure OnAfterCheckFinishConditions(ProdOrderLine: Record "Prod. Order Line"; Rule: Record "AutoFinishPORule_AP_TSL"; var IsReadyToFinish: Boolean)
A subscriber can set IsReadyToFinish to true to mark a line as ready, for example when a shop floor system has explicitly marked it complete, or to false to block finishing.