---
id: object/codeunit/20557
type: object
title: Codeunit 20557 "Subc. Purchase Order Creator"
summary: Codeunit 20557 "Subc. Purchase Order Creator" in Subcontracting (Microsoft.Manufacturing.Subcontracting). 8 public procedures, 2 events. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - subcontracting
versions:
  introduced: "29"
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: ba733c064a14357d435f905b3d5edc657004c4821b7ba31c17667c36577bd4ff
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/Subcontracting/app/src/Purchase/SubcPurchaseOrderCreator.Codeunit.al
    title: src/Apps/W1/Subcontracting/app/src/Purchase/SubcPurchaseOrderCreator.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/10278
    - change/bcapps/9892
    - change/bcapps/9396
    - change/bcapps/8902
    - change/bcapps/9080
object_type: codeunit
object_id: 20557
name: Subc. Purchase Order Creator
namespace: Microsoft.Manufacturing.Subcontracting
app: Subcontracting
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 26
  events: 2
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 0
  called_by: 0
  implements: 0
---

# Codeunit 20557 "Subc. Purchase Order Creator"

> Codeunit 20557 "Subc. Purchase Order Creator" in Subcontracting (Microsoft.Manufacturing.Subcontracting). 8 public procedures, 2 events. Introduced in BC29, still in BC30.

Subcontracting · Microsoft.Manufacturing.Subcontracting · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/Subcontracting/app/src/Purchase/SubcPurchaseOrderCreator.Codeunit.al) · facts from BC29

## Events published

- `OnBeforeHandleProdOrderRtngWorkCenterWithSubcontractor(var SubContractorWorkCenterNo: Code[20])` (internal)
- `OnBeforeShowCreatedPurchaseOrder(ProdOrderNo: Code[20]; NoOfCreatedPurchOrder: Integer; var IsHandled: Boolean)` (internal)

## Procedures

- `CreateSubcontractingPurchaseOrderFromRoutingLine(ProdOrderRoutingLine: Record "Prod. Order Routing Line"): Integer`
- `InsertProdDescriptionOnAfterInsertPurchOrderLine(PurchOrderLine: Record "Purchase Line"; var RequisitionLine: Record "Requisition Line")`
- `InsertSubcontractingProdOrderComments(PurchOrderLine: Record "Purchase Line"; RequisitionLine: Record "Requisition Line"; var NextLineNo: Integer)` (internal): Inserts the subcontracting production order comments as purchase order lines.
- `TransferSubcontractingProdOrderLineAttachments(PurchOrderLine: Record "Purchase Line"; RequisitionLine: Record "Requisition Line")` (internal): Transfers the subcontracting production order line attachments to the purchase order line.
- `TransferSubcontractingProdOrderComp(var PurchaseLine: Record "Purchase Line"; var RequisitionLine: Record "Requisition Line"; var NextLineNo: Integer)`
- `ShowCreatedPurchaseOrder(ProdOrderNo: Code[20]; NoOfCreatedPurchOrder: Integer)`: Opens the subcontracting purchase order(s) marked during the current CreateSubcontractingOrdersForRoutingLineSelection call on this instance. Does nothing if no purchase order was marked (for example when called directly).
- `ShowExistingPurchaseOrdersForRoutingLines(var ProdOrderRoutingLine: Record "Prod. Order Routing Line")` (internal)
- `CreateSubcontractingOrdersForRoutingLineSelection(var ProdOrderRoutingLine: Record "Prod. Order Routing Line"): Integer` (internal)

Plus 16 local procedures.

## Recent changes

- 2026-08-21 [#10278 Subcontracting Operation Notes](../../changes/bcapps/10278.md) (main, BC30, feature)
- 2026-08-18 [#9892 [main] Bug 644283: Renumber Subcontracting app object ids as it clashes with partner range](../../changes/bcapps/9892.md) (main, BC30, refactor)
- 2026-07-31 [#9396 [Subcontracting] Fix subcontracting order opening wrong purchase order after creation](../../changes/bcapps/9396.md) (main, BC30, fix)
- 2026-07-28 [#8902 Bug 639568: Scope Subc. PO component location check to current prod order line](../../changes/bcapps/8902.md) (main, BC30, fix)
- 2026-07-08 [#9080 Bug 635072: Subcontracting order uses Prod. Order Line location, not Work Center](../../changes/bcapps/9080.md) (main, BC30, fix)

## Across versions

- Present in: BC29-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Subc. Purchase Order Creator")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
