diagnosing account generator errors in fixed assets - fagda[1]

63
ORACLE APPLICATIONS WHITE PAPER Oracle Fixed Assets Diagnosing Account Generator Errors in Fixed Assets ORACLE World Wide Support 1

Upload: hgopalan

Post on 21-Jan-2016

518 views

Category:

Documents


10 download

DESCRIPTION

Account Generator Errors in Fixed Assets

TRANSCRIPT

Page 1: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

ORACLE APPLICATIONS WHITE PAPER Oracle Fixed Assets Diagnosing Account Generator Errors in Fixed Assets ORACLE World Wide Support

1

Page 2: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

Date Author Version Change Reference 30 MAR 2001 Kevin E. Cronk 1.0 Initial Document Completed

2

Page 3: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

TABLE OF CONTENTS

1 INTRODUCTION ...................................................................................................................................................5

2 GENERATING ACCOUNTS IN ORACLE FIXED ASSETS ............................................................................6

2.1 OVERVIEW AND DEFINITIONS...............................................................................................................................6 2.2 FA ACCOUNT GENERATOR – THE WORKFLOW PROCESS.....................................................................................7 2.3 FA ACCOUNT GENERATOR – THE GENERATE ACCOUNTS PROCESS (FAGDA) ...................................................8

2.3.1 What Accounts Are Generated in Advance by FAGDA? ..............................................................................9 2.3.2 Generating Accounts for Retired Assets .....................................................................................................11 2.3.3 Turning Off Generate Accounts..................................................................................................................11

3 DEFAULT ACCOUNT GENERATOR PROCESS ...........................................................................................13

3.1 GENERATE DEFAULT ACCOUNT PROCESS ..........................................................................................................13 3.2 GENERATE ASSET LEVEL ACCOUNT...................................................................................................................13 3.3 GENERATE CATEGORY LEVEL ACCOUNT ...........................................................................................................14 3.4 GENERATE BOOK LEVEL ACCOUNT ...................................................................................................................15

4 USING THE UPGRADED FLEXBUILDER RULES........................................................................................16

4.1 GENERATE ACCOUNTS WITH UPGRADED FLEXBUILDER RULES PROCESS .........................................................16 4.2 INVALID PARAMETERS IN THE UPGRADED RULES ..............................................................................................16 4.3 RETRIEVING SOURCE CODE FOR THE UPGRADED RULES....................................................................................17 4.4 CREATING SOURCE CODE FOR THE UPGRADED FLEXBUILDER RULES................................................................18 4.5 UPGRADED FUNCTIONS WITH AN INVALID NAME...............................................................................................18

5 DEBUGGING ACCOUNT GENERATION FAILURES ..................................................................................19

5.1 ACCOUNT FAILURES...........................................................................................................................................19 5.1.1 When Do Accounts Fail? ............................................................................................................................19 5.1.2 Why Do Accounts Fail? ..............................................................................................................................19 5.1.3 What Accounts Failed?...............................................................................................................................20

5.2 APPLY THE LATEST DIAGNOSTIC PATCHES ........................................................................................................23 5.3 DIAGNOSE FAILURE WITHOUT THE AID OF SQL .................................................................................................24

5.3.1 Gather The Parameters ..............................................................................................................................24 5.3.2 Build the Account........................................................................................................................................27 5.3.3 Validate the Account...................................................................................................................................27

5.4 DIAGNOSING FAILURE WITH THE FAXAGTST.SQL DIAGNOSTIC SCRIPT .........................................................28 5.4.1 Finding the Correct Script..........................................................................................................................28 5.4.2 Gathering the Parameters ..........................................................................................................................28 5.4.3 Running the Script ......................................................................................................................................31

5.5 DIAGNOSING FAILURE WITH THE FAGDA_TEST.SQL DIAGNOSTIC SCRIPT.......................................................32

6 DIAGNOSING OTHER ERRORS ......................................................................................................................33

6.1 ROLLBACK SEGMENT ERRORS............................................................................................................................33 6.2 OVERWRITING WORKFLOW WHEN APPLYING PATCHES ....................................................................................33 6.3 ORA-20002 AND FAFLEXWF ERRORS............................................................................................................34

6.3.1 Tablespace for WF tables and Indexes .......................................................................................................34 6.3.2 Reload Workflow ........................................................................................................................................34 6.3.3 Qualified Segments Defined........................................................................................................................34 6.3.4 Test For Failed Accounts............................................................................................................................35 6.3.5 Test Parameters for Upgraded Flexbuilder Rules......................................................................................35

6.4 CREATE JOURNAL ENTRIES WAITS FOR FAGDA PROCESS .................................................................................35

3

Page 4: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

6.5 DYNAMIC INSERTION FAILS IN FAGDA PROCESS..............................................................................................35 6.6 NO ERROR MESSAGES IN THE LOG FILE .............................................................................................................36 6.7 DEPRECIATION EXPENSE ACCOUNT MODIFICATIONS DO NOT WORK................................................................36

7 MODIFYING WORKFLOW - CONSIDERATIONS ........................................................................................37

7.1 GENERAL LEDGER ACCOUNTING AND WORKFLOW CHANGES IN FA .................................................................37 7.2 TRUNCATING THE FA_DISTRIBUTION_ACCOUNTS TABLE........................................................................38

8 PERFORMANCE ISSUES....................................................................................................................................39

8.1 ESTIMATING THE TIME TO COMPLETION ............................................................................................................39 8.2 IMPROVING PERFORMANCE ................................................................................................................................40

9 PROFILE OPTIONS ............................................................................................................................................42

9.1 FA:GENERATE <ASSET/BOOK/CATEGORY> LEVEL ACCOUNT ..........................................................................42 9.2 DEBUG PROFILE OPTIONS...................................................................................................................................43 9.3 FA: NUMBER OF GENERATE ACCOUNTS PARALLEL REQUESTS .........................................................................43 9.4 FA: GENERATE DEPRECIATION EXPENSE ACCOUNT ..........................................................................................43 9.5 FA: USE FA_CUSTOM_GEN_CCID_PKG .....................................................................................................43

10 IF AN ITAR IS NECESSARY............................................................................................................................45

APPENDICES............................................................................................................................................................46

APPENDIX A – SAMPLE SOURCE CODE FOR UPGRADED FLEXBUILDER RULE.......................................................46 APPENDIX B –FAXAGTST.SQL TEST SCRIPT ......................................................................................................50 APPENDIX C – SUCCESSFUL RUN OF FAXAGTST.SQL TEST SCRIPT ...................................................................53 APPENDIX D – FAGDA_TEST.SQL TEST SCRIPT ..................................................................................................55 APPENDIX E – SUBMITTING GENERATE ACCOUNT FROM THE COMMAND LINE....................................................63

4

Page 5: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

1 Introduction

This document is intended to assist in diagnosing Account Generator failures in the Oracle Fixed Assets module. This document is not intended to educate on the use of Workflow Builder nor is it intended to educate on the intricacies of the Account Generator workflow processes. Some of this information will be discussed where it is relevant to diagnose the failure to generate an account in Fixed Assets. If a detailed treatment of the Fixed Assets Account Generator Process is needed, please refer to the Oracle Fixed Assets Account Generator White Paper, available on Metalink under Note number 115322.1. Several examples of workflow modifications are included in that document. If a detailed treatment of the Workflow Builder is needed, please refer to the following: For release 11.5.X Oracle Workflow Guide Release 2.5. Part Number A75397–01. For release 11.0.X Oracle Workflow Guide Release 2.0.3 Part Number A56104–01 Familiarity with these documents or similar workflow documentation is recommended prior to debugging Account Generation errors.

5

Page 6: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

2 Generating Accounts in Oracle Fixed Assets

2.1 Overview and Definitions

Oracle Fixed Assets generates accounts in release 11.0.X and 11.5.X using a workflow process called FA Account Generator. This process will be called by the application to generate an asset related account when the account is needed to complete a transaction. Oracle Fixed Assets can generate 25 different account types in release 11.5.X for a particular asset, 23 in release 11.0.X. Oracle Fixed Assets also has a concurrent process called Generate Accounts, short name FAGDA (Fixed Assets Generate Distribution Accounts) that will generate and store from 14 to 23 of the 25 accounts that may be needed by an asset in it’s lifetime. The accounts that are pregenerated depend on the release and mini-pack applied (see section 2.2.1 for full list). The FAGDA concurrent process generates the accounts by calling the FA Account Generator process for each active distribution for the asset book for which the process was run. Account generation errors can occur in a variety of transactions and processes in Oracle Fixed Assets. This paper will discuss account generation failures in Oracle Fixed Assets and the various debugging techniques that can be used to resolve these issues. Definitions: Distribution – unique combination of expense account, location and employee associated

with each asset. A particular asset has one or more active distributions. If an asset has more than one active distribution, it is referred to as multi-distributed.

Active Distribution – An asset’s distribution is active if it has not been terminated by any

transaction that changes the asset’s distribution information (units, expense account, location, employee ). At the table level a distribution is active if the date_ineffective field in the fa_distribution_history table is null.

CCID – Code Combination ID, a unique id that represents a unique combination of flexfield

segment values. In this paper it refers to the Accounting Key Flexfield structure and the values from the GL_CODE_COMBINATIONS table.

Generate Accounts – Name of the concurrent process used to generate accounts in Oracle

Fixed Assets. This process calls the workflow process FA Account Generator for each of the accounts that it attempts to generate.

FAGDA – short name for the Generate Accounts process (acronym for Fixed Assets

Generate Distribution Accounts) FA Account Generator – Default name of the Fixed Assets workflow used in Oracle Fixed

Assets to generate accounting code combinations. Workflow Builder – A PC based tool that is used to access and modify the FA Account

Generator workflow process stored in the database.

6

Page 7: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

2.2 FA Account Generator – The Workflow Process FA Account Generator is referred to as the workflow process for generating accounts in Oracle Fixed Assets. FA Account Generator is in fact the workflow type, which in turn points to the actual workflow process. Please see section 3 of this paper for more detailed information on the default workflow process. The “Fixed Assets Account Generator and Workflow White Paper” contains detailed information on modifying the workflow process using Workflow Builder. To determine the workflow process you are using for account generation in FA: Navigation: Setup/Financials/Flexfields/Key/Accounts Query “FA Account Generator” Seeded values are as follows: Generate Default Account Generate Accounts Using Upgrade Rules

7

Page 8: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

2.3 FA Account Generator – The Generate Accounts Process (FAGDA) The Generate Accounts concurrent process (FAGDA) is pregenerates from 6 to 23 individual code combinations for each distribution. The ccids generated are stored in the FA_DISTRIBUTION_ACCOUNTS table. When a process or transaction needs an account, if the account is one of the pregenerated accounts, it first checks this table and uses the pregenerated ccid if it is populated therein. If the account is not present, then a call to workflow is made and the account is generated. Generate Accounts is primarily a performance enhancement feature. Multiple calls to workflow to generate a large number of accounts, such as in a depreciation run, can cause a performance bottleneck. This can be avoided by generating the needed accounts in advance using the FAGDA process. The FAGDA process is OPTIONAL, depreciation and other Fixed Asset processes can complete successfully, even it FAGDA has completed in error. If FAGDA failes to generate an account that is needed by a process, then the process will also fail when at attempts to generate the account in question. The FAGDA process can in effect be turned off by using profile options that allow account generation for the various account groupings to be turned off. The FAGDA process is submitted automatically when the Depreciation process is run. This is the only time this process is submitted unless the user also submits it as a standalone process. The name of the standalone request is “Generate Accounts”.

8

Page 9: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

2.3.1 What Accounts Are Generated in Advance by FAGDA?

This depends on the Release and the Mini-Pack applied within that release. The following chart shows the various accounts and which accounts are generated in the FAGDA process for Release 11i.

Accounts Generated

Account Type Account Name A-D E-F

Asset Level Accounts Depreciation Expense X X

Book Level Accounts Cost of Removal Clearing X XCost of Removal Gain, X XCost of Removal Loss X XDeferred Depreciation Expense XDeferred Depreciation Reserve XDepreciation Adjustment XIntercompany Accounts PayableIntercompany Accounts ReceivableNet Book Value Retired Gain X XNet Book Value Retired Loss X XProceeds of Sale Clearing X XProceeds of Sale Gain X XProceeds of Sale Loss X XRevaluation Reserve Retired Gain XRevaluation Reserve Retired Loss X

Category Level Accounts Asset Clearing X XAsset Cost X XBonus Depreciation Expense (11.5.X only) XBonus Depreciation Reserve (11.5.X only) XConstruction-in-Process Clearing X XConstruction-in-Process Cost X XDepreciation Reserve X XRevaluation Amortization XRevaluation Reserve X

11.5.X FAGDAMini-Pack

9

Page 10: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

In release 11.0.X the accounts that are pregenerated can range from 0 to 21 accounts. The base release of 11.0 did not include the FAGDA process at all. Mini-pack C included six accounts. Enhancement 1004321 included eight more accounts as shown in the chart below. Enhancement 1553682 adds 7 more accounts, again the same as in the chart above with the exception of the Bonus Depreciation accounts which do not exist in release 11.0.X. In summary, If you are on the latest code in release 11.0 or 11.5, all accounts except the Intercompany AR and Intercompany AP accounts are generated in FAGDA.

Accounts GeneratedG or

Account Type Account Name C D 1763995

Asset Level Accounts Depreciation Expense X X X

