how to find active bom and route version for an item based on site when we call prodtablecreate form from another form

I am passing itemid as args from my form to prodtablecreate form, i need to fill active bom and route version for that item based on site

But when i fetch its showing no active route,bom version found,

also i need to fill inventory dimensions with site,warehouse and revision so I’m finding inventdim combination and assigning this to prodtable.inventdimid

prodTable.ItemId    = _temp.Itemid;
          prodTable.Name      = InventTable::find(_temp.Itemid).ItemName;
          prodtable.QtySched=_temp.qtyreqd;
          prodtable.BOMDate=systemdateget();



        select * from bomv join _inventdim  where bomv.ItemId==prodtable.ItemId && bomv.Active==noyes::Yes && bomv.Approved==noyes::Yes && bomv.InventDimId==_inventdim.inventDimId && _inventdim.InventSiteId=="Implant";
         indim2= InventDim::find(bomv.InventDimId);


        bomIdDate           = BOMVersion::findActive(prodTable.ItemId,, prodTable.QtySched, indim2).bomId;
        routeIdDate         = RouteVersion::findActive(prodTable.ItemId,prodTable.bomDate, prodTable.QtySched, indim2).RouteId;


                prodTable.bomId     = bomIdDate;
                prodTable.RouteId   = routeIdDate;

how to fix this error and find its bom and route version