打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Ask Deft Flux: How do I Query a Hierarchical Bill of Material in Epicor? |

Ask Deft Flux: How do I Query a Hierarchical Bill of Material in Epicor?

October 16, 2015 / / Comments Off on Ask Deft Flux: How do I Query a Hierarchical Bill of Material in Epicor?

On occasion, an Epicor ERP user will want to write a report that requires a hierarchical view of a part’s bill of material.  In Epicor, we would prefer to do this using a Business Activity Query (BAQ).  The Epicor 10 BAQ tool is much more powerful than the tool from version 9, so it comes close to being able to do this, but just misses the mark.  In order to query a hierarchical BOM, we must write the SQL and create a view in the database.  Once we create the view, we can use a BAQ to access it, or we can query it directly using an SSRS report.  Herewith, we provide the SQL:

with pm as (select x.Company, x.PartNum, x.RevisionNum, QtyPer,                    FixedQty, MtlPartNum as ChildPartNum              from erp.PartMtl x                        inner join erp.PartRev pr on pr.Company = x.Company               and pr.PartNum = x.PartNum               and pr.RevisionNum = x.RevisionNum               and pr.Approved = 1               and pr.EffectiveDate <= GetDate()               and pr.EffectiveDate = (select max(effectiveDate)              from erp.PartRev pr2             where pr2.Company = pr.Company               and pr2.PartNum = pr.PartNum               and pr2.Approved = 1               and pr2.EffectiveDate <= GetDate()) ),     bm as (select 1 as BOMLevel,                    root.PartNum as TopLevelPartNum, root.*,                   cast(root.QtyPer as decimal(30,10)) as PartQty              from pm as root             where not exists (select null                                  from Erp.PartMtl b                                 where b.MtlPartNum = root.PartNum)             union all            select BOMLevel + 1 as BOMLevel,                    bm.TopLevelPartNum, node.*,                   cast(node.QtyPer * bm.PartQty as decimal(30,10)) as PartQty              from pm as node inner join bm on bm.Company = node.Company               and bm.ChildPartNum = node.PartNum)select *  from bm
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
Hierarchical queries in MySQL
丁甘仁家传秘方选萃_申之公
Deft拿回韩服第一还不够,胜点冲破1500+,谁追的上?
中考数学倒计时28:特殊相似图形组成的几何图形证明
破坏·重构·超越——曾来德书法的审美文化阐释
Mech-Intro_14
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服