Three client extensions are provided to let you modify the behavior of layer consumption logic in FIFO/LIFO. The name of the package is CSTPACHK. The files are located in the Cost Management plsql/115/sql directory.
CSTACHKS.pls - FIFO/LIFO Layer Consumption Extension Package Specification Template.
CSTACHKB.pls - FIFO/LIFO Layer Consumption Extension Package Body Template.
For issues from asset sub inventories, the layers will be consumed in the following order:
quantity in the layer specified by the layer_hook .
Drive the layer specified by the layer_hook negative only if there are no other positive layers.
Positive quantity from the layers specified by the layers_hook in the order that they are specified.
For return to receiving, corrections and assembly returns:
Positive quantity from the layers that was created for the deliveries for the same PO or completions from the same job in FIFO/LIFO manner.
Drive the earliest / latest layer that was created for the deliveries for the same PO or completions from the same job negative only if there are no other positive layers.
This client extension lets you define a layer from which a transaction should consume. Cost Management calls this single layer consumption extension for each transaction at the time of costing for FIFO/LIFO transactions.
The following table lists the parameters for Single Layer Consumption Extension.
| Parameter | Usage | Type | Description |
|---|---|---|---|
| i_org_id | IN | NUMBER | The organization that the layer cost worker is running in |
| i_txn_id | IN | NUMBER | Transaction identifier |
| i_layer_id | IN | NUMBER | Layer Id of the transaction to be consumed |
| i_cost_method | IN | NUMBER | Costing method used for processing the transaction |
| i_user_id | IN | NUMBER | User identifier |
| i_login_id | IN | NUMBER | Login identifier |
| i_req_id | IN | VARCHAR2 | Request ID for program |
| i_prg_appl_id | IN | NUMBER | Application ID of program |
| i_prg_id | IN | NUMBER | Program identifier |
| o_err_code | OUT | VARCHAR2 | Output error code. Can be any SQL code. |
| o_err_num | OUT | NUMBER | Output error number |
| o_err_msg | OUT | VARCHAR2 | Error message |
>0 The extension has been used, return value is the inventory layer id from CST_INV_LAYERS.
0 The extension has not been used.
Transaction Information
i_org_id: The organization id corresponding to the transaction in MTL_MATERIAL_TRANSACTIONS.
i_txn_id: This transaction id should correspond to the id of the material transaction in MTL_MATERIAL_TRANSACTIONS table that requires the layer consumption.
i_layer_id: This is the input layer id from CST_QUANTITY_LAYERS for a combination of organization, item and cost group.
The valid values for i_cost_method are:
i_cost_method = 5 - FIFO
i_cost_method = 6 - LIFO
o_err_num
This parameter indicates the processing status of your extension as follows:
o_err_num = 0 - The extension executed successfully.
o_err_num <> 0 - An error condition has occurred and the ex-tension did not process successfully.
o_err_code and o_err_msg
Values for error_code, o_err_code, and error_explanation, o_err_msg, are stored in the MTL_MATERIAL_TRANSACTIONS table.
This client extension lets you define multiple layers from which a transaction should consume from. Cost Management calls this multilayer consumption extension for each transaction at the time of costing for FIFO/LIFO transactions.
The following table lists the parameters for the multiple layer consumption:
| Parameter | Usage | Type | Description |
|---|---|---|---|
| i_txn_id | IN | NUMBER | Transaction identifier |
| i_required_qty | IN | NUMBER | Quantity that transaction needs to consume |
| i_cost_method | IN | NUMBER | Costing method used for processing the transaction |
| o_custom_layers | IN OUT | INV_LAYER_TBL | PL/SQL table that contains the layers and the quantities that should be consumed for this transaction |
| o_err_code | OUT | VARCHAR2 | Output error code. Can be any SQL code. |
| o_err_num | OUT | NUMBER | Output error number |
| o_err_msg | OUT | VARCHAR2 | Error message |
Transaction Information
i_txn_id: The transaction id of the material transaction in MTL_MATERIAL_TRANSACTIONS.
i_required_qty: The quantity in primary Unit of Measure that this transaction should consume.
List of inventory layers
o_custom_layers: This is a PL/SQL table that contains records of type inv_layer_rec. The records have two columns, one contains the layer id that should be matched with the inv_layer_id in CST_INV_LAYERS table and the other one contains the layer quantity that should be consumed for this layer.
Costing Method
The valid values for i_cost_method are:
i_cost_method = 5 - FIFO
i_cost_method = 6 - LIFO
o_err_num
This parameter indicates the processing status of your extension as follows:
o_err_num = 0 - The extension executed successfully.
o_err_num <> 0 - An error condition has occurred and the ex-tension did not process successfully.
o_err_code and o_err_msg
Values for error_code, o_err_code, and error_explanation, o_err_msg, are stored in the MTL_MATERIAL_TRANSACTIONS table.
This client extension lets you specify if a layer merge should be attempted for the desired transactions. It will attempt to combine the quantity from the specified receipt transaction with an existing inventory layer. Cost Management calls this client extension every time a layer is going to be created to check if this new layer should be merged with an existing layer. By default, the program attempts to merge layers.
The following table lists the parameters for the Layer Merge consumption:
| Parameter | Usage | Type | Description |
|---|---|---|---|
| i_txn_id | IN | NUMBER | Transaction identifier |
| o_err_code | OUT | VARCHAR2 | Output error code. Can be any SQL code. |
| o_err_num | OUT | NUMBER | Output error number |
| o_err_msg | OUT | VARCHAR2 | Error message |
1 - When the system has attempted to combine the quantity from the specified receipt transaction with an existing inventory layer.
0 - When a new inventory layer has been created for the specified receipt transaction.
o_err_num
This parameter indicates the processing status of your extension as follows:
o_err_num = 0 - The extension executed successfully.
o_err_num <> 0 - An error condition has occurred and the ex-tension did not process successfully.
o_err_code and o_err_msg
Values for error_code, o_err_code, and error_explanation, o_err_msg, are stored in the MTL_MATERIAL_TRANSACTIONS table.