Book Level Accounts Cost of Removal Clearing X XCost of Removal Gain, X XCost of Removal Loss X XDeferred Depreciation Expense XDeferred Depreciation Reserve XDepreciation Adjustment XIntercompany Accounts PayableIntercompany Accounts ReceivableNet Book Value Retired Gain X XNet Book Value Retired Loss X XProceeds of Sale Clearing X XProceeds of Sale Gain X XProceeds of Sale Loss X XRevaluation Reserve Retired Gain XRevaluation Reserve Retired Loss X

Category Level Accounts Asset Clearing X X XAsset Cost X X XConstruction-in-Process Clearing X X XConstruction-in-Process Cost X X XDepreciation Reserve X X XRevaluation Amortization XRevaluation Reserve X

11.0.X FAGDA

10

Page 11: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

2.3.2 Generating Accounts for Retired Assets

A problem can arise when FAGDA attempts to generate accounts for fully retired assets for which the accounts to be generate are no longer active. This typically happens in an environment that contains fully retired assets and was upgraded from an earlier version. The Generate Accounts process attempts to create accounts for all active distributions. Fully retired assets also have an active distribution. Since assets that have been fully retired can only be reinstated in the current year, an asset retired in a previous fiscal year will never use the accounts associated with the distribution, therefore they need not be generated. This issue was addressed by excluding assets retired in a previous fiscal year and the code is included in the following mini-packs for FA: Release 11.0.X

�� 11.0.FA.E - bug 1350298 �� 11.0.FA.F - bug 1391289 �� 11.0.FA.G - bug 1626136

Release 11.5.X

�� 11i.FA.B - bug 1405177 �� 11i.FA.C - bug 1483543 �� 11i.FA.D - bug 1509971 �� 11i.FA.E - bug 1584277 �� 11i.FA.F - bug 1794240

Subsequent mini-packs will include these fixes as well.

2.3.3 Turning Off Generate Accounts

The Generate Accounts process was developed as a performance enhancement. The application will run correctly without the account generation process enabled. Typically there are two reasons why account generation may be turned off for some or all accounts:

�� Not enough assets in the system to make the performance gains worthwhile. �� Dynamic creation of accounts at transaction run time is desirable.

As the number of assets in the system drops below 10,000 the performance gains become less of an issue. Consideration must also be given to the number of books in your environment, as accounts must be generated for each unique combination of book and distribution. This is a guideline only and should never be substituted for system testing in your environment. Certain business models require use of accounts for specific transactions that are time sensitive. The accounts built could be different next month than they would be if generated today. In this scenario, the accounts thus generated can only be generated at the run time of the transaction. An example given in the original enhancement was an account segment for a retirement account that is based on the assets retirement type, a value which is not known until the retirement transaction occurs. Both of these scenarios can be accommodated via the use of profile options that were introduced with enhancement 1106734. They can be used to selectively turn off account generation by the FAGDA process. There are three profile options that are used to enable or

11

Page 12: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

disable account generation by account level. The accounts affected are the same as in the chart on pages 9 and 10. The profile options are as follows: FA: Generate Asset Level Account FA: Generate Book Level Account FA: Generate Category Level Account Values of YES or NULL will result in account generation for the accounts within that level. A value of NO will skip the accounts. Please see section 9 for a detailed explanation of how to enable/disable these profile options.

12

Page 13: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

3 Default Account Generator Process 3.1 Generate Default Account Process

To effectively diagnose and correct account generation errors it is imperative to understand how Oracle Fixed Assets builds the various accounts. The following figures in sections 3.2, 3.3 and 3.4 show a diagram of the default account generation for the different levels of accounts. Each diagram also gives the navigation within the application where the actual values can be retrieved. In release 11.0.X the original seeded workflow was not the correct default workflow. For category level accounts it used the cost center from the expense account (distribution_ccid) instead of the cost center from the account generator default account (default_ccid) in the book controls form. The corrected version was provided in patch 1000331 and is in version 110.6 of faflxgrp.wft and can be found in the FA_TOP/patch/110/import/ directory. The FA Account Generator workflow groups the assets into three different groups referred to as levels. The default workflow has a different definition for each group of accounts.

3.2 Generate Asset Level Account

The Asset Level accounts include only the Depreciation Expense Account.

Asset Level Accounts: Depreciation Expense

The default workflow for the asset level account simply uses all the segments from the expense account that was assigned to the asset in the Assignments Form.

Default Asset Account Level Generation Company1 Cost Center2 Account3 Sub-Acct Product Distribution (Expense) Account 02 400 7500 300 621 Asset WorkBench/Assignments DEPRECIATION EXPENSE ACCOUNT 02 400 7500 300 621 1 - Qualified Segment - Balancing Segment 2 - Qualified Segment - Cost Center 3 - Qualified Segment - Natural Account

13

Page 14: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

3.3 Generate Category Level Account

The accounts included in the Category Level are as follows:

Category Level Accounts: Asset Clearing Asset Cost Bonus Depreciation Expense (11.5.X only) Bonus Depreciation Reserve (11.5.X only) Construction-in-Process Clearing Construction-in-Process Cost Depreciation Reserve Revaluation Amortization Revaluation Reserve

The default workflow for the category level account pulls the required segments from three different account combinations. - Expense account (DISTRIBUTION_CCID) - Default account (DEFAULT_CCID) - Various accounts from the category definition. The following example is for the ASSET_COST_ACCOUNT:

Example of Default Category Account Level Generation Company1 Cost Center2 Account3 Sub-Acct Product Default Account From Book Controls 01 000 9999 000 000 DEFAULT_CCID parameter Setup/Asset System/Book Controls Distribution Account 02 400 7500 300 621 DISTRIBUTION_CCID parameter Asset WorkBench/Assignments Account Segment from Category 01 000 1520 000 000 ACCOUNT_SEGMENT parameter Setup/Asset System/Asset Categories ASSET COST ACCOUNT 02 000 1520 000 000 1 - Balancing Segment 2 - Cost Center 3 - Natural Account

A common modification is to derive the Cost Center qualified segment from the expense account rather than from the default ccid. This allows for cost center level detail on the balance sheet.

14

Page 15: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

3.4 Generate Book Level Account

The accounts included in the Book Level are as follows:

Book Level Accounts: Cost of Removal Clearing Cost of Removal Gain, Cost of Removal Loss Deferred Depreciation Expense Deferred Depreciation Reserve Depreciation Adjustment Intercompany Accounts Payable Intercompany Accounts Receivable Net Book Value Retired Gain Net Book Value Retired Loss Proceeds of Sale Clearing Proceeds of Sale Gain Proceeds of Sale Loss Revaluation Reserve Retired Gain Revaluation Reserve Retired Loss

The default workflow for the book level account is identical to the category level except that the natural account segment comes from the Book Controls rather than from the category. The following example is for the NBV_RETIRED_LOSS_ACCOUNT:

Example of Default Book Account Level Generation Company1 Cost Center2 Account3 Sub-Acct Product Default Account From Book Controls 01 000 9999 000 000 DEFAULT_CCID parameter Setup/Asset System/Book Controls Distribution Account 02 400 7500 300 621 DISTRIBUTION_CCID parameter Asset WorkBench/Assignments Account Segment from Book Controls 9400 ACCOUNT_SEGMENT parameter Setup/Asset System/Book Controls/Nat. Accts NBV RETIRED LOSS ACCOUNT 02 000 9400 000 000 1 - Balancing Segment 2 - Cost Center 3 - Natural Account

15

Page 16: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

4 Using the Upgraded Flexbuilder Rules 4.1 Generate Accounts With Upgraded Flexbuilder Rules Process

In release 10.7 Flexbuilder was used for account creation. Flexbuilder is a series of rules defined for each unique combination of account type and book. When upgrading from Release 10.7, the existing flexbuilder rules can be converted into PLSQL packages that are stored in the database. If the book name was OPS CORP in 10.7, then the corresponding package in release 11.0 or 11.5 is OPS_CORP_<account type>, for example the function name for the the asset cost account would be as follows: OPS_CORP_ASSET_COST To utilize these rules, the workflow process that is selected in the Account Generator form (see section 2.1) should be the “Generate Accounts Using Upgrade Rules”. Workflow is still utilized, but the workflow process calls the upgrade function rather than applying the rules as defined in the default workflow. The behavior of the default workflow in release 11.0 and 11.5 is the same as the default behavior of flexbuilder in release 10.7. If the account generator workflow is used after an upgrade, any modifications in flexbuilder for release 10.7 should be duplicated in workflow (see Note number 115322.1). An upgraded flexbuilder function can be tested using the detailed instructions on Metalink as follows: 1015770.102 - How to test the individual upgraded flexbuilder rules.

4.2 Invalid Parameters in the Upgraded Rules

Release 10.7 did not include the distribution_id (do not confuse with distribution_ccid) as a standard parameter for the flexbuilder functions. A patch was available in release 10.7 that supplied this value as a parameter. When a system with this parameter defined is upgraded, an incompatibility may result between the upgraded rules and the functions that call them. The following note provides a script and detailed instructions on testing the calling functions. 1015769.102 - Test the calling functions to verify parameter mismatches. (script calls the functions WITH the distribution_id parameter) The code can also be compared manually. The calling functions are in the following code from the FA_FLEX_UPG_PKG package. select text from dba_source where name = 'FA_FLEX_UPG_PKG' and owner = 'APPS' and type = 'PACKAGE'; An example of one of the functions extracted in this manner is the category level function: FUNCTION CATE_LEVEL_ACCT (X_flex_num in number, X_func in varchar2, X_acct_ccid in varchar2, X_acct_seg in varchar2,

16

Page 17: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

X_def_ccid in varchar2, X_dist_ccid in varchar2, X_flex_seg in out varchar2, X_error_msg in out varchar2) RETURN BOOLEAN; Compare that code to the following category level account package definition: -- replace name ('OPS_CORP_ASSET_COST') with the book specific function name select text from dba_source where name = 'OPS_CORP_ASSET_COST' and owner = 'APPS' and type = 'PACKAGE'; PACKAGE OPS_CORP_ASSET_COST AUTHID CURRENT_USER AS FUNCTION BUILD ( FB_FLEX_NUM IN NUMBER DEFAULT 101, ACCOUNT_CCID IN VARCHAR2 DEFAULT NULL, ACCOUNT_SEGMENT IN VARCHAR2 DEFAULT NULL, DEFAULTS_CCID IN VARCHAR2 DEFAULT NULL, DISTRIBUTION_CCID IN VARCHAR2 DEFAULT NULL, FB_FLEX_SEG IN OUT VARCHAR2, FB_ERROR_MSG IN OUT VARCHAR2) RETURN BOOLEAN; END OPS_CORP_ASSET_COST; If the parameters do not match, either the individual functions must be changed or the FA_FLEX_UPG_PKG must be modified. Due to the large number of individual functions it would likely be easiest to modify the calling functions in FA_FLEX_UPG_PKG.

4.3 Retrieving Source Code for the Upgraded Rules

The source code for upgraded rules in release 11.0.X and 11.5.X may need to be accessed for the following reasons: - modify account generation when using upgraded rules - verify and debug functionality for a specific account/book function

To view the source code created in the upgrade process, run the following query. Replace “OPS_CORP” with the name the asset book in question. select text from dba_source where name = 'OPS_CORP_ASSET_COST' and owner = 'APPS' and type = 'PACKAGE BODY'; Please see APPENDIX A for the full text of an upgraded asset cost function.

17

Page 18: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

4.4 Creating Source Code for the Upgraded Flexbuilder Rules

This process is detailed in the Upgrade Manual Chapter 12 (Flexbuilder) under To summarize the process: 1) Run the following to retrieve all of the flexbuilder functions: select f.function_code from fnd_flexbuilder_functions f where f.application_id = 140; 2) For each function, run the following commands: $FND_TOP/bin/FNDFBPLS apps/apps 0 Y "OFA" "<flexbuilder function name>" "unique file name" example: $FND_TOP/bin/FNDFBPLS apps/apps 0 Y "OFA" "US CORP DEPRN_EXP" "opcoexp.pls" The following sql will create the command line statements: select '$FND_TOP/bin/FNDFBPLS apps/apps 0 Y "OFA" "' ||f.function_code ||'" "' ||translate(f.function_code,' ','_') ||'"' from fnd_flexbuilder_functions f where f.application_id = 140; 3) Then you need to execute each of the statements to create the correct package specification and body.

4.5 Upgraded Functions with an Invalid Name

As previously discussed the upgrade process creates functions with names in the following format: <book_type_code>_<account type> Oracle Assets allows a book to be defined that starts with a numeric character, such as 123 CORP. In this case the upgraded function name for asset cost would be “123_CORP_ASSET_COST”. Such a function name is illegal in PLSQL and account generation will fail for this book when attempting to use the upgraded flexbuilder rules. The solutions is to either - use workflow instead of the upgraded rules. - rename the book and all related records in the data base for the book in question. The second option requires comprehensive sql updates and will need development/consulting involvement to implement. This issue was noted in BUG 1359213.

18

Page 19: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

5 Debugging Account Generation Failures 5.1 Account Failures 5.1.1 When Do Accounts Fail?

Account Generation errors can occur in numerous places in the Fixed Assets application. Whenever a code combination is needed for a particular transaction, the application will generate it if it has not been generated using the Generate Accounts (FAGDA) process. Account failures are most common (but not limited to) the following areas: Forms: Asset Workbench/Assignments - Transfers Asset Workbench/Open - Reclassification Processes: Calculate Gains and Losses - FARET Depreciation – FADEPR Generate Accounts – FAGDA Create Journal Entries – FAPOST Periodic Mass Copy – FAMCP

5.1.2 Why Do Accounts Fail?

