[Script]如何获取物料的成本

For Discrete Manufacturing

Query Like:
SELECT SEGMENT1 ITEM,
CST_COST_API.GET_ITEM_COST(1,INVENTORY_ITEM_ID, ORGANIZATION_ID,NULL,NULL) COST
FROM MTL_SYSTEM_ITEMS_B
WHERE INVENTORY_ITEM_ID = &ITEM_ID AND ORGANIZATION_ID = &ORG_ID;

For OPM organization

对于OPM组织,上边的Query不适用,需要使用下边的Query
SELECT MSI.SEGMENT1 ITEM,
GMF_CMCOMMON.GET_CMPT_COST( INVENTORY_ITEM_ID, ORGANIZATION_ID, SYSDATE, CMM.COST_TYPE_ID ,0) COST
FROM MTL_SYSTEM_ITEMS_B MSI, CM_MTHD_MST CMM
WHERE CMM.COST_MTHD_DESC='Standard Cost';


Function CST_COST_API.get_item_cost


Synopsis:

This function returns the item cost for a given item and organization.
This function accepts only IN parameters, and returns a single value.
This makes the API simple to call as part of SQL statements.

You may also pass either the cost group ID or the cost type ID,
if you desire more specific cost information. Do not pass both the
cost group and the cost type at the same time.

For now, pass p_api_version = 1.

This API currently does not support the retrieval of specific layer
costs within a FIFO/LIFO organization.


Code Details:

The output of this function is dependent on the primary cost method
of the organization, and which of the parameters were specified.
Note that you should never specify both the cost_type_id and
the cost_group_id together; to not pass a parameter, use NULL.

For FIFO/LIFO, the cost group average from CQL is returned.

Parameters | Standard | Average/FIFO/LIFO
-----------------------+-----------------------+----------------------
item, org | Frozen from CIC | Default CG from CQL
item, org, cost_group | Frozen from CIC | Specified CG from CQL
item, org, cost_type | Specified CT from CIC | Specified CT from CIC

The precision parameter is used to determinate what type of rounding
should be applied to the item cost value that is returned. The number
specified for this parameter represents the number of decimal digits
that the output will be rounded to and its defaulted as NULL.

Error Conditions:

For all errors, the returned value is NULL.

The possible error conditions are:
Invalid item/organization combination.
Item is not cost enabled.
Item has no cost in the specified cost group or cost type.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值