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;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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