Account failures can usually be traced to one of the following: - Invalid worklflow setup and configuration. - The account violates a cross validation rules. - Accounting code combinations has been disabled. - Accounting code combinations has been end dated. - Accounting code combination does not exist and dynamic inserts is not enabled. - Segment value has been disabled. - Segment value has been end dated. New error message diagnostics are available in the latest updates that often provide the reason for the failure in the log file itself. (see sections 5.1.3 and 5.2).

19

Page 20: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

5.1.3 What Accounts Failed?

The accounts that have failed are shown in the log file for the account generator process. A review of the log file is always the frist step in determining what accounts failed. Depending on the minipack level you are on the error messages can vary greatly. Typically the following information will be seen: Flexbuilder failed to generate a new code combination Cause: The code combination for the generated segment values does not exist and cannot be created because it would contain invalid segment values. Action: Check the account segment value you are using to generate a new code combination. The Asset Number is C5971 The Asset Id is 108635 The book_type_code parameter is CORP The account type parameter is NBV_GAIN The account segment parameter is 3900 The account CCID parameter is 0 The default ccid parameter is 1120 The distribution_ccid parameter is 2981 Turn on print debug to get as detailed an error message as possible: FA: Print Debug (set to Yes) Account Generator:Run in Debug Mode (set to Yes) With the latest patches applied there is enhanced error messaging as shown in the following example. (see section 5.2 for latest patches and review Metalink for patch updates) Action: Please review the following message for a detailed explanation of why the account could not be generated. Error: function &CALLING_FN returned failure (CALLED_FN=FAFLEX_PKG_WF.START_PROCESS) This combination has expired. The Asset Number is C5971 Error: function &CALLING_FN returned failure (CALLED_FN=FA_GENACCTS_PKG.GEN_CCID) The Asset Id is 129825 If the log does not provide this information, or further diagnosis of failures is desired, SQL can be used to determine the full extent of account failures in the Generate Accounts process.

20

Page 21: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

Determine what accounts are present in the FA_DISTRIBUTION_ACCOUNTS table. The queries that follow will need to be modified to exclude any ccids that are not in your FA_DISTRIBUTION_ACCOUNTS table. The ccids stored therein are dependent on the release and minipack that you are on and therefore can vary within Release. SQL>describe FA_DISTRIBUTION_ACCOUNTS The output will appear similar to the following: Name Constraint Type BOOK_TYPE_CODE NOT NULL VARCHAR2(15) DISTRIBUTION_ID NOT NULL NUMBER ASSET_COST_ACCOUNT_CCID NUMBER(15) ASSET_CLEARING_ACCOUNT_CCID NUMBER(15) DEPRN_EXPENSE_ACCOUNT_CCID NUMBER(15) DEPRN_RESERVE_ACCOUNT_CCID NUMBER(15) CIP_COST_ACCOUNT_CCID NUMBER(15) CIP_CLEARING_ACCOUNT_CCID NUMBER(15) NBV_RETIRED_GAIN_CCID NUMBER(15) NBV_RETIRED_LOSS_CCID NUMBER(15) PROCEEDS_SALE_GAIN_CCID NUMBER(15) PROCEEDS_SALE_LOSS_CCID NUMBER(15) COST_REMOVAL_GAIN_CCID NUMBER(15) COST_REMOVAL_LOSS_CCID NUMBER(15) PROCEEDS_SALE_CLEARING_CCID NUMBER(15) COST_REMOVAL_CLEARING_CCID NUMBER(15) REVAL_RSV_GAIN_ACCOUNT_CCID NUMBER(15) REVAL_RSV_LOSS_ACCOUNT_CCID NUMBER(15) DEFERRED_EXP_ACCOUNT_CCID NUMBER(15) DEFERRED_RSV_ACCOUNT_CCID NUMBER(15) DEPRN_ADJ_ACCOUNT_CCID NUMBER(15) REVAL_AMORT_ACCOUNT_CCID NUMBER(15) REVAL_RSV_ACCOUNT_CCID NUMBER(15) BONUS_EXP_ACCOUNT_CCID NUMBER(15) BONUS_RSV_ACCOUNT_CCID NUMBER(15) LAST_UPDATE_DATE NOT NULL DATE LAST_UPDATED_BY NOT NULL NUMBER(15) CREATED_BY NUMBER(15) CREATION_DATE DATE LAST_UPDATE_LOGIN NUMBER(15)

The following query will determine the number of distributions that have not generated all of the accounts that are stored in the FA_DISTRIBUTION_ACCOUNTS table. These accounts typically have an error condition that prevents then from being generated. When this query completes successfully, then all of the account have been successfully generated.

21

Page 22: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

If the describe command above reveals ccids that are not present as columns in your FA_DISTRIBUTION_ACCOUNTS table, then the query will need to be edited to remove them or an error (ORA-00904: invalid column name) will result. Accounts may be null in this table if account generation for the class of accounts has been disabled using the profile options in section 2.3.3. If this is the case, those accounts should be eliminated from the query. -- incomplete records in fa_distribution_accounts select da.book_type_code book ,ad.asset_number num ,ad.asset_id id ,dh.distribution_id dist_id from fa_additions ad ,fa_distribution_history dh ,fa_distribution_accounts da ,fa_category_books cb where dh.asset_id = ad.asset_id and da.distribution_id = dh.distribution_id and cb.category_id = ad.asset_category_id and cb.book_type_code = da.book_type_code and (da.ASSET_COST_ACCOUNT_CCID is null OR da.ASSET_CLEARING_ACCOUNT_CCID is null OR da.DEPRN_EXPENSE_ACCOUNT_CCID is null OR da.DEPRN_RESERVE_ACCOUNT_CCID is null OR da.NBV_RETIRED_GAIN_CCID is null OR da.NBV_RETIRED_LOSS_CCID is null OR da.PROCEEDS_SALE_GAIN_CCID is null OR da.PROCEEDS_SALE_LOSS_CCID is null OR da.COST_REMOVAL_GAIN_CCID is null OR da.COST_REMOVAL_LOSS_CCID is null OR da.PROCEEDS_SALE_CLEARING_CCID is null OR da.COST_REMOVAL_CLEARING_CCID is null OR da.REVAL_RSV_GAIN_ACCOUNT_CCID is null OR da.REVAL_RSV_LOSS_ACCOUNT_CCID is null OR da.DEFERRED_EXP_ACCOUNT_CCID is null OR da.DEFERRED_RSV_ACCOUNT_CCID is null OR da.DEPRN_ADJ_ACCOUNT_CCID is null OR da.REVAL_AMORT_ACCOUNT_CCID is null OR da.REVAL_RSV_ACCOUNT_CCID is null OR da.BONUS_EXP_ACCOUNT_CCID is null OR da.BONUS_RSV_ACCOUNT_CCID is null OR decode(cb.WIP_COST_ACCOUNT_CCID, null, 'not null', da.CIP_COST_ACCOUNT_CCID) is null OR decode(cb.WIP_CLEARING_ACCOUNT_CCID, null, 'not null', da.CIP_CLEARING_ACCOUNT_CCID) is null) order by 1,2; This query will indicate only that you have ccids that failed to generate. To find which accounts are in error, rerun the query for each ccid separately, removing all the OR conditions except the account you wish to test. Any failures thus returned can be diagnosed with the methods that follow.

22

Page 23: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

5.2 Apply the Latest Diagnostic Patches

Apply the latest patches for Account Generator include new error messaging.

For Release 11.0 Introduced in Patch 1763995: This patch enhances error messaging when Account Generator errors occur in PL/SQL based programs and form level transactions. The error will now display the several details including the concatenated segments being generated. Also displayed will be any associated FND messages such as those noting the ccid has been disabled or the combination is excluded by a cross validation rule. Note: You must have applied FA minipack E (Patch# 1350298) or greater prior to applying this patch. Note: You will also need the latest FND/Workflow patch (i.e. Patch# 1516634 or greater) to get the concatenated segment output. Also available in the latest CUMULATIVE CONCURRENT PROGRAM PATCH FOR 11.0, patch 1891974. This also adds enhanced account generator error messaging to all concurrent programs. In addition it includes fixes for upgraded flexbuilder rules, deprn expense generation, and dynamic insertion. Also included are fixes to avoid rounding issues and out-of-balance conditions in reporting books. If you are using MRC, you must also apply patch 1875291 immediately after applying this patch (please see the special instructions). Note: You must apply FA minipack F (Patch #1391289) before applying patch 1891974. See the read me for additional information on these or any patches that are applied.

For Release 11.5 Introduced in Patch 1791339 This patch enhances error messaging when Account Generator errors occur in PL/SQL based programs and form level transactions. The error will now display the several details including the concatenated segments being generated. Also displayed will be any associated FND messages such as those noting the ccid has been disabled or the combination is excluded by a cross validation rule. Also included in this patch is a change that makes the generation of the bonus expense and reserve accounts conditional on whether the asset is linked to a bonus rule or not. Note: You must have applied FA minipack C (Patch# 1483543) or greater prior to applying this patch. Also available in the latest CUMULATIVE CONCURRENT PROGRAM PATCH FOR 11.5, patch 1891974. (See above for description) Note: You must apply FA minipack E (Patch #1584277) before applying patch 1891974.

23

Page 24: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

5.3 Diagnose Failure without the aid of SQL

Understanding the setup of the FA Account Generator workflow is critical to diagnose the failure without the aid of SQL. You must know how the failed account is being built so that you can retrieve the parameters through the forms and manually build the account. The account can then be verified to see if exists and is valid. The example that follows shows how to diagnose the ASSET_COST_ACCOUNT failure with the default workflow setup .

5.3.1 Gather The Parameters

The expense account provides the balancing segment for all accounts. To retrieve the expense account for a particular asset, navigate as follows: Asset Workbench - Query the asset in question Open the Assignments Form Note the expense account value as shown below. (multiply distributed assets may have more than one)

24

Page 25: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

The asset cost account natural account segment comes from the asset cost account as specified in the category setup. To retrieve the cost account for a particular asset, navigate as follows: Setup/Asset System/Asset Categories - Query the category to which the asset belongs. Tab to the General Ledger Accounts zone of the form. Query the book for which the transaction is occurring. Note the asset account value as shown below.

25

Page 26: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

The remaining segments for the asset cost account come from the account generator default account when using the default workflow setup. The default account is specified in the book controls setup. To retrieve the default account for a particular book, navigate as follows: Setup/Asset System/Book Controls - Query the book to which the asset belongs. Click on the Natural Accounts Tab. Note the default account value as shown below.

26

Page 27: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

5.3.2 Build the Account Build the account using the rules of the default workflow. Refer to section 3.3 for the category level default workflow. The segments shown in bold were used to build the account. Expense Account: 01.410.7350.0000.000 Cost Account: 01.000.1550.0000.000 Default Account: 01.000.9999.0000.000 --------------------- ASSET_COST_ACCOUNT: 01.000.1550.0000.000

5.3.3 Validate the Account There are several levels of validation that occur when an account is generated. Quite often the user can recognize what is wrong with the account at this point in the process. If all appears correct, the following steps typically will find the error: Query the combination in the General Ledger Combinations form to verify: - the account exists - the account is enabled - detail posting is allowed - the from/to dates (if populated) do not exclude todays date Even though the combination exists, it is possible that individual segment values have been disabled subsequent to the creation of the combination. Therefore for each segment in the accounting flexfield, query the appropriate value set and examine the values which appear in the combination. Verify the following for each value: Query the segment value and verify: - the value exists - the value is enabled - the from/to dates (if populated) do not exclude todays date Finally, review the cross validation rule to determine if the account violates an existing rule. It is important to remember that an existing account can be created before the cross validation rule is added. Fixed Assets will fail to generate the account if it violates a rule even if the account itself exists and is enabled.

27

Page 28: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

5.4 Diagnosing Failure With The FAXAGTST.sql Diagnostic Script 5.4.1 Finding the Correct Script

The faxagtst.sql script is used to test account generation in Oracle Fixed Assets. The main advantage of this script is that it is provided with the application. The script will reside in two different directories as follows: FA_TOP/admin/sql/ FA_TOP/patch/110/sql/ The script in the admin/sql/ directory should be avoided as it likely contains a parameter error. Check the version of the script, it should be as follows: Release 11.0 - $Header: faxagtst.sql 110.3 Release 11.5 - $Header: faxagtst.sql 115.2 You can also verify the script is correct by opening it with any test editor. If the script begins as follows: DECLARE X_flex_account_type varchar2(30) := '&&account_type'; X_book_type_code varchar2(30) := '&&flex_structure'; X_flex_num number := &&flex_structure; Change the second variable declaration to read as follows: X_book_type_code varchar2(30) := '&&book';

5.4.2 Gathering the Parameters The instructions to use the script are as follows: FAXAGTST.SQL Instructions The faxagtst.sql program can be used to generate more specific error messages about why an account is failing. The errors in the log or on the screen typically indicate that the Account Generator function is failing to generate the General Ledger account combination it needs. REQUIRED ARGUMENTS: Enter value for account_type: see #1 Enter value for book: book_type_code for the book that fails Enter value for flex_structure: see #2 Enter value for distribution_ccid: see #3 Enter value for account_segment: see #5 Enter value for default_ccid: see #4 Enter value for account_ccid: see #5 In order to retrieve the required arguments you need to know the book_type_code and the asset_id. ASSET_ID: The asset_id can be retirieved using the asset number: select asset_id from fa_additions where asset_number = '&number';

28

Page 29: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

The log file may NOT contain an actual asset number or id, in that case you can retrieve the asset_id using the distribution_id from the log file (distribution_id not distribution_ccid): select asset_id from fa_distribution_history where distribution_id = '&dist_id'; 1) Account type is as follows: ACCOUNT Internal name -------------------------------- --------------- Book Level Accounts (Use 0 for account_ccid parameter) AP_INTERCOMPANY_ACCT AP_INTERCO AR_INTERCOMPANY_ACCT AR_INTERCO COST_OF_REMOVAL_CLEARING_ACCT COR_CLEARING COST_OF_REMOVAL_GAIN_ACCT COR_GAIN COST_OF_REMOVAL_LOSS_ACCT COR_LOSS DEFERRED_DEPRN_EXPENSE_ACCT DEF_DEPRN_EXP DEFERRED_DEPRN_RESERVE_ACCT DEF_DEPRN_RSV NBV_RETIRED_GAIN_ACCT NBV_GAIN NBV_RETIRED_LOSS_ACCT NBV_LOSS PROCEEDS_OF_SALE_CLEARING_ACCT POS_CLEARING PROCEEDS_OF_SALE_GAIN_ACCT POS_GAIN PROCEEDS_OF_SALE_LOSS_ACCT POS_LOSS REVAL_RSV_RETIRED_GAIN_ACCT REV_RSV_GAIN REVAL_RSV_RETIRED_LOSS_ACCT REV_RSV_LOSS DEPRN_ADJUSTMENT_ACCT DEPRN_ADJ Category Level accounts ASSET_CLEARING_ACCT ASSET_CLEARING ASSET_COST_ACCT ASSET_COST CIP_CLEARING_ACCT CIP_CLEARING CIP_COST_ACCT CIP_COST DEPRN_RESERVE_ACCT DEPRN_RSV REVAL_AMORTIZATION_ACCT REV_AMORT REVAL_RESERVE_ACCT REV_RSV Asset Level Accounts (Use 0 for account segment and account_ccid) DEPRN_EXPENSE_ACCT DEPRN_EXP 2. The flex_structure is as follows: select accounting_flex_structure, book_type_code from fa_book_controls where book_type_code = '&&book_type_code' 3. The distributions_ccid If process was run with the profile option FA: Print Debug set to Yes the error log typically contains the distribution id.

29

Page 30: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

Otherwise run the following query, select asset_id, distribution_id, code_combination_id distribution_ccid from fa_distribution_history where asset_id = '&&asset_id' and transaction_header_id_out is NULL; 4. The default_ccid is as follows: select flexbuilder_defaults_ccid, book_type_code from fa_book_controls where book_type_code like '&&book_type_code' / 5. This is the query to retrieve the parameters for the account_segment and account_ccid. For the BOOK level accounts: account_ccid is 0 for all BOOK and ASSET level accounts.

Retrieve the account segment parameter as follows: select NBV_RETIRED_GAIN_ACCT NBV_GAIN, NBV_RETIRED_LOSS_ACCT NBV_LOSS, PROCEEDS_OF_SALE_CLEARING_ACCT POS_CLEARING, PROCEEDS_OF_SALE_GAIN_ACCT POS_GAIN, PROCEEDS_OF_SALE_LOSS_ACCT POS_LOSS, REVAL_REV_RETIRED_GAIN_ACCT REV_RSV_GAIN, REVAL_REV_RETIRED_LOSS_ACCT REV_RSV_LOSS, DEPRN_ADJUSTMENT_ACCT DEPRN_ADJ, COST_OF_REMOVAL_CLEARING_ACCT COR_CLEARING, COST_OF_REMOVAL_GAIN_ACCT COR_GAIN, COST_OF_REMOVAL_LOSS_ACCT COR_LOSS, DEFERRED_DEPRN_EXPENSE_ACCT DEF_DEPRN_EXP, DEFERRED_DEPRN_RESERVE_ACCT DEF_DEPRN_RSV, AP_INTERCOMPANY_ACCT AP_INTERCO, AR_INTERCOMPANY_ACCT AR_INTERCO from fa_book_controls where book_type_code = '&&book';

For the CATEGORY level accounts:

ASSET_COST_ACCOUNT: select ad.asset_id id, cb.book_type_code book, cb.asset_cost_acct account_segment, cb.asset_cost_account_ccid account_ccid from fa_category_books cb, fa_additions ad where cb.category_id = ad.asset_category_id and ad.asset_id = '&&asset_id' / DEPRN_RESERVE_ACCOUNT: select ad.asset_id id, cb.book_type_code book, cb.deprn_reserve_acct account_segment, cb.reserve_account_ccid account_ccid from fa_category_books cb, fa_additions ad

30

Page 31: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

where cb.category_id = ad.asset_category_id and ad.asset_id = '&&asset_id' / ASSET_CLEARING_ACCOUNT: select ad.asset_id id, cb.book_type_code book, cb.asset_clearing_acct account_segment, cb.asset_clearing_account_ccid account_ccid from fa_category_books cb, fa_additions ad where cb.category_id = ad.asset_category_id and ad.asset_id = '&&asset_id' /

RECLASSIFICATION:

For the asset_cost_account and deprn_reserve_account for the new category to which you are reclassifying. select cb.asset_category_id from fa_category_books cb where cb.attribute1 = '&&segment1' and cb.attribute2 = '&&segment1' etc... Then run ASSET_COST_ACCOUNT: select cb.asset_cost_acct account_segment, cb.asset_cost_account_ccid account_ccid from fa_category_books cb where cb.category_id = &&asset_category_id / DEPRN_RESERVE_ACCOUNT: select cb.deprn_reserve_acct account_segment, cb.reserve_account_ccid account_ccid from fa_category_books cb where cb.category_id = &&asset_category_id /

5.4.3 Running the Script

Run the following: sqlplus user/pwd @<path>faxagtst e.g. sqlplus apps/apps @$FA_TOP/admin/sql/faxagtst IMPORTANT: You must provide all 7 arguments. See Appendix B for a copy of the faxagtst.sql script for 11.5.X. See Appendix C for a successful run of the faxagtst.sql script.

31

Page 32: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

5.5 Diagnosing Failure With The FAGDA_test.sql Diagnostic Script

The FAGDA_test.sql script appears in it’s entirety in Appendix D. The script can be cut and pasted into a text file named FAGDA_test.sql. This script runs the faxagtst.sql script for all of the accounts for a particular asset. It fornats that output in an HTML format in a file named FAGDA_test.html. This file can be viewed with your browser. To run the script all that is need is the asset_id and book_type_code. The script will retrieve the balance of the parameters. @FAGDA_test.sql <Asset_id> "<book_type_code>" For example: @FAGDA_test.sql 1234 "CORP" The output will appear similar to the following for each account generated: =========================================================== Book_type_code: OPS CORP Flex_Structure: 101 Distribution_ccid: 19347 Account_segment: 1540 Account_ccid: 12847 Default_ccid: 34616 Success CCID is :19351 Segments : 01-470-1540-0000-000 =========================================================== Review any combinations and error messages that do not generate successfully. The script actually runs the FAXAGTST.sql script for every account for the asset in question. The results of the indeividual FAXAGTST.sql runs can be viewed by selecting VIEW/PAGE SOURCE in your browser. The actual ouptut of the individual runs may reveal the source of the error or the segment upon which it fails. A sample of the FAXAGTST.sql output is in Appendix C.

32

Page 33: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

6 Diagnosing Other Errors 6.1 Rollback Segment Errors

The ORA-01555 is common when running this process the first time. The problem can usually be minimized by increasing the number of the minimum extents in the rbs being used for FAGDA. Often the setting on the clients system is 2, many articles on Metalink refer to a recommended setting of 20 for APPS. Of course, a 20 times increase in the extent size would have had a similar effect, though it is not particularly economical in its usage of disk space. The FAGDA process does not cause the rbs to extend as it commits for every record it creates in fa_distribution_accounts. The problem is without extending, the rbs will never use more than the 2 minimum extents. Therefore, every time you cross the boundary between those two extents, fully one half of the rollback information is lost. At some point in large runs for FAGDA, this information is accessed (why I am not sure), causing the ORA-1555. With 20 extents as a minimum, then each time you cross into a new extent, only 1/20 of the information previously written in the rbs is lost. If the ct is at 2 extents minimum, they may wish to try an extent size the same or smaller than the present setting, but with a minimum extents setting of 20. For example: 1) 2 minimum extents 20 MB each for 40 MB total at minimum size. verses 2) 20 minimum extents of 2 MB each for 40 MB total at minimum size. Both examples use the same "minimum" size. Each time you enter a new extent in the first example, you lose 20MB of rbs used for read consistent image, preserving 20 MB. In example 2), Each time you enter a new extent you only lose 2MB of rbs used for read consistent image, preserving 38MB. As a side note, this is usually seen in runs of FAGDA where thousands of records are being populated. No data is lost as it commits at every record, and the process can be resubmitted as often as necessary to get the intial build of accounts completed. It is not likely to occur with normal processing volumes.

6.2 Overwriting Workflow When Applying Patches

Applying a mini-pack may cause unprotected customizations to be overwritten if they have not been prorperly protected. In release 11.0 the patch driver did not execute the WFLOAD command in the mini-packs, however in 11i all FA mini-packs call wfload with the UPGRADE option. All financial products in 11.5.X call WFLOAD with the UPGRADE option, in release 11.0.X FA was the only product that did not call WFLOAD in the mini-packs.

33

Page 34: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

Customized workflows will not be overwritten if the access levels have been set to reflect the customizations. We have received a few TARs where custom workflows were replaced because the customer had NOT protected their changes. This has been reported in other products recently as well, PA in particular, as this apparently is standard patching procedure in 11i products (to call wfload). Even if protected the options can be overwritten if the ct uses the FORCE option instead of UPGRADE, but UPGRADE is the default in the driver files for the patches. If a PROTECTED workflow is overwritten it is likely due to rerunning wfload with the FORCE option after seeing wfload access level errors in the patch log file due to a protected workflow.

6.3 ORA-20002 and FAFLEXWF Errors

Generate Accounts process errors and the following error is in the log file: ORA-20002: 3136: Item 'FAFLEXWF/#SYNCH' cannot be accessed while synchronous process in progress. OR ORA-20002: 3103: Attribute 'BOOK_TYPE_CODE' does not exist for item 'FAFLEXWF/'.

6.3.1 Tablespace for WF tables and Indexes

The most common cause of this error is a tablespace violation. Please review the Alert log for the time frame that includes the time frame during which the process ended in error.

6.3.2 Reload Workflow

This error has also been eliminated by reloading the workflow file. When run on the database server, the following command will load the workflow into the database: $FND_TOP/bin/WFLOAD usr/pwd 0 Y UPGRADE $FA_TOP/<path>/<filename.wft> For example: $FND_TOP/bin/WFLOAD apps/apps 0 Y UPGRADE $FA_TOP/patch/110/import/faflxgrp.wft To overwrite a protected workflow, use the FORCE option on the command line: ***WARNING – this option will overwrite your existing workflow *** $FND_TOP/bin/WFLOAD usr/pwd 0 Y FORCE $FA_TOP/<path>/<filename.wft> For example: $FND_TOP/bin/WFLOAD apps/apps 0 Y FORCE $FA_TOP/patch/110/import/faflxgrp.wft

6.3.3 Qualified Segments Defined Particularly if this is a new implementation, make sure that the Cost Center segment is qualified in the definition of the Accounting Flexfield. The Cost Center qualifier is only required in Oracle Fixed Assets and Project Accounting and may therefore not be set.

34

Page 35: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

6.3.4 Test For Failed Accounts If the error message also indicates failure on a particular distribution, run the account generator test for the asset in question from one of the following notes: NOTE:146661.1 Account Generator Test Script for Fixed Assets NOTE:1062849.6 How do I use the FAXAGTST.SQL to debug problems

6.3.5 Test Parameters for Upgraded Flexbuilder Rules If the Generate Accounts process has never been run successfully and you are using the upgraded flexbuilder rules, please review Note 1015770.102 - How to test the upgraded flexbuilder rules. Note 1015769.102 - Test the calling functions to verify parameter mismatches.

6.4 Create Journal Entries waits for FAGDA process

If you are on a current mini pack, the Generate Process is decoupled from all required processes including Create Journal Entries. If you are not on the current code you can manually uncouple FAGDA from the Create Journal Entries process using one of the following options: 1) Edit the existing request set to allow CJE to continue of FAGDA fails. 2) Create a new Create Journal Entry request set that does not include FAGDA 3) Apply a current mini-pack EDIT THE REQUEST SET: <Note:102594.1> CREATE NEW REQUEST SET: <Note:1019842.102>

6.5 Dynamic Insertion Fails in FAGDA Process 1854331 Patch Description PLACEHOLDER FOR MERGING ACCOUNT GENERATOR MESSAGING ENHANCEMENTS INTO PRO*C Patch will merge the new detailed error messaging from account generator with programs like depreciation and gain loss. This will provide consistent and detailed messaging to the user. Also fixes problems with date formatting and dynamic insertion. *** You must have applied FA Patchset C (1483543) or higher before applying this patch ***

35

Page 36: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

6.6 No Error Messages in the Log File

If there are start and end messages in the log file but no errors, the most likely cause is an environment problem. The log will be similar to the following: FAGDA module: Generate Accounts Current system time is 10-MAR-2000 09:12:03 Executing request completion options... Finished executing request completion options. Concurrent request completed The APPLTMP environment variable and the util_file_dir variable in the init.ora initialization file for the database must point to the same directory. Also, that directory must have the permissions set to allow read/write access to allow error messages. If nothing at all appears in the log file, run the following request from Sysadmin responsibility: Submit and Purge Concurrent Request Statistics The following workaround is available as a short term solution when there are no error messages in the log file: Run FAGDA from SQL using the following script and the error messages will be displayed : spool <filename> set serveroutput on declare v_err_buf varchar2(20000); v_ret_code number; begin fa_genaccts_pkg.gen_accts(v_err_buf,v_ret_code, <Insert the book_type_code> ); dbms_output.put_line('v err buf is '||substr(v_err_buf,1,100)); end; end spool

6.7 Depreciation Expense Account Modifications Do Not Work The expense account is a special case when making modifications to workflow. The expense account generated is the same as the expense (distribution) account for the asset. Rather than call workflow to generate the same account, by default workflow is not called. The application uses the expense account directly. Therefore, modifications to the FA Account Generator workflow to specifically generate the expense account in a manner other than the default method will be ignored unless the application is told to call workflow for the expense account. This is accomplished with a profile option. To force a call to workflow for the expense account, set the following profile option to Yes. FA: Generate Depreciation Expense Account

36

Page 37: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

7 Modifying Workflow - Considerations

Modifications to workflow are often the cause of account generation errors. When a change to workflow or a change to the PLSQL functions for upgraded rules are made, the new accounts that are generated as a result of the change may experience validation errors in various processes and transactions in the application. The accounts may not exist or could violate cross validation rules that were not a factor before the change. These errors can be diagnosed with standard debugging procedures ans ttest scripts in section 6.

7.1 General Ledger Accounting and Workflow Changes in FA The most significant issue with a workflow change is to coordinate the change with the existing general ledger accounting for the transactions which pre-dated the workflow change. There are several references that indicate that the solution may be to truncate the fa_distribution_accounts table and regenerate all of the accounts. This is not a supported solution when the affected accounts are balance sheet accounts since this could leave an imbalance between Fixed Assets detail and the General Ledger balances. The following example illustrates the problem: Account structure: BalSegment.CostCenter.NaturalAccount 1) Asset is added: Original workflow did NOT use a cost center. Expense Account: 01.410.7500 Category Cost Account Segment: 1500 Cost Account to Which Asset Cost was debited: 01.000.1500 2) Modified workflow to use a cost center. Cost Account which workflow now generates: 01.410.1500 3) Truncated the FA_DISTRIBUTION_ACCOUNTS table. Ran FAGDA to regenerate the accounts.

Cost Account now stored in FA is 01.410.1500 even though in General Ledger the Asset Cost is still in account 01.000.1500

4) Transfer or Reclassify the Asset The asset is transferred out of account 01.410.1500. This leaves a Credit balance in 01.410.1500 and an offsetting Debit balance in 01.000.1500 The proper way to handle a change when an account (typically asset cost or depreciation reserve) that carries a balance on the balance sheet is modified in workflow to generate a different account, requires that the asset be transferred. This allows the application to account for the change from the old account into the newly generated account. One way of accomplishing this would be using Mass Transfer and a dummy or currently unused location. All assets in a particular location can be transferred to the dummy location. They are then immediately transferred back from the dummy location to the original location. This results in a new distribution for the asset. When Generate Accounts is run, it will transfer the asset from the old cost/reserve to the new cost/reserve accounts. This will insure that the General Ledger and Fixed Assets detail remain in balance.

37

Page 38: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

7.2 Truncating The FA_DISTRIBUTION_ACCOUNTS Table TRUNCATE TABLE FA_DISTRIBUTION_ACCOUNTS; As a general rule, the fa_distribution_accounts table should never be truncated (see section 7.1). This is often used when in the implementation phase of fixed assets or when assets entries are not posted to the general ledger. After truncating, all accounts will need to be regenerated for all books. This will adversely affect performance and can result in detail Fixed Asset ledgers not balancing with the asset account balances in the General Ledger.

38

Page 39: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

8 Performance Issues 8.1 Estimating the Time to Completion

If FAGDA is running, you can estimate the time to completion. Run the following query one minute apart (use '/' from the SQL command line to rerun the query 60 seconds later). Subtract the first result from the second, this value is the records per minute that are being committed. -- To determine the total number of distributions for which -- accounts have been generated. select count(*) from fa_distribution_accounts where book_type_code = '&book'; Then determine the number of records that need to be generated with the following query. -- To determine the count of active fa_distribution_history -- records that require a row to be generated in -- fa_distribution_accounts. Supply the book_type_code -- for the book that you are running generate accounts. -- Subselect eliminate rows already generated for this book. select count(*) from fa_distribution_history dh ,fa_books bk ,fa_deprn_periods dp where dh.transaction_header_id_out is null and bk.asset_id = dh.asset_id and bk.book_type_code = '&book' and dp.book_type_code = bk.book_type_code and dp.period_close_date is null and bk.transaction_header_id_out is null and (bk.period_counter_fully_retired is null OR bk.period_counter_fully_retired >= (select min(dp1.period_counter) from fa_deprn_periods dp1 where dp1.fiscal_year = dp.fiscal_year)) and distribution_id not in (select da.distribution_id from fa_distribution_accounts da where da.book_type_code = bk.book_type_code); Divide the result from the last query by the result from the first query. This is the number of minutes to completion. To determine the hours until completion, divide the previous result by sixty.

39

Page 40: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

8.2 Improving Performance Use the information in section 8.1 to first establish a base line performance so that the following options can be tested for effectiveness after the appropriate changes have been made. 1) For both release 11.0 and 11.5, apply patch 1516634. This patch provides the latest performance enhancements for workflow, it specifically implements additional caching in the workflow account generator packages. This patch is included in FND minipack C and later for Release 11.5. It is also included in Oracle Applications 11.5.4 Maintenance Pack. This patch is included in FND minipack H and later for Release 11.0. 2) Turn off the following profile options to reduce overhead: FA: Print Debug (set to No) Account Generator:Run in Debug Mode (set to No) Verify that these options are turned off at the USER level as well. 3) Check the setting for the following profile option: FA: Number of Generate Accounts Parallel Requests Valid values are from 1 to 15. - If set to 1, try a value from 2 to 5. - If set to greater than 1, try with value of 1. - If set greater than 5, next try with a value of 2 to 5 In each case, recheck performance after the change. Depending on hardware configuration, load on the system, etc. different settings can affect performance. 4) Run the Purge Obsolete Workflow Runtime Data concurrent request. Note:1018928.102 on Metalink. 5) Consider turning off Account Generator for book level accounts. Book level accounts include: Cost of Removal Clearing Cost of Removal Gain Cost of Removal Loss Deferred Depreciation Expense Deferred Depreciation Reserve Depreciation Adjustment Net Book Value Retired Gain Net Book Value Retired Loss Proceeds of Sale Clearing Proceeds of Sale Gain Proceeds of Sale Loss Revaluation Reserve Retired Gain Revaluation Reserve Retired Loss

40

Page 41: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

On the latest version of the code all of these accounts are generated for each distribution. Typically very few of these accounts are used in an assets lifetime and they can be safely generated at transaction time without sacrificing significant performance. However, certain transactions such as Mass Retirements will perform substantially better if these accounts are not turned off. To turn off book level accounts set the following profile option to NO: FA: Generate Book Level Account Values of YES or NULL will result in account generation for the accounts within that level. A value of NO will skip these accounts.

41

Page 42: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

9 Profile Options The profile options related to the FA Account Generator process are as follows: FA:Generate Asset Level Account FA:Generate Book Level Accounts FA:Generate Category Level Accounts FA: Number of Generate Accounts Parallel Requests FA: Generate Depreciation Expense Account FA: Use FA_CUSTOM_GEN_CCID_PKG FA: Print Debug Account Generator:Run in Debug Mode

9.1 FA:Generate <Asset/Book/Category> Level Account

Three new profile options: FA:Generate Asset Level Account FA:Generate Book Level Accounts FA:Generate Category Level Accounts Setting any of these profiles to 'NO' will prevent the Generate Accounts Program from pre-generating any of the associated accounts. In general they should be left NULL or set to 'YES'. The value 'NO' should only be used in cases where the FA workflow has been customized so that one or more accounts for a single asset & distribution may change over time. For example, when a segment value is determined by an asset's retirement type which can not be known at the time of addition. To set the profile options they must first be visible and updateable at the appropriate access level. Responsibility: Application Developer Navigation: Profile Query in the name field for each profile options as follows: FA_PREGEN_ASSET_ACCOUNT FA_PREGEN_CAT_ACCOUNT FA_PREGEN_BOOK_ACCOUNT In the box titled “System Administrator Access” check the appropriate boxes for “visible” and “updateable” as required. Typically these options will be set at the application level since the expectation is that they be consistent for all users and responsibilities using Oracle Assets. The profile options can then be set at the level for which they were enabled. NOTE: Excluding one or more account types from processing by the Generate Accounts program will have significant performance impacts as workflow will be called for each account as needed. This is especially important in the case of mass transactions and batch processing such as Depreciation. By default these profiles should be left as NULL or set to 'YES'.

42

Page 43: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

9.2 Debug Profile Options FA: Print Debug (Yes/No) Account Generator:Run in Debug Mode (Yes/No)

9.3 FA: Number of Generate Accounts Parallel Requests FA: Number of Generate Accounts Parallel Requests (1-15/null)

9.4 FA: Generate Depreciation Expense Account

FA: Generate Depreciation Expense Account (Yes/No) By default workflow is not called for the depreciation expense account. Since each asset is assigned to one or more expense accounts when it is created, calling workflow would be redundant and waste resources when the account it generates is identical to the account to which it was originally assigned. Therefore, if the workflow for the expense account has been modified, this profile option must be set to “Yes” to force the application to call workflow to generate the expense account. See section 6.7.

9.5 FA: Use FA_CUSTOM_GEN_CCID_PKG

FA: Use FA_CUSTOM_GEN_CCID_PKG (Yes/No) From patch 1141094: In Release 11, Oracle Assets uses Account Generator implemented using Workflow rules and procedures to generate code combinations for all the account types. Some of the account types for which Oracle Assets creates code combinations are: Asset Cost Account, Asset Clearing Account, Depreciation Expense Account, Depreciation Reserve Account, etc. Oracle Assets shipped a new concurrent program called Generate Accounts (FAGDA) which generates all the code combinations for all the distributions in a book and stores it in a table called FA_DISTRIBUTION_ACCOUNTS. As mentioned earlier, Account Generator is called repeatedly to generate the combinations for each account type and, subsequently, all transactions and concurrent programs such as Depreciation (FADEPR) and Create Journal Entries (FAPOST) check if a combination already exists in the table FA_DISTRIBUTION_ACCOUNTS and uses the combination if it exists. There are performance issues associated with using Account Generator and Generate Accounts does not alleviate the performance issues, although it can be run ahead of critical month-end processes, thereby significantly speeding up month-end close. The code to generate code combinations using Account Generator in Oracle Assets is contained in the package FA_GCCID_PKG which is shipped in the file FAFBGCB.pls. This package contains a function called 'fafbgcc' which calls the Workflow process to generate code combinations. Oracle Assets will now provide a PL/SQL package and stub function which a customer can modify to generate code combinations without using Account Generator. A profile option, FA: Use FA_CUSTOM_GEN_CCID_PKG to Generate CCID, when enabled

43

Page 44: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

will allow FA_GCCID_PKG.fafbgcc to call the stub package instead of calling Oracle's Workflow to generate code combinations. All the logic required to generate a code combination must be placed in this stub package. No changes must be made to the logic in FA_GCCID_PKG. The stub package is called: FA_CUSTOM_GEN_CCID_PKG and the function is called: gen_ccid. After calling the stub function FA_GCCID_PKG.fafbgcc will check the return value of either TRUE (indicating success in generating a code combination) or FALSE (indicating failure in generating a code combination) of the stub. In the case where the stub returns TRUE, 'fafbgcc' will check that the returned CCID exists in GL_CODE_COMBINATIONS and is enabled. 'fafbgcc' will not, however, check cross-validation rules or the validity of individual segment values that make up the code combinations since these validations are contained within the Account Generator Workflow process which is now being bypassed. The customized code in the stub package will have to ensure that the code combination for a given account type is the desired one based on what business rules are defined. In the case where the stub returns FALSE, 'fafbgcc' will also return a failure to the calling function which could have been invoked during a transaction or by a concurrent program. The following SQL will be used to validate the ccid returned by the custom stub package: CURSOR validate_ccid IS SELECT 'VALID' FROM gl_code_combinations glcc WHERE glcc.code_combination_id = X_rtn_ccid AND glcc.enabled_flag = 'Y' AND nvl(glcc.end_date_active, sysdate) >= sysdate;

44

Page 45: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

10 If an iTAR is Necessary

Things to provide to Oracle Support when logging an iTAR for Account Generation errors: 1) Name of the failed process/transaction being performed. 2) Error Log of the failed process (with print debug enabled). 3) Detailed description of screen errors if the error occurred in a form transaction. 4) Output from FAXAGTST.sql or FAGDA_test.sql. 5) Asset trace if the source of the error is a specific asset. 6) System changes, especially regarding FA Account Generator workflow changes. 7) Mini-pack Level If unsure of the mini-pack, use the following chart with your FAXASSET form version to verify the information. Navigate to Assets/Asset Workbench Select Help/About Oracle Applications from the menu. Scroll down until the FAXASSET form name is visible From release 11i Form Name: FAXASSET Form Version: 11.5.184

