This script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posted the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.
This script returns the top level BOM for a manufacturing order.
/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
SELECT
['Mfg Order Master'].MANUFACTUREORDER_I
,['Mfg Order Master'].ITEMNMBR
,'CUSTOMER ITEM NUMBER' AS CustomerItemNumber
,['Item Master'].ITEMDESC
,['Mfg Order Master'].ENDQTY_I
,['Inventory U of M Schedule Setup'].BASEUOFM
,'DRAWING NUMBER' AS DrawingNumber
,'REVISION' AS Revision
,'SPEC NUMBER AND ISSUE' AS SpecificationAndIssue
,['Bill Of Material Line File'].CPN_I AS ComponentS
FROM
WO010032 AS ['Mfg Order Master'] --WO010032
INNER JOIN
IV00101 AS ['Item Master'] --Item Master (IV00101)
ON
['Item Master'].ITEMNMBR = ['Mfg Order Master'].ITEMNMBR
INNER JOIN
IV40201 AS ['Inventory U of M Schedule Setup'] --Inventory U of M Schedule Setup (IV40201)
ON
['Inventory U of M Schedule Setup'].UOMSCHDL = ['Item Master'].UOMSCHDL
INNER JOIN
BM010115 AS ['Bill Of Material Line File'] --BM010115
ON
['Bill Of Material Line File'].PPN_I = ['Mfg Order Master'].ITEMNMBR