add

About Me

My photo
Oracle Apps - Techno Functional consultant

Wednesday, June 20

Troubleshooting costing issues within the Oracle Payroll


1 SET UP OVERVIEW
1.1 Costing Flexfield
Payroll costing is setup using the Payroll Cost Allocation Key Flexfield. Flexfield Segments are defined to allow cost codes to be allocated to set areas within the organization, Example: cost center\regions\projects\accounts.The specific setup is determined by the individual accounting\business needs.

Example of Cost Allocation Flexfield:

       Segment  Name      
       1        Region    
       2        Project    
       3        Account    
1.2 Flexfield Qualifiers
Flexfield Qualifiers are used to set at which level the segments can be used within the system. There are five levels at which costing information can be entered : 
 
    [Fig 1.]
    Cost Level/Qualifier        Application Form  
    1. Element Entry           Element Entry
    2. Assignment               Employee Assignment 
    3. Organization             Define Organization  
    4. Element Link             Element Link  
    5. Payroll                      Define Payroll

You can set a cost segment to be at just one or many levels within the system.
Note: If it does not have the flexfield qualifier set at a specific level' then it will not appear on the corresponding form. Qualifiers should be checked if you expect to see a segment at a certain level and it is not available.
1.3 Balancing
If using double entry bookkeeping you should also set up balance segments. This allows the opposite result of the costed value to be captured, in a specific code. There is a flexfield qualifier for balancing, which allows the double entry segments of the cost code to be entered via the element link form.

    Cost Level/Qualifier       Application Form  
    Balancing                      Element Link
1.4 Balance Adjustment
It is also possible to cost a balance adjustment; this requires you to enter cost codes on the Adjust Balance form. When you have entered the cost codes, you need to set the costed checkbox.  This sets the BALANCE_ADJ_COST_FLAG to Y,on the PAY_ELEMENT_ENTRIES_F table and the adjustment is costed.
1.5 Suspense Account
The system allows you to set up a suspense account; this is another set of Flexfield segments defined on the Payroll form.  This is used if validation of the costing flexfield fails. If that is the case then the cost amounts will be costed to the suspense account. It is important to be aware of this as, if you are getting values costed to a different code than expected, this could be the suspense account.  If a suspense account is not defined and the cost flexfield fails, then the cost codes will be null.
1.6 Costing Hierarchy
The costing process will determine which level to assign the costed values to using the hierarchy rule shown in (Fig 1. above) where 1 is high and 5 is low priority.

If you have the following setup :  
   
     Segment  Name     Qualifier  
     1        Region   Element Entry + Payroll 
     2        Project  Element Link  
     3        Account  Element Link + Element Entry   

You will then be able to enter values at the following levels:

    a. At Payroll Form -  Region
    b. At Element Entry Form -  Region \ Account
    c. At Element Link Form -   Project \ Account

If you enter a value at all the levels :

    a. Payroll Level - Region(11111)
    b. Element Entry Level - Region(66666)\Account(77777)
    c. Element Link Level - Project(22222)\Account(44444)

The costing will check to validate these combinations against the hierarchy. Region is defined at payroll level, but this would be overridden by the code defined at element entry level. The same is true of Account, it is entered at element link level, but the element entry level would take priority. If a segment is displayed at a level and left Null, then the next level in the hierarchy will be used.

The actual cost combination would be:
 
    Region(66666)\Account(77777)\Project(22222)

1.7 Costing Types
The type of costing is also set on the Element Link form and can be Costed, Fixed Costed, Distributed or Not Costed.
1.7.1 Costed

This works as defined in the Costing Hierarchy section above, using all five of the available levels.(see fig 1.above)  It is important to note that this type allows you to use assignment level costing. This means you can split the run result values over more than one set of cost codes. This is done on the Assignment costing screen, you are able to enter percentages for specific sets of segments, the sum of these must be 100 percent.
    Proportion %    Cost Code
    60              111.444.555
    40              222.555.666

If a run result of 100 pounds is costed here, 60 will be costed to cost code111.444.555 and 40 to cost code 222.555.666.
1.7.2 Fix Costed

Fix costed works in the same way as costed, except it does not use the assignment or organization level costing. So the Fix costed hierarchy is as follows, with 1 having the highest priority.
    Fig 2.
    Cost Level/Qualifier        Application Form  
    1. Element Entry            Element Entry
    2. Element Link              Element Link  
    3. Payroll                       Define Payroll
1.7.3 Distributed
Distributed costing requires you to create a distribution set of elements.
This is done from the Element Set form. Using a type of Distribution Set, you include the elements you want to be in the set. You can then assign the distribution set to an element at link level. The element is then costed as a member of the distribution set, so the costing result is divided by the sum of the distribution sets costings and multiplied by the number of members in the set.

2 TECHNICAL OVERVIEW
2.1 Running Costing
To run the costing process you submit the concurrent request Costing from Submit Processes and Reports form. This will prompt for the parameters Start Date, End Date, Payroll and Consolidation Set (if used). The process will then process all costable values between the two dates for the specified payroll.
2.2 What is Costed?
The costing processes picks up run results.  The specific payroll actions that
will be picked up by the costing process are in the PAY_ACTION_CLASSIFICATIONS
table and have a CLASSIFICATION_NAME of COSTED, shown below. 
  PAY_ACTION_CLASSIFICATIONS table :

  CLASSIFICATION_NAME  ACTION_TYPE  MEANING
  COSTED               B            Balance adjustment
  COSTED               Q            QuickPay Run
  COSTED               R            Run
  COSTED               V            Reversal
So the process will create an assignment_action for every assignment that has a run result from one of the costed classifications. Therefore if an element for an assignment has had both a Quick Pay and a reversal, then this will produce one assignment action for the assignment, with both of the actions costed. The process then populates the PAY_COST table(below) with the run result value (costed_value). The actual cost code is stored on the PAY_COST_ALLOCATION_KEYFLEX table in the concatenated_segments column, this is referenced using the cost_allocation_keyflex_id from PAY_COSTS.
2.3 Rolling Back
It is possible to rollback the costing process, using the rollback request from Submit Reports and Requests. This is only possible if you have not run the Transfer to GL process for that costing process. If you have you will need to rollback the transfer first, then the costing or you will get locks.

It is also worth noting that if you have costed a value to the wrong account by mistake, you can rollback the costing change the cost code and re-run. This will only pick up the new set of segments; if the actual run result is incorrect, you will have to rollback the actual process that calculated the value, a payroll for example. 

3 ISSUES & TROUBLESHOOTING
3.1 Unexpected Cost Codes
It you get values costed to the a cost code you did not expect, then firstly check this is not the suspense account. If it is the suspense account, you can assume that the Costing Flexfield has failed validation. You should then check the PAY_MESSAGE_LINES table and the costing log file for the reason validation failed. There are some other reasons that the suspense account will be used,  they are:

    1. A costing distribution set has no members.
    2. Sum of distribution set values is Null.
    3. The combination of assignment level costing, does not equal 100%.

If you get no cost code for a run result, then you have either not specified a suspense account or both the cost flex and the suspense account have failed validation.

If the cost codes you are getting are not the suspense account and validation has not failed, then it is likely that you have the costing segment set at a level higher up the hierarchy.  To verify this you can check the following tables using the cost_allocation_keyflex_id from PAY_COSTS. If you find the value at a higher level you will need to rollback and change the set up before rerunning.
    Costing Level    Table                                                  Column
    Element Entry    PAY_ELEMENT_ENTRIES_F           cost_allocation_keyflex_id
    Assignment        PAY_COST_ALLOCATIONS_F         cost_allocation_keyflex_id
    Organization      HR_ALL_ORGANIZATION_UNITS    cost_allocation_keyflex_id
    Element Link     PAY_ELEMENT_LINKS_F                 cost_allocation_keyflex_id
    Payroll              PAY_PAYROLLS_F                            cost_allocation_keyflex_id
3.2 Unexpected Costed Values
If you get problems where the actual costed value is not what is expected. This is not normally due to the costing process itself, as this does not do calculations, except for when percentage values are set at assignment level and when processing distributed costing. It is worth checking the Input Values from the element link of the offending element. When you set the link to be costed, you can then go to the input values and have them costed or not costed. If therefore you only want to cost the input value Pay Value, you must make sure any other input values that could be costed are not checked. If you have another input value also checked, costing will cost both values. The solution is to just cost the Pay Value input value.
3.3 Performance
Performance of the costing process on occasion used to be slow. However some significant changes to the core code that addressed this issue, the main changes are in the up-to-date C Code Patch. (See Version Checking) Ensure you have the latest version of the C code before any further investigation is made. If you have the latest version and still suffer performance problems, there is some tuning that can be done. This involves altering the way the costing process validates against the pay_cost_allocation_keyflex table. This can be done by setting the value of the parameter COST_PLS_VAL in the table PAY_ACTION_PARAMETERS. This parameter is usually not defined, this means the costing process uses (AOL C Code) validation. This is fine until the table becomes increasingly populated and
performance starts to slow. It is then possible to set COST_PLS_VAL to value Y.  This will force the costing process to validate using the (fnd_flex_keyval PL/SQL API), this will have to be used together with indexes on the pay_cost_allocation_keyflex table, in order to see a performance improvements.
3.4 Deadlock Issue
A problem was reported whereby the costing process caused database deadlocks.
Again this should be resolved by applying the latest version of the C code. 
(See Version checking)

4 VERSION CHECKING
The costing process is part of the payroll C code chain, that calculates
payroll run results. The main C code component used for costing is pycos.lpc.

Versions of the costing is delivered with the payroll C Code Chain.
To determine version of pycos.lpc - C Code for Costing :

    UNIX -
    $ cd $PAY_TOP/bin
    $ strings -a PYUGEN|grep pycos.lpc

   result:
  $Header: pycos.lpc 110.24 98/11/26 02:03:22 porting ship
    NT -
    Start a command prompt session
    cd PAY_TOP/bin
    find "pycos.lpc" pyugen.exe

No comments: