DECLARE
CURSOR get_details
IS
SELECT TICKET_CATEGORY,TICKET_TYPE,DURATION,BALANCE, PPX.PERSON_ID, EMP_NUMBER FROM XXFUJ_UPLOAD_TICKET XXFUJ, PER_PEOPLE_X PPX
WHERE
EMPLOYEE_NUMBER = EMP_NUMBER
--AND EMP_NUMBER IN ( 'xx1635')-- and person_id is not null;
;
l_err_msg VARCHAR2 (500) := NULL;
l_id_flex_num NUMBER (9) := NULL;
l_analysis_criteria_id NUMBER (9) := NULL;
l_person_analysis_id NUMBER (9) := NULL;
l_pea_object_version_number NUMBER (9) := NULL;
BEGIN
--Initialize Session
fnd_global.
apps_initialize (user_id => 2605, -- XXXX_MIGRATION
resp_id => 50419, -- XXXX HRMS Manager
resp_appl_id => 800 -- Human Resouces
);
SELECT fifs.id_flex_num
INTO l_id_flex_num
FROM fnd_id_flex_structures fifs
WHERE id_flex_structure_code LIKE 'FUJ_XX_DET';
FOR fetch_details IN get_details
LOOP
l_err_msg := NULL;
l_analysis_criteria_id := NULL;
l_person_analysis_id := NULL;
l_pea_object_version_number := NULL;
BEGIN
hr_sit_api.
create_sit (
p_validate => FALSE,
p_person_id => fetch_details.person_id,
p_business_group_id => 81,
p_id_flex_num => l_id_flex_num,
p_effective_date => SYSDATE,
p_comments => NULL,
p_date_from => SYSDATE
--p_date_to => fetch_details.end_date,
,p_segment1 => fetch_details.TICKET_CATEGORY
,p_segment2 => fetch_details.TICKET_TYPE
,p_segment3 => fetch_details.DURATION
,p_segment4 => nvl(fetch_details.BALANCE,30)
,p_analysis_criteria_id => l_analysis_criteria_id,
p_person_analysis_id => l_person_analysis_id,
p_pea_object_version_number => l_pea_object_version_number);
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line (' Exception: ' || l_err_msg);
COMMIT;
END;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
END ;
No comments:
Post a Comment