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;

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'. cur_pos_va l_rec. g_error_msg.trans action_id.insert_error_message_prc(cur_pos_val_rec.PUT_LINE(fnd_file. ------------.no other data is accepted'.PUT_LINE(fnd_file. cur_pos_val_rec.organization_name. fnd_file. 'Organization is not an HR Organ ization'). fnd_file. g_error_msg). cur_pos_val_rec.insert_error_message_prc(cur_pos_val_rec. xxph_common_dmg_pkg. ------------UPDATE xx_hr_positions_stg ----updating organization_id in staging t .PUT_LINE(fnd_file.organization_name.rowid. fnd_file.transacti on_id. g_error_msg.component_name. 'PERMANENT STATUS SHOULD BE YES OR N O').rowid. 'Data'. 'Data'. END. xxph_common_dmg_pkg.LOG. 'other error in finding permanent st atus' sqlerrm).insert_error_message_prc(cur_pos_val_rec. xxph_common_dmg_pkg.transac tion_id. g_error_msg). 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. 'Organization_name does not exist' ).permanent_position. xx_per_posfail_prc(cur_pos_val_rec. BEGIN IF(cur_pos_val_rec.rowid. cur_pos_val_r ec. xx_per_posfail_prc(cur_pos_val_rec. ''). fnd_file. g_error_msg).rowid.component_name. '').LOG. cur_pos_val_rec. xxph_common_dmg_pkg. 'Validation'. ''). 'organization_name'.PUT_LINE(fnd_file. fnd_file.insert_error_message_prc(cur_pos_val_rec.organization_name.PUT_LINE(fnd_file. cur_pos_val_ rec. '').LOG.transacti on_id. cur_pos_val_rec. g_error_msg).permanent_position. END IF.LOG. WHEN others THEN g_error_msg := 'Other error in finding permanent status '.organization_name IS NULL) THEN ----checking mandetory column organization g_error_msg := 'Organization_name does not exist'. 'Organization_name:' g_organiza tion_id). cur_pos_val_r ec. g_error_msg. ELSE SELECT DISTINCT organization_id INTO g_organization_id -----deriving organization_id FROM hr_organization_units WHERE name = cur_pos_val_rec. g_error_msg.component_name. IF l_hr_org_count = 0 THEN g_error_msg := 'Organization is not an HR Organization'. 'permanent_position'.component_name.LOG. 'Validation'. 'permanent_position'.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

l_object_version_number := NULL. '-------------------------------------T1').PUT_LINE(FND_FILE. l_parent_position_id := NULL. l_hierarchycount NUMBER. ' start of mandetory validations of r eporting info'). l_business_group_id := NULL. l_pos_structure_version_id NUMBER.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. l_commit := p_commit. CURSOR cur_reppos_stg IS SELECT xxrp.PUT_LINE(FND_FILE. l_reppositioncount NUMBER.PUT_LINE(FND_FILE. FND_FILE. 'position_id:' l_pos_id).rowid FROM xx_reppos_stg xxrp WHERE processing_status = 'N'. . l_success NUMBER. l_success := 0.position_name. l_business_group_id NUMBER. BEGIN IF(cur_reppos_rec. l_object_version_number NUMBER.l_parent_position_id NUMBER.LOG. CURSOR cur_reppos_ins IS SELECT xxrp. l_pos_structure_element_id NUMBER. BEGIN FND_FILE.LOG.*. END IF. l_position_date := NULL. l_read := 0. l_pos_structure_element_id := NULL. xxrp. g_error_msg := NULL. l_error NUMBER. l_error := 0. --l_effective_start_date DATE.*. l_reppositioncount := NULL.LOG. xxrp. FOR cur_reppos_rec IN cur_reppos_stg LOOP FND_FILE. l_pos_id := NULL.rowid FROM xx_reppos_stg xxrp WHERE processing_status = 'V'. l_pos_structure_version_id := NULL. l_read NUMBER. l_commit VARCHAR2(3). l_hierarchycount := NULL. l_position_date DATE. l_read := l_read + 1.

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

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

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

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

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

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

t_count NUMBER. 70. valid_positions_rec. 25.PUT_LINE(fnd_file. ' ')). ' ') CHR(9) rpad(nvl('============'.rowid. t_error_records NUMBER. 'P_Request_id:' p_reques t_id). ' ').OUTPUT.PUT_LINE(fnd_file. 30. 70. ' '). t_success_records NUMBER. ' '). ' ') CHR(9) rpad(nvl('Error_Message'.OUTPUT.date_effective_name.insert_error_message_prc(valid_positions_rec . 'ORACLE_ERROR'. rpad(nvl('================='. ' ') CHR(9) rpad(nvl('Error_Column'. ' ').transaction_id. ' ') .component_name. --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. t_count_records NUMBER. --TO insert error message into error table xxph_common_dmg_pkg. vali d_positions_rec. END IF. 17. ' ') CHR(9) rpad(nvl('Error_Value'. 100. NULL). 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. 25. ' ').rowid. IF(t_count = 0) THEN /* Update the staging table with error status for records that are not present in standard table */ UPDATE xxph. fnd_file.PUT_LINE(fnd_file. END IF. 'error report for posit ions' SQLERRM. fnd_file.OUTPUT.xx_hr_positions_stg SET processing_status = 'E' WHERE rowid = valid_positions_rec. 'POSITION_NAME'. rpad(nvl('SAP_Position_name'. ' '). BEGIN IF(p_commit = 'YES') THEN FOR valid_positions_rec IN cur_valid_positions(p_request_id) LOOP --fnd_file. ' ') CHR(9) rpad(nvl('Er ror_Record_Type'. END LOOP. END IF. COMMIT. ' ').date_effective_name.

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

component_name = xxe.transaction_id = xxe.xx_hr_validgrade_stg SET processing_status = 'E' WHERE rowid = valid_grades_rec. l_grderror_records NUMBER.*.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.rowid FROM xxph.processing_status = 'V' AND xxvg. --TO insert error message into error table .xx_hr_validgrade_stg xxvg. xxe. l_grdcount NUMBER. l_grdcount_records NUMBER. 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. 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.rowid.error_column. l_grdsuccess_records NUMBER.conc_req_id = p_conc_req_id. xxe. xxe.error_messg FROM xxph.valid_grade. IF(l_grdcount = 0) THEN /* Update the staging table with error status for records that are not present in standard table */ /* UPDATE xxph.error_type.position_name) . xxe.transaction_id AND xxvg. xx_ph_all_errors xxe WHERE xxvg. xxvg.conc_req_id = p_conc_req_id.To Develop the error Report of grades ==================================================================== ============================ PROCEDURE xx_grades_output_report_prc(p_request_id IN NUMBER.xx_hr_validgrade_stg xxvg WHERE xxvg.error_value.

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

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

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

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

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

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

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

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

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

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