The Periodic Average Costing Account Generation Extension lets you provide alternative accounts.
Cost Management calls the Account Generation extension each time a transaction is processed by the Periodic Distributions Processor.
When this extension is called, the application determines if it has been implemented, and returns a value accordingly. The return values are as follows:
- 1 The extension was not used and the normal default accounts should be used.
>0 The extension was used and the user specified accounts should be used. The return value should be a valid code_combination_id from the GL_CODE_COMBINATIONS table for the ledger associated with the cost group.
Cost Management provides a template package and function for account generation extension for Periodic Average Costing. The name of the template package is CSTPAPHK.
Print the following files before you begin writing Periodic Average Costing Account extensions. The files are located in the Cost Management patch/115/sql directory.
CSTAPHKS.pls Account Generation Extension Package Specification Template. If you create functions outside the predefined function within the CSTPACHK package, then you must also modify this file to include those new functions.
CSTAPHKB.pls Account Generation Extension Package Body Template. This file contains the function get_account_id that you can modify to implement the Account Generation extension.
Suggestion: After you write the function, do not forget to compile it and store it in the database. See: Writing PL/SQL Functions/Procedures.
The following table lists the parameters for Account Generation extension that provide alternate accounts in Periodic Average Costing.
| Parameter | Usage | Type | Description |
|---|---|---|---|
| I_TXN_ID | IN | NUMBER | Transaction Identifier |
| I_LEGAL_ENTITY | IN | NUMBER | Legal Entity Identifier |
| I_COST_TYPE_ID | IN | NUMBER | Cost Type being processed |
| I_COST_GROUP_ID | IN | NUMBER | Cost Group being processed |
| I_DR_FLAG | IN | BOOLEAN | Flag indicating if this is the debit line |
| I_ACCT_LINE_TYPE | IN | NUMBER | Accounting Line Type |
| I_COST_ELEMENT_ID | IN | NUMBER | Cost Element Identifier |
| I_RESOURCE_ID | IN | NUMBER | Resource Identifier |
| I_SUBINV | IN | VARCHAR2 | Subinventory on the transaction |
| I_EXP | IN | BOOLEAN | Expense or Asset identifier |
| O_Err_Num | OUT | NUMBER | Output Error Number |
| O_Err_Code | OUT | VARCHAR2 | Output Error Code - can be any SQL error code |
| O_Err_Msg | OUT | VARCHAR2 | Output Error Message |
Debit/Credit
The valid values of i_dr_flag are as follows and indicate whether the accounting entry is a debit or a credit:
i_dr_flag = TRUE Indicates a debit
i_dr_flag = FALSE Indicates a credit
(TRUE and FALSE are pre-defined PL/SQL constants that can be assigned to BOOLEAN variables).
Expense Account Identifier
The valid values of i_exp are:
i_exp = TRUE The transaction is an expense distribution.
i_exp = FALSE The transaction is an asset distribution.
(TRUE and FALSE are pre-defined PL/SQL constants that can be assigned to BOOLEAN variables).
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 extension did not process successfully.
o_err_code and o_err_msg
Values for o_err_code, and o_err_msg can be viewed in the Periodic Distributions Processor Log file.
Other Sources
PL/SQL User's Guide and Reference
Oracle Bills of Material Technical Reference Manual, Release 12