* Calling stub CREATE CURSOR BOM (ItemID I, ; ParentItemID I ) LOCAL lnRecno() PRIVATE lnRecurseLevel lnRecurseLevel = 0 USE Inventory * Find the fisnished good you want SELECT 0 USE BOM ORDER ItemID IF NOT ProduceBOM( ItemID ) * Recursion failed because BOM is too complex ENDIF GOTO lnRecno() * Produce BOM cursor PROCEDURE ProduceBOM LPARAMETERS liItem LOCAL liNextItem, lcAlias, llRet lnRecurseLevel = lnRecurseLevel + 1 IF lnRecurseLevel > 100 RETURN .F. ENDIF lcAlias = ALIAS() SELECT BOM SEEK litemID SCAN WHILE iItemID = liItemID INSERT INTO BOM ( ItemID, ParentItemID ) VALUES ( iItemID, liItemID ) llRet = ProduceBOM( ChildItemID ) ENDSCAN RETURN llRetThis is just off the top of my head so it is not tested or debugged but it should show you that exploding a BOm is not a difficult process. The procedur could easily bet a mathod in an object and the object could have a property for hilding the top level item to be exploded.