FAXASSET Version Mini Patch Release From To Pack Number 11.0.X 110.97 110.109 A 681385 110.110 110.122 B 733163 110.123 110.148 C 811357 110.149 110.216 D 1042202 110.217 110.232 E 1350298 110.233 110.254 F 1391289 110.255

- G 1626136

11.5.X 115.143 115.167 A 1345671 115.168 115.172 B 1405177 115.173 115.177 C 1483543 115.178 115.183 D 1509971 115.184 115.203 E 1584277 115.204 - G 1794240

45

Page 46: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

Appendices APPENDIX A – Sample Source Code for Upgraded Flexbuilder Rule SQL> select text 2 from dba_source 3 where name = 'OPS_CORP_ASSET_COST' 4 and owner = 'APPS' 5 and type = 'PACKAGE'; PACKAGE OPS_CORP_ASSET_COST AUTHID CURRENT_USER AS FUNCTION BUILD ( FB_FLEX_NUM IN NUMBER DEFAULT 101, ACCOUNT_CCID IN VARCHAR2 DEFAULT NULL, ACCOUNT_SEGMENT IN VARCHAR2 DEFAULT NULL, DEFAULTS_CCID IN VARCHAR2 DEFAULT NULL, DISTRIBUTION_CCID IN VARCHAR2 DEFAULT NULL, FB_FLEX_SEG IN OUT VARCHAR2, FB_ERROR_MSG IN OUT VARCHAR2) RETURN BOOLEAN; END OPS_CORP_ASSET_COST; 13 rows selected. SQL> select text 2 from dba_source 3 where name = 'OPS_CORP_ASSET_COST' 4 and owner = 'APPS' 5 and type = 'PACKAGE BODY'; (Line Numbers added for readability) 1 PACKAGE BODY OPS_CORP_ASSET_COST AS 2 3 FUNCTION BUILD_PRIVATE ( 4 FB_FLEX_NUM IN NUMBER DEFAULT 101, 5 X_ACCOUNT_CCID IN VARCHAR2 DEFAULT NULL, 6 X_ACCOUNT_SEGMENT IN VARCHAR2 DEFAULT NULL, 7 X_DEFAULTS_CCID IN VARCHAR2 DEFAULT NULL, 8 X_DISTRIBUTION_CCID IN VARCHAR2 DEFAULT NULL, 9 FB_FLEX_SEG IN OUT VARCHAR2, 10 FB_ERROR_MSG IN OUT VARCHAR2) 11 RETURN BOOLEAN 12 IS 13 FB_SEGMENTS FND_FLEX_EXT.SEGMENTARRAY; 14 FB_SEG_DELIM VARCHAR2(1) DEFAULT NULL; 15 FB_DONE BOOLEAN DEFAULT FALSE; 16 FB_STATUS BOOLEAN DEFAULT TRUE; 17 BEGIN 18 19 /* Initialize all OUT parameters to NULL */ 20 FB_FLEX_SEG := NULL; 21 FB_ERROR_MSG := NULL; 22 23 /* Build Code Combination for Structure 101 */

46

Page 47: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

24 IF (FB_FLEX_NUM = 101) THEN 25 BEGIN 26 27 /* Initialize segment values */ 28 FOR i IN 1..5 LOOP 29 FB_SEGMENTS(i) := NULL; 30 END LOOP; 31 32 /* Assignment rule #3 */ 33 BEGIN 34 IF (FB_SEGMENTS(1) IS NULL) THEN 35 SELECT SEGMENT1 INTO FB_SEGMENTS(1) 36 FROM GL_CODE_COMBINATIONS 37 WHERE CODE_COMBINATION_ID = TO_NUMBER(X_DISTRIBUTION_CCID); 38 END IF; 39 EXCEPTION 40 WHEN NO_DATA_FOUND THEN 41 FND_MESSAGE.SET_NAME('FND', 'FLEX-FLEXFIELD COMB NOT FOUND'); 42 FND_MESSAGE.SET_TOKEN('CCID', X_DISTRIBUTION_CCID); 43 FND_MESSAGE.SET_TOKEN('FLXCODE', 'GL#'); 44 FND_MESSAGE.SET_TOKEN('QTSET', 'SET='); 45 FND_MESSAGE.SET_TOKEN('CCID2', '101'); 46 FB_ERROR_MSG := FND_MESSAGE.GET_ENCODED; 47 FB_STATUS := FALSE; 48 GOTO FB_CONCAT_SEG_VALS; 49 END; 50 51 /* Check if we are done */ 52 FB_DONE := TRUE; 53 FOR i IN 1..5 LOOP 54 IF (FB_SEGMENTS(i) IS NULL) THEN 55 FB_DONE := FALSE; 56 EXIT; 57 END IF; 58 END LOOP; 59 IF (FB_DONE) THEN 60 GOTO FB_CONCAT_SEG_VALS; 61 END IF; 62 63 /* Assignment rule #2 */ 64 IF (FB_SEGMENTS(3) IS NULL) THEN 65 FB_SEGMENTS(3) := X_ACCOUNT_SEGMENT; 66 END IF; 67 68 /* Check if we are done */ 69 FB_DONE := TRUE; 70 FOR i IN 1..5 LOOP 71 IF (FB_SEGMENTS(i) IS NULL) THEN 72 FB_DONE := FALSE; 73 EXIT; 74 END IF; 75 END LOOP; 76 IF (FB_DONE) THEN 77 GOTO FB_CONCAT_SEG_VALS; 78 END IF; 79 80 /* Assignment rule #1 */ 81 BEGIN 82 IF (FB_SEGMENTS(1) IS NULL) THEN 83 SELECT SEGMENT1 INTO FB_SEGMENTS(1) 84 FROM GL_CODE_COMBINATIONS 85 WHERE CODE_COMBINATION_ID = TO_NUMBER(X_DEFAULTS_CCID); 86 END IF;

47

Page 48: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

87 IF (FB_SEGMENTS(2) IS NULL) THEN 88 SELECT SEGMENT2 INTO FB_SEGMENTS(2) 89 FROM GL_CODE_COMBINATIONS 90 WHERE CODE_COMBINATION_ID = TO_NUMBER(X_DEFAULTS_CCID); 91 END IF; 92 IF (FB_SEGMENTS(4) IS NULL) THEN 93 SELECT SEGMENT4 INTO FB_SEGMENTS(4) 94 FROM GL_CODE_COMBINATIONS 95 WHERE CODE_COMBINATION_ID = TO_NUMBER(X_DEFAULTS_CCID); 96 END IF; 97 IF (FB_SEGMENTS(5) IS NULL) THEN 98 SELECT SEGMENT5 INTO FB_SEGMENTS(5) 99 FROM GL_CODE_COMBINATIONS 100 WHERE CODE_COMBINATION_ID = TO_NUMBER(X_DEFAULTS_CCID); 101 END IF; 102 EXCEPTION 103 WHEN NO_DATA_FOUND THEN 104 FND_MESSAGE.SET_NAME('FND', 'FLEX-FLEXFIELD COMB NOT FOUND'); 105 FND_MESSAGE.SET_TOKEN('CCID', X_DEFAULTS_CCID); 106 FND_MESSAGE.SET_TOKEN('FLXCODE', 'GL#'); 107 FND_MESSAGE.SET_TOKEN('QTSET', 'SET='); 108 FND_MESSAGE.SET_TOKEN('CCID2', '101'); 109 FB_ERROR_MSG := FND_MESSAGE.GET_ENCODED; 110 FB_STATUS := FALSE; 111 GOTO FB_CONCAT_SEG_VALS; 112 END; 113 114 <<FB_CONCAT_SEG_VALS>> 115 /* Concatenate segment values */ 116 FB_SEG_DELIM := FND_FLEX_EXT.GET_DELIMITER('SQLGL', 'GL#', 101); 117 FB_FLEX_SEG := FND_FLEX_EXT.CONCATENATE_SEGMENTS(5, FB_SEGMENTS, FB_SEG_DELIM); 118 RETURN FB_STATUS; 119 120 END; 121 END IF; 122 123 /* Structure not found. Error! */ 124 FND_MESSAGE.SET_NAME('FND', 'FLEX-BUILD NO ID_FLEX_NUM'); 125 FND_MESSAGE.SET_TOKEN('FUNCTION', 'OPS CORP ASSET_COST'); 126 FND_MESSAGE.SET_TOKEN('CODE', 'GL#'); 127 FND_MESSAGE.SET_TOKEN('NUM', TO_CHAR(FB_FLEX_NUM)); 128 FB_ERROR_MSG := FND_MESSAGE.GET_ENCODED; 129 RETURN FALSE; 130 131 EXCEPTION 132 WHEN OTHERS THEN 133 /* Handle Generic PLSQL Errors */ 134 FND_MESSAGE.SET_NAME('FND', 'SQL_PLSQL_ERROR'); 135 FND_MESSAGE.SET_TOKEN('ERRNO', TO_CHAR(SQLCODE)); 136 FND_MESSAGE.SET_TOKEN('REASON', SQLERRM); 137 FND_MESSAGE.SET_TOKEN('ROUTINE', 'OPS_CORP_ASSET_COST.BUILD'); 138 FB_ERROR_MSG := FND_MESSAGE.GET_ENCODED; 139 RETURN FALSE; 140 141 END BUILD_PRIVATE; 142 143 144 FUNCTION BUILD ( 145 FB_FLEX_NUM IN NUMBER DEFAULT 101, 146 ACCOUNT_CCID IN VARCHAR2 DEFAULT NULL, 147 ACCOUNT_SEGMENT IN VARCHAR2 DEFAULT NULL, 148 DEFAULTS_CCID IN VARCHAR2 DEFAULT NULL, 149 DISTRIBUTION_CCID IN VARCHAR2 DEFAULT NULL,

48

Page 49: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

150 FB_FLEX_SEG IN OUT VARCHAR2, 151 FB_ERROR_MSG IN OUT VARCHAR2) 152 RETURN BOOLEAN 153 IS 154 BEGIN 155 156 RETURN OPS_CORP_ASSET_COST.BUILD_PRIVATE ( 157 FB_FLEX_NUM, 158 ACCOUNT_CCID, 159 ACCOUNT_SEGMENT, 160 DEFAULTS_CCID, 161 DISTRIBUTION_CCID, 162 FB_FLEX_SEG, 163 FB_ERROR_MSG); 164 165 END BUILD; 166 167 168 END OPS_CORP_ASSET_COST;

49

Page 50: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

APPENDIX B –FAXAGTST.sql Test Script /*===========================================================================+ | Copyright (c) 1994 Oracle Corporation | | Redwood Shores, California, USA | | All rights reserved. | +===========================================================================*/ /* $Header: faxagtst.sql 115.2 2001/04/18 19:19:57 pkm ship $ */ /* simulating FAFBGCC function. */ whenever sqlerror exit failure prompt prompt &&Account_Type prompt Book &&Book prompt &&distribution_ccid prompt &&account_segment prompt &&account_ccid set serveroutput on DECLARE X_flex_account_type varchar2(30) := '&&account_type'; X_book_type_code varchar2(30) := '&&Book'; X_flex_num number; X_dist_ccid number := &&distribution_ccid; X_acct_segval varchar2(30) :='&&account_segment'; X_default_ccid number ; X_account_ccid number := &&account_ccid; X_distribution_id number default null; X_return_ccid number; itemtype varchar2(30) :='FAFLEXWF'; itemKey varchar2(30); h_concat_segs varchar2(2000); h_concat_ids varchar2(2000); h_concat_descrs varchar2(2000); h_errmsg varchar2(2000); h_encoded_msg varchar2(2000); result boolean; h_return_ccid number; char_date varchar2(27); h_appl_short_name varchar2(30); h_message_name varchar2(30); h_num number; h_string varchar2(100); BEGIN fnd_flex_workflow.debug_on; /* added for BUG# 1735689 to be consistent with 11.0 */ select accounting_flex_structure, flexbuilder_defaults_ccid into X_flex_num, X_default_ccid from fa_book_controls where book_Type_code=X_book_type_code; itemkey := FND_FLEX_WORKFLOW.INITIALIZE ('SQLGL', 'GL#', X_flex_num, 'FAFLEXWF'

50

Page 51: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

); /* Initialize the workflow item attributes */ wf_engine.SetItemAttrText(itemtype => itemtype, itemkey => itemkey, aname =>'BOOK_TYPE_CODE', avalue =>X_book_type_code); wf_engine.SetItemAttrText(itemtype => itemtype, itemkey => itemkey, aname =>'ACCOUNT_TYPE', avalue =>X_flex_account_type); wf_engine.SetItemAttrNumber(itemtype => itemtype, itemkey => itemkey, aname =>'CHART_OF_ACCOUNTS_ID', avalue =>X_flex_num); wf_engine.SetItemAttrNumber(itemtype => itemtype, itemkey => itemkey, aname => 'DISTRIBUTION_CCID', avalue => X_dist_ccid ); wf_engine.SetItemAttrText(itemtype => itemtype, itemkey => itemkey, aname => 'ACCT_SEG_VAL', avalue => X_acct_segval); wf_engine.SetItemAttrNumber(itemtype => itemtype, itemkey => itemkey, aname => 'DEFAULT_CCID', avalue => X_default_ccid); wf_engine.SetItemAttrNumber(itemtype => itemtype, itemkey => itemkey, aname => 'ACCOUNT_CCID', avalue => X_account_ccid); wf_engine.SetItemAttrNumber(itemtype => itemtype, itemkey => itemkey, aname => 'DISTRIBUTION_ID', avalue => X_distribution_id); result := FND_FLEX_WORKFLOW.GENERATE('FAFLEXWF', itemkey, h_return_ccid, h_concat_segs, h_concat_ids, h_concat_descrs, h_errmsg); IF (not result) THEN dbms_output.put_line('Failed to Generate CCID'); dbms_output.put_line('Segments : ' || h_concat_segs); /* BUG# 1504839 * enhancing the messaging here for fagda and for form level * transactions. Now dump the concatonated segs and the FND * error returned in encoded format from Workflow * -- bridgway 04/12/01 */ FND_MESSAGE.PARSE_ENCODED (ENCODED_MESSAGE => h_errmsg, --h_encoded_msg, APP_SHORT_NAME => h_appl_short_name, MESSAGE_NAME => h_message_name); dbms_output.put_line('Error Message: ' || h_message_name);

