CREATE OR REPLACE PROCEDURE xxx_employee_salary_p
IS
CURSOR get_details
IS
SELECT aest.*, paaf.assignment_id
FROM xxx_employee_salary_t aest,
per_people_x per,
per_assignments_x paaf
WHERE paaf.person_id = per.person_id
AND paaf.assignment_type = 'E'
AND paaf.primary_flag = 'Y'
AND aest.employee_number = per.employee_number
AND paaf.assignment_status_type_id IN (1, 2);
l_pay_proposal_id NUMBER := NULL;
l_assignment_id NUMBER := NULL;
l_object_version_number NUMBER := NULL;
l_element_entry_id NUMBER := NULL;
l_inv_next_sal_date_warning BOOLEAN;
l_proposed_salary_warning BOOLEAN;
l_approved_warning BOOLEAN;
l_payroll_warning BOOLEAN;
l_err_msg VARCHAR2 (500) := NULL;
BEGIN
FOR fetch_details IN get_details
LOOP
BEGIN
l_element_entry_id := NULL;
l_inv_next_sal_date_warning := NULL;
l_proposed_salary_warning := NULL;
l_approved_warning := NULL;
l_payroll_warning := NULL;
hr_maintain_proposal_api.
insert_salary_proposal (
p_pay_proposal_id => l_pay_proposal_id,
p_assignment_id => fetch_details.assignment_id,
p_business_group_id => fnd_profile.
VALUE ('PER_BUSINESS_GROUP_ID'),
p_change_date => fetch_details.change_date,
p_comments => NULL,
p_next_sal_review_date => NULL,
p_proposal_reason => NULL,
p_proposed_salary_n => fetch_details.salary,
p_forced_ranking => NULL,
p_date_to => NULL,
p_object_version_number => l_object_version_number,
p_multiple_components => 'N',
p_approved => 'Y',
p_validate => FALSE,
p_element_entry_id => l_element_entry_id,
p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
p_proposed_salary_warning => l_proposed_salary_warning,
p_approved_warning => l_approved_warning,
p_payroll_warning => l_payroll_warning);
UPDATE xxx_employee_salary_t aest
SET aest.process_flag = 'Y', err_msg = NULL
WHERE aest.employee_number = fetch_details.employee_number;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
l_err_msg := SQLERRM;
UPDATE xxx_employee_salary_t aest
SET aest.process_flag = 'Y', err_msg = l_err_msg
WHERE aest.employee_number = fetch_details.employee_number;
COMMIT;
END;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
END aqs_employee_salary_p;
No comments:
Post a Comment