CREATE OR REPLACE FORCE VIEW apps.xxhr_people_assignment_v (person_id,
assignment_id,
assignment_number,
employee_number,
employee_name,
date_of_joining,
ORGANIZATION,
organization_id,
email_address,
POSITION,
grade,
job,
age,
national_identifier,
dob,
title,
sex,
marital_status,
religion,
nationality,
employee_group,
payroll_id,
user_person_type,
business_group_id,
effective_start_date,
effective_end_date,
overtime_yes_no
)
AS
(SELECT per.person_id, asg.assignment_id, asg.assignment_number,
per.employee_number, per.full_name employee_name,
per.original_date_of_hire date_of_joining, org.NAME ORGANIZATION,
org.organization_id, per.email_address, pos.NAME POSITION,
gra.NAME grade, job.NAME job,
TRUNC ((SYSDATE - per.date_of_birth) / 365) age,
per.national_identifier, per.date_of_birth dob,
hr_general.decode_lookup ('TITLE', per.title) title,
hr_general.decode_lookup ('SEX', per.sex) sex,
hr_general.decode_lookup ('MAR_STATUS',
per.marital_status
) marital_status,
hr_general.decode_lookup ('SA_RELIGION',
per.per_information7
) religion,
hr_general.decode_lookup ('NATIONALITY',
per.nationality
) nationality,
grp.group_name employee_group, asg.payroll_id,
ptp.user_person_type, per.business_group_id,
per.effective_start_date, per.effective_end_date,
grp.segment4 overtime_yes_no
FROM per_all_people_f per,
per_person_types ptp,
per_all_assignments_f asg,
hr_organization_units_v org,
per_jobs job,
per_positions pos,
per_grades gra,
pay_people_groups grp
WHERE 1 = 1
AND per.person_type_id = ptp.person_type_id
--AND ptp.user_person_type IN ('Employee', 'Contract Employee')--Dev
AND ptp.user_person_type IN ('Employee', 'Contract') --UAT
AND TRUNC (SYSDATE) BETWEEN per.effective_start_date
AND per.effective_end_date
AND per.current_employee_flag = 'Y'
AND per.person_id = asg.person_id
AND TRUNC (SYSDATE) BETWEEN asg.effective_start_date
AND asg.effective_end_date
AND asg.organization_id = org.organization_id
AND asg.position_id = pos.position_id(+)
AND asg.job_id = job.job_id(+)
AND asg.grade_id = gra.grade_id(+)
AND asg.people_group_id = grp.people_group_id(+));
assignment_id,
assignment_number,
employee_number,
employee_name,
date_of_joining,
ORGANIZATION,
organization_id,
email_address,
POSITION,
grade,
job,
age,
national_identifier,
dob,
title,
sex,
marital_status,
religion,
nationality,
employee_group,
payroll_id,
user_person_type,
business_group_id,
effective_start_date,
effective_end_date,
overtime_yes_no
)
AS
(SELECT per.person_id, asg.assignment_id, asg.assignment_number,
per.employee_number, per.full_name employee_name,
per.original_date_of_hire date_of_joining, org.NAME ORGANIZATION,
org.organization_id, per.email_address, pos.NAME POSITION,
gra.NAME grade, job.NAME job,
TRUNC ((SYSDATE - per.date_of_birth) / 365) age,
per.national_identifier, per.date_of_birth dob,
hr_general.decode_lookup ('TITLE', per.title) title,
hr_general.decode_lookup ('SEX', per.sex) sex,
hr_general.decode_lookup ('MAR_STATUS',
per.marital_status
) marital_status,
hr_general.decode_lookup ('SA_RELIGION',
per.per_information7
) religion,
hr_general.decode_lookup ('NATIONALITY',
per.nationality
) nationality,
grp.group_name employee_group, asg.payroll_id,
ptp.user_person_type, per.business_group_id,
per.effective_start_date, per.effective_end_date,
grp.segment4 overtime_yes_no
FROM per_all_people_f per,
per_person_types ptp,
per_all_assignments_f asg,
hr_organization_units_v org,
per_jobs job,
per_positions pos,
per_grades gra,
pay_people_groups grp
WHERE 1 = 1
AND per.person_type_id = ptp.person_type_id
--AND ptp.user_person_type IN ('Employee', 'Contract Employee')--Dev
AND ptp.user_person_type IN ('Employee', 'Contract') --UAT
AND TRUNC (SYSDATE) BETWEEN per.effective_start_date
AND per.effective_end_date
AND per.current_employee_flag = 'Y'
AND per.person_id = asg.person_id
AND TRUNC (SYSDATE) BETWEEN asg.effective_start_date
AND asg.effective_end_date
AND asg.organization_id = org.organization_id
AND asg.position_id = pos.position_id(+)
AND asg.job_id = job.job_id(+)
AND asg.grade_id = gra.grade_id(+)
AND asg.people_group_id = grp.people_group_id(+));
============================================================
Below is the script for Update the Person i..e in Correction mode not update mode.
DECLARE
-- Local Variables
-- -----------------------
ln_object_version_number PER_ALL_PEOPLE_F.OBJECT_VERSION_NUMBER%TYPE ;-- := 7;
lc_dt_ud_mode VARCHAR2(100) := NULL;
ln_assignment_id PER_ALL_ASSIGNMENTS_F.ASSIGNMENT_ID%TYPE; -- := 33564;
lc_employee_number PER_ALL_PEOPLE_F.EMPLOYEE_NUMBER%TYPE; -- := 'PRAJ_01';
-- Out Variables for Find Date Track Mode API
-- ----------------------------------------------------------------
lb_correction BOOLEAN;
lb_update BOOLEAN;
lb_update_override BOOLEAN;
lb_update_change_insert BOOLEAN;
-- Out Variables for Update Employee API
-- -----------------------------------------------------------
ld_effective_start_date DATE;
ld_effective_end_date DATE;
lc_full_name PER_ALL_PEOPLE_F.FULL_NAME%TYPE;
ln_comment_id PER_ALL_PEOPLE_F.COMMENT_ID%TYPE;
lb_name_combination_warning BOOLEAN;
lb_assign_payroll_warning BOOLEAN;
lb_orig_hire_warning BOOLEAN;
cursor c1 is
select --*
B.OBJECT_VERSION_NUMBER,A.*
from XXHR_PEOPLE_ASSIGNMENT_V A
--,per_all_assignments_f B
,per_all_people_f B
WHERE 1=1
AND A.PERSON_ID=B.PERSON_ID
AND B.effective_end_date = TO_DATE ('12/31/4712', 'MM/DD/RRRR')
and trunc(sysdate) between b.effective_start_date and b.effective_end_date
--AND A.EMPLOYEE_NUMBER IN('E01549','E00007')
--AND A.EMPLOYEE_NUMBER IN('E01577','S01112')
order by a.person_id
;
BEGIN
for rec in c1
loop
-- Update Employee API
-- ---------------------------------
hr_person_api.update_person
( -- Input Data Elements
-- ------------------------------
p_effective_date => sysdate, ---TO_DATE('29-JUN-2011'),
p_datetrack_update_mode => 'CORRECTION',
p_person_id => REC.PERSON_ID,
p_per_information2 => NULL, --To Update Granfather is null
--p_middle_names => 'TEST',
--p_marital_status => 'M',
-- Output Data Elements
-- ----------------------------------
p_employee_number => rec.employee_number,
p_object_version_number => REC.object_version_number,
p_effective_start_date => ld_effective_start_date,
p_effective_end_date => ld_effective_end_date,
p_full_name => lc_full_name,
p_comment_id => ln_comment_id,
p_name_combination_warning => lb_name_combination_warning,
p_assign_payroll_warning => lb_assign_payroll_warning,
p_orig_hire_warning => lb_orig_hire_warning
);
COMMIT;
dbms_output.put_line('uPDATED FOR-'||rec.object_version_number||'-Employee No-'||rec.employee_number);
--update xx_gosi_update set status='S-'||rec.emp_no where rowid=rec.rowid;
commit;
end loop;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
dbms_output.put_line(SQLERRM);
END;
No comments:
Post a Comment