Oralce r12 HRMS SQL

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5
At a glance
Powered by AI
The document discusses Oracle Payroll tables and queries. Key tables are categorized into Element Entry, Payroll Run, and Costing & Pre Payment tables.

The tables are categorized into Element Entry Related Tables, Payroll Run Related Tables, and Costing & Pre Payment Related Tables.

The query provided gets the element history for an employee. It starts with 'select' statement.

select i.organization_id, o.name, l.meaning, l.

lookup_type,
i.org_information_context, i.org_information1,
i.org_information2 , i.org_information3 , i.org_information4
from hr_all_organization_units o
, hr_organization_information i
, fnd_lookup_values l
where o.organization_id = i.organization_id
and i.org_information1 = l.lookup_code
and o.name like 'YRC%'

SELECT
ppf.employee_number,
ppf.full_name,
(ppa.EFFECTIVE_DATE)Payroll_Run_Date,
TP.PERIOD_NAME,
sum(decode(pec.CLASSIFICATION_NAME,'Earnings',to_number(rrv.result_value),0))
Earnings,
sum(decode(pec.CLASSIFICATION_NAME,'Involuntary
Deductions',to_number(rrv.result_value),0)) Involuntary_Deductions,
sum(decode(pec.CLASSIFICATION_NAME,'Employer
Charges',to_number(rrv.result_value),0))Employer_Charges,
sum(decode(pec.CLASSIFICATION_NAME,'Information',to_number(rrv.result_value),0))
Information
FROM per_people_x ppf,
per_assignments_x paf,
pay_assignment_actions pas,
pay_payroll_actions ppa,
pay_run_results rr,
pay_run_result_values rrv,
pay_element_types_f ety,
pay_input_values_F I,
PER_TIME_PERIODS TP,
PAY_ELEMENT_CLASSIFICATIONS_VL pec
WHERE ppf.person_id = paf.person_id
AND paf.assignment_id = pas.assignment_id
AND pas.assignment_action_id = rr.assignment_action_id
AND ppa.payroll_action_id = pas.payroll_action_id
AND rr.element_type_id = ety.element_type_id
AND i.element_type_id = ety.element_type_id
AND rrv.run_result_id = rr.run_result_id
AND rrv.input_value_id = i.input_value_id
and TP.TIME_PERIOD_ID = PPA.TIME_PERIOD_ID
and ety.CLASSIFICATION_ID=pec.CLASSIFICATION_ID
AND i.name = 'Pay Value'
and ppa.EFFECTIVE_DATE BETWEEN :p_st_effect_date AND :p_end_effect_date
group by ppf.employee_number,
ppf.person_id,
ppf.full_name,
ppa.TIME_PERIOD_ID,
ppa.EFFECTIVE_DATE,
TP.PERIOD_NAME,
paf.ORGANIZATION_ID
order by ppf.employee_number
and ppf.employee_number = nvl(:p_emp_number,ppf.employee_number)

For fusion but not working


SELECT
PPF.PERSON_NUMBER,
PPFN.FULL_NAME,
(PPA.EFFECTIVE_DATE)PAYROLL_RUN_DATE,
TP.PERIOD_NAME,
SUM(DECODE(PEC.CLASSIFICATION_NAME,'EARNINGS',TO_NUMBER(RRV.RESULT_VALUE),0))
EARNINGS,
SUM(DECODE(PEC.CLASSIFICATION_NAME,'INVOLUNTARY
DEDUCTIONS',TO_NUMBER(RRV.RESULT_VALUE),0)) INVOLUNTARY_DEDUCTIONS,
SUM(DECODE(PEC.CLASSIFICATION_NAME,'EMPLOYER
CHARGES',TO_NUMBER(RRV.RESULT_VALUE),0))EMPLOYER_CHARGES,
SUM(DECODE(PEC.CLASSIFICATION_NAME,'INFORMATION',TO_NUMBER(RRV.RESULT_VALUE),0))
INFORMATION
FROM PER_ALL_PEOPLE_F_V PPF,
PER_PERSON_NAMES_F_V PPFN,
PER_ALL_ASSIGNMENTS_F PAF,
PAY_SEARCH_ACTIONS_V PAS,
PAY_PAYROLL_ACTIONS PPA,
PAY_RUN_RESULTS RR,
PAY_RUN_RESULT_VALUES RRV,
PAY_ELEMENT_TYPES_F ETY,
PAY_INPUT_VALUES_F I,
PAY_TIME_PERIODS TP,
PAY_ELE_CLASSIFICATIONS_VL PEC
WHERE PPF.PERSON_ID = PAF.PERSON_ID
and PPF.PERSON_ID = PPFN.PERSON_ID
AND PAF.ASSIGNMENT_ID = PAS.ASSIGNMENT_ID
AND PAS.ASSIGNMENT_ID = RR.PAYROLL_ASSIGNMENT_ID
AND PPA.PAYROLL_ACTION_ID = PAS.PAYROLL_ACTION_ID
AND RR.ELEMENT_TYPE_ID = ETY.ELEMENT_TYPE_ID
AND I.ELEMENT_TYPE_ID = ETY.ELEMENT_TYPE_ID
AND RRV.RUN_RESULT_ID = RR.RUN_RESULT_ID
AND RRV.INPUT_VALUE_ID = I.INPUT_VALUE_ID
--AND TP.TIME_PERIOD_ID = PPA.TIME_PERIOD_ID
AND TP.TIME_PERIOD_ID = PPA.EARN_TIME_PERIOD_ID
or TP.TIME_PERIOD_ID = PPA.DEDN_TIME_PERIOD_ID
AND ETY.CLASSIFICATION_ID=PEC.CLASSIFICATION_ID
AND I.BASE_NAME = 'PAY VALUE'
GROUP BY PPF.PERSON_NUMBER,
PPF.PERSON_ID,
PPFN.FULL_NAME,
TP.TIME_PERIOD_ID,
PPA.EFFECTIVE_DATE,
TP.PERIOD_NAME,
PAF.ORGANIZATION_ID
ORDER BY PPF.PERSON_NUMBER

Query to Get Payments made through Cheque


SELECT per.employee_number,
per.full_name,
pac.effective_date payement_date,
paa.serial_number cheque_number,
(SELECT 'Yes'
FROM pay_payroll_actions ppa
WHERE ppa.target_payroll_action_id = pac.payroll_action_id)
Void,
popm.org_payment_method_name payment_method,
ppp.VALUE amount,
hr_general.decode_lookup ('SA_BANKS', pea.segment1) bank_name,
pea.segment2 bank_branch,
pea.segment3 account_type,
pea.segment4 account_number
FROM pay_assignment_actions paa,
pay_payroll_actions pac,
per_all_assignments_f paaf,
per_all_people_f per,
pay_pre_payments ppp,
pay_org_payment_methods_f popm,
pay_external_accounts pea
WHERE paa.payroll_action_id = pac.payroll_action_id
AND pac.action_type = 'H'
AND paaf.assignment_id = paa.assignment_id
AND paaf.assignment_type = 'E'
AND paaf.primary_flag = 'Y'
AND paaf.assignment_status_type_id = 1
AND paaf.person_id = per.person_id
AND pac.effective_date BETWEEN per.effective_start_date
AND per.effective_end_date
AND pac.effective_date BETWEEN paaf.effective_start_date
AND paaf.effective_end_date
AND ppp.pre_payment_id = paa.pre_payment_id
AND popm.org_payment_method_id = ppp.org_payment_method_id
AND popm.org_payment_method_id =
NVL (:p_org_payement_method_id, popm.org_payment_method_id)
AND paaf.business_group_id =
fnd_profile.VALUE ('PER_BUSINESS_GROUP_ID')
AND paaf.payroll_id = 61
AND pac.effective_date BETWEEN :l_date_start AND :l_date_end
AND pea.external_account_id = popm.external_account_id
AND NVL (pea.enabled_flag, 'N') = 'Y'
AND popm.payment_type_id = 24

select pes.ELEMENT_SET_NAME,petf.ELEMENT_NAME,petf.DESCRIPTION
from PAY_ELEMENT_SETS pes , PAY_ELEMENT_TYPE_RULES petr, PAY_ELEMENT_TYPES_F petf
where pes.ELEMENT_SET_ID = petr.ELEMENT_SET_ID
and petf.ELEMENT_TYPE_ID = petr.ELEMENT_TYPE_ID

Important Tables

There is a big list of oracle payroll tables. But these are main tables which every
technical consultant must know in detail. I have categorized these tables into
following three categories.

Element Entry Related Tables

PAY_ELEMENT_TYPES_F
PAY_ELEMENT_ENTRIES_F
PAY_INPUT_VALUES_F
PAY_ELEMENT_LINKS_F

Payroll Run Related Tables


-
PAY_ALL_PAYROLLS_F
PAY_PAYROLL_ACTIONS
PAY_ASSIGNMENT_ACTIONS
PAY_RUN_RESULTS
PAY_RUN_RESULT_VALUES
Costing & Pre Payment Related Tables
-
PAY_COSTS
PAY_PAYMENT_COSTS
PAY_PRE_PAYMENTS

PER_ALL_ASSIGNMENTS_F PAAF,
PAY_ASSIGNMENT_ACTIONS PAA,
PAY_PAYROLL_ACTIONS PPA,
PER_ALL_PEOPLE_F PAPF,
PAY_ACTION_INFORMATION PAI

Query to Get the Element History for an Employee

-Starts Here
select ppf.person_id
,period_name
,pet.element_name
,prrv.result_value
,ppos.person_id
from
per_people_f ppf
, apps.pay_element_types_f pet
, apps.pay_input_values_f piv
, apps.pay_run_result_values prrv
, apps.pay_run_results prr
, apps.pay_payroll_actions ppa
, apps.pay_assignment_actions paa
, apps.pay_element_classifications pec
, apps.per_time_periods ptp
, apps.per_assignments_f paf
, apps.pay_payrolls_f pay
, apps.per_periods_of_service ppos
where ppf.person_id = paf.person_id
and paf.assignment_id = paa.assignment_id
and piv.name = Pay Value
and prrv.input_value_id = piv.input_value_id
and piv.element_type_id = pet.element_type_id(+)
and prr.run_result_id = prrv.run_result_id
and paa.payroll_action_id = ppa.payroll_action_id
and prr.assignment_action_id = paa.assignment_action_id
and pet.element_type_id = prr.element_type_id
and ppa.action_type in (Q, R)
and pet.classification_id = pec.classification_id
and ptp.time_period_id = ppa.time_period_id(+)
and pay.payroll_id = paf.payroll_id
AND ppos.person_id = ppf.person_id
and ptp.payroll_id = paf.payroll_id
and nvl (ppa.date_earned, ppa.effective_date)
between pet.effective_start_date
and pet.effective_end_date
and nvl (ppa.date_earned, ppa.effective_date)
between piv.effective_start_date
and piv.effective_end_date
and nvl (ppa.date_earned, ppa.effective_date)
between paf.effective_start_date
and paf.effective_end_date
and nvl (ppa.date_earned, ppa.effective_date)
between ppf.effective_start_date
and ppf.effective_end_date
and ppf.employee_number = 600099
and upper(pet.element_name) like %COMMISSION%
and ptp.start_date between 01-JAN-2014 and 28-NOV-2015
and ptp.start_date between last_day(add_months(ppos.actual_termination_date,-7))+1
and last_day(add_months(ppos.actual_termination_date,-1))

http://oraclehrmsoverview.com/2015/04/01/oracle-payroll-process-locking-concepts/

Q1
PAY_ALL_PAYROLLS_F ALLPAYROLLDEO,
PAY_PAYROLL_REL_ACTIONS PAYRELACTIONEO,
PAY_PAY_RELATIONSHIPS_DN PAYRELATIONSHIPEO,
PER_PERSON_NAMES_F PERSONNAMEDEO,
PAY_TIME_PERIODS PAYTIMEPERIODSEO,
PER_ALL_PEOPLE_F PERSONEO,

HCM_LOOKUPS ACTIONTYPELOOKUP,
HCM_LOOKUPS ACTIONSTATUSLOOKUP,
PAY_PAYROLL_ACTIONS PAYROLLACTIONEO,
PAY_REQUESTS PRQ,
PAY_TASK_ACTIONS PTA,
PAY_TASKS_VL PT,
PER_LEGISLATIVE_DATA_GROUPS LDG

Q2

PAY_OBJECT_ACTIONS PAY_OBJ_ACT,

HCM_LOOKUPS ACTIONTYPELOOKUP,
HCM_LOOKUPS ACTIONSTATUSLOOKUP,
PAY_PAYROLL_ACTIONS PAYROLLACTIONEO,
PAY_REQUESTS PRQ,
PAY_TASK_ACTIONS PTA,
PAY_TASKS_VL PT,
PER_LEGISLATIVE_DATA_GROUPS LDG

Q3

PAY_TEMP_OBJECT_ACTIONS PAY_OBJ_ACT,

HCM_LOOKUPS ACTIONTYPELOOKUP,
HCM_LOOKUPS ACTIONSTATUSLOOKUP,
PAY_PAYROLL_ACTIONS PAYROLLACTIONEO,
PAY_REQUESTS PRQ,
PAY_TASK_ACTIONS PTA,
PAY_TASKS_VL PT,
PER_LEGISLATIVE_DATA_GROUPS LDG

You might also like