FIFO/LIFO Layer Consumption Extension

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.

Consumption Logic

For issues from asset sub inventories, the layers will be consumed in the following order:

  1. quantity in the layer specified by the layer_hook .

  2. Drive the layer specified by the layer_hook negative only if there are no other positive layers.

  3. Positive quantity from the layers specified by the layers_hook in the order that they are specified.

  4. For return to receiving, corrections and assembly returns:

Package Function for Single Layer Consumption

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.

layer_hook

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

Return Values of Function

Additional Information about Parameters

Transaction Information

Costing Method

The valid values for i_cost_method are:

Error Handling

o_err_num

This parameter indicates the processing status of your extension as follows:

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.

Procedure for Multilayer Consumption

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.

layers_hook

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

Additional Information about Parameters

Transaction Information

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:

Error Handling

o_err_num

This parameter indicates the processing status of your extension as follows:

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.

Function for Layers Merge

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.

LayerMerge_hook

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

Return Values of Function:

Error Handling

o_err_num

This parameter indicates the processing status of your extension as follows:

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.