Oracle HRMS API - Hire Into Job
PI - hr_employee_api.hire_into_job
Example --
Consider a Contact for some employee already exist in Oracle System. Now that Contact has got Job, so his Person type should be converted to Employee from Contact (External)
Following API helps to create assignment for that Contact and helps to change his Person Type
DECLARE
-- Local Variables
-- ---------------------
lc_dt_ud_mode VARCHAR2(100) := NULL;
ln_person_id NUMBER := 32981;
ln_object_number NUMBER := 1;
ld_effective_date DATE := TO_DATE('28-JUN-2012');
lc_employee_number VARCHAR2(100) := 'CONTACT_TEST_01';
-- Out Variables for Find Date Track Mode API
-- ------------------------------------------------------------
lb_correction BOOLEAN;
lb_update BOOLEAN;
lb_update_override BOOLEAN;
lb_update_change_insert BOOLEAN;
-- Out Variables for Hire to Job API
-- -------------------------------------------
ld_effective_start_date DATE;
ld_effective_end_date DATE;
lb_assign_payroll_warning BOOLEAN;
lb_orig_hire_warning BOOLEAN;
ln_assignment_id NUMBER;
-- Local Variables
-- ---------------------
lc_dt_ud_mode VARCHAR2(100) := NULL;
ln_person_id NUMBER := 32981;
ln_object_number NUMBER := 1;
ld_effective_date DATE := TO_DATE('28-JUN-2012');
lc_employee_number VARCHAR2(100) := 'CONTACT_TEST_01';
-- Out Variables for Find Date Track Mode API
-- ------------------------------------------------------------
lb_correction BOOLEAN;
lb_update BOOLEAN;
lb_update_override BOOLEAN;
lb_update_change_insert BOOLEAN;
-- Out Variables for Hire to Job API
-- -------------------------------------------
ld_effective_start_date DATE;
ld_effective_end_date DATE;
lb_assign_payroll_warning BOOLEAN;
lb_orig_hire_warning BOOLEAN;
ln_assignment_id NUMBER;
BEGIN
-- Find Date Track Mode
-- ----------------------------
dt_api.find_dt_upd_modes
( -- Input data elements
-- ---------------------------
p_effective_date => TO_DATE('28-JUN-2012'),
p_base_table_name => 'PER_ALL_PEOPLE_F',
p_base_key_column => 'PERSON_ID',
p_base_key_value => ln_person_id,
-- Output data elements
-- -----------------------------
p_correction => lb_correction,
p_update => lb_update,
p_update_override => lb_update_override,
p_update_change_insert => lb_update_change_insert
);
-- Find Date Track Mode
-- ----------------------------
dt_api.find_dt_upd_modes
( -- Input data elements
-- ---------------------------
p_effective_date => TO_DATE('28-JUN-2012'),
p_base_table_name => 'PER_ALL_PEOPLE_F',
p_base_key_column => 'PERSON_ID',
p_base_key_value => ln_person_id,
-- Output data elements
-- -----------------------------
p_correction => lb_correction,
p_update => lb_update,
p_update_override => lb_update_override,
p_update_change_insert => lb_update_change_insert
);
IF ( lb_update_override = TRUE OR lb_update_change_insert = TRUE )
THEN
-- UPDATE_OVERRIDE
-- -----------------------------
lc_dt_ud_mode := 'UPDATE_OVERRIDE';
END IF;
THEN
-- UPDATE_OVERRIDE
-- -----------------------------
lc_dt_ud_mode := 'UPDATE_OVERRIDE';
END IF;
IF ( lb_correction = TRUE )
THEN
-- CORRECTION
-- --------------------
lc_dt_ud_mode := 'CORRECTION';
END IF;
THEN
-- CORRECTION
-- --------------------
lc_dt_ud_mode := 'CORRECTION';
END IF;
IF ( lb_update = TRUE )
THEN
-- UPDATE
-- --------------
lc_dt_ud_mode := 'UPDATE';
END IF;
-- Hire into Job API
-- ------------------------
hr_employee_api.hire_into_job
( -- Input Data Elements
-- -----------------------------
p_effective_date => ld_effective_date,
p_person_id => ln_person_id,
p_datetrack_update_mode => lc_dt_ud_mode,
-- Output Data Elements
-- ----------------------------
p_object_version_number => ln_object_number,
p_employee_number => lc_employee_number,
p_assignment_id => ln_assignment_id,
p_effective_start_date => ld_effective_start_date,
p_effective_end_date => ld_effective_end_date,
p_assign_payroll_warning => lb_assign_payroll_warning,
p_orig_hire_warning => lb_orig_hire_warning
);
COMMIT;
THEN
-- UPDATE
-- --------------
lc_dt_ud_mode := 'UPDATE';
END IF;
-- Hire into Job API
-- ------------------------
hr_employee_api.hire_into_job
( -- Input Data Elements
-- -----------------------------
p_effective_date => ld_effective_date,
p_person_id => ln_person_id,
p_datetrack_update_mode => lc_dt_ud_mode,
-- Output Data Elements
-- ----------------------------
p_object_version_number => ln_object_number,
p_employee_number => lc_employee_number,
p_assignment_id => ln_assignment_id,
p_effective_start_date => ld_effective_start_date,
p_effective_end_date => ld_effective_end_date,
p_assign_payroll_warning => lb_assign_payroll_warning,
p_orig_hire_warning => lb_orig_hire_warning
);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
/
SHOW ERR;
Hello Bhaskar Reddy
ReplyDeletethanks for your beautifull blog
i have 1 question i hope to help me .
- i want to bulit API in module eAM
API name and bkg
EAM_ACTIVITY_PUB.CREATE_ACTIVITY
and please i want you explaine how i use Record and tbl variable with api
variable example
x_curr_item_rec
INV_Item_GRP.Item_Rec_Type;
x_curr_item_error_tbl
INV_Item_GRP.Error_Tbl_Type;