Explode the BOM
The planning team wants one number per purchased part: how many units must be bought to build a given quantity of a finished item. Bills of materials nest — a bike is built from wheels and a frame, a wheel from a rim and spokes — and every line carries a scrap allowance for the parts that arrive bent or get ruined on the shop floor. To make it interesting, last month's data import managed to create BOMs that contain themselves, and the current explosion job loops until the server kills it.
The data
The starter ships a table named "BOM Structure Line" — one row per line of a bill of materials. Keep the table in your submission exactly as given (the grading tests seed rows into it by name):
"Parent Item No."(Code[20]) — the assembly this line belongs to."Component Item No."(Code[20]) — the item this line consumes."Quantity Per"(Decimal) — units of the component needed per one unit of the parent."Scrap %"(Decimal) — extra percentage added to the line's demand to cover expected waste.
An item is an assembly when at least one "BOM Structure Line" row names it as "Parent Item No."; an item with no such rows is a purchased component.
Requirements
Create a codeunit named "BOM Explosion" with one public procedure:
procedure Explode(ItemNo: Code[20]; Quantity: Decimal; var ComponentDemand: Dictionary of [Code[20], Decimal])Solve it with Pro
You’re reading the opening of the statement. Pro unlocks the whole problem:
- The full statement
- Starter code in the browser editor
- 12 grading tests, run on Business Central 28.5
- 3 hints
- The reference solution
Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.
Already on Pro? Sign in