Advertisement
tko_pb

risyal 2

Jun 1st, 2022
1,065
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Country Code    Business Partner Key    Size    PO Buyer    Country Group   SupplierValue   Additional
  2.  
  3. where mpfg.value in ('HUMMEL-OLD-302SHA--BLUE GRASS-L')
  4.  
  5. select  
  6.     mpFg.value,
  7.     ppbl.kst_part,
  8.     mpDr.value,
  9.     ppbl.QtyBOM,
  10.     cuFg.name as uom,
  11.     ppbl.ispiping,
  12.     mpDr.value as Product_Category,
  13.     '2021-01-01' as validFrom,
  14.     'ID' as countryCode,
  15.     '' as bpKey,
  16.     '' as "size",
  17.     '' as po_buyer,
  18.     'INDONESIA' as countryGroup,
  19.     case
  20.         when (mpcDr.value = 'FB' or mpcDr.value = 'WIP')  then 'SP-DM-515'
  21.         else 'SP-DM-516'
  22.     end as bp,
  23.     ppbwip.*
  24. from m_product mpFG
  25. join c_uom cuFg on mpfg.c_uom_id = cuFg.c_uom_id
  26. join pp_product_bom ppb on ppb.pp_product_bom_id = (select max(ppb2.pp_product_bom_id) from pp_product_bom ppb2 where ppb2.m_product_id = mpfg.m_product_id)
  27. join pp_product_bomline ppbl on ppb.pp_product_bom_id = ppbl.pp_product_bom_id
  28. join m_product mpDr on ppbl.m_product_id = mpDr.m_product_id
  29. join m_product_category mpcDr on mpDr.m_product_category_id = mpcDr.m_product_category_id  
  30. union all
  31. select  
  32.     mpFg.value,
  33.     ppbl.kst_part,
  34.     mpDr.value,
  35.     ppbl.QtyBOM,
  36.     cuFg.name as uom,
  37.     ppbl.ispiping,
  38.     mpDr.value as Product_Category,
  39.     '2021-01-01' as validFrom,
  40.     'ID' as countryCode,
  41.     '' as bpKey,
  42.     '' as "size",
  43.     '' as po_buyer,
  44.     'INDONESIA' as countryGroup,
  45.     case
  46.         when (mpcDr.value = 'FB' or mpcDr.value = 'WIP')  then 'SP-DM-515'
  47.         else 'SP-DM-516'
  48.     end as bp,
  49.     ppbwip.*
  50. from m_product mpFG
  51. join c_uom cuFg on mpfg.c_uom_id = cuFg.c_uom_id
  52. join pp_product_bom ppb on ppb.pp_product_bom_id = (select max(ppb2.pp_product_bom_id) from pp_product_bom ppb2 where ppb2.m_product_id = mpfg.m_product_id)
  53. join pp_product_bomline ppbl on ppb.pp_product_bom_id = ppbl.pp_product_bom_id
  54. join pp_product_bom ppbWip on ppbWip.pp_product_bom_id = (select max(ppb2.pp_product_bom_id) from pp_product_bom ppb2 where ppb2.m_product_id = mpfg.m_product_id)
  55. join m_product mpDr on ppbl.m_product_id = mpDr.m_product_id
  56. join m_product_category mpcDr on mpDr.m_product_category_id = mpcDr.m_product_category_id  
  57.  
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement