查询物料PAC单位成本

复制代码
select  cpp.period_name       期间名称,
 ccga.organization_id  组织ID,
 ood.ORGANIZATION_CODE 组织代码,
 OOD.ORGANIZATION_NAME 组织名称,
 msib.inventory_item_id 物料ID,
 msib.segment1 物料编码,
 msib.description 物料名称,
 msib.primary_uom_code 单位,
 cppb.txn_category 类型,
 cppb.txn_category_qty 数量,
 round(decode(cppb.txn_category_qty, 0, 0,cppb.txn_category_value / cppb.txn_category_qty),5) 单位成本,
 round(cppb.txn_category_value,2) 金额,
 cppb.period_quantity 期间数量,
 cppb.periodic_cost 期间成本,
 round(cppb.period_balance,2) 期间金额,
 round(cppb.variance_amount,2) 差异
  from cst_pac_period_balances      cppb,
       mtl_system_items_b           msib,
       cst_pac_periods              cpp,
       cst_cost_groups              ccg,
       cst_cost_group_assignments   ccga,
       org_organization_definitions ood
 where cppb.inventory_item_id = msib.inventory_item_id
   and msib.organization_id = ccga.organization_id
   and cpp.period_name = '&period_name'
  and ood.ORGANIZATION_CODE=nvl('&organization_code',ood.ORGANIZATION_CODE)
  and msib.segment1='&item_code'
  and ood.OPERATING_UNIT=nvl('&ou_id',ood.OPERATING_UNIT)
   and cpp.pac_period_id = cppb.pac_period_id
   and ccg.cost_group_id = cppb.cost_group_id
   and ccg.cost_group_id = ccga.cost_group_id
   and ood.ORGANIZATION_ID = ccga.organization_id;
复制代码

 

posted on   lizicheng  阅读(1809)  评论(0编辑  收藏  举报

编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示