Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. set @totalHALBS = (select count (distinct lvl2) as Total from vwSAP_BOMAnalysisByFG vwbe inner join SAPItemMaster sim on vwbe.Lvl2 = sim.MATNR WHERE FG = '9120B' and sim.MTART = 'HALB')
  2.  
  3. SET @finishHALBS = 0
  4.  
  5. WHILE (@finishHALBS <= @totalHALBS)
  6. BEGIN
  7. SET @finishHALBS = @finishHALBS + 1
  8. INSERT INTO #BOMAnalysis
  9. select distinct vwbe.Lvl2, sim.MAKTG,@finishHALBS,1,sim.MTART,'2' from vwSAP_BOMAnalysisByFG vwbe inner join SAPItemMaster sim on vwbe.Lvl2 = sim.MATNR WHERE FG = '9120B' and sim.MTART = 'HALB'
  10. end
  11.  
  12. select * from #BOMAnalysis order by mattype
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement