Employee Grade Step Creation API
declare
-- api parameters
l_placement_id NUMBER;
l_object_version_number NUMBER;
l_effective_start_date DATE;
l_effective_end_date DATE;
--
-- local parameters
l_error_msg VARCHAR2(1000);
--
-- Main Cursor
cursor main_rec
is
SELECT a.s_no,
b.employee_number,
c.assignment_id,
a.effective_start_date,
b.business_group_id,
a.basic_salary_amount,
(SELECT pspsf.step_id
FROM per_grades pg,
per_grade_spines_f pgsf,
pay_rates pr,
pay_grade_rules_f pgrf,
per_spinal_point_steps_f pspsf
WHERE pg.NAME = a.grade
AND pr.parent_spine_id = pgsf.parent_spine_id
AND pgsf.grade_id = pg.grade_id
AND pgrf.rate_id = pr.rate_id
AND pspsf.spinal_point_id = pgrf.grade_or_spinal_point_id
AND SYSDATE BETWEEN pgsf.effective_start_date
AND pgsf.effective_end_date
AND SYSDATE BETWEEN pgrf.effective_start_date
AND pgrf.effective_end_date
AND SYSDATE BETWEEN pspsf.effective_start_date
AND pspsf.effective_end_date
AND pgrf.VALUE = a.basic_salary_amount) step_id
FROM xxnbk_emp_grade_step_load a,
per_people_x b,
per_assignments_x c
WHERE 1 = 1
AND a.employee_number = b.employee_number
AND c.person_id = b.person_id
-- and s_no <=10
AND STATUS IS NULL
order by s_no;
---
-- begin the process
begin
--
for i in main_rec
loop
--
IF I.step_id IS NOT NULL THEN --Checking grade step defined for that salary
BEGIN
--
hr_sp_placement_api.create_spp
(p_validate => FALSE
,p_effective_date => i.effective_start_date
,p_business_group_id => i.business_group_id
,p_assignment_id => i.assignment_id
,p_step_id => i.step_id
,p_auto_increment_flag => 'N'
,p_reason => null
,p_request_id => null
,p_program_application_id => null
,p_program_id => null
,p_program_update_date => null
,p_increment_number => null
,p_information1 => null
,p_information2 => null
,p_information3 => null
,p_information4 => null
,p_information5 => null
,p_information6 => null
,p_information7 => null
,p_information8 => null
,p_information9 => null
,p_information10 => null
,p_information11 => null
,p_information12 => null
,p_information13 => null
,p_information14 => null
,p_information15 => null
,p_information16 => null
,p_information17 => null
,p_information18 => null
,p_information19 => null
,p_information20 => null
,p_information21 => null
,p_information22 => null
,p_information23 => null
,p_information24 => null
,p_information25 => null
,p_information26 => null
,p_information27 => null
,p_information28 => null
,p_information29 => null
,p_information30 => null
,p_information_category => 'KE'
,p_placement_id => l_placement_id
,p_object_version_number => l_object_version_number
,p_effective_start_date => l_effective_start_date
,p_effective_end_date => l_effective_end_date
,p_replace_future_spp => false
);
--
update xxnbk_emp_grade_step_load
set Status ='S'
WHERE S_NO=i.S_NO;
COMMIT;
--
EXCEPTION WHEN OTHERS THEN
--
l_error_msg :=sqlerrm;
--
update xxnbk_emp_grade_step_load
set Status ='E',Error_message=l_error_msg
WHERE S_NO=i.S_NO;
--
END;
--
ELSE
--
update xxnbk_emp_grade_step_load
set Status ='E',Error_message='Grade Step not defined'
WHERE S_NO=i.S_NO;
--
END IF;
--
end loop;
--
commit;
--
dbms_output.put_line('Success ');
--
exception when others then
dbms_output.put_line('Error in main '||sqlerrm);
end;
No comments:
Post a Comment