Saturday, March 29, 2025

How Costing works in Oracle Payroll?

 What is costing?


Costing in Oracle Payroll R12 helps track payroll expenses. Debits record costs, Credits allocate payments, and balancing ensures they match. This keeps financial records accurate.

Levels of Costing (from lowest to highest priority):


Payroll
Element Link
Organization
Assignment
Element Entry

Types of Costing:

Costed:

· Uses all 5 levels of the costing hierarchy.

Fixed Costed:

· Fix costed works in the same way as costed but it does not use the assignment or organization level costing.

Distributed:

· Used when we want to distribute overhead costs over other elements.

· Requires creation of distribution set of elements

· Assign the distribution set to an element at the element link level.


What is costing/balancing and debit/credit?



Costing: Cost borne by the company
Balancing: Balance the effect to the company

Debit: Costed to company. Money is going out from company account. For e.g. basic salary is paid to an employee, it will be a debited from the company account.

Credit: Reverse of Debit. Money is coming into the company account. For e.g. rent deduction from employee, it will be credit to the company account.

Below table shows the debit/credit based on element classification:


How to enable an input value for Costing?

By default, the input value with name “Pay Value” is enabled for costing, but if the input value name is different then we need to enable the costing at element link level as shown below:


Tables effected in payroll costing:

PAY_PAYROLL_ACTIONS
PAY_ASSIGNMENT_ACTIONS
PAY_RUN_RESULTS
PAY_COSTS


Finally, if we want to fetch the costing details for an element from the run results, below is the query to do so:

SELECT
papf.employee_number,
petf.element_name,
pivf.name,
prrv.result_value,
(
SELECT
decode(
pc.debit_or_credit, ‘D’, ‘Debit’, ‘Credit’
)
|| ‘ : ‘
|| concatenated_segments
FROM
pay_cost_allocation_keyflex pcak,
pay_costs pc
WHERE
pcak.cost_allocation_keyflex_id = pc.cost_allocation_keyflex_id
AND pc.run_result_id = prrv.run_result_id
AND pc.input_value_id = prrv.input_value_id
AND pc.balance_or_cost = ‘C’
) costing_segment,
(
SELECT
decode(
pc.debit_or_credit, ‘D’, ‘Debit’, ‘Credit’
)
|| ‘ : ‘
|| pcak.concatenated_segments
FROM
pay_cost_allocation_keyflex pcak,
pay_costs pc
WHERE
pcak.cost_allocation_keyflex_id = pc.cost_allocation_keyflex_id
AND pc.run_result_id = prrv.run_result_id
AND pc.input_value_id = prrv.input_value_id
AND pc.balance_or_cost = ‘B’
) balancing_segment
FROM
pay_payroll_actions ppa,
pay_assignment_actions paa,
pay_run_results prr,
pay_element_types_f petf,
pay_run_result_values prrv,
per_all_assignments_f paaf,
pay_input_values_f pivf,
per_all_people_f papf
WHERE
ppa.payroll_action_id = paa.payroll_action_id
AND paa.assignment_action_id = prr.assignment_action_id
AND prr.element_type_id = petf.element_type_id
AND paaf.assignment_id = paa.assignment_id
AND papf.person_id = paaf.person_id
AND prr.run_result_id = prrv.run_result_id
AND papf.employee_number =:p_employee_number
AND ppa.effective_date =:p_effective_date
AND prrv.input_value_id = pivf.input_value_id
AND petf.element_name = nvl(petf.element_name,:p_element_name)
AND ppa.effective_date BETWEEN petf.effective_start_date AND petf.effective_end_date
AND ppa.effective_date BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND ppa.effective_date BETWEEN pivf.effective_start_date AND pivf.effective_end_date
AND ppa.effective_date BETWEEN papf.effective_start_date AND papf.effective_end_date
AND EXISTS (
SELECT
1
FROM
pay_costs pc
WHERE
pc.input_value_id = prrv.input_value_id
AND pc.run_result_id = prrv.run_result_id
);