51

Page 52: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

if (h_message_name = 'FLEX-EXCLUDED BY XVAL RULE' or h_message_name = 'FLEX-EXCLUDED BY SEC. RULE') then h_num := INSTR(h_errmsg, 'MESSAGE', 1); h_num := h_num + 8; h_string := substr(h_errmsg, h_num); h_string := ltrim(rtrim(h_string)); dbms_output.put_line('XVAL Message: ' || h_string); elsif (h_message_name = 'FLEX-VALUE IS DISABLED') then h_num := INSTR(h_errmsg, 'VALUE', 16); h_num := h_num + 6; h_string := substr(h_errmsg, h_num); h_string := ltrim(rtrim(h_string)); dbms_output.put_line('Value: ' || h_string); else null; end if; /* end BUG# 1504839 */ return; END IF; if (h_return_ccid = -1) then select to_char(sysdate,'DD-MON-YYYY') into char_date from dual; h_return_ccid := FND_FLEX_EXT.get_ccid( 'SQLGL', 'GL#', X_flex_num, char_date, h_concat_segs); if (h_return_ccid = 0 ) then dbms_output.put_line('Failed to generate CCID'); FND_MESSAGE.SET_ENCODED(h_errmsg); h_encoded_msg := FND_MESSAGE.GET_ENCODED; FA_SRVR_MSG.ADD_MESSAGE (CALLING_FN=>'FAFLEX_PKG_WF.START_PROCESS', NAME=>h_encoded_msg); return; end if; end if; /* if h_return_ccid = -1 */ dbms_output.put_line('Success'); dbms_output.put_line('CCID is :' || to_char(h_return_ccid)); dbms_output.put_line('Segments : ' || h_concat_segs); exception when others then wf_core.context('FA_FLEX_PKG','StartProcess',X_book_type_code,X_dist_ccid,X_default_ccid,'FAFLEXWF'); raise; END ; / exit;

52

Page 53: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

APPENDIX C – Successful Run of FAXAGTST.sql Test Script (Line Numbers added for readability) 1 START FND_FLEX_WORKFLOW.INITIALIZE 2 APPLICATION_SHORT_NAME = SQLGL 3 CODE = GL# 4 NUM = 101 5 ITEMTYPE = FAFLEXWF 6 ITEMKEY GENERATED IS 35403 7 PROCESS SELECTED IS DEFAULT_ACCOUNT_GENERATION 8 APPLICATION ID IS 101 9 NUMBER OF SEGMENTS IS 5 10 START FND_FLEX_WORKFLOW.GENERATE 11 ITEMTYPE = FAFLEXWF 12 ITEMKEY = 35403 13 INSERT_IF_NEW = FALSE 14 START FND_FLEX_WORKFLOW_APIS.START_GENERATION 15 START FND_FLEX_WORKFLOW_APIS.COPY_SEGMENT_FROM_COMBINATION 16 APPLICATION SHORT NAME = SQLGL 17 APPLICATION ID = 101 18 CODE = GL# 19 NUM = 101 20 SEGMENT_IDENTIFIER = QUALIFIER 21 SEGMENT = GL_BALANCING 22 CCID = 12831 23 REPLACE_CURRENT_VALUE = FALSE 24 START FND_FLEX_WORKFLOW_APIS.UNIQUE_QUALIFIER_TO_SEGMENT 25 APPLICATION_ID = 101 26 CODE = GL# 27 NUM = 101 28 QUALIFIER = GL_BALANCING 29 SEGMENT NAME IS Company 30 START FND_FLEX_WORKFLOW_APIS.GET_SEGMENT_NUMBER 31 APPLICATION_ID = 101 32 CODE = GL# 33 NUM = 101 34 SEGMENT = Company 35 SEGMENT NUMBER IS 1 36 VALUE ASSIGNED : 01 37 START FND_FLEX_WORKFLOW_APIS.COPY_SEGMENT_FROM_COMBINATION 38 APPLICATION SHORT NAME = SQLGL 39 APPLICATION ID = 101 40 CODE = GL# 41 NUM = 101 42 SEGMENT_IDENTIFIER = QUALIFIER 43 SEGMENT = FA_COST_CTR 44 CCID = 12831 45 REPLACE_CURRENT_VALUE = FALSE 46 START FND_FLEX_WORKFLOW_APIS.UNIQUE_QUALIFIER_TO_SEGMENT 47 APPLICATION_ID = 101 48 CODE = GL# 49 NUM = 101 50 QUALIFIER = FA_COST_CTR 51 SEGMENT NAME IS Department 52 START FND_FLEX_WORKFLOW_APIS.GET_SEGMENT_NUMBER 53 APPLICATION_ID = 101 54 CODE = GL# 55 NUM = 101 56 SEGMENT = Department 57 SEGMENT NUMBER IS 2 58 VALUE ASSIGNED : 000 59 START FND_FLEX_WORKFLOW_APIS.ASSIGN_TO_SEGMENT

53

Page 54: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

60 APPLICATION ID = 101 61 CODE = GL# 62 NUM = 101 63 SEGMENT_IDENTIFIER = QUALIFIER 64 SEGMENT = GL_ACCOUNT 65 VALUE = 1570 66 REPLACE_CURRENT_VALUE = FALSE 67 START FND_FLEX_WORKFLOW_APIS.UNIQUE_QUALIFIER_TO_SEGMENT 68 APPLICATION_ID = 101 69 CODE = GL# 70 NUM = 101 71 QUALIFIER = GL_ACCOUNT 72 SEGMENT NAME IS Account 73 START FND_FLEX_WORKFLOW_APIS.GET_SEGMENT_NUMBER 74 APPLICATION_ID = 101 75 CODE = GL# 76 NUM = 101 77 SEGMENT = Account 78 SEGMENT NUMBER IS 3 79 VALUE ASSIGNED 80 START FND_FLEX_WORKFLOW_APIS.COPY_FROM_COMBINATION 81 APPLICATION SHORT NAME = SQLGL 82 APPLICATION ID = 101 83 CODE = GL# 84 NUM = 101 85 CCID = 12831 86 REPLACE_CURRENT_VALUE = FALSE 87 VALUE ASSIGNED TO SEGMENT 4 IS 0000 88 VALUE ASSIGNED TO SEGMENT 5 IS 000 89 START FND_FLEX_WORKFLOW_APIS.VALIDATE_COMBINATION 90 APPLICATION SHORT NAME = SQLGL 91 APPLICATION ID = 101 92 CODE = GL# 93 NUM = 101 94 NSEGMENTS = 5 95 VALIDATION_TYPE = GENERATE_CCID 96 DYNAMIC_INSERTS_ALLOWED = TRUE 97 INSERT IF NEW COMBINATION = FALSE 98 FND_FLEX_SEGMENT1 IS 01 99 FND_FLEX_SEGMENT2 IS 000 100 FND_FLEX_SEGMENT3 IS 1570 101 FND_FLEX_SEGMENT4 IS 0000 102 FND_FLEX_SEGMENT5 IS 000 103 CONCATENATED SEGMENTS TO BE VALIDATED IS 01-000-1570-0000-000 104 VALIDATION SUCCEEDED 105 CCID IS 13528 106 START FND_FLEX_WORKFLOW_APIS.END_GENERATION 107 PROCESS STATUS IS COMPLETE 108 PROCESS RESULT IS SUCCESS 109 CCID IS 13528 110 CONCATENATED SEGMENTS IS 01-000-1570-0000-000 111 CONCATENATED IDS IS 01-000-1570-0000-000 112 CONCATENATED DESCRIPTIONS IS Operations-Balance Sheet-Asset Clearing-No Sub 113 Account-No Product 114 NEW COMBINATION IS FALSE 115 VALIDATION_STATUS IS VALID

54

Page 55: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

APPENDIX D – FAGDA_test.sql Test Script This script is on Metalink under NOTE:146661.1. -- @FAGDA_test.sql <Asset_id> "<book_type_code>" -- Ex : @FAGDA_test.sql 1234 "CORP" -- Author: Ian Freeberg ------------------------------------------------------ set echo off set define _ set define & set serveroutput on size 1000000 set trimspool on set trimout on set verify off set pagesize 0 set linesize 9999 set heading off set feedback off set timing off spool FAGDA_test.html -- Prompt *************************<BR> -- Prompt Creating Temporary tables<BR> -- Prompt *************************<BR> create table agt_accounts_temp (

account_type varchar2(60), account_source varchar2(60),

account_seg_cn varchar2(60), account_ccid_cn varchar2(60)

) pctfree 0 storage (initial 100K); -- Prompt *************************<BR> -- Prompt Inserting Rows<BR> -- Prompt *************************<BR> begin -- Account Type Source Type Column1 varchar2(25) Column2 number insert into agt_accounts_temp values('DEPRN_EXP', 'ASSET', 'deprn_expense_acct', null); insert into agt_accounts_temp values('ASSET_CLEARING', 'CATEGORY', 'asset_clearing_acct','asset_clearing_account_ccid'); insert into agt_accounts_temp values('ASSET_COST', 'CATEGORY', 'asset_cost_acct', 'asset_cost_account_ccid'); insert into agt_accounts_temp values('CIP_CLEARING', 'CATEGORY', 'cip_clearing_acct', 'wip_clearing_account_ccid'); insert into agt_accounts_temp values('CIP_COST', 'CATEGORY', 'cip_cost_acct', 'wip_cost_account_ccid'); insert into agt_accounts_temp values('DEPRN_RSV', 'CATEGORY', 'deprn_reserve_acct', 'reserve_account_ccid'); insert into agt_accounts_temp values('REV_AMORT', 'CATEGORY', 'reval_amortization_acct','reval_amort_account_ccid'); insert into agt_accounts_temp values('REV_RSV', 'CATEGORY', 'reval_reserve_acct', 'reval_reserve_account_ccid'); insert into agt_accounts_temp values('POS_GAIN', 'BOOK', 'proceeds_of_sale_gain_acct', null); insert into agt_accounts_temp values('COR_GAIN', 'BOOK', 'cost_of_removal_gain_acct', null); insert into agt_accounts_temp values('NBV_GAIN', 'BOOK', 'nbv_retired_gain_acct', null); insert into agt_accounts_temp values('POS_LOSS', 'BOOK', 'proceeds_of_sale_loss_acct', null);

55

Page 56: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

insert into agt_accounts_temp values('COR_LOSS', 'BOOK', 'cost_of_removal_loss_acct', null); insert into agt_accounts_temp values('NBV_LOSS', 'BOOK', 'nbv_retired_loss_acct', null); insert into agt_accounts_temp values('POS_CLEARING', 'BOOK', 'proceeds_of_sale_clearing_acct', null); insert into agt_accounts_temp values('COR_CLEARING', 'BOOK', 'cost_of_removal_clearing_acct', null); insert into agt_accounts_temp values('AP_INTERCO', 'BOOK', 'ap_intercompany_acct', null); insert into agt_accounts_temp values('AR_INTERCO', 'BOOK', 'ar_intercompany_acct', null); insert into agt_accounts_temp values('DEF_DEPRN_EXP', 'BOOK', 'deferred_deprn_expense_acct', null); insert into agt_accounts_temp values('DEF_DEPRN_RSV', 'BOOK', 'deferred_deprn_reserve_acct', null); insert into agt_accounts_temp values('DEPRN_ADJ', 'BOOK', 'deprn_adjustment_acct', null); insert into agt_accounts_temp values('REV_RSV_GAIN', 'BOOK', 'reval_rsv_retired_gain_acct', null); insert into agt_accounts_temp values('REV_RSV_LOSS', 'BOOK', 'reval_rsv_retired_loss_acct', null); commit; end; / set serveroutput on DECLARE user_asset_id number := &1; user_book varchar2(30) := '&2'; X_flex_account_type varchar2(30); X_book_type_code varchar2(30) := user_book; X_flex_num number; X_dist_ccid number; X_acct_segval varchar2(25); X_default_ccid number; X_account_ccid number; X_distribution_id number default null; X_return_ccid number; itemtype varchar2(30) := 'FAFLEXWF'; itemKey varchar2(30); h_concat_segs varchar2(2000); h_concat_ids varchar2(2000); h_concat_descrs varchar2(2000); h_errmsg varchar2(2000); h_encoded_msg varchar2(2000); result boolean; h_return_ccid number; char_date varchar2(27); /* finding distribution_ccid */ cursor dist_ccid_cursor is select asset_id, distribution_id, code_combination_id from fa_distribution_history where asset_id = user_asset_id and transaction_header_id_out is NULL; /* creating cursor for the 23 acct types */ cursor acct_type_cursor is select account_type, account_source, account_seg_cn, account_ccid_cn from agt_accounts_temp;

56

Page 57: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

/* accounting_flex_structure */ cursor flex_num_cursor is select accounting_flex_structure from fa_book_controls where book_type_code = user_book; /* default_ccid */ cursor default_ccid_cursor is select flexbuilder_defaults_ccid, book_type_code from fa_book_controls where book_type_code = user_book; cursor_string varchar2(2000); v_cursor_id number; v_dummy integer; type account_segment_type is record ( proceeds_of_sale_gain_acct varchar2(25), cost_of_removal_gain_acct varchar2(25), nbv_retired_gain_acct varchar2(25), proceeds_of_sale_loss_acct varchar2(25), cost_of_removal_loss_acct varchar2(25), nbv_retired_loss_acct varchar2(25), proceeds_of_sale_clearing_acct varchar2(25), cost_of_removal_clearing_acct varchar2(25), ap_intercompany_acct varchar2(25), ar_intercompany_acct varchar2(25), deferred_deprn_expense_acct varchar2(25), deferred_deprn_reserve_acct varchar2(25), deprn_adjustment_acct varchar2(25), reval_rsv_retired_gain_acct varchar2(25), reval_rsv_retired_loss_acct varchar2(25), asset_clearing_acct varchar2(25), asset_cost_acct varchar2(25), cip_clearing_acct varchar2(25), cip_cost_acct varchar2(25), deprn_reserve_acct varchar2(25), reval_amortization_acct varchar2(25), reval_reserve_acct varchar2(25), deprn_expense_acct varchar2(25), asset_clearing_account_ccid number, asset_cost_account_ccid number, wip_clearing_account_ccid number, wip_cost_account_ccid number, reserve_account_ccid number, reval_amort_account_ccid number, reval_reserve_account_ccid number ); account_segment_rec account_segment_type; column_name_hold1 varchar2(30); column_name_hold2 varchar2(30); cnh1_alais varchar2(25); cnh2_alais number; v_ErrorCode number; v_ErrorText varchar2(200); Too_Many_Distributed EXCEPTION; PRAGMA EXCEPTION_INIT(Too_Many_Distributed, -2042); error_position_end number; error_position integer; hold_debug varchar2(1); err_status number := 0; begin dbms_output.put_line('<html><head><title>Account Generator Test</title></head>'); dbms_output.put_line('<body>'); dbms_output.put_line('<font color="Blue" size=+2>');

57

Page 58: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

dbms_output.put_line('Account Generator Test<BR>'); dbms_output.put_line('</font><HR>'); for dist_ccid_rec in dist_ccid_cursor loop dbms_output.put_line('<font color="Purple" size=+2>'); dbms_output.put_line('Asset_id: ' || dist_ccid_rec.asset_id); dbms_output.put_line('<BR>Book_type_code: ' || user_book ); dbms_output.put_line('<BR>Distribution_id: ' || dist_ccid_rec.distribution_id); dbms_output.put_line('</font><HR>'); for acct_type_rec in acct_type_cursor loop dbms_output.put_line('<Table cellpadding="0" cellspacing="0" border=0>'); /* Parameter 1 Account Type */ X_flex_account_type := acct_type_rec.account_type; dbms_output.put_line('<tr><td>Account_type:</td><td>' || X_flex_account_type || '</td></tr>'); /* Parameter 2 Book_type_code */ dbms_output.put_line('<tr><td>Book_type_code:</td><td>' || X_book_type_code || '</td></tr>'); /* Parameter 3 Flex Structure */ for flex_num_rec in flex_num_cursor loop X_flex_num := flex_num_rec.accounting_flex_structure; dbms_output.put_line('<tr><td>Flex_Structure:</td><td>' || X_flex_num || '</td></tr>'); end loop; /* Parameter 4 distribution_ccid */ X_dist_ccid := dist_ccid_rec.code_combination_id; dbms_output.put_line('<tr><td>Distribution_ccid:</td><td>' || X_dist_ccid || '</td></tr>'); /* Parameter 5 and 7 account_segment */ if acct_type_rec.account_source = 'BOOK' then column_name_hold1 := acct_type_rec.account_seg_cn; cursor_string := 'select ' || column_name_hold1 || ' cnh1_alais' || Chr(10) || 'from fa_book_controls' || Chr(10) || 'where book_type_code = '''|| user_book ||''''; v_cursor_id := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(v_cursor_id, cursor_string, DBMS_SQL.V7); DBMS_SQL.DEFINE_COLUMN(v_cursor_id, 1, cnh1_alais, 25); v_dummy := DBMS_SQL.EXECUTE(v_cursor_id); loop if DBMS_SQL.FETCH_ROWS(v_cursor_id) = 0 then exit; end if; DBMS_SQL.COLUMN_VALUE(v_cursor_id, 1, cnh1_alais); X_acct_segval := cnh1_alais; X_account_ccid := 0; dbms_output.put_line('<tr><td>Account_segment:</td><td>' || X_acct_segval || '</td></tr>'); dbms_output.put_line('<tr><td>Account_ccid:</td><td>' || X_account_ccid || '</td></tr>'); end loop; DBMS_SQL.CLOSE_CURSOR(v_cursor_id); end if; if acct_type_rec.account_source = 'CATEGORY' then column_name_hold1 := acct_type_rec.account_seg_cn;

58

Page 59: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

column_name_hold2 := acct_type_rec.account_ccid_cn; cursor_string := 'select' || Chr(10) || column_name_hold1 || ' cnh1_alais,' || Chr(10) || column_name_hold2 || ' cnh2_alais' || Chr(10) || 'from fa_category_books cb,' || Chr(10) || 'fa_additions ad' || Chr(10) || 'where cb.category_id = ad.asset_category_id' || Chr(10) || 'and ad.asset_id = ' || user_asset_id || Chr(10) || 'and cb.book_type_code = '''|| user_book ||''''; v_cursor_id := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(v_cursor_id, cursor_string, DBMS_SQL.V7); DBMS_SQL.DEFINE_COLUMN(v_cursor_id, 1, cnh1_alais, 25); DBMS_SQL.DEFINE_COLUMN(v_cursor_id, 2, cnh2_alais); v_dummy := DBMS_SQL.EXECUTE(v_cursor_id); loop if DBMS_SQL.FETCH_ROWS(v_cursor_id) = 0 then exit; end if; DBMS_SQL.COLUMN_VALUE(v_cursor_id, 1, cnh1_alais); DBMS_SQL.COLUMN_VALUE(v_cursor_id, 2, cnh2_alais); X_acct_segval := cnh1_alais; X_account_ccid := cnh2_alais; dbms_output.put_line('<tr><td>Account_segment:</td><td>' || cnh1_alais || '</td></tr>'); dbms_output.put_line('<tr><td>Account_ccid:</td><td>' || cnh2_alais || '</td></tr>'); end loop; DBMS_SQL.CLOSE_CURSOR(v_cursor_id); end if; if acct_type_rec.account_source = 'ASSET' then column_name_hold1 := acct_type_rec.account_seg_cn; cursor_string := 'select ' || column_name_hold1 || ' cnh1_alais' || Chr(10) || 'from fa_category_books' || Chr(10) || 'where book_type_code = '''|| user_book ||'''' || Chr(10) || 'and category_id = (select asset_category_id' || Chr(10) || 'from fa_additions' || Chr(10) || 'where asset_id = '|| user_asset_id ||')'; v_cursor_id := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(v_cursor_id, cursor_string, DBMS_SQL.V7); DBMS_SQL.DEFINE_COLUMN(v_cursor_id, 1, cnh1_alais, 25); v_dummy := DBMS_SQL.EXECUTE(v_cursor_id); loop if DBMS_SQL.FETCH_ROWS(v_cursor_id) = 0 then exit; end if; DBMS_SQL.COLUMN_VALUE(v_cursor_id, 1, cnh1_alais); X_acct_segval := cnh1_alais; X_account_ccid := 0; dbms_output.put_line('<tr><td>Account_segment:</td><td>' || X_acct_segval || '</td></tr>'); dbms_output.put_line('<tr><td>Account_ccid:</td><td>' ||

59

Page 60: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

X_account_ccid || '</td></tr>'); end loop; DBMS_SQL.CLOSE_CURSOR(v_cursor_id); end if; /* Parameter 6 Default_ccid */ for default_ccid_rec in default_ccid_cursor loop X_default_ccid := default_ccid_rec.flexbuilder_defaults_ccid; dbms_output.put_line('<tr><td>Default_ccid:</td><td>' || X_default_ccid || '</td></tr>'); end loop; dbms_output.put_line('</table><BR>'); dbms_output.put_line('<!-- <font size=-2>'); BEGIN fnd_flex_workflow.debug_on; itemkey := FND_FLEX_WORKFLOW.INITIALIZE ('SQLGL', 'GL#', X_flex_num, 'FAFLEXWF' ); /* Initialize the workflow item attributes */ wf_engine.SetItemAttrText(itemtype => itemtype, itemkey => itemkey, aname => 'BOOK_TYPE_CODE', avalue => X_book_type_code); wf_engine.SetItemAttrText(itemtype => itemtype, itemkey => itemkey, aname => 'ACCOUNT_TYPE', avalue => X_flex_account_type); wf_engine.SetItemAttrNumber(itemtype => itemtype, itemkey => itemkey, aname => 'CHART_OF_ACCOUNTS_ID', avalue => X_flex_num); wf_engine.SetItemAttrNumber(itemtype => itemtype, itemkey => itemkey, aname => 'DISTRIBUTION_CCID', avalue => X_dist_ccid ); wf_engine.SetItemAttrText(itemtype => itemtype, itemkey => itemkey, aname => 'ACCT_SEG_VAL', avalue => X_acct_segval); wf_engine.SetItemAttrNumber(itemtype => itemtype, itemkey => itemkey, aname => 'DEFAULT_CCID', avalue => X_default_ccid); wf_engine.SetItemAttrNumber(itemtype => itemtype, itemkey => itemkey, aname => 'ACCOUNT_CCID', avalue => X_account_ccid); wf_engine.SetItemAttrNumber(itemtype => itemtype, itemkey => itemkey, aname => 'DISTRIBUTION_ID', avalue => X_distribution_id); result := FND_FLEX_WORKFLOW.GENERATE('FAFLEXWF',

60

Page 61: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

itemkey, h_return_ccid, h_concat_segs, h_concat_ids, h_concat_descrs, h_errmsg); dbms_output.put_line('</font> -->'); IF (not result) THEN err_status := 1; dbms_output.put_line('<BR><font color="red" size=+2>Failed to generate CCID</font><BR>'); dbms_output.put_line('Segments : ' || h_concat_segs || '<BR>'); dbms_output.put_line('Error : ' || h_errmsg || '<BR>'); -- return; END IF; if (h_return_ccid = -1) then select to_char(sysdate,'DD-MON-YYYY') into char_date from dual; h_return_ccid := FND_FLEX_EXT.get_ccid( 'SQLGL', 'GL#', X_flex_num, char_date, h_concat_segs); if (h_return_ccid = 0 ) then err_status := 1; dbms_output.put_line('<BR><font color="red" size=+2>Failed to generate CCID</font><BR>'); dbms_output.put_line('Error : ' || h_errmsg || '<BR>'); FND_MESSAGE.SET_ENCODED(h_errmsg); h_encoded_msg := FND_MESSAGE.GET_ENCODED; FA_SRVR_MSG.ADD_MESSAGE(CALLING_FN=>'FAFLEX_PKG_WF.START_PROCESS', NAME=>h_encoded_msg); -- return; end if; end if; /* if h_return_ccid = -1 */ if err_status != 1 then dbms_output.put_line('<BR><font color="green" size=+2>Success</font><BR>'); dbms_output.put_line('CCID is :' || to_char(h_return_ccid) || '<BR>'); dbms_output.put_line('Segments : ' || h_concat_segs || '<BR>'); end if; err_status := 0; exception when others then wf_core.context('FA_FLEX_PKG','StartProcess',X_book_type_code, X_dist_ccid,X_default_ccid,'FAFLEXWF'); raise; end; dbms_output.put_line('<BR><HR>'); end loop; end loop; dbms_output.put_line('</body></html>'); exception when others then error_position := DBMS_SQL.LAST_ERROR_POSITION; dbms_output.put_line('<hr><font size=+2 color=red>Error: ORA' || SQLCODE || '</font>'); dbms_output.put_line('<br>Position: ' || error_position || ' of '

61

Page 62: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

|| length(cursor_string) || '<br>'); dbms_output.put_line(replace(substr(cursor_string,1,error_position),chr(10),'<br>')); error_position_end := instr(cursor_string,' ',error_position+1) - error_position; dbms_output.put_line('<font color=red>' || replace(substr(cursor_string,error_position+1, error_position_end),chr(10),'<br>') || '</font>'); dbms_output.put_line(replace(substr(cursor_string,error_position+error_position_end+1), chr(10),'<br>') || '<br>'); hold_debug := 'N'; DBMS_SQL.CLOSE_CURSOR(v_cursor_id); end; / -- Prompt <BR>************************* -- Prompt <BR>Dropping Temporary tables -- Prompt <BR>*************************<BR> drop table agt_accounts_temp; commit; -- Prompt <BR>************************* -- Prompt <BR>Table Dropped -- Prompt <BR>*************************<BR> spool off

62

Page 63: Diagnosing Account Generator Errors in Fixed Assets - Fagda[1]

APPENDIX E – Submitting Generate Account from the Command Line To bypass the concurrent manager and submit the Generate Accounts from the command line, go to $FA_TOP/bin type in: FAGENID apps/apps 0 Y '&BOOK' and then press ENTER the process will generate a log file and a report in the same directory from which you submitted it --->$FA_TOP/bin. Make sure that the user has write access to the directory from which the process is submitted.

63