mtl_material_transactions的COST字段定义

本文详细解析了事务处理表的成本核算过程,包括实际成本、交易成本、原有成本和处理后的新成本。并通过查询展示了子库存转移事务中交易成本为空,以及库存间转移后成本更新的具体情况。

事务处理表的成本核算:mtl_material_transactions

MMT的成本字段定义:

1.actual cost             ----> actual cost
2.transaction cost   ----> the cost entered by the user during a transaction
3.prior cost               ----> item cost before the transaction
4.new cost                ----> item cost  after the transaction processing


SELECT MMT.ERROR_CODE ,
       MMT.ERROR_EXPLANATION,
       MMT.transaction_source_name,
       transaction_quantity,
       transaction_uom,
       subinventory_code,
       inventory_item_id,
       mmt.actual_cost,
       mmt.prior_cost,
       mmt.new_cost,
       mmt.transaction_cost
  FROM mtl_material_transactions mmt
 WHERE mmt.transaction_id in (124727534, 124727535);


运行查询后可知:由于这次是子库存转移事务,所以本次Transaction Cost为空,不会产生成本变化。


2.  库存间转移后,成本更新

SELECT MMT.*, MMT.ERROR_CODE ,
       MMT.ERROR_EXPLANATION,
       MMT.transaction_source_name,
       transaction_quantity,
       transaction_uom,
       subinventory_code,
       inventory_item_id,
       mmt.actual_cost,
       mmt.prior_cost,
       mmt.new_cost,
       mmt.transaction_cost
  FROM mtl_material_transactions mmt
 WHERE /*mmt.transaction_group_id = 124731249
       and*/ mmt.shipment_number = 'JSH_TO_JJT001';




优化sql:SELECT we.organization_id ,we.wip_entity_id ,case when wl.line_id is null then we.wip_entity_name else '' end wip_entity_name ,we.primary_item_id ,mtt.transaction_type_name ,mmt.transaction_date ,bd.department_code ,mmt.inventory_item_id ,mmt.subinventory_code ,mta.reference_account ,br.resource_code ,lu2.meaning as line_type_name ,mta.base_transaction_value ,mta.cost_element_id ,flv.meaning as cost_element ,wdj.class_code job_type_code ,ml.meaning job_type_name FROM (select * from gerp.mtl_material_transactions where substr(transaction_date,1,7) >= '2023-06' and transaction_source_type_id = 5) mmt inner join gerp.wip_entities we on mmt.organization_id = we.organization_id inner join gerp.mtl_transaction_accounts mta on mta.transaction_source_id = we.wip_entity_id and mta.transaction_id = mmt.transaction_id and mta.transaction_source_type_id = 5 inner join gerp.mtl_transaction_types mtt on mtt.transaction_type_id = mmt.transaction_type_id inner join mfg_lookups lu2 on lu2.lookup_code = mta.accounting_line_type and lu2.lookup_type = 'CST_ACCOUNTING_LINE_TYPE' inner join gerp.mtl_system_items_b msi on msi.inventory_item_id = mmt.inventory_item_id and msi.organization_id = mta.organization_id left join gerp.bom_departments bd on bd.department_id = mmt.department_id left join gerp.bom_resources br on br.resource_id = mta.resource_id left join gerp.wip_lines wl on wl.line_id = mmt.repetitive_line_id left join gerp.wip_discrete_jobs wdj on wdj.wip_entity_id = mta.transaction_source_id left join gerp.fnd_lookup_values_vl flv on cast(mta.cost_element_id as string) = flv.lookup_code and flv.lookup_type = 'CST_COST_CODE_TYPE' left join mfg_lookups ml on ml.lookup_code = wdj.job_type and ml.lookup_type = 'WIP_DISCRETE_JOB' 。其中mmt,we,mta,msi,wdj数据量很大
06-10
<think>好的,我需要帮助用户找到MTL_MATERIAL_TRANSACTIONS表和GL_INTERFACE表之间的关联字段。首先,我需要回顾一下这两个表的结构和用途。 根据引用[2],MTL_MATERIAL_TRANSACTIONS(MMT)是库存事务处理的主表,记录物料移动的详细信息,比如事务处理类型、数量、日期等。而GL_INTERFACE表通常是总账模块的接口表,用于将子模块的数据导入总账生成会计分录。 接下来,我需要确定这两个表如何关联。通常,库存事务生成会计信息后会传递到总账,所以关联可能通过事务处理标识符或来源信息。 引用[4]提到在MTL_TRANSACTIONS_INTERFACE中使用账户别名,并提到库存事务处理工作流程和处理事务处理接口的请求。这可能意味着事务处理接口表中的数据在导入到MMT后,会进一步生成会计分录到GL_INTERFACE。 可能的关联字段包括事务处理ID(TRANSACTION_ID)或来源头编号(TRANSACTION_SOURCE_ID)。例如,MMT中的TRANSACTION_ID可能与GL_INTERFACE中的REFERENCE1或REFERENCE2字段对应,或者通过来源类型(TRANSACTION_SOURCE_TYPE_ID)和来源头编号来关联。 另外,引用[3]指出事务处理类型由来源和动作组合决定,可能影响会计分录的生成方式。因此,在GL_INTERFACE中可能会有REFERENCE_COLUMN或CONTEXT字段来标识库存事务的来源。 总结可能的关联字段:MMT.TRANSACTION_ID对应GL_INTERFACE.REFERENCE1,或者通过来源类型和来源头编号组合关联。需要进一步验证这些字段是否在实际使用中对应。</think>在Oracle EBS系统中,$MTL\_MATERIAL\_TRANSACTIONS$ 与 $GL\_INTERFACE$ 表的关联主要通过以下字段实现: 1. **事务处理标识关联** - $MTL\_MATERIAL\_TRANSACTIONS.TRANSACTION\_ID$ 对应 $GL\_INTERFACE.REFERENCE1$ 或 $GL\_INTERFACE.REFERENCE2$,具体取决于系统配置[^3][^4] - 示例SQL片段: ```sql SELECT gl.interface_line_id, mmt.transaction_id FROM mtl_material_transactions mmt, gl_interface gl WHERE gl.reference1 = TO_CHAR(mmt.transaction_id) ``` 2. **来源类型与编号组合关联** - 通过事务处理来源类型 $TRANSACTION\_SOURCE\_TYPE\_ID$ 和来源头编号 $TRANSACTION\_SOURCE\_ID$ 建立关联: ```sql AND mmt.transaction_source_type_id = 5 -- 例如生产工单 AND mmt.transaction_source_id = gl.reference_id ``` 这种关联方式常用于特定模块的事务处理(如工单、采购订单等)[^2] 3. **会计科目分配字段** - $GL\_INTERFACE$ 中的 $CODE\_COMBINATION\_ID$ 对应库存事务的会计分配账户: ```sql AND mmt.distribution_account_id = gl.code_combination_id ``` 该关联用于验证账户段值匹配性[^4]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值