create or replace PACKAGE BODY xx_per_positions_pkg IS /**************************************************************************** * Name:xx_per_positions_pkg Description:This Package has all the procedures used

for import of Positions Author:TCS Date:10/08/2007 4:54:25 PM History Modified By T Date Description

*****************************************************************************/ /*====================================================================== Validating mandatory columns =========================================================================*/ PROCEDURE xx_per_positions_prc(p_request_id IN NUMBER, p_commit IN VARCHAR2 ) IS l_org_id NUMBER; l_grade_id NUMBER; l_position_id NUMBER; l_effective_start_date DATE; l_effective_end_date DATE; l_position_definition_id NUMBER; l_object_version_number NUMBER; l_security_profile_id NUMBER; l_language_code VARCHAR2(30); l_name VARCHAR2(240); l_status VARCHAR2(100); l_valid_grade_id NUMBER; l_count NUMBER; l_read NUMBER; l_success NUMBER; l_error NUMBER; l_commit VARCHAR2(3); l_pos_ins boolean; l_grd_ins boolean; l_poscount NUMBER; l_job_date DATE; l_organization_date DATE; l_hr_org_count NUMBER; l_pos_name varchar2(60); l_org_name varchar2(60); l_working_hours NUMBER; l_probation_duration NUMBER; l_probation_unit VARCHAR2(50); --Cursor for fetching data from staging table CURSOR cur_pos_val_stg IS SELECT xxhr.*, xxhr.rowid FROM xx_hr_positions_stg xxhr

WHERE processing_status ='N'; BEGIN fnd_file.PUT_LINE(fnd_file.LOG, fnd_file.PUT_LINE(fnd_file.LOG, ; l_org_id := fnd_profile.VALUE('ORG_ID'); l_count := 0; l_security_profile_id := 62; l_language_code := hr_api.userenv_lang; l_status := 'VALID'; l_commit := p_commit; l_read := 0; l_success := 0; l_error := 0; FOR cur_pos_val_rec IN cur_pos_val_stg LOOP l_read := l_read + 1; l_position_id := NULL; l_effective_start_date := NULL; l_effective_end_date := NULL; l_position_definition_id := NULL; l_object_version_number := NULL; l_name := NULL; g_error_msg := NULL; g_organization_id := NULL; g_job_id := NULL; g_jobname := NULL; g_availability_status_id := NULL; g_permanent_flag := NULL; g_location_id := NULL; g_business_group_id := NULL; g_payroll_id := NULL; g_bargaining_unit_cd := NULL; g_pay_basis_id := NULL; g_seasonal_flag := NULL; g_entry_grade_id := NULL; g_status := NULL; g_frequency := NULL; g_ptype := NULL; l_job_date := NULL; l_organization_date := NULL; l_hr_org_count := 0; l_pos_name := NULL; l_org_name := NULL; l_working_hours := NULL; l_probation_duration := NULL; l_probation_unit := NULL; IF(cur_pos_val_rec.date_effective_name IS NULL) THEN ----checking mandetory column position_name g_error_msg := 'Position name does not exist'; xx_per_posfail_prc(cur_pos_val_rec.rowid, g_error_msg); xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.transaction _id, cur_pos_val_rec.component_name, 'Position Name', cur_pos_val_rec.date _effective_name, 'Data', g_error_msg, ''); fnd_file.PUT_LINE(fnd_file.LOG, 'Position name does not exist');

'Mandetory validations started'); 'ORG_ID :' fnd_profile.VALUE('ORG_ID'))

ELSIF LENGTH(cur_pos_val_rec.date_effective_name) > 120 THEN g_error_msg := 'Position name must not be more that 120 Characters'; xx_per_posfail_prc(cur_pos_val_rec.rowid, g_error_msg); xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.transacti on_id, cur_pos_val_rec.component_name, 'Position Name', cur_pos_val_rec.da te_effective_name, 'Data', g_error_msg, ''); fnd_file.PUT_LINE(fnd_file.LOG, 'Position name must not be more that 120 Characters'); END IF; IF(cur_pos_val_rec.start_date IS NULL) THEN ---checking mandetory column startdate of position g_error_msg := 'Start date does not exist'; xx_per_posfail_prc(cur_pos_val_rec.rowid, g_error_msg); xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.transacti on_id, cur_pos_val_rec.component_name, 'start_date', cur_pos_val_rec.start _date, 'Data', g_error_msg, ''); fnd_file.PUT_LINE(fnd_file.LOG, 'Start date does not exist'); END IF; BEGIN IF(cur_pos_val_rec.position_type IS NULL) THEN ----checking mandetory column position_type g_error_msg := 'Position type does not exist'; xx_per_posfail_prc(cur_pos_val_rec.rowid, g_error_msg); xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.transac tion_id, cur_pos_val_rec.component_name, 'position_type', cur_pos_val_rec. position_type, 'Data', g_error_msg, ''); fnd_file.PUT_LINE(fnd_file.LOG, 'Position type does not exist'); ELSE SELECT lookup_code ----deriving lookupcode of position_type INTO g_ptype FROM hr_lookups WHERE lookup_type = 'POSITION_TYPE' AND meaning = cur_pos_val_rec.position_type; fnd_file.PUT_LINE(fnd_file.LOG, 'Position type' g_ptype); END IF; EXCEPTION WHEN no_data_found THEN g_error_msg := 'No position_type exists with this name'; xx_per_posfail_prc(cur_pos_val_rec.rowid, g_error_msg); xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.transacti on_id, cur_pos_val_rec.component_name, 'position_type', cur_pos_val_rec.po sition_type, 'Validation', g_error_msg, ''); fnd_file.PUT_LINE(fnd_file.LOG, 'No position_type exists with this n ame'); WHEN others THEN g_error_msg := 'Other error in finding position_type'; xx_per_posfail_prc(cur_pos_val_rec.rowid, g_error_msg); xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.transacti on_id, cur_pos_val_rec.component_name, 'position_type', cur_pos_val_rec.po sition_type, 'Validation', g_error_msg, ''); fnd_file.PUT_LINE(fnd_file.LOG, 'Other error in finding position_typ e' sqlerrm); END;

BEGIN IF(cur_pos_val_rec.position_name IS NULL) THEN ----checking mandetory column position_type g_error_msg := 'Position name does not exist'; xx_per_posfail_prc(cur_pos_val_rec.rowid, g_error_msg); xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.transac tion_id, cur_pos_val_rec.component_name, 'position_name', cur_pos_val_rec. position_name, 'Data', g_error_msg, ''); fnd_file.PUT_LINE(fnd_file.LOG, 'Position type does not exist'); ELSE SELECT meaning ----deriving lookupcode of position_type INTO l_pos_name FROM hr_lookups WHERE lookup_type = 'PH_POSITION_NAME' AND meaning = cur_pos_val_rec.position_name; fnd_file.PUT_LINE(fnd_file.LOG, 'Position name' g_ptype); END IF; EXCEPTION WHEN no_data_found THEN g_error_msg := 'No position_name exists with this name'; xx_per_posfail_prc(cur_pos_val_rec.rowid, g_error_msg); xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.transacti on_id, cur_pos_val_rec.component_name, 'position_name', cur_pos_val_rec.po sition_name, 'Validation', g_error_msg, ''); fnd_file.PUT_LINE(fnd_file.LOG, 'No position_type exists with this n ame'); WHEN others THEN g_error_msg := 'Other error in finding position_name'; xx_per_posfail_prc(cur_pos_val_rec.rowid, g_error_msg); xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.transacti on_id, cur_pos_val_rec.component_name, 'position_name', cur_pos_val_rec.po sition_name, 'Validation', g_error_msg, ''); fnd_file.PUT_LINE(fnd_file.LOG, 'Other error in finding position_typ e' sqlerrm); END; BEGIN IF(cur_pos_val_rec.permanent_position IS NULL) THEN ----checking mandetory column permanent_flag g_error_msg := 'Permanent flag does not exist'; xx_per_posfail_prc(cur_pos_val_rec.rowid, g_error_msg); xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.transac tion_id, cur_pos_val_rec.component_name, 'permanent_position', cur_pos_val _rec.permanent_position, 'Data', g_error_msg, ''); fnd_file.PUT_LINE(fnd_file.LOG, 'Permanent flag does not exist'); ELSE SELECT lookup_code INTO g_permanent_flag ----deriving lookupcode for permanent_flag FROM hr_lookups WHERE lookup_type = 'YES_NO' AND meaning = cur_pos_val_rec.permanent_position; fnd_file.PUT_LINE(fnd_file.LOG, 'Permanent_flag:' g_permanent_f lag); END IF;

'Data'.organization_name. g_error_msg. 'organization_name'.insert_error_message_prc(cur_pos_val_rec. WHEN others THEN g_error_msg := 'Other error in finding permanent status '. xxph_common_dmg_pkg.no other data is accepted'.component_name. g_error_msg.PUT_LINE(fnd_file.organization_name IS NULL) THEN ----checking mandetory column organization g_error_msg := 'Organization_name does not exist'. 'other error in finding permanent st atus' sqlerrm). cur_pos_val_ rec.LOG.PUT_LINE(fnd_file. 'Data'.organization_name. 'permanent_position'. END.rowid. g_error_msg.LOG.transacti on_id. ELSE SELECT DISTINCT organization_id INTO g_organization_id -----deriving organization_id FROM hr_organization_units WHERE name = cur_pos_val_rec. xx_per_posfail_prc(cur_pos_val_rec. xxph_common_dmg_pkg. fnd_file. fnd_file. cur_pos_val_rec. BEGIN IF(cur_pos_val_rec.transacti on_id.PUT_LINE(fnd_file.permanent_position. cur_pos_val_r ec.PUT_LINE(fnd_file. 'Organization_name:' g_organiza tion_id). g_error_msg). fnd_file. ------------UPDATE xx_hr_positions_stg ----updating organization_id in staging t . xx_per_posfail_prc(cur_pos_val_rec.insert_error_message_prc(cur_pos_val_rec. ''). 'Organization_name does not exist' ).rowid. 'Validation'. g_error_msg).PUT_LINE(fnd_file. '').trans action_id.rowid. fnd_file.LOG.permanent_position. cur_pos_val_rec. xx_per_posfail_prc(cur_pos_val_rec. xx_per_posfail_prc(cur_pos_val_rec.EXCEPTION WHEN no_data_found THEN g_error_msg := 'Permanent status should be yes or no. xxph_common_dmg_pkg. cur_pos_va l_rec.By Niraj Date:30/08/07 SELECT COUNT(*) INTO l_hr_org_count FROM hr_organization_information WHERE org_information_context = 'CLASS' AND org_information1 = 'HR_ORG' AND org_information2 = 'Y' AND organization_id = g_organization_id. 'organization_name'.insert_error_message_prc(cur_pos_val_rec.component_name. ------------. g_error_msg).LOG. 'Organization is not an HR Organ ization').component_name.rowid. cur_pos_val_rec.transac tion_id.LOG.component_name. g_error_msg. IF l_hr_org_count = 0 THEN g_error_msg := 'Organization is not an HR Organization'. cur_pos_val_r ec. fnd_file. 'Validation'. 'PERMANENT STATUS SHOULD BE YES OR N O'). 'permanent_position'. g_error_msg). '').organization_name. cur_pos_val_rec. xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec. END IF. '').

'organization_name'. fnd_file. cur_pos_val_re c. BEGIN IF(cur_pos_val_rec. xx_per_posfail_prc(cur_pos_val_rec. WHEN others THEN g_error_msg := 'Other error in finding organization'. EXCEPTION WHEN no_data_found THEN g_error_msg := 'Organization does not exist with this name'.job_group '. cur_pos_val_rec.PUT_LINE(fnd_file. 'Jobname:' g_jobname). SELECT DISTINCT job_id INTO g_job_id -------deriving job_id by concatinating jobgroup and jobband FROM per_jobs WHERE name = g_jobname.transac tion_id. 'organization_name'. xx_per_posfail_prc(cur_pos_val_rec.rowid. cur_pos_val_rec. xx_per_posfail_prc(cur_pos_val_rec. 'Other error in finding organization ' sqlerrm).able SET organization_id = g_organization_id WHERE rowid = cur_pos_val_rec. 'Data'.insert_error_message_prc(cur_pos_val_rec. END IF. xxph_common_dmg_pkg. g_error_msg.LOG.PUT_LINE(fnd_file. fnd_file. 'Job_id:' g_job_id).rowid. cur_pos_val_rec. UPDATE xx_hr_positions_stg SET job_id = g_job_id --------updating staging table with job_id WHERE rowid = cur_pos_val_rec. fnd_file. ELSIF(cur_pos_val_rec. cur_pos_val_re c. g_error_msg).job_group IS NULL) THEN ------checking mandetory column jobgroup g_error_msg := 'Job_group does not exist'. g_error_msg.insert_error_message_prc(cur_pos_val_rec.LOG. fnd_file.rowid. 'job_band'. g_error_msg). g_error_msg).transacti on_id. cur_pos_val_rec.rowid.PUT_LINE(fnd_file.rowid.job_ group.organization_name.job_band IS NULL) THEN -------checking mandetory column jobband g_error_msg := 'Job_band does not exist'. xxph_common_dmg_pkg. xx_per_posfail_prc(cur_pos_val_rec.rowid. ELSE g_jobname := cur_pos_val_rec.component_name.j ob_band. ''). '').trans action_id.' cur_pos_val_rec. . g_error_msg. ' Organization does not exist with t his name').PUT_LINE(fnd_file.component_name. g_error_msg).PUT_LINE(fnd_file.insert_error_message_prc(cur_pos_val_rec. g_error_msg. 'Data'.insert_error_message_prc(cur_pos_val_rec. END.component_name.component_name.PUT_LINE(fnd_file. 'Job_group do not exist'). cur_pos_val_rec. 'Job_band does not exist').LOG.LOG.transacti on_id. ''). ''). END IF.organization_name. 'Validation'.LOG. fnd_file. cur_pos_val_rec.job _band. fnd_file. 'job_group'. 'Validation'. xxph_common_dmg_pkg. xxph_common_dmg_pkg.LOG.

cur_pos_val_rec.rowid. 'job_name'.status . ''). END IF. 'Validation'. 'status '. '').LOG. cur_pos_val_rec. g_error_msg. WHEN others THEN g_error_msg := 'Other error in finding status'. 'No status exists with this name') .rowid. fnd_file. ''). 'Data'. xx_per_posfail_prc(cur_pos_val_rec. cur_pos_val_rec. 'Other error in finding job' sq lerrm).status .LOG.component_name. 'No job exists with this name').rowid. cur_pos_val_rec.PUT_LINE(fnd_file. fnd_file.status IS NULL) THEN g_error_msg := 'Status does not exist'. ''). 'Validat ion'. cur_pos_val_rec.status. fnd_file.component_name.rowid.trans action_id. '').LOG.PUT_LINE(fnd_file.component_name.LOG. g_error_msg.insert_error_message_prc(cur_pos_val_rec. xxph_common_dmg_pkg. WHEN others THEN g_error_msg := 'Other error in finding job'. 'job_name'. xxph_common_dmg_pkg.EXCEPTION WHEN no_data_found THEN g_error_msg := 'No job exists with this name'. UPDATE xx_hr_positions_stg SET availability_status_id = g_availability_status_id WHERE rowid = cur_pos_val_rec.rowid. g_jobname. g_error_msg.insert_error_message_prc(cur_pos_val_rec. 'status '.LOG. END.insert_error_message_prc(cur_pos_val_rec. g_error_msg. xx_per_posfail_prc(cur_pos_val_rec.LOG.PUT_LINE(fnd_file. 'Other error in finding status' sqlerrm). g_error_msg).stat us.component_name.insert_error_message_prc(cur_pos_val_rec. fnd_file. g_error_msg). 'Status does not exist').PUT_LINE(fnd_file. EXCEPTION WHEN no_data_found THEN g_error_msg := 'No status exists with this name'.rowid. g_error_msg. -----checking mandetory column status of position xx_per_posfail_prc(cur_pos_val_rec. xxph_common_dmg_pkg. xx_per_posfail_prc(cur_pos_val_rec.transac tion_id. g_jobname.component_name.PUT_LINE(fnd_file. 'STATUS:' g_availability_stat us_id). 'Validat ion'. xx_per_posfail_prc(cur_pos_val_rec.transac tion_id. cur_pos_val_rec. g_error_msg). 'status '.PUT_LINE(fnd_file. xxph_common_dmg_pkg. fnd_file. 'Validation'. ELSE SELECT DISTINCT shared_type_id INTO g_availability_status_id ------deriving ststus_id FROM per_shared_types WHERE shared_type_name = cur_pos_val_rec. xxph_common_dmg_pkg. cur_pos_val_rec.transac tion_id.insert_error_message_prc(cur_pos_val_rec. . fnd_file. cur_pos_val_rec. BEGIN IF(cur_pos_val_rec. g_error_msg). g_error_msg).transac tion_id.

g_error_msg).effective_date_from IS NULL) THEN ------checking mandetory column effective_date_from g_error_msg := 'Effective_date_from does not exist'.transac tion_id. 'effective_date_from'. fnd_file.PUT_LINE(fnd_file.transac tion_id. EXCEPTION WHEN too_many_rows THEN g_error_msg := 'TOO_MANY_ROWS error while validating job effective d ate'.rowid. '').rowid. 'Effective_date_from does not exis t'). ''). xxph_common_dmg_pkg. END IF. cur_pos_va l_rec. g_error_msg).LOG.component_name. xx_per_posfail_prc(cur_pos_val_rec. xxph_common_dmg_pkg. 'effective_date_from'. 'effective_date_from'. IF(l_job_date IS NOT NULL) THEN fnd_file.component_name. xxph_common_dmg_pkg.rowid. 'Miscallaneous error in job_date of position' sqlerrm).effective_date_from.LOG. g_error_msg. g_error_msg. 'Data'. cur_pos_va l_rec.rowid.effective_date_from. cur_pos_val_rec. fnd_file. ate)). cur_pos_val_rec.LOG. 'JOB_DATE:' to_date(l_job_d . cur_pos_val_rec. BEGIN IF(cur_pos_val_rec. xx_per_posfail_prc(cur_pos_val_rec.effective_date_from IS NOT NULL) THEN SELECT DISTINCT date_from INTO l_job_date FROM per_jobs WHERE name = g_jobname.PUT_LINE(fnd_file.component_name. xxph_common_dmg_pkg. 'Effective_date_from should be after job effective start date'). fnd_file. END IF. '').LOG.transac tion_id.component_name.insert_error_message_prc(cur_pos_val_rec.t ransaction_id.END.effective_date_from. IF(to_date(cur_pos_val_rec. cur_ pos_val_rec. 'effective_date_from'. END IF. 'Data'.PUT_LINE(fnd_file. g_error_msg. END IF.insert_error_message_prc(cur_pos_val_rec.effective_date_from. g_error_msg. IF(cur_pos_val_rec.insert_error_message_prc(cur_pos_val_rec.PUT_LINE(fnd_file. g_error_msg).PUT_LINE(fnd_file. 'Data'. 'Data'. cur_pos_val_rec. cur_pos_va l_rec. xx_per_posfail_prc(cur_pos_val_rec. '').effective_date_from) < to_date(l_job_ date)) THEN g_error_msg := 'Effective_date_from should be after job effect ive start date'. xx_per_posfail_prc(cur_pos_val_rec. 'TOO_MANY_ROWS error in job_date') . WHEN others THEN g_error_msg := 'Error while validating for job effective date as job name not found'. g_error_msg). fnd_file.insert_error_message_prc(cur_pos_val_rec.LOG.

WHEN others THEN g_error_msg := 'Error while validating for organization effective da te as organization name not found'. 'Data'. 'Data'. 'Data'. xx_per_posfail_prc(cur_pos_val_rec. g_error_msg. xxph_common_dmg_pkg.effective_date_from IS NOT NULL) THEN SELECT DISTINCT date_from INTO l_organization_date FROM hr_all_organization_units WHERE name = cur_pos_val_rec.insert_error_message_prc(cur_pos_val_rec. xxph_common_dmg_pkg. IF(l_organization_date IS NOT NULL) THEN fnd_file.component_name.tra nsaction_id. xx_per_posfail_prc(cur_pos_val_rec. cur_pos_val_rec. fnd_file. 'ORGANIZATION:' rganization_date)).PUT_LINE(fnd_file. xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec. fnd_file.rowid.rowid. g_error_msg).effective_date_from IS NOT NULL) THEN IF(to_date(cur_pos_val_rec. 'effective_date_from'.transac tion_id.LOG. xx_per_posfail_prc(cur_pos_val_rec.effective_date_from.rowid.PUT_LINE(fnd_file.component_name. 'effective_date_from'. EXCEPTION WHEN too_many_rows THEN g_error_msg := 'TOO_MANY_ROWS error while validating organization ef fective date'. EN g_error_msg := 'Effective_date_from should be after organizati on effective start date'. g_error_msg).PUT_LINE(fnd_file.insert_error_message_prc(cur_pos_val_rec. cur_pos_val_rec.effective_date_from < l_organization_date) TH .insert_error_message_prc(cur_pos_val_rec. g_error_msg.END. fnd_file. ''). cur_po to_date(l_o IF(cur_pos_val_rec. 'Effective_date_from should be after organization effective start date'). g_error_msg. END IF.PUT_LINE(fnd_file. cur_pos_va l_rec. 'TOO_MANY_ROWS error in organizati on_date of position' sqlerrm). END IF.organization_name.LOG. END IF. ''). BEGIN IF(cur_pos_val_rec.effective_date_from.transac tion_id. g_error_msg). xx_per_posfail_prc(cur_pos_val_rec. BEGIN IF(cur_pos_val_rec.effective_date_from) > to_date(cur_pos_ val_rec.component_name. xxph_common_dmg_pkg. END. cur_pos_va l_rec.rowid. 'effective_date_from'. 'Error while validating for organi zation effective date as organization name not found' sqlerrm).LOG.component_name. cur_pos_val_rec.LOG.start_date)) THEN g_error_msg := 'Effective_date_from should be after start date'.effective_date_from. '').t ransaction_id. g_error_msg). cur_ pos_val_rec. 'effective_date_from'. cur_pos_val_rec.

PUT_LINE(fnd_file.effective_date_from. g_error_msg). cur_pos_val_rec. '').LOG.insert_error_message_prc(cur_pos_val_rec.headcount IS NULL) THEN g_error_msg := 'Head count does not exist'. 'fte'. fnd_file.head count.trans action_id. 'Data'.rowid. g_error_msg.LOG.transac tion_id. xxph_common_dmg_pkg.insert_error_message_prc(cur_pos_val_rec.component_name. END IF.fte. END IF.fte IS NULL) THEN g_error_msg := 'FTE does not exist'. 'Da ta'. fnd_file. xxph_common_dmg_pkg. g_error_msg. 'effective_date_from'.rowid. xx_per_posfail_prc(cur_pos_val_rec. g_error_msg). 'Validation'. ------checking mandetory column fte xx_per_posfail_prc(cur_pos_val_rec. xx_per_posfail_prc(cur_pos_val_rec. IF(l_poscount <> 0) THEN g_error_msg := 'Position already exist'. g_error_msg).component_name. END. EXCEPTION WHEN others THEN g_error_msg := 'Head count should be one for single incumbment'. fnd_file. 'Head count should be one for sing le incumbment ' sqlerrm). ''). EXCEPTION WHEN others THEN g_error_msg := 'Miscallaneous error in effective_date of position'. xxph_common_dmg_pkg. IF(cur_pos_val_rec. g_error_msg. '').LOG. ''). cur_pos_val_rec.s_val_rec.PUT_LINE(fnd_file. xxph_common_dmg_pkg. BEGIN IF(cur_pos_val_rec. 'headcount'. 'Head count do not exist'). ''). cur_pos_va l_rec.LOG. xx_per_posfail_prc(cur_pos_val_rec.rowid.component_name. g_error_msg. g_error_msg. 'Data'. fnd_file. 'Data'. ------checking mandetory column fte xx_per_posfail_prc(cur_pos_val_rec. cur_pos_val_rec. cur_pos_val_rec. fnd_file.transac tion_id. cur_pos_val_rec. 'Effective_date_from should be after start date'). cur_pos_val_rec. g_error_msg).he adcount.insert_error_message_prc(cur_pos_val_rec.PUT_LINE(fnd_file.effective_date_from.LOG. .rowid.component_name. 'FTE does not exist'). END IF. SELECT COUNT(1) ----checking whether position already exists INTO l_poscount FROM hr_all_positions_f WHERE name = cur_pos_val_rec. 'Miscallaneous error in effective_ date of position' sqlerrm). END IF.date_effective_name.transac tion_id.PUT_LINE(fnd_file.rowid.PUT_LINE(fnd_file. g_error_msg). END. cur_pos_val_rec.insert_error_message_prc(cur_pos_val_rec. 'headcount'.

'Validation'. g_error_msg).transac tion_id. 'Other error in finding business g roup of given organization' sqlerrm). /*==================================================================== ======================= DERIVING BUSINESS_GROUP_ID FROM ORGANIZATION_NAME ===================================================================== =======================*/ BEGIN IF(cur_pos_val_rec. g_business_g roup_id. 'business_group_id'..component_name. 'No organization exists with this business group'). xxph_common_dmg_pkg.organization_name IS NOT NULL) THEN ----deriving business_group_id SELECT DISTINCT business_group_id INTO g_business_group_id FROM hr_organization_units WHERE name = cur_pos_val_rec.LOG. '').insert_error_message_prc(cur_pos_val_rec.LOG.xxph_common_dmg_pkg.component_name. cur_pos_val_rec. g_error_msg. xxph_common_dmg_pkg.component_name. ''). END. g_error_msg. g_business_g roup_id. 'business_group_id'. UPDATE xx_hr_positions_stg SET business_group_id = g_business_group_id ------updating busines s_group_id in staging_table WHERE rowid = cur_pos_val_rec. fnd_file. 'position'.. fnd_file. cur_pos_val_rec. EXCEPTION WHEN no_data_found THEN g_error_msg := 'No organization exists with this business group'..PUT_LINE(fnd_file... xx_per_posfail_prc(cur_pos_val_rec.date_ effective_name. cur_pos_val_rec.LOG. xx_per_posfail_prc(cur_pos_val_rec.organization_name.transac tion_id. 'BUSINESS GROUP:' group_id)..organization_name IS NOT NULL) THEN -----deriving location_id SELECT DISTINCT location_id INTO g_location_id g_business_ .transac tion_id. 'Validation'.rowid.PUT_LINE(fnd_file.LOG. WHEN others THEN g_error_msg := 'Other error in finding business group of given organ ization'. g_error_msg).PUT_LINE(fnd_file.insert_error_message_prc(cur_pos_val_rec. g_error_msg. '').rowid. END IF.PUT_LINE(fnd_file. cur_pos_val_rec. /*==================================================================== ================= DERIVING LOCATION_ID FROM LOCATION_NAME ================================================================== =====================*/ BEGIN IF(cur_pos_val_rec. END IF..rowid. fnd_file.Position already e xist').insert_error_message_prc(cur_pos_val_rec. 'Errror.. fnd_file. 'Validation'.

WHEN others THEN g_error_msg := 'Other error in finding location of given organizatio n'.payrol l.component_name. g_location_id.rowid. 'location_name'. /*-----------------------------------------------------------------------------------DERIVING PAYROLL_ID FROM PAYROLL_NAME ------------------------------------------------------------------------------------*/ BEGIN IF(cur_pos_val_rec. g_error_msg. 'Other error in finding location o f given organization' sqlerrm). cur_pos_val_rec. fnd_file.organization_name.rowid. UPDATE xx_hr_positions_stg ------updating payroll_id in staging_ta ble SET payroll_id = g_payroll_id WHERE rowid = cur_pos_val_rec. g_error_msg). 'location:' g_location_id). location_name. 'location_id'. g_error_msg).FROM hr_all_organization_units WHERE name = cur_pos_val_rec.insert_error_message_prc(cur_pos_val_rec. cur_pos_val_rec.PUT_LINE(fnd_file.transac tion_id.LOG. cur_pos_val_rec.PUT_LINE(fnd_file. xx_per_posfail_prc(cur_pos_val_rec. fnd_file.PUT_LINE(fnd_file. xxph_common_dmg_pkg.transac tion_id. xxph_common_dmg_pkg. cur_pos_val_rec. 'Validation'. 'No payroll exists with this name' ).rowid.LOG. fnd_file. END IF.transac tion_id. g_error_msg).LOG. WHEN others THEN .component_name.rowid. END. fnd_file. xx_per_posfail_prc(cur_pos_val_rec. xxph_common_dmg_pkg.payroll IS NOT NULL) THEN SELECT DISTINCT payroll_id ----deriving payroll_id INTO g_payroll_id FROM pay_all_payrolls_f WHERE payroll_name = cur_pos_val_rec.rowid. 'Validation'. ''). 'No location exists with this name '). EXCEPTION WHEN no_data_found THEN g_error_msg := 'No payroll exists with this name'.insert_error_message_prc(cur_pos_val_rec.LOG. cur_pos_val_rec. EXCEPTION WHEN no_data_found THEN g_error_msg := 'No location exists with this name'. END IF.component_name.LOG.insert_error_message_prc(cur_pos_val_rec. fnd_file.payroll. 'payroll_id:' g_payroll_id). 'payroll'. xx_per_posfail_prc(cur_pos_val_rec. ' Validation'.PUT_LINE(fnd_file. ''). ''). g_error_msg.PUT_LINE(fnd_file. g_error_msg. UPDATE xx_hr_positions_stg ------updating location_id in staging_t able SET location_id = g_location_id WHERE rowid = cur_pos_val_rec.

PUT_LINE(fnd_file. g_error_msg).transac tion_id.PUT_LINE(fnd_file.component_name. cur_pos_val_rec. g_error_msg.insert_error_message_prc(cur_pos_val_rec. ''). xxph_common_dmg_pkg. EXCEPTION WHEN no_data_found THEN g_error_msg := 'No bargaining_unit exists with this name'. 'No bargaining_unit exists with th is name'). 'payroll'.insert_error_message_prc(cur_pos_val_rec.component_name. cur_pos_val_rec. xx_per_posfail_prc(cur_pos_val_rec. 'bargaining_unit:' ng_unit_cd).bargaining_unit.PUT_LINE(fnd_file.insert_error_message_prc(cur_pos_val_rec. '').transac tion_id. 'Validation'. cur_pos_val_re c. cur_pos_val_rec. 'bargaining_unit'. 'Other error in finding payroll of given organization' sqlerrm). 'bargaining_unit'. END.bargaining_unit. xx_per_posfail_prc(cur_pos_val_rec.rowid. fnd_file. 'Validation'. '').LOG. fnd_file.g_error_msg := 'Other error in finding payroll of given organization '. g_error_msg).bargaining_unit. fnd_file. /* =================================================================== =============== DERIVING V_SEASONAL_FLAG ================================================================== ==================*/ BEGIN IF(cur_pos_val_rec. fnd_file. xxph_common_dmg_pkg. xxph_common_dmg_pkg. 'Validation'. g_error_msg). cur_pos_val_re c. END. g_error_msg. xx_per_posfail_prc(cur_pos_val_rec. cur_pos_val_rec.PUT_LINE(fnd_file.payrol l.LOG.rowid.LOG.seasonal IS NOT NULL) THEN --deriving seasonal_flag lookupcode SELECT lookup_code INTO g_seasonal_flag g_bargaini . g_error_msg.component_name. 'Other error in finding bargaining _unit of given organization' sqlerrm).rowid.bargaining_unit IS NOT NULL) THEN ---deriving bargaining_unit lookupcode SELECT lookup_code INTO g_bargaining_unit_cd FROM hr_lookups WHERE lookup_type = 'BARGAINING_UNIT_CODE' AND meaning = cur_pos_val_rec.LOG. END IF. /*-----------------------------------------------------------------------------------DERIVING BARGAINING_UNIT_CODE FROM BARGAINING_UNIT ------------------------------------------------------------------------------------*/ BEGIN IF(cur_pos_val_rec. WHEN others THEN g_error_msg := 'Other error in finding bargaining_unit of given orga nization'.transac tion_id.

PUT_LINE(fnd_file.component_name. 'Validation'. END.insert_error_message_prc(cur_pos_val_rec. xxph_common_dmg_pkg. cur_pos_val_rec. 'seasonal'. xxph_common_dmg_pkg. xx_per_posfail_prc(cur_pos_val_rec. 'No salary_basis exists with this name').salary_basis IS NOT NULL) THEN ----deriving paybasis_id SELECT DISTINCT pay_basis_id INTO g_pay_basis_id FROM per_pay_bases WHERE name = cur_pos_val_rec.LOG.PUT_LINE(fnd_file.transac tion_id. 'Seasonal status should be yes or no').rowid. EXCEPTION WHEN no_data_found THEN g_error_msg := 'Seasonal status should be yes or no'.FROM hr_lookups WHERE lookup_type = 'YES_NO' AND meaning = cur_pos_val_rec. UPDATE xx_hr_positions_stg --------updating paybasis_id in staging .rowid.transac tion_id.PUT_LINE(fnd_file.insert_error_message_prc(cur_pos_val_rec. cur_pos_val_rec. END IF. 'pay_basis:' table SET pay_basis_id = g_pay_basis_id WHERE rowid = cur_pos_val_rec. fnd_file.insert_error_message_prc(cur_pos_val_rec. cur_pos_val_rec. 'Other error in finding seasonal_f lag of given organization' sqlerrm).rowid. /*-----------------------------------------------------------------------------------DERIVING PAY_BASIS_ID FROM SALARY_BASIS ------------------------------------------------------------------------------------*/ BEGIN IF(cur_pos_val_rec. g_error_msg). cur_pos_val_rec.transac tion_id.LOG. fnd_file.seasonal.PUT_LINE(fnd_file.seaso nal. xxph_common_dmg_pkg.salary_basis.seaso nal. fnd_file.LOG.component_name. cur_pos_val_rec.transac g_pay_basis_id). END IF.rowid. fnd_file. EXCEPTION WHEN no_data_found THEN g_error_msg := 'No salary_basis exists with this name'. xx_per_posfail_prc(cur_pos_val_rec. WHEN others THEN g_error_msg := 'Other error in finding seasonal_flag of given organi zation'. 'Validation'. g_error_msg. g_error_msg). 'salary_basis'. ''). xxph_common_dmg_pkg. cur_pos_val_rec.s alary_basis. '').rowid. xx_per_posfail_prc(cur_pos_val_rec. 'Validation'. g_error_msg). g_error_msg. g_error_msg). g_error_msg. xx_per_posfail_prc(cur_pos_val_rec.component_name.LOG. ''). WHEN others THEN g_error_msg := 'Other error in finding salary_basis of given organiz ation'. 'seasonal'.insert_error_message_prc(cur_pos_val_rec.

PUT_LINE(fnd_file.PUT_LINE(fnd_file. UPDATE xx_hr_positions_stg ------------updating grade_id in stagin .tion_id.component_name.frequency AND lookup_type = 'FREQUENCY'. '').rowid. 'No grade exists with this name'). END IF.grade. 'salary_basis'.transac tion_id. 'Validation'. 'GRADE:' g table SET entry_grade_id = g_entry_grade_id WHERE rowid = cur_pos_val_rec. g_error_msg. g_error_msg).PUT_LINE(fnd_file. xxph_common_dmg_pkg.grade.LOG. fnd_file. xxph_common_dmg_pkg. 'grade'. END. END.component_name. cur_pos_val_rec. g_error_msg.transac tion_id.grade IS NOT NULL) THEN ----deriving grade_id SELECT DISTINCT grade_id INTO g_entry_grade_id FROM per_grades WHERE name = cur_pos_val_rec. cur_pos_val_rec. 'Validation'.rowid. '').LOG. /*-----------------------------------------------------------------------------------DERIVING FREQUENCY -----------------------------------------------------------------------------------*/ BEGIN IF(cur_pos_val_rec. cur_pos_val_rec. fnd_file. fnd_file. -----------------------------------------------------------------------------------/*DERIVING GRADE_ID FROM GRADE_NAME*/ -----------------------------------------------------------------------------------BEGIN IF(cur_pos_val_rec. xx_per_posfail_prc(cur_pos_val_rec.insert_error_message_prc(cur_pos_val_rec. 'grade'.LOG. 'Validation'. g_entry_grade_id).rowid. 'Other error in finding entry_grad e of given organization' sqlerrm). cur_pos_val_rec. g_error_msg). EXCEPTION WHEN no_data_found THEN g_error_msg := 'No grade exists with this name'. WHEN others THEN g_error_msg := 'Other error in finding entry_grade of given organiza tion'. cur_pos_val_rec.s alary_basis.frequency IS NOT NULL) THEN ------deriving lookupcode for frequency SELECT lookup_code INTO g_frequency FROM hr_lookups WHERE meaning = cur_pos_val_rec.PUT_LINE(fnd_file.LOG. '').insert_error_message_prc(cur_pos_val_rec. g_error_msg. 'Other error in finding salary_bas is of given organization' sqlerrm).grade. cur_pos_val_rec. xx_per_posfail_prc(cur_pos_val_rec. fnd_file.component_name.

--V fro Validate Records ELSE UPDATE xxph. 'frequency:' g_frequency).dat e_effective_name.freq uency. END. 'Data'. 'Workings hours should be specifie d along with frequency' sqlerrm). fnd_file. 'Validation'. '').0. g_error_msg). SELECT decode(cur_pos_val_rec. 'frequency'.transac tion_id.LOG. xx_per_posfail_prc(cur_pos_val_rec.rowid. fnd_file. WHEN others THEN g_error_msg := 'Workings hours should be specified along with freque ncy'. xx_per_posfail_prc(cur_pos_val_rec. END IF. cur_pos_val_rec. 'Validation'.PUT_LINE(fnd_file. END IF. 'No frequency exists with this nam e').probation_duration = 0 THEN l_probation_duration := NULL.working_hours.LOG.transac tion_id. cur_pos_val_rec. cur_pos_val_rec. '--.PUT_LINE(fnd_file. cur_pos_val_rec.rowid.component_name.rowid.PUT_LINE(fnd_file. l_probation_unit := NULL.PUT_LINE(fnd_file. '').NULL. g_error_msg). '').insert_error_message_prc(cur_pos_val_rec. xxph_common_dmg_pkg.cur_pos_val_rec.LOG.freq uency.transacti on_id. fnd_file.LOG. . IF cur_pos_val_rec. g_error_msg.SAVEPOINT x'). fnd_file. cur_pos_val_rec.xx_hr_positions_stg SET processing_status = 'V' WHERE processing_status = 'N' AND rowid = cur_pos_val_rec. IF(g_error_msg IS NULL) THEN UPDATE xxph.fnd_file.xx_hr_positions_stg SET processing_status = 'E' WHERE processing_status = 'N' AND rowid = cur_pos_val_rec.PUT_LINE(fnd_file. xxph_common_dmg_pkg. g_error_msg. 'HR_POSITIONS'.LOG. END IF. 'frequency'. cur_pos_val_rec. -. EXCEPTION WHEN no_data_found THEN g_error_msg := 'No frequency exists with this name'. 'End of derivations').wor king_hours) INTO l_working_hours FROM dual.rowid.insert_error_message_prc(cur_pos_val_rec.component_name.insert_error_message_prc(cur_pos_val_rec.xxph_common_dmg_pkg. SAVEPOINT x. g_error_msg.component_name.

direct_patient_staff. l_position_definition_id. p_max_persons => cur_pos_val_rec. p_program_update_date => NULL. p_term_start_day_cd => NULL. l_name. p_effective_date => cur_pos_val_rec.registered_nurse.attribute31. p_attribute4 => cur_pos_val_rec. p_position_transaction_id => cur_pos_val_rec.effective_date_from. p_current_org_prop_end_date => NULL. p_program_application_id => NULL. p_pay_term_end_month_cd => NULL. p_comments => NULL. p_time_normal_finish => cur_pos_val_rec.IF(l_commit = 'YES') THEN IF g_error_msg IS NULL THEN -------valid records inserted thru api BEGIN /* hr_position_api. -cur_pos_val_rec. p_overl ap_period => NULL. p_organization_id => g_organization_id. p_replacement_required_flag => NULL. p_work_term_end_day_cd => NULL. p_probation_period => l_probation_duration. p_pay_basis_id => g_pay_basis_id. p_en try_step_id => NULL. p_update_source_cd => NULL . p_object_version_number => l_object_v ersion_number. p_supervisor_id => NULL .meal_coupon_eligibility. p_current_job_prop_end _date => NULL.*/ hr_position_api. l_effective_end_date. p_prior_position_id => NULL. p_prob ation_period_unit_cd => l_probation_unit. p_security_profile_id => l_security _profile_id). p_fill_by_date => NULL. p_security_req uirements => NULL. --cur_ pos_val_rec. p_relief_positi on_id => NULL.fte. p_attribute3 => cur_pos_val_rec. p_working_hours => l_working_hours.organi zation_name. p_amendment_date => NULL. p_work_period_type_cd => NULL.start_date.headcount. . p_position_type => g_ptype. p_date_effective = > cur_pos_val_rec. --cur_pos_val_rec. p_posit ion_id => l_position_id. p_segment2 => cur_pos_val_rec. p_pay_term_end_day_cd => NULL.create_position( p_validate => p_position_id => p_effective_start_date => p_effective_end_date => p_position_definition_id => p_name => FALSE. p_seasonal_flag => g_seasonal_flag.attribute33. p_location_id => g_locat ion_id. l_effective_start_date. p _effective_end_date => l_effective_end_date.start_time. p_permit_recruitment_flag => NULL. p_overlap_unit_cd => NULL. p_business_group_id => g_business_group_id.position_name. p_am endment_recommendation => NULL. p_status => l_status. p_entry_grade_id => g_entry_grade_id. p_s egment1 => cur_pos_val_rec. p_date_end => cur_pos_val_rec. p_effective_start_date => l_effective_start_date. p_attribute2 => cur_pos_val_rec. p_amendment_ref_number => NULL. p_successor_position_id => NULL.shoe_uniform_eligibility. p_proposed_date_f or_layoff => NULL. p_permanent_temporary_flag => g_permanent_ flag. p_work_ter m_end_month_cd => NULL. p_attribute1 => cur_pos_val_ rec. p_time_normal_start => cur_pos_val_rec. p_name => l_name.attribute32. l_position_id. p_avail_status_prop_end_ date => NULL. p_program_id => NULL. p_works_council_approval_flag => NULL.create_position(p_validate => FALSE. p_job_id => g_job_id. p_pos ting_description => NULL. p_fte => cur_pos_val_rec. p_proposed_fte_for_layoff => NULL. p_segment3 => NULL. p_concat_segments => NULL. p_te rm_start_month_cd => NULL. p_frequency => g_frequency. p_review_flag => NULL. p_request_id => NULL. p_earliest_hi re_date => NULL.end_time. p_attribute_category => 'PH_ADD_POS_DETAILS'. p_availabi lity_status_id => g_status.effective_date_to. p_entry_grade_rule_id => NULL. p_position_definition_id => l_pos ition_definition_id. p_supervisor_position_id => NULL. p_segment4 => NULL.transaction_id. p_bargaining _unit_cd => g_bargaining_unit_cd. p_language_code => l_language_code. p_pay_freq_payroll_id => g_payroll_id.

headcount. g_location_id. p_time_normal_finish => cur_pos_val_rec. p_entry_grade_id => g_entry_grade_id. cur_pos_val_rec. p_successor_position_id => NULL. p_amendment_recommendation => NULL. g_payroll_id. p_replacement_required_flag => NULL.p_object_version_number p_job_id p_organization_id p_effective_date ate_from. p_time_normal_start => cur_pos_val_rec. p_work_period_type_cd => NULL.transaction p_prior_position_id => NULL. p_current_org_prop_end_date => NULL. cur_pos_val_rec. . p_security_requirements => NULL. g_organization_id. p_fte => cur_pos_val_rec. p_status => l_status. l_language_code. p_permit_recruitment_flag => NULL. p_seasonal_flag => g_seasonal_flag. p_works_council_approval_flag => NULL.fte. p_work_term_end_month_cd => NULL. p_position_type => g_ptype. p_current_job_prop_end_date => NULL. g_status.end_time. p_date_end => cur_pos_val_rec. p_term_start_month_cd => NULL. NULL. p_bargaining_unit_cd => g_bargaining_unit_cd. p_posting_description => NULL. p_overlap_unit_cd => NULL. p_term_start_day_cd => NULL. p_avail_status_prop_end_date => NULL. p_amendment_date => NULL.start_time.effective_d cur_pos_val_rec. g_job_id. p_overlap_period => NULL. p_pay_term_end_day_cd => NULL. p_comments => NULL. p_date_effective p_language_code p_availability_status_id p_business_group_id p_entry_step_id p_entry_grade_rule_id p_location_id p_pay_freq_payroll_id p_position_transaction_id _id. p_pay_term_end_month_cd => NULL. p_max_persons => cur_pos_val_rec. p_relief_position_id => NULL.start_date. p_probation_period => l_probation_duration. => => => => => => => => => => => => => l_object_version_number. p_supervisor_position_id => NULL. p_working_hours => l_working_hours. p_permanent_temporary_flag => g_permanent_flag. p_work_term_end_day_cd => NULL. p_frequency => g_frequency. p_probation_period_unit_cd => l_probation_unit. g_business_group_id. p_review_flag => NULL. p_earliest_hire_date => NULL. p_fill_by_date => NULL. p_amendment_ref_number => NULL. p_update_source_cd => NULL. NULL.effective_d ate_to.

'API failed when inserting p osition records: ' sqlerrm fnd_message.direct_pati => cur_pos_val_rec.organizatio => => => => => => => => NULL. fnd_file. 'ORACLE ERROR'. IF g_error_msg IS NOT NULL THEN .attribute31. NULL.attribute32. l_success := l_success + 1.GET. p_segment3 p_segment4 p_concat_segments p_request_id p_program_application_id p_program_id p_program_update_date p_security_profile_id ). xx_per_posfail_prc(cur_pos_val_rec. xxph_common_dmg_pkg.PUT_LINE(fnd_file.LOG. p_segment1 me. p_attribute2 ent_staff. NULL. p_attribute4 _eligibility. g_error_msg). END IF.position_name.t ransaction_id.rowid. END. 'Position'. cur_pos_val_rec. cur_pos_val_rec . p_attribute3 m_eligibility.rowid. NULL. --cur_pos_val_rec. p_segment2 n_name.rowid. EXCEPTION WHEN others THEN g_error_msg := 'API failed when inserting position records: ' sqlerrm fnd_message.component_name. NULL.GET). --cur_pos_val_rec.attribute33.xx_hr_positions_stg SET processing_status = 'E' WHERE processing_status='V' AND rowid = cur_pos_val_rec. g_error_msg. NULL.registered_ => cur_pos_val_rec. l_pos_ins := FALSE.p_proposed_fte_for_layoff p_proposed_date_for_layoff p_pay_basis_id p_supervisor_id p_attribute_category p_attribute1 nurse. NULL.meal_coupon => cur_pos_val_rec. NULL. cur_pos_val_rec.xx_hr_positions_stg SET processing_status = 'P' WHERE processing_status='V' AND rowid = cur_pos_val_rec.position_na => cur_pos_val_rec. NULL. g_pay_basis_id. ''). 'PH_ADD_POS_DETAILS'.insert_error_message_prc(cur_pos_val_rec.shoe_unifor => cur_pos_val_rec. IF g_error_msg IS NULL THEN => => => => => => NULL. ELSE UPDATE xxph. --cur_pos_val_rec. l_security_profile_id UPDATE xxph.

l_error := l_read -l_success. l_success). l_ln_responsibility_id NUMBER := fnd_global. BEGIN fnd_file.PUT_LINE(fnd_file.LOG. . . 'Total no of records processed:' 'Total no of records errored:' l_ 'Total no of records:' /*==================================================== --MAIN PROCEDURE OF POSITIONS-=====================================================*/ ER.LOG. l_request_id NUMBER := fnd_global.resp_id. l_ln_application_id NUMBER := fnd_global. l_commit VARCHAR2(3) := p_commit.LOG. l_ln_application_id).conc_request_id. l_read). END IF. END xx_per_positions_prc.*/ COMMIT.apps_initialize(l_ln_user_id.PUT_LINE(fnd_file. fnd_file. END LOOP. fnd_file.PUT_LINE(fnd_file.xx_hr_validgrade_stg SET processing_status = 'N' WHERE processing_status = 'V'. END IF. PROCEDURE xx_load_positions_prc(errbuf OUT VARCHAR2.prog_appl_id. COMMIT.LOG.xx_hr_validgrade_stg SET conc_req_id = NULL WHERE processing_status = 'V'.PUT_LINE(fnd_file. conc_req_id = NULL WHERE processing_status = 'V'.user_id. 'p_commit:' p_commit). /* IF(l_read=100) THEN COMMIT. 'l_commit:' l_commit).fnd_global.*/ fnd_file. UPDATE xxph. END IF. UPDATE xx_hr_positions_stg SET processing_status = 'N'.PUT_LINE(fnd_file. l_ln_responsibility_id --. error). /* UPDATE xxph. IF(l_commit = 'YES') THEN fnd_file. END IF. END IF.ROLLBACK TO x. retcode OUT NUMB p_commit IN VARCHAR2) IS l_ln_user_id NUMBER := fnd_global.LOG.

BEGIN fnd_file. 'ORACLE ERROR'. 'Error while updating error flag in staging table for rowid' p_rowid ' ' sqlerrm). processing_status = 'E' WHERE rowid = p_rowid. created_by = v_user_id. last_update_login = v_user_id.xxph_common_dmg_pkg. l_commit).component_name. cur_pos_val_rec. 'Position'. END xx_per_posfail_prc. /*====================================================================== ================== Failure procedure for grades ======================================================================== ================== PROCEDURE xx_per_gradefail_prc(p_rowid IN rowid. 'FAILURE PROCEDURE').PUT_LINE(fnd_file.VALUE('USER_ID'). --xx_grades_output_report_prc(l_request_id.LOG. l_commit). cur_pos_val_rec.PUT_LINE(fnd_file. v_user_id := fnd_profile. xx_output_report_prc(l_request_id. xx_per_positions_prc(l_request_id. l_commit). g_error_msg.insert_error_message_prc(cur_pos_val_rec.date_ef fective_name. EXCEPTION WHEN others THEN -. COMMIT.UPDATE xx_hr_positions_stg SET conc_req_id = l_request_id WHERE processing_status = 'N'. ------------N for New Records--------/* UPDATE xx_hr_validgrade_stg SET conc_req_id = l_request_id WHERE processing_status = 'N'. fnd_file. 'USER ID: ' l_ln_user_id 'RESP ONSIBILITY ID: ' l_ln_responsibility_id 'APPLICATION ID: ' l_ln_applica tion_id). ''). /*====================================================================== ================== Failure procedure for positions =========================================================================== ===============*/ PROCEDURE xx_per_posfail_prc(p_rowid IN rowid.PUT_LINE(fnd_file. last_update_date = sysdate.transacti on_id. ------------N for New Records---------*/ fnd_file. END xx_load_positions_prc.LOG.LOG. p_err_msg IN VARCHAR2 . UPDATE xx_hr_positions_stg SET creation_date = sysdate. p_err_msg IN VARCHAR2) IS v_user_id NUMBER. last_updated_by = v_user_id.

LOG. IN VARCHAR2) IS l_pos_id NUMBER.PUT_LINE(FND_FILE. UPDATE xx_reppos_stg SET creation_date = SYSDATE. v_user_id := fnd_profile. BEGIN fnd_file. 'Error While Updating Error Flag in s taging Table for rowid' p_rowid ' ' sqlerrm). AR2) IS v_user_id NUMBER. processing_status = 'E' WHERE rowid = p_rowid. 'Failure Procedure').LOG. 'Failure Procedure'). 'Error While Updating Error Flag in staging Table for rowid' p_rowid ' ' sqlerrm). created_by = v_user_id.VALUE('USER_ID').*/ /*===================================================================== ================ Loading Hierarchy and Reporting information ======================================================================= ================*/ /* PROCEDURE xx_per_hierarchies_prc(p_request_id IN NUMBER. END. v_user_id := fnd_profile. END. processing_status = 'E' WHERE rowid = p_rowid. p_commit p_err_msg IN VARCH .) IS v_user_id NUMBER. BEGIN FND_FILE.LOG. last_updated_by = v_user_id. UPDATE xx_hr_validgrade_stg SET creation_date = sysdate. EXCEPTION WHEN others THEN fnd_file. last_update_login = v_user_id. created_by = v_user_id.VALUE('USER_ID'). */ /* ===================================================================== =================== Failure procedure for hierarchies ========================================================================= =================*/ /* PROCEDURE xx_per_hierfail_prc(p_rowid IN rowid.LOG. last_update_login = v_user_id.PUT_LINE(fnd_file. last_updated_by = v_user_id. last_update_date = sysdate. last_update_date =SYSDATE.PUT_LINE(fnd_file.PUT_LINE(FND_FILE. EXCEPTION WHEN OTHERS THEN FND_FILE.

CURSOR cur_reppos_stg IS SELECT xxrp. l_pos_structure_version_id := NULL. l_hierarchycount := NULL. . l_reppositioncount := NULL.position_name. l_pos_structure_element_id NUMBER. l_error NUMBER. l_hierarchycount NUMBER.LOG. '-------------------------------------T1'). xxrp. FOR cur_reppos_rec IN cur_reppos_stg LOOP FND_FILE. l_business_group_id NUMBER. l_object_version_number NUMBER.l_parent_position_id NUMBER. l_success NUMBER. l_read NUMBER. l_object_version_number := NULL.PUT_LINE(FND_FILE. l_commit := p_commit. l_read := l_read + 1. l_read := 0.LOG. l_pos_id := NULL.PUT_LINE(FND_FILE. l_business_group_id := NULL. l_pos_structure_element_id := NULL. --l_effective_start_date DATE. l_parent_position_id := NULL.rowid FROM xx_reppos_stg xxrp WHERE processing_status = 'V'.PUT_LINE(FND_FILE. 'position_id:' l_pos_id). BEGIN FND_FILE. l_position_date DATE. l_success := 0.position_name IS NOT NULL) THEN-----deriving p osition_id from position_name SELECT DISTINCT position_id INTO l_pos_id FROM hr_all_positions_f WHERE name = cur_reppos_rec. FND_FILE. ' start of mandetory validations of r eporting info'). xxrp. g_error_msg := NULL. END IF. l_position_date := NULL. l_reppositioncount NUMBER. l_commit VARCHAR2(3). CURSOR cur_reppos_ins IS SELECT xxrp.LOG. l_error := 0.*. l_pos_structure_version_id NUMBER.*.rowid FROM xx_reppos_stg xxrp WHERE processing_status = 'N'. BEGIN IF(cur_reppos_rec.

'position_name'.tran saction_id. xx_per_hierfail_prc(cur_reppos_rec. WHEN OTHERS THEN g_error_msg := 'OTHER ERROR IN FINDING IN POSITION'. xxph_common_dmg_pkg.position_name. g_error_msg).component_name. 'position_name'. 'Validation'. xxph_common_dmg_pkg. 'Date of position'. g_error_msg. cur_reppos_rec. xxph_common_dmg_pkg. xx_per_hierfail_prc(cur_reppos_rec. l_position_ date. '').position_name.insert_error_message_prc(cur_reppos_rec. '').position_name.rowid. FND_FILE. cur_reppos_rec . cur_reppos_rec.LOG.PUT_LINE(FND_FILE. BEGIN IF(cur_reppos_rec.LOG.PUT_LINE(FND_FILE. WHEN TOO_MANY_ROWS THEN g_error_msg := 'TOO MANY DATA FOR POSITION_DATE'. cur_reppos_rec .rowid.insert_error_message_prc(cur_reppos_rec. g_error_msg). g_error_msg.LOG.component_name. xxph_common_dmg_pkg. 'NO DATE EXISTS FOR THIS POSITION ' sqlerrm).EXCEPTION WHEN NO_DATA_FOUND THEN g_error_msg := 'No position exists with this name to attach repo rting position'. 'TOO MANY DATA FOR POSITION'). cur_reppos_rec .heirarchy IS NULL) THEN ------checking for mandetory column hierarchy . FND_FILE. END.rowid. END. 'OTHER ERROR IN FINDING IN POSI TION' sqlerrm). ''). WHEN TOO_MANY_ROWS THEN g_error_msg := 'TOO MANY DATA FOR POSITION'. 'position_name'.LOG. g_error_msg. g_error_msg.component_name. BEGIN IF(cur_reppos_rec.LOG. 'Validation'. 'No position exists with this n ame to attach reporting position'). g_error_msg).position_name.component_name. cur_reppos_rec .tran saction_id.insert_error_message_prc(cur_reppos_rec. xx_per_hierfail_prc(cur_reppos_rec. FND_FILE. xx_per_hierfail_prc(cur_reppos_rec.rowid.PUT_LINE(FND_FILE. cur_reppos_rec.tran saction_id. EXCEPTION WHEN NO_DATA_FOUND THEN g_error_msg := 'NO DATE EXISTS FOR THIS POSITION'. g_error_msg). xxph_common_dmg_pkg. ''). cur_reppos_rec. END IF.tran saction_id. 'Validation'.tran saction_id. FND_FILE. 'Validation'.insert_error_message_prc(cur_reppos_rec. cur_reppos_rec.insert_error_message_prc(cur_reppos_rec. xx_per_hierfail_prc(cur_reppos_rec. FND_FILE.rowid. '').position_name IS NOT NULL AND l_pos_id IS NOT NULL) THEN SELECT DISTINCT effective_start_date INTO l_position_date FROM hr_all_positions_f WHERE name = cur_reppos_rec. 'position_name'.component_name.PUT_LINE(FND_FILE. 'TOO MANY DATA FOR POSITION_DATE' ). g_error_msg.PUT_LINE(FND_FILE. 'Validation'.position_name. g_error_msg).

PUT_LINE(FND_FILE.g_error_msg := 'REPORTING HIERARCHY DO NOT EXIST'. ''). 'Data'. g_error_msg). 'Validation'.hei rarchy. EXCEPTION WHEN NO_DATA_FOUND THEN g_error_msg := 'NO HEIRARCHY EXISTS WITH THIS NAME'. 'TOO MANY ROWS FOR HEIRARCHY NAME ').business_group_id INTO l_pos_structure_version_id.insert_error_message_prc(cur_reppos_rec. xxph_common_dmg_pkg. xxph_common_dmg_pkg. 'Validation'. cur_reppos_rec. 'NO HEIRARCHY EXISTS WITH THIS NA ME').hei rarchy. cur_reppos_rec.pos_structure_version_id.LOG. WHEN TOO_MANY_ROWS THEN g_error_msg := 'TOO MANY ROWS FOR HEIRARCHY NAME'. 'v_business_group_id :' l_bu siness_group_id).insert_error_message_prc(cur_reppos_rec.LOG. g_error_msg). g_error_msg. FND_FILE.tr .rowid. l_business_group_id FROM per_pos_structure_versions ppsv.PUT_LINE(FND_FILE.LOG.PUT_LINE(FND_FILE.component_name. g_error_msg). xxph_common_dmg_pkg.insert_error_message_prc(cur_reppos_rec. ' MISCELLANEOUS ERROR IN FINDING HEIRARCHY' sqlerrm). FND_FILE. 'HEIRARCHY'.hei rarchy. FND_FILE. 'herarchy name:' cur_reppos_ rec. END.tran saction_id. xx_per_hierfail_prc(cur_reppos_rec. g_error_msg. FND_FILE.LOG.heirarchy). WHEN OTHERS THEN g_error_msg := 'MISCELLANEOUS ERROR IN FINDING HEIRARCHY'. 'HEIRARCHY'. FND_FILE.rowid. FND_FILE.businessgroup_id pps.insert_error_message_prc(cur_reppos_rec.component_name. g_error_msg). 'Validation'. xx_per_hierfail_prc(cur_reppos_rec. END IF. g_error_msg).position_structure_id AND pps. '').component_name.name = cur_reppos_rec.rowid.rowid.insert_error_message_prc(cur_reppos_rec.PUT_LINE(FND_FILE.LOG.component_name. 'HEIRARCHY'.LOG.LOG. 'HEIRARCHY'. g_error_msg. cur_reppos_rec.position_structure_id = ppsv. '').reporting_to_position IS NULL) THEN------check ing mandetory column reportingposition g_error_msg := 'REPORTING TO POSITION DO NOT EXIST'. cur_reppos_rec. xxph_common_dmg_pkg.heirarchy.tran saction_id.rowid.h eirarchy. 'REPORTING HIERARCHY DO NOT EXI ST'). 'v_pos_structure_version_id:' l_pos_structure_version_id). cur_reppos_rec. FND_FILE. xx_per_hierfail_prc(cur_reppos_rec. g_error_msg. ''). xxph_common_dmg_pkg. ----deriving version_id. per_position_structures pps WHERE pps. cur_reppos_rec. xx_per_hierfail_prc(cur_reppos_rec.PUT_LINE(FND_FILE.tran saction_id. cur_reppos_rec.PUT_LINE(FND_FILE. cur_reppos_rec. ELSE SELECT DISTINCT ppsv. xx_per_hierfail_prc(cur_reppos_rec.tr ansaction_id.PUT_LINE(FND_FILE. BEGIN IF(cur_reppos_rec.

cur_reppos_rec.PUT_LINE(FND_FILE.ansaction_id.hei rarchy. xx_per_hierfail_prc(cur_reppos_rec.rowid.Hierarchy already Exist. xx_per_hierfail_prc(cur_reppos_rec. FND_FILE. FND_FILE. xxph_common_dmg_pkg. 'parent_position_id:' l_pare nt_position_id).component_name. g_error_msg. 'REPORTING TO POSITION DOES NOT E XIST WITH THIS NAME').component_name. xxph_common_dmg_pkg. cur_reppos_rec.component_name.component_name. '').rowid. '').reporting_to_position.tran saction_id.xx_reppos_stg WHERE heirarchy = cur_reppos_rec.. FND_FILE.heirarchy AND position_name = cur_reppos_rec.insert_error_message_prc(cur_reppos_rec. '').position_name AND processing_status IN('N'. IF(l_hierarchycount > 1) THEN g_error_msg := 'ERRROR.tran saction_id. 'P'). cur_re ppos_rec. END IF.LOG. cur_reppos_rec. 'reporting_to_position'. cur_re ppos_rec. g_error_msg.PUT_LINE(FND_FILE. ELSE SELECT DISTINCT position_id ------deriving parentposition_id INTO l_parent_position_id FROM hr_all_positions_f WHERE name = cur_reppos_rec. xxph_common_dmg_pkg. g_error_msg).Same Hier archy cannot exist more than once for position'.. . 'Data'.tran saction_id. WHEN OTHERS THEN g_error_msg := 'MISCELLANEOUS ERROR REPORTING TO POSITION '. 'reporting_to_position'. cur_reppos_rec. 'REPORTING TO POSITION DO NOT E XIST').rowid.PUT_LINE(FND_FILE. cur_ reppos_rec. 'reporting_to_position'. 'Data'. 'reporting_to_position'. xx_per_hierfail_prc(cur_reppos_rec. g_error_msg. g_error_msg). g_error_msg.reporting_to_position.LOG. ''). END.reporting_to_position. xxph_common_dmg_pkg. cur_reppos_rec. ' MISCELLANEOUS ERROR REPORTING T O POSITION' sqlerrm). FND_FILE.insert_error_message_prc(cur_reppos_rec.component_name.. ''). 'Data'..LOG..insert_error_message_prc(cur_reppos_rec. g_error_msg).reporting_to_position..LOG. 'Validation'. cur_reppos_rec. g_error_msg.reporting_to_position.PUT_LINE(FND_FILE.rowid. SELECT COUNT(1) INTO l_hierarchycount FROM xxph.LOG.. cur_re ppos_rec. xx_per_hierfail_prc(cur_reppos_rec.PUT_LINE(FND_FILE. 'HEIRARCHY'. 'TOO MANY ROWS FOR REPORTING TO POSITION').insert_error_message_prc(cur_reppos_rec. WHEN TOO_MANY_ROWS THEN g_error_msg := 'TOO MANY ROWS FOR REPORTING TO POSITION '. FND_FILE. g_error_msg). EXCEPTION WHEN NO_DATA_FOUND THEN g_error_msg := 'REPORTING TO POSITION DOES NOT EXIST WITH THIS N AME'.tran saction_id. 'Data'..

''). 'Validations Over' IF g_error_msg IS NULL THEN UPDATE xxph.PUT_LINE(FND_FILE. IF(l_hierarchycount > 1) THEN g_error_msg := 'ERRROR.heirarchy AND reporting_to_position = cur_reppos_rec.Same Hierarchy cannot have more than one reporting position'. --V fro Validate Records ELSE UPDATE xxph.LOG. 'reporting_to_position'.processing_status).position_name AND processing_status IN('N'. 'ERRROR.xx_reppos_stg WHERE heirarchy = cur_reppos_rec. 'P').. p_effective_date => l_position_date.reporting_to_position AND position_name = cur_reppos_rec. END IF.. 'Data'..Reporting to posi tion already Exist. cu sqlerrm).Same Hierarchy cannot have more than one reporting position') ..PUT_LINE(FND_FILE..reporting_to_position.LOG.xx_reppos_stg SET processing_status = 'V' WHERE processing_status = 'N' AND rowid = cur_reppos_rec. p_pos_structure_version_id => l_pos_structure_version_id... FND_FILE. END IF..rowid..PUT_LINE(FND_FILE.PUT_LINE(FND_FILE. cur_re ppos_rec. hr_pos_hierarchy_ele_api.FND_FILE.. SELECT COUNT(1) INTO l_reppositioncount FROM xxph.component_name.LOG. FND_FILE. cur_reppos_rec.rowid...create_pos_hierarchy_ele(p_validate => FALSE.insert_error_message_prc(cur_reppos_rec.. g_error_msg). END IF. IF l_commit = 'YES' THEN IF g_error_msg IS NULL THEN BEGIN FND_FILE. 'start of insertion'). ..tran saction_id. 'ERRROR.LOG..xx_reppos_stg SET processing_status = 'E' WHERE processing_status = 'N' AND rowid = cur_reppos_rec. p_business_group_id => l_business_group_id.. g_error_msg...Hierarchy already Exist. p_hr_installed => 'I'.. p_subordinate_position_id => l_pos_id.. xx_per_hierfail_prc(cur_reppos_rec..PUT_LINE(FND_FILE. xxph_common_dmg_pkg..LOG.rowid. 'updating processing status:' r_reppos_rec.LOG.Same Hierarchy cannot exist more than once'). p_parent_position_id => l_parent_position_id.Reporting to position already Exi st..PUT_LINE(FND_FILE. g_error_msg).. FND_FILE. 'Validations Over' FND_FILE.

l_success := l_success + 1. g_error_msg). o:' /*==================================================================== ========================= Main Procedure For Hierarchies ================================================================== ==========================*/ BER.conc_request_id. l_ln_application_id). FND_FILE.LOG. FND_FILE. retcode OUT NUM p_commit IN VARCHAR2) IS l_ln_user_id NUMBER := fnd_global. l_commit VARCHAR2(3) := p_commit.PUT_LINE(FND_FILE. COMMIT. FND_FILE. /* PROCEDURE xx_load_poshier_prc(errbuf OUT VARCHAR2.resp_id. g_error_msg. IF g_error_msg IS NULL THEN UPDATE xxph. 'ORACLE ERROR'. cur_reppos_rec. transaction_id. 'Total no of records processed in rep orting info:' l_success).PUT_LINE(FND_FILE. . 'position_name'. '').p_pos_structure_element_id => l_pos_structure_element_id. l_ln_responsibility_id . l_ln_responsibility_id NUMBER := fnd_global. 'Total no of records errored in repor ting info:' l_error). 'API FAILED WHEN INSERTING RE PORTING_INFORMATION' sqlerrm). l_ln_application_id NUMBER := fnd_global.LOG.rowid. xxph_common_dmg_pkg. END IF.xx_reppos_stg SET processing_status = 'P' WHERE processing_status = 'V' AND rowid = cur_reppos_rec. l_request_id NUMBER := fnd_global. END IF.user_id. BEGIN ---fnd_global.component_name.position_name.PUT_LINE(FND_FILE.PUT_LINE(FND_FILE.LOG. 'Total no of records in reporting inf l_read).prog_appl_id. l_error := l_read -l_success. xx_per_hierfail_prc(cur_reppos_rec. p_object_version_number => l_object_version_number). EXCEPTION WHEN OTHERS THEN g_error_msg := 'API FAILED WHEN INSERTING REPORTING_INFORMAT ION:' SQLERRM.LOG. END LOOP.insert_error_message_prc(cur_reppos_rec. END xx_per_hierarchies_prc. FND_FILE. END. cur_reppos _rec.apps_initialize(l_ln_user_id.rowid. --P for processed Records END IF.

'l_commit:' IF(l_commit = 'YES') THEN UPDATE xxph.*/ /*===================================================================== ====================== To Develop the error Report of positions ======================================================================= =========================*/ PROCEDURE xx_output_report_prc(p_request_id IN NUMBER. UPDATE xxph. xx_per_hierarchies_prc(l_request_id.date_effective_name.PUT_LINE(FND_FILE.*.component_name AND xxe.rowid FROM xxph.error_type.PUT_LINE(FND_FILE.xx_hr_positions_stg xxvp. l_commit).processing_status = 'V' AND xxvp. ------------N for New Records--------- p_commit).transaction_id AND xxvp. xx_hier_output_report_prc(l_request_id. COMMIT. END xx_load_poshier_prc.PUT_LINE(FND_FILE.LOG.error_value. xxvp.error_column. COMMIT. l_commit). xxe. --cursor to fetch all the error records obtained through this request CURSOR cur_error_records(p_conc_req_id NUMBER) IS SELECT xxvp.conc_req_id = p_conc_req_id. xx_ph_all_errors xxe WHERE xxvp.transaction_id = xxe.component_name = xxe.xx_hr_positions_stg xxvp WHERE xxvp. . xxe. l_commit).FND_FILE. 'p_commit:' FND_FILE. 'USER ID: ' l_ln_user_id 'RESPON SIBILITY ID: ' l_ln_responsibility_id 'APPLICATION ID: ' l_ln_applicati on_id).xx_reppos_stg SET processing_status = 'N' WHERE processing_status = 'V'.LOG.conc_req_id = p_conc_req_id. UPDATE xxph. FND_FILE.xx_reppos_stg SET conc_req_id = NULL WHERE processing_status = 'V'. END IF.error_messg FROM xxph. xxe.LOG. p_commit IN VARCHA R2) IS --cursor to fetch all the valid records processed through this request CURSOR cur_valid_positions(p_conc_req_id NUMBER) IS SELECT xxvp.xx_reppos_stg SET conc_req_id = l_request_id WHERE processing_status = 'N'. xxe.

' '). ' '). END LOOP. ' ') CHR(9) rpad(nvl('============'. ' '). ' ') CHR(9) rpad(nvl('Error_Value'. ' ') .OUTPUT.rowid. 25. rpad(nvl('================='. BEGIN IF(p_commit = 'YES') THEN FOR valid_positions_rec IN cur_valid_positions(p_request_id) LOOP --fnd_file.OUTPUT. 'P_Request_id:' p_reques t_id). valid_positions_rec.insert_error_message_prc(valid_positions_rec . 70.OUTPUT.date_effective_name.component_name.date_effective_name. NULL).xx_hr_positions_stg SET processing_status = 'E' WHERE rowid = valid_positions_rec. END IF. IF(t_count = 0) THEN /* Update the staging table with error status for records that are not present in standard table */ UPDATE xxph.transaction_id. 17.PUT_LINE(fnd_file. fnd_file. ' '). --TO insert error message into error table xxph_common_dmg_pkg. 30. COMMIT. 70.PUT_LINE(fnd_file. t_count_records NUMBER. t_error_records NUMBER.rowid. 'error report for posit ions' SQLERRM. t_success_records NUMBER. ' ') CHR(9) rpad(nvl('Error_Message'. 100. 25. ' '). rpad(nvl('SAP_Position_name'. ' '). ' ')). 'POSITION_NAME'. END IF. --To check whether the record exists in standard Table SELECT COUNT(1) INTO t_count FROM hr_all_positions_f WHERE name = valid_positions_rec. ' ') CHR(9) rpad(nvl('Er ror_Record_Type'. ' ') CHR(9) rpad(nvl('Error_Column'. ' '). fnd_file. 'ORACLE_ERROR'.t_count NUMBER. IF(t_count = 1) THEN /* Update the staging table with processed status for records t hat are present in standard table*/ UPDATE xx_hr_positions_stg SET processing_status = 'P' WHERE rowid = valid_positions_rec. END IF. vali d_positions_rec.PUT_LINE(fnd_file.

conc_req_id = p_request_id AND processing_status = 'P'. ' ').error_type.OUTPUT. 100. rpad(nvl(error_records_rec.PUT_LINE(fnd_file. SELECT COUNT(1) INTO t_count_records FROM xx_hr_positions_stg xxvp WHERE xxvp. 30. IF(p_commit = 'NO') THEN SELECT COUNT(1) INTO t_success_records FROM xx_hr_positions_stg xxvp WHERE xxvp. IF(p_commit = 'YES') THEN SELECT COUNT(1) INTO t_success_records FROM xx_hr_positions_stg xxvp WHERE xxvp.PUT_LINE(fnd_file.OUTPUT.conc_req_id = p_request_id. 25. ' '). fully ' fnd_file.PUT_LINE(fnd_file. END xx_output_report_prc.PUT_LINE(fnd_file. ' ').OUTPUT. ' ') CHR(9) rpad(nvl('============='. '================================ ==============='). 70. ' ') CHR(9) rpad(nvl(error_records_rec. END LOOP. ' ') CHR(9) rpad(nvl('== ==============='. FOR error_records_rec IN cur_error_records(p_request_id) LOOP fnd_file.er ror_column.OUTPUT. or ' fnd_file. 17. ' ') CHR(9) rpad(nvl(error_records_rec. /* ===================================================================== ====================== 'Total Records Processed with Err 'Total Records Processed Sucess 'Total Records that are Valid ' . t_success_records). ' ') CHR(9) rpad(nvl(error_records_rec. fnd_file. END IF. 17.PUT_LINE(fnd_file. 'P_Request_id:' p_request_id). ' ')). 30. fnd_file.PUT_LINE(fnd_file. ' ')).conc_req_id = p_request_id AND processing_status = 'E'.conc_req_id = p_request_id AND processing_status = 'V'. ' ') CHR(9) rpad(nvl(error_records_rec. ' ').OUTPUT. t_success_records).error_messg. SELECT COUNT(1) INTO t_error_records FROM xx_hr_positions_stg xxvp WHERE xxvp.OUTPUT.date _effective_name. t_error_records).OUTPUT. 'Total Records Processed ' t_c ount_records). fnd_file. ' '). ' '). END IF. 100. ' '). fnd_file.PUT_LINE(fnd_file. ' ').CHR(9) rpad(nvl('==========='.error_v alue.

IF(l_grdcount = 0) THEN /* Update the staging table with error status for records that are not present in standard table */ /* UPDATE xxph.conc_req_id = p_conc_req_id.transaction_id AND xxvg.To Develop the error Report of grades ==================================================================== ============================ PROCEDURE xx_grades_output_report_prc(p_request_id IN NUMBER. p_co mmit IN VARCHAR2) IS --cursor to fetch all the valid records processed through this request CURSOR cur_valid_grades(p_conc_req_id NUMBER) IS SELECT xxvg. l_grderror_records NUMBER.component_name = xxe. xxe. xxe. --TO insert error message into error table . xx_ph_all_errors xxe WHERE xxvg.xx_hr_validgrade_stg xxvg WHERE xxvg.xx_hr_validgrade_stg SET processing_status = 'E' WHERE rowid = valid_grades_rec.conc_req_id = p_conc_req_id.valid_grade. xxvg. BEGIN IF(p_commit = 'YES') THEN FOR valid_grades_rec IN cur_valid_grades(p_request_id) LOOP --To check whether the record exists in standard Table SELECT COUNT(1) INTO l_grdcount FROM per_valid_grades WHERE position_id IN (SELECT position_id FROM hr_all_positions_f WHERE name = valid_grades_rec.error_type.rowid.rowid FROM xxph. l_grdcount NUMBER. xxe.component_name AND xxe. --cursor to fetch all the error records obtained through this request CURSOR cur_grades_error_records(p_conc_req_id NUMBER) IS SELECT xxvg.error_messg FROM xxph.error_value.transaction_id = xxe. l_grdsuccess_records NUMBER.processing_status = 'V' AND xxvg. l_grdcount_records NUMBER. xxe.xx_hr_validgrade_stg xxvg.*.error_column.position_name) .

END IF.va lid_grade.xxph_common_dmg_pkg. 30.OUTPUT. COMMIT. 50. 30. ' ') CHR(9) rpad('Error_Record_Type'. END IF. 'Total Records Processed ' l_g IF(p_commit = 'YES') THEN SELECT COUNT(1) INTO l_grdsuccess_records FROM xx_hr_validgrade_stg xxvg WHERE xxvg.OUTPUT. fully ' fnd_file. fnd_file. 'ORACLE_ERROR'. END IF. ' ') CHR(9) rpad(error_gradesrecords_rec.xx_hr_validgrade_stg SET processing_status = 'P' WHERE rowid = valid_grades_rec.PUT_LINE(fnd_file. END LOOP.PUT_LINE(fnd_file.error_messg. 50.PUT_LINE(fnd_file.tr ansaction_id. rdcount_records).insert_error_message_prc(valid_grades_rec. rpad('SAP_Grade_name'.rowid. 30.OUTPUT. FOR error_gradesrecords_rec IN cur_grades_error_records(p_request_id) LOOP fnd_file. ' ') CHR(9) rpad(error_gradesrecords_rec. 'Valid_grade'. ' ') CHR(9) 'Error_Column' CHR(9) rpad('Error_Value'.Update the staging table with processed status for records t hat are --present in standard table UPDATE xxph.conc_req_id = p_request_id . ' ') CHR(9) rpad(error_gradesrecords_rec. ' ')).conc_req_id = p_request_id AND processing_status = 'P'. fnd_file.component_name.error_value. 100.error_column. 50.conc_req_id = p_request_id. SELECT COUNT(1) INTO l_grdcount_records FROM xx_hr_validgrade_stg xxvg WHERE xxvg. 100. ' ') CHR(9) rpad(error_gradesrecords_rec. 'error report for grades'. 'Total Records Processed Sucess l_grdsuccess_records). ' ')). IF(l_grdcount = 1) THEN -. 30. END LOOP. NULL). ELSE SELECT COUNT(1) INTO l_grdsuccess_records FROM xx_hr_validgrade_stg xxvg WHERE xxvg. valid_grades_rec.error_type.OUTPUT.valid_grade. rpad(error_gradesrecords_rec.PUT_LINE(fnd_file. valid_grades _rec. ' ') CHR(9) rpad('Error_Messag e'.

xxvh.AND processing_status = 'V'.component_name AND xxe. SELECT COUNT(1) INTO l_grderror_records FROM xx_hr_validgrade_stg xxvg WHERE xxvg.xx_reppos_stg xxvh WHERE xxvh. xxe.PUT_LINE(fnd_file. l_grderror_records). BEGIN IF(p_commit = 'YES') THEN FOR valid_hier_rec IN cur_valid_hiers(p_request_id) LOOP . or ' fnd_file.processing_status = 'V' AND xxvh.*.error_value.error_column.error_type.conc_req_id = p_conc_req_id.OUTPUT. xx_ph_all_errors xxe WHERE xxvh. l_grdsuccess_records). xxe. xxvh.xx_reppos_stg xxvh. END IF. END xx_grades_output_report_prc. xxe.PUT_LINE(fnd_file.heirarchy. /*====================================================================== ===================== To Develop the error Report of hierarchies ======================================================================== ========================*/ /*PROCEDURE xx_hier_output_report_prc(p_request_id IN NUMBER.transaction_id AND xxvh.conc_req_id = p_conc_req_id. l_hiercount_records NUMBER. y ' fnd_file. xxe.transaction_id = xxe. xxvh.rowid FROM xxph.error_messg FROM xxph. t IN VARCHAR2) IS p_commi 'Total Records Processed with Err 'Total Records Valid Sucessfull --cursor to fetch all the valid records processed through this request CURSOR cur_valid_hiers(p_conc_req_id NUMBER) IS SELECT xxvh. l_hiersuccess_records NUMBER.conc_req_id = p_request_id AND processing_status = 'E'. l_hiercount NUMBER.component_name = xxe.position_name.reporting_to_position. l_hiererror_records NUMBER.OUTPUT. --cursor to fetch all the error records obtained through this request CURSOR cur_hier_error_records(p_conc_req_id NUMBER) IS SELECT xxvh.

reporting_to_position) .OUTPUT.Update the staging table with processed status for records that are --present in standard table UPDATE xxph.PUT_LINE(FND_FILE. END LOOP. IF(l_hiercount = 0) THEN /* Update the staging table with error status for records tha t are not present in standard table */ /* UPDATE xxph.50. END IF. IF(l_hiercount = 1) THEN -.' '). FND_FILE.' ').xx_reppos_stg SET processing_status = 'E' WHERE rowid = valid_hier_rec.error_column.' ') CHR(9) RPAD( NVL('SAP_ReportingPosition_Name'.OUTPUT. RPAD(NVL('SAP_Position_Name'.70.' ') CHR(9) RPAD(NVL(error_hierrecords_rec.PUT_LINE(FND_FILE.50.30.' ') CHR(9) RP AD(NVL('Error_Record_Type'.70. 'valid_ hier_rec. --TO insert error message into error table xxph_common_dmg_pkg.reporting_to_position. 'error report for hierarchies'.50.heirarchy.' ').' ') CHR(9) RPAD(NVL(error_hierrecords_rec.' ').50.component_name.' ') CHR(9) RPAD(NVL( .xx_reppos_stg SET processing_status = 'P' WHERE rowid = valid_hier_rec.' ') CHR(9) RPAD(NVL('Error_Message'.' '). COMMIT.' ')). END IF.insert_error_message_prc(valid_hier_rec.' ') CHR(9) RPAD(NVL('Error_Value'.50.rowid.' '). valid_hier_rec.' ').50. 'Position Hierarchy'.50.' ') CHR(9) RPAD(NVL(error_hierrecords_rec.rowid.30.' ').' ') CHR(9) RPAD(NVL('Error_Colum n'.error_type.' ').' ' ) CHR(9) RPAD(NVL(error_hierrecords_rec.----------'. ' ').--To check whether the record exists in standard Table SELECT COUNT(1) INTO l_hiercount FROM per_pos_structure_elements WHERE parent_position_id IN (SELECT position_id FROM hr_all_positions_f WHERE name = valid_hier_rec.' ').50.tr ansaction_id.RPAD(NVL(error_hierrecords_rec.' ') CHR(9) RPAD(NVL(error_hierrecords_rec.' '). NULL ).' ') CHR(9) RPAD(NVL('SAP_Hierarchy'. 'ORACLE_ERROR'.50.' '). END IF. FOR error_hierrecords_rec IN cur_hier_error_records(p_request_id) LOOP FND_FILE.p osition_name.error_value.

OUTPUT. l_hiersuccess_records). retcode OUT NUMBER.PUT_LINE(FND_FILE.error_messg.PUT_LINE(FND_FILE.OUTPUT. l_login_id NUMBER.200. l_request_id NUMBER. l_hiererror_records). _hiercount_records). BEGIN 'Total Records Processed with E 'Total Records Valid ' l_ 'Total Records Processed Suce . l_ln_responsibility_id NUMBER := fnd_global.conc_req_id = p_request_id. p_vgload_id IN NUMBER) AS l_ln_user_id NUMBER := fnd_global.prog_appl_id. p_load_id IN NUMBER. END IF.resp_id.PUT_LINE(FND_FILE. END xx_hier_output_report_prc. l_ln_application_id NUMBER := fnd_global.OUTPUT. FND_FILE. l_vg_count NUMBER. rror ' FND_FILE.conc_req_id = p_request_id AND processing_status = 'E'. FND_FILE.' '). l_pos_count NUMBER.PUT_LINE(FND_FILE. ELSE SELECT COUNT(1) INTO l_hiersuccess_records FROM xx_reppos_stg xxvh WHERE xxvh.error_hierrecords_rec. 'Total Records Processed ' l IF(p_commit = 'YES') THEN SELECT COUNT(1) INTO l_hiersuccess_records FROM xx_reppos_stg xxvh WHERE xxvh. hiersuccess_records).' ')). SELECT COUNT(1) INTO l_hiererror_records FROM xx_reppos_stg xxvh WHERE xxvh.user_id.conc_req_id = p_request_id AND processing_status = 'P'. ssfully ' FND_FILE. END LOOP.OUTPUT. SELECT COUNT(1) INTO l_hiercount_records FROM xx_reppos_stg xxvh WHERE xxvh.*/ /*===================================================================== ========================== Inserting Data Into Staging Tables ========================================================================== =======================*/ PROCEDURE xx_positions_load_stg_prc(errbuf OUT VARCHAR 2.conc_req_id = p_request_id AND processing_status = 'V'.

seasonal. payroll. last_updated_by.l_ln_responsibility_id.conc_request_id).PUT_LINE(fnd_file. start_date. --attribute31. direct_pa tient_staff. l_login_id := to_number(fnd_profile. frequency. headcount.-. location_id. COMMIT. NULL. probation_duration.LOG. fte. /* -. last_update_date. job_group.PUT_LINE(fnd_file. NULL.PUT_LINE(fnd_file. transaction_id. NULL. creation_date.Niraj INSERT INTO xx_hr_positions_stg(batch_id. effective_date_to. xx_per_positions_transid_s. position_id. organization. fnd_file. job_band.LOG. type. permenant. end_time. --attribute35. location. organization_name. job_band. created_by.'). fte.PUT_LINE(fnd_file. NULL. 'Start Inserting Data ***********'). effective_date_from. position_name. grade.. NULL. status.apps_initialize(l_ln_user_id. '*********************************** ********************************'). --attribute36. NULL. '*********************************** ********************************'). job_id. status. --attribute38. conc_req_id) SELECT load_id. start_date. date_effective_name. --attribute39. worki ng_hours. --attribute37. --attribute34. organization_id. registered_nurse.VALUE('LOGIN_ID')). start_time. payroll. component_name. 'Loading Data from SAP tables to Ora cle Staging Table. date_effective_name. NULL. fnd_file. pay_basis_id.. headcount. position_type. loc ation_name.nextval.l_l n_application_id). seasonal. business_group_ id. salary_basis. last_update_login. fnd_file. job_group. duration_unit. --attribute32. payroll_id. l_request_id := to_number(fnd_global.fnd_global. --attribute40. processing_status. permanent _position. entry_grade_id . NULL. availability_status_id.LOG. bargaining_unit. position_name. fnd_file.LOG. . effective_date_from. --attribute33.

permanent_position. start_time. --attribute32. seasonal. organization_name.stg_hr_positiondetails_temp @CRYSTAL WHERE load_id = nvl(p_load_id. . --attribute35. l_login_id. bargaining_unit. organization_id. */ INSERT INTO xx_hr_positions_stg (batch_id. --attribute36. l_ln_user_id. business_group_id. sysdate. l_ln_user_id. payroll_id. job_id. probation_duration. NULL. NULL. position_id. headcount. effective_date_to. availability_status_id. working_hours. --attribute38. end_time. status. duration_unit. 'N'. position_type. --attribute34. --attribute37. job_group. effective_date_from. NULL. --attribute33. sysdate. payroll. transaction_id. salary_basis. --attribute39.NULL. location_name. frequency. position_name. load_id). NULL. start_date. 'HR_POSITIONS'. l_request_id FROM ods_sap_hr. --attribute40. job_band. fte. location_id. date_effective_name. --attribute31. grade.

processing_status. NULL. conc_req_id) SELECT load_id. --attribute34. date_effective_name. registered_nurse. location. permenant. . direct_patient_staff. NULL.grade. --attribute36. seasonal. start_date. --attribute32. last_updated_by. --attribute37. start_time. salary_basis. NULL. entry_grade_id. fte. --attribute35. NULL. probation_duration. last_update_date. job_group. effective_date_from. salary_basis. headcount. --attribute40. --attribute39. frequency. organization. NULL. component_name. --attribute33. job_band. --attribute31. last_update_login. status. NULL. NULL. NULL. end_time. created_by. --attribute38. position_name. pay_basis_id. TYPE. duration_unit. grade. payroll. NULL. working_hours. shoe_uniform_eligibility.NEXTVAL. meal_coupon_eligibility. xx_per_positions_transid_s. NULL. creation_date.

--attribute39. duration_unit. shoe_uniform_eligibility. --attribute34. load_id) AND date_effective_name NOT IN ( SELECT date_e ffective_name FROM xx_hr_po sitions_stg ). --attribute32. 'N'. l_login_id. direct_patient_staff. fnd_file.PUT_LINE(fnd_file. start_time.PUT_LINE(fnd_file. fnd_file.PUT_LINE(fnd_file. --attribute37. end_time.stg_hr_positiondetails_temp @crystal WHERE load_id = nvl(p_load_id.PUT_LINE(fnd_file. to_date. working_hours. l_request_id FROM ods_sap_hr. --attribute31. l_ln_user_id. l_ln_user_id. component_name. 'Number of records successfully inserted into staging table' ' ' l_pos_count).NULL. registered_nurse.OUTPUT.LOG. transaction_id. --attribute36. EXCEPTION WHEN no_data_found THEN fnd_file. valid_grade. position_name. SYSDATE. --attribute35. --attribute33. SYSDATE. END.OUTPUT. frequency. . WHEN others THEN fnd_file. --attribute38. probation_duration. /* INSERT INTO xx_hr_validgrade_stg(batch_id. --attribute40. from_date. '============================== ============================================================================'). 'Error while inserting records int o staging table' sqlerrm).LOG. meal_coupon_eligibility. 'No records inserted into the stag ing table in this run' sqlerrm). BEGIN SELECT COUNT(1) INTO l_pos_count FROM xx_hr_positions_stg pos WHERE pos.conc_req_id = l_request_id. 'HR_POSITIONS'.

attribute33. last_update_date. 'No records inserted into the stag 'Error while inserting records int 'Error while inserting records into .PUT_LINE(fnd_file. conc_req_id ) SELECT load_id. created_by. l_ln_user_id.conc_req_id = l_request_id. 'XX_VALID_GRADES'.OUTPUT.PUT_LINE(fnd_file. EXCEPTION WHEN no_data_found THEN fnd_file. EXCEPTION WHEN others THEN fnd_file.PUT_LINE(fnd_file. fnd_file. load_id).LOG. ing table in this run' sqlerrm). 'Number of records successfully inserted into staging table' ' ' l_vg_count).stg_hr_validgrades_temp @CRYSTAL WHERE load_id = nvl(p_vgload_id. attribute35.LOG. 'N'. l_ln_user_id. valid_grade. attribute36. attribute37. END. position_name '.' organization_name. BEGIN SELECT COUNT(1) INTO l_vg_count FROM xx_hr_validgrade_stg vg WHERE vg. attribute34. '============================== ============================================================================'). attribute40./* attribute31. sysdate.OUTPUT. last_update_login. sysdate. attribute39.nextval. attribute38. creation_date. to_date. o staging table' sqlerrm). WHEN others THEN fnd_file. attribute32. xx_grade_transid_s. l_request_id FROM ods_sap_hr. fnd_file. COMMIT. from_date.PUT_LINE(fnd_file.PUT_LINE(fnd_file. l_login_id. last_updated_by.LOG.* processing_status.

staging table' sqlerrm). / sho err . END xx_per_positions_pkg.*/ END xx_positions_load_stg_prc.