Sie sind auf Seite 1von 27

Pre-requisites and Required Setups

Create Staging tables


Inbound Interface may use some Staging/Custom tables to capture flat file data.

Develop Control file and Place in CUSTOM_TOP


This is a technical development process, where the developer will develop the control file as per
data file structure. This control file saves with extension as ‘ctl’. After that deploy the control file in
the CUSTOM_TOP of the Prod/Dev/Test environment

Use any SFTP tool to move the control file and data file received.
Eg: RESOURCE_TOP (XXCGS_RESRC/11.5.0/bin) at server side

Run SQL*Loader
Use any Network Protocol tool (putty/manager/telnet) to run the SQL*Loader program .
Enter the user name and pass word to login into the server.

Step Brief Description Syntax to be followed


No.

(1). Go to the DB_TOP and Run the cd /


environment variable file cd data2/TEST/testdb/9.2.0
Eg:TEST_mumcgsuxd12.env . ./ TEST_mumcgsuxd12.env
(2). Run the SQL*Loader Program $ sqlldr userid=userid/password control=
/data2/TEST/testappl/XXCGS_RESRC/11.5.0/bin/
XXHR_PERSON_LOAD.ctl data=
/data2/TEST/testappl/XXCGS_RESRC/11.5.0/bin/
XXHR_PERSON_LOAD.dat

Loading the Data into the BASE Tables:


Once the flat file data loaded into the staging table, then create Interface script i.e., Package for
the Employee person interface. Ensure that .sql program is successfully completed in the
database.
Once the procedure executes successfully the data will be populated into the BASE tables
HR Employee Person API
This API creates a “new employee”. This API creates a default primary assignment and a period
of service for the employee. Secure user functionality is included in this version of the API. The
employee is visible to secure users in the business group.

Base Tables affected


 PER_ALL_PEOPLE_ALL
 PER_ALL_ASSIGNMENTS_ALL
 PER_PERIODS_OF_SERVEICE

Data file Layout


The Employee Person API data should be provided in the form of XXHR_PERSON_LOAD.csv
file with fields separated by delimiter. The first line in file is to describe the fields in the data file.
The following fields are mandatory for the API development.

Field Description

EmplID Employee’s ID

Empl Rcd Nbr Employee’s Record number

First Name Employee’s First name

Middle Name Employee’s middle name

Last Name Employee’s last name

Name Employee’s Full name

Highest Education Level Employee’s Highest Education

Gender Employee’s Sex

Marital Status Employee’s Marital Status

Date of Birth Employee’s Date of birth

SOEID Employee’s SOEID

RITSID Employee’s RITSID

Email Employee’s Email Address

Alternate Employee ID Employee’s Alternate employee id


IN Parameters:

Field Data type Siz Mandato Description


e ry

p_validate Varchar2 11 Y When this parameter is set


to FALSE (the default
value), the procedure
executes all validation for
that business function
p_business_group_id Number 3 Y Employee’s Record number

p_last_name Date Y Employee’s last name


p_first_name Number 3 Y Employee’s forst name
p_sex Date Y Employee’s gender
p_marital_status Date Y Employee’s marital status
p_date_of_birth Date Y Employee’s date of birth
p_original_date_of_hire Varchar2 10 Y Employee’s original date of
hire
p_nationality Varchar2 30 Y Employee’s nationality
p_email_address Varchar2 1 Y Employee’s Email Address
p_hire_date Varchar2 10 Y This parameter is used as
the first day the person
details come into effect.
p_person_type_id Varchar2 30 Y If p_validate is false, this
uniquely identifies the
person created

OUT Parameters:

Field Data type Siz Mandato Description


e ry

p_employee_number Varchar2 Employee’s soe id


p_person_id Number 11 Y If p_validate is false, this
uniquely identifies the
person created
p_assignment_id Number 3 Y If p_validate is false, this
uniquely identifies the
primary assignment created
p_per_object_version_number Number Y Holds the value for the
person record
p_asg_object_version_number Number 3 Y Holds the value for the
assignment record.
p_per_effective_start_date Date Y If p_validate is false, this will
be set to the effective start
date of the person
p_per_effective_end_date Date Y If p_validate is false, this will
be set to the effective end
date of the person
Field Data type Siz Mandato Description
e ry

p_full_name Varchar2 Y If p_validate is false, this will


be set to the complete full
name of the person. If
p_validate is true this will be
null.
p_per_comment_id Number 10 Y To avoid any confusion over
where the comments have
allocated in the database
p_assignment_sequence Number 30 Y If p_validate is false this will
be set to the sequence
number of the primary
assignment
p_assignment_number Varchar2 1 Y If p_validate is false this will
be set to the assignment
number of the primary
assignment
p_name_combination_warning Boolean 10 Y Employee’s Department

p_assign_payroll_warning Boolean 30 Y Set to true if the date of


birth has not been set.
P_orig_hire_warning Boolean 11 Y dof hire is not null

Descriptive Flexfield:
To add descriptive flexfield to capture additional information for the particular Employee Person
data

Field Data type Siz Mandator Description


e y

p_per_information_category Varchar2 30 Y Descriptive flexfiled


p_per_information7 Varchar2 150 Y Descriptive flexfiled
p_attribute_category Varchar2 30 Y Descriptive flexfiled
p_attribute1 Varchar2 150 Y Descriptive flexfiled
p_attribute2 Varchar2 150 Y Descriptive flexfiled
p_attribute3 Varchar2 150 Y Descriptive flexfiled
p_attribute4 Varchar2 150 Y Descriptive flexfiled
p_attribute5 Varchar2 150 Y Descriptive flexfiled
p_attribute6 Varchar2 150 Y Descriptive flexfiled
p_attribute7 Varchar2 150 Y Descriptive flexfiled

HR Employee Person API Script


-- *******************************************************************************************************
-- File Name : xxhr_person_proc.sql
-- Module Name : Resource module
-- Created By : Sudhakar
-- Created Date : 07-Dec-2007
-- Purpose : This Procedure to load the data employee person from staging
table to base tables

-- ********************************************************************************************************

CREATE OR REPLACE PROCEDURE xxhr_person_proc IS

l_business_group_id per_all_assignments_f.business_group_id%TYPE;
l_per_comment_id per_all_people_f.comment_id%TYPE;
l_assignment_sequence per_all_assignments_f.assignment_sequence%TYPE;
l_assignment_number per_all_assignments_f.assignment_sequence%TYPE;
l_name_combination_warning BOOLEAN;
l_assign_payroll_warning BOOLEAN;
l_ORIG_HIRE_WARNING BOOLEAN;
l_person_id per_all_people_f.person_id%TYPE;
l_assignment_id per_all_assignments_f.assignment_id%TYPE;
l_per_object_version_number per_all_people_f.object_version_number%TYPE;
l_asg_object_version_number per_all_assignments_f.object_version_number%TYPE;
l_per_effective_start_date per_all_people_f.effective_start_date%TYPE;
l_per_effective_end_date per_all_people_f.effective_end_date%TYPE;
l_original_date_of_hire per_all_people_f.original_date_of_hire%TYPE;
l_nationality per_all_people_f.nationality%TYPE;
l_person_type_id per_all_people_f.person_type_id%TYPE;
l_per_information_category per_all_people_f.per_information_category%TYPE;
l_per_information7 per_all_people_f.per_information7%TYPE;
l_hire_date date;

v_person_id number;
v_assignment_id number;
v_per_object_version_number number;
v_asg_object_version_number number;
v_per_effective_start_date date;
v_per_effective_end_date date;
v_full_name varchar2(100);
v_per_comment_id number;
v_assignment_sequence number;
v_assignment_number varchar2(100);
v_name_combination_warning boolean;
v_orig_hire_warning boolean;
v_assign_payroll_warning boolean;
v_employee_number varchar2(20);
G_USER_ID number;
G_LOGIN_ID number;
v_resp_id number;
v_resp_APPL_id number;
v_business_group_id number;
v_emp_no varchar2(20);

CURSOR person_emp IS
SELECT xp.empl_id
,xp.empl_rcd_nbr
,xp.first_name
,xp.middle_name
,xp.last_name
,xp.name
,xp.highest_education_level
,decode(ltrim(rtrim(gender)),'U','M',ltrim(rtrim(gender))) gender
,xp.marital_status
,xp.date_of_birth
,xp.soe_id
,xp.rits_id
,xp.email
,xj.hire_date
,xp.alternate_employee_id
FROM xxhr_person_stg xp,
xxhr_job_stg xj
WHERE xp.empl_id = xj.empl_id
AND xp.empl_id NOT IN(SELECT employee_number FROM per_all_people_f);

BEGIN
G_USER_ID := FND_PROFILE.VALUE('USER_ID');
G_LOGIN_ID := FND_PROFILE.VALUE('LOGIN_ID');
v_resp_id := FND_PROFILE.VALUE('RESP_ID');
v_resp_APPL_id := FND_PROFILE.VALUE('RESP_APPL_ID');
v_business_group_id := FND_PROFILE.VALUE('PER_BUSINESS_GROUP_ID');

FND_GLOBAL.APPS_INITIALIZE(G_USER_ID,v_resp_id,v_resp_APPL_id);

FOR v_person_emp IN person_emp LOOP

-- ***************************************************************************
-- Create Personal Particulars for Employee
-- ***************************************************************************
--v_employee_number:= NULL;

hr_employee_api.create_employee
(p_validate => FALSE
,p_business_group_id => v_business_group_id
,p_last_name => v_person_emp.last_name
,p_first_name => v_person_emp.first_name
,p_sex => v_person_emp.gender
--,p_marital_status => v_person_emp.marital_status
,p_date_of_birth => v_person_emp.date_of_birth
,p_original_date_of_hire => v_person_emp.hire_date
,p_nationality => 'PQH_AT'
,p_email_address => v_person_emp.email
,p_hire_date => v_person_emp.hire_date
,p_person_type_id => l_person_type_id
,p_per_information_category => 'IN'
,p_per_information7 => 'RO'
,p_attribute_category => v_business_group_id
,p_attribute1 => v_person_emp.empl_rcd_nbr
,p_attribute2 => v_person_emp.name
,p_attribute3 => v_person_emp.highest_education_level
,p_attribute4 => v_person_emp.marital_status
,p_attribute5 => v_person_emp.soe_id
,p_attribute6 => v_person_emp.rits_id
,p_attribute7 => v_person_emp.alternate_employee_id
,p_employee_number => v_person_emp.empl_id
,p_person_id => v_person_id
,p_assignment_id => v_assignment_id
,p_per_object_version_number => v_per_object_version_number
,p_asg_object_version_number => v_asg_object_version_number
,p_per_effective_start_date => v_per_effective_start_date
,p_per_effective_end_date => v_per_effective_end_date
,p_full_name => v_full_name
,p_per_comment_id => v_per_comment_id
,p_assignment_sequence => v_assignment_sequence
,p_assignment_number => v_assignment_number
,p_name_combination_warning => v_name_combination_warning
,p_assign_payroll_warning => v_assign_payroll_warning
,P_ORIG_HIRE_WARNING => v_orig_hire_warning
);
COMMIT;
END LOOP;
DBMS_OUTPUT.PUT_LINE('Ex:'||v_person_id||','||v_assignment_id||','||
v_per_object_version_number);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('Error: '||SQLERRM);
END;
/

HR Assignment API
This API updates employee assignment details which do not affect entitlement to element entries

Base Tables affected


 PER_JOBS
 PER_ALL_ASSIGNMENTS_ALL
 PER_JOB_DEFINITIONS
 PER_JOB_GROUPS

Data file Layout


The Employee Job API data should be provided in the form of .csv file with fields separated by
delimiter. The first line in file is to describe the fields in the data file.
The following is the layout for Employee Job API data file. The following fields are mandatory

Field Description

EmplID Employee’s ID

Empl Rcd Nbr Employee’s Record number

Effective Date Employee’s Effective date

Effective Sequence Employee’s Effective


Sequence
Rehire Date Employee’s Refire Date

Hire Date Employee’s hire date

Probation Date Employee’s Probation date

GDW Department ID Employee’s GWD


Department ID
GDW Department ID Employee’s
Description GDW Department ID
Description

Employee Status Employee’s Employee


Status

Department Employee’s Department

Department Description Employee’s Department


Description

Supervisor ID Employee’s Supervisor ID


Field Description

Supervisor Name Employee’s Supervisor


Name

Direct Manager ID Employee’s direct manager


ID
Direct Manager Name Employee’s Direct Manager
Name

Location Code Employee’s Location Code

Location Description Employee’s Location


Description

Reason Code Employee’s Reason Code

Action Reason Description Employee’s Action Reason


Description

Action Employee’s Action

Salary Grade Employee’s Salary Grade

Job Code Employee’s Job Code

Full/Part Time Employee’s Full/Part Time

HR Responsible ID Employee’s HR
Responsible ID

HR Responsible Name Employee’s HR


Responsible Name

IN Parameters:

Field Data type Siz Mandato Description


e ry

p_validate Varchar2 11 Y When this parameter is set


to FALSE (the default
value), the procedure
executes all validation for
that business function
p_business_group_id Number 3 Y Employee’s Record number

p_date_from Date Y Employee’s last name


p_job_group_id Number 3 Y Employee’s forst name
p_segment1 Date Y Employee’s gender
p_effective_date Date Y Employee’s marital status
Field Data type Siz Mandato Description
e ry

p_datetrack_update_mode Date Y Employee’s date of birth


p_assignment_number Varchar2 30 Y Employee’s nationality
p_supervisor_id Varchar2 1 Y Employee’s Email Address
p_assignment_id Varchar2 10 Y This parameter is used as
the first day the person
details come into effect.
p_default_code_comb_id Varchar2 30 Y If p_validate is false, this
uniquely identifies the
person created
p_set_of_books_id
p_title

OUT Parameters:

Field Data type Siz Mandato Description


e ry

p_job_id Varchar2 11 Y When this parameter is set


to FALSE (the default
value), the procedure
executes all validation for
that business function
p_job_definition_id Number 3 Y Employee’s Record number
p_object_version_number Date Y Employee’s last name
p_name Number 3 Y Employee’s forst name
p_effective_start_date Date Y Employee’s gender
p_effective_end_date Date Y Employee’s marital status
p_no_managers_warning Date Y Employee’s date of birth
p_other_manager_warning Varchar2 10 Y Employee’s original date of
hire
p_comment_id Varchar2 30 Y Employee’s nationality
p_soft_coding_keyflex_id Varchar2 1 Y Employee’s Email Address
p_cagr_grade_def_id Varchar2 10 Y This parameter is used as
the first day the person
details come into effect.
p_cagr_concatenated_segmen Varchar2 30 Y If p_validate is false, this
ts uniquely identifies the
person created
p_concatenated_segments Varchar2

HR Assignment API script

-- -----------------------------------------------------------------------------------
-- Procedure Name : xxhr_job_proc
-- Author's Nam : Mangaiah P
-- Creation Date : 12/20/2007
-- Updated Date : 02/19/2008
-- Purpose : This PACKAGE to load the data employee JOB from staging
table to base tables
-- ------------------------------------------------------------------------------------

CREATE OR REPLACE PACKAGE xxhr_job_pkg


AUTHID CURRENT_USER
AS

PROCEDURE xxhr_assign_proc;
PROCEDURE xxhr_job_proc;
PROCEDURE xxhr_criteria_proc;

END xxhr_job_pkg;
/

CREATE OR REPLACE PACKAGE BODY xxhr_job_pkg AS

PROCEDURE xxhr_assign_proc IS

l_assignment_number number;
l_assignment_id number;
v_special_ceiling_step_id number;
v_object_version_number number;
V_concatenated_segments number;
V_soft_coding_keyflex_id number;
V_comment_id number;
v_effective_start_date date;
v_effective_end_date date;
V_no_managers_warning boolean;
V_other_manager_warning boolean;
v_num number;
v_seg_conc VARCHAR2(2000);
l_change_reason varchar2(50);
l_date_probation_end date;
l_default_code_comb_id number;
l_set_of_books_id number;
G_USER_ID number;
G_LOGIN_ID number;
v_resp_id number;
v_resp_APPL_id number;
v_assignment_id number;
v_org_id number;
l_object_version_number number;
l_effective_date date;
v_job_id NUMBER;
v_job_definition_id NUMBER;
v_business_group_id NUMBER;
v_name VARCHAR2(240);
l_job_id number;
l_job_group_id number;
v_job_code varchar2(20);
l_job_definition_id NUMBER;
v_rec_ccid varchar2(240);
v_group_name varchar2(30);
V_people_group_id number;
V_org_now_no_manager_warning boolean;
V_spp_delete_warning boolean;
V_entries_changed_warning varchar2(2000);
V_tax_district_changed_warning boolean;
counter number := 0;

CURSOR Job_emp Is
SELECT empl_id
,empl_rcd_nbr
,to_char(to_date(effective_date,'dd-mon-rrrr')) effective_date
,effective_sequence
,to_char(to_date(rehire_date,'dd-mon-rrrr')) rehire_date
,to_char(to_date(probation_date,'dd-mon-rrrr')) probation_date
,department
,supervisor_id
,direct_manager_id
,location_code
,reason_code
,action
,salary_grade
,full_or_part_time
,hr_responsible_id
FROM xxhr_job_stg
WHERE empl_id in(SELECT assignment_number
FROM per_all_assignments_f )
AND department in (SELECT flex_value
FROM fnd_flex_values_vl
WHERE flex_value_set_id = 1009636);

BEGIN

G_USER_ID := FND_PROFILE.VALUE('USER_ID');
G_LOGIN_ID := FND_PROFILE.VALUE('LOGIN_ID');
v_org_id := FND_PROFILE.VALUE('ORG_ID');
v_resp_id := FND_PROFILE.VALUE('RESP_ID');
v_resp_APPL_id := FND_PROFILE.VALUE('RESP_APPL_ID');
v_business_group_id := FND_PROFILE.VALUE('PER_BUSINESS_GROUP_ID');

FND_GLOBAL.APPS_INITIALIZE(G_USER_ID,v_resp_id,v_resp_APPL_id);

FOR v_job_emp IN job_emp LOOP

-- ---------------------------------------------------------------------------------------------------------
-- Validation for assignment id
-- ---------------------------------------------------------------------------------------------------------
SELECT assignment_id
,effective_start_date
,object_version_number
INTO l_assignment_id
,l_effective_date
,l_object_version_number
FROM per_all_assignments_f
WHERE person_id =(SELECT person_id
FROM per_all_people_f
WHERE employee_number = v_job_emp.empl_id);

-- -----------------------------------------------------------------------------------------------------------
-- Validation for set of book id
-- -----------------------------------------------------------------------------------------------------------
SELECT ho.org_information3
INTO l_set_of_books_id
FROM gl_sets_of_books gsb,
hr_organization_information ho
WHERE gsb.set_of_books_id = ho.org_information3
AND ho.org_information_context='Operating Unit Information'
AND ho.ORGANIZATION_ID = v_org_id;

-- ------------------------------------------------------------------------------------------------------------------------
-- Validation for code combination id
-- ------------------------------------------------------------------------------------------------------------------------
v_rec_ccid:= '50001'||'.'||'9475020003'||'.'||
ltrim(rtrim(v_job_emp.department))||'.'||'0000000000'||'.'||'00000'||'.'||'00000';

BEGIN

SELECT fnd_flex_ext.get_ccid
('SQLGL',
' GL#',
50268,
TO_CHAR(SYSDATE,'DD-MON-YYYY'),
v_rec_ccid) --'50001.9475020003.7501.0000000000.00000.00000')
INTO l_default_code_comb_id
FROM dual;
/*if l_default_code_comb_id = 0 then

dbms_output.enable(500000);

dbms_output.put_line('There is no code_combination_id Exists for this combination:'||


v_rec_ccid);
END IF;*/

EXCEPTION WHEN NO_DATA_FOUND then


FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'There is no code_combination_id Exists for
this '||v_rec_ccid);
WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Error While Inserting a Record'||SQLCODE||
SQLERRM);
END;

hr_assignment_api.update_emp_asg
(p_validate => FALSE
,p_effective_date => l_effective_date
,p_datetrack_update_mode => 'CORRECTION'
,p_object_version_number => l_object_version_number
,p_assignment_number => NULL --l_assignment_number
,p_supervisor_id => NULL
,p_assignment_id => l_assignment_id
,p_default_code_comb_id => l_default_code_comb_id
,p_set_of_books_id => l_set_of_books_id
,p_title => NULL
,p_ass_attribute_category => v_business_group_id
,p_ass_attribute1 => v_job_emp.empl_rcd_nbr
,p_ass_attribute2 =>
fnd_date.date_to_canonical(to_date(v_job_emp.effective_date,'DD-MON-RRRR'))
--v_job_emp.effective_date
,p_ass_attribute3 => v_job_emp.effective_sequence
,p_ass_attribute4 =>
fnd_date.date_to_canonical(to_date(v_job_emp.rehire_date,'DD-MON-RRRR'))
--v_job_emp.rehire_date
,p_ass_attribute5 =>
fnd_date.date_to_canonical(to_date(v_job_emp.probation_date,'DD-MON-RRRR'))
--v_job_emp.probation_date
,p_ass_attribute6 => v_job_emp.department
,p_ass_attribute7 => v_job_emp.supervisor_id
,p_ass_attribute8 => v_job_emp.direct_manager_id
,p_ass_attribute9 => v_job_emp.location_code
,p_ass_attribute10 => v_job_emp.reason_code
,p_ass_attribute11 => v_job_emp.action
,p_ass_attribute12 => v_job_emp.salary_grade
,p_ass_attribute13 => v_job_emp.full_or_part_time
,p_ass_attribute14 => v_job_emp.hr_responsible_id
,p_effective_start_date => v_effective_start_date
,p_effective_end_date => v_effective_end_date
,p_no_managers_warning => v_no_managers_warning
,p_other_manager_warning => v_other_manager_warning
,p_comment_id => V_comment_id
,p_soft_coding_keyflex_id => v_soft_coding_keyflex_id
,p_cagr_grade_def_id => v_num
,p_cagr_concatenated_segments => v_seg_conc
,p_concatenated_segments => V_concatenated_segments
);

commit;
END LOOP;
DBMS_OUTPUT.PUT_LINE('Ex:'||l_object_version_number);
COMMIT;
END xxhr_assign_proc;

PROCEDURE xxhr_job_proc IS

l_set_of_books_id number;
G_USER_ID number;
G_LOGIN_ID number;
v_resp_id number;
v_resp_APPL_id number;
v_org_id number;
v_object_version_number number;
l_effective_date date;
v_job_id NUMBER;
v_job_definition_id NUMBER;
v_business_group_id NUMBER;
v_name VARCHAR2(240);
l_job_id number;
l_job_group_id number;
l_job_definition_id NUMBER;
v_group_name varchar2(30);
v_job_count number;

CURSOR job_emp_code is
SELECT distinct job_code
FROM xxhr_job_stg; --where job_code not in (select name from per_jobs);

BEGIN
G_USER_ID := FND_PROFILE.VALUE('USER_ID');
G_LOGIN_ID := FND_PROFILE.VALUE('LOGIN_ID');
v_org_id := FND_PROFILE.VALUE('ORG_ID');
v_resp_id := FND_PROFILE.VALUE('RESP_ID');
v_resp_APPL_id := FND_PROFILE.VALUE('RESP_APPL_ID');
v_business_group_id :=
FND_PROFILE.VALUE('PER_BUSINESS_GROUP_ID');

FND_GLOBAL.APPS_INITIALIZE(G_USER_ID,v_resp_id,v_resp_APPL_id);
-- ------------------------------------------------------------------------------------------------
-- Open the Cursor for Loop
-- ------------------------------------------------------------------------------------------------
FOR v_job_code IN job_emp_code LOOP

SELECT fnd_flex_ext.get_ccid('PER',
'JOB',
101,
TO_CHAR(SYSDATE, 'DD-MON-YYYY'),
v_job_code.job_code)
INTO v_job_definition_id
FROM dual;

SELECT job_group_id
INTO l_job_group_id
FROM PER_JOB_GROUPS
WHERE master_flag = 'Y';

l_effective_date :=to_date('01-JAN-1990','dd-mon-yyyy');

-- --------------------------------------------------------------------------------------------------
-- Validation for job code
-- --------------------------------------------------------------------------------------------------

select count(*) into v_job_count from per_jobs


where name = v_job_code.job_code;

if v_job_count > 0
then
dbms_output.enable(500000);
dbms_output.put_line('This job already exists:'||v_job_code.job_code);
else
-----------------------------------------------------------------------------------------------------
--Run the Job API
-----------------------------------------------------------------------------------------------------

hr_job_api.create_job
(p_validate => FALSE
,p_business_group_id => v_business_group_id
,p_date_from => l_effective_date
,p_job_group_id => l_job_group_id
,p_segment1 => v_job_code.job_code
,p_job_id => v_job_id
,p_job_definition_id => v_job_definition_id
,p_object_version_number => v_object_version_number
,p_name => v_name
);

dbms_output.enable(500000);

DBMS_OUTPUT.PUT_LINE('Job created with job_id:'||v_job_code.job_code);


end if;
commit;
END LOOP;
--COMMIT;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error:'||SQLERRM);
END xxhr_job_proc;

--------------------------------------------------------------------------------------------------------
-- hr_assignment_api.update_emp_asg_criteria
--------------------------------------------------------------------------------------------------------

PROCEDURE xxhr_criteria_proc IS

l_assignment_id number;
v_special_ceiling_step_id number;
v_object_version_number number;
V_concatenated_segments number;
V_soft_coding_keyflex_id number;
v_effective_start_date date;
v_effective_end_date date;
V_other_manager_warning boolean;
l_set_of_books_id number;
G_USER_ID number;
G_LOGIN_ID number;
v_resp_id number;
v_resp_APPL_id number;
v_org_id number;
l_effective_date date;
l_job_id number;
v_group_name varchar2(30);
V_people_group_id number;
V_org_now_no_manager_warning boolean;
V_spp_delete_warning boolean;
V_entries_changed_warning varchar2(2000);
V_tax_district_changed_warning boolean;

CURSOR job_emp is
SELECT empl_id
,empl_rcd_nbr
,to_char(to_date(effective_date,'dd-mon-rrrr')) effective_date
,effective_sequence
,to_char(to_date(rehire_date,'dd-mon-rrrr')) rehire_date
,to_char(to_date(probation_date,'dd-mon-rrrr')) probation_date
,department
,supervisor_id
,direct_manager_id
,location_code
,reason_code
,action
,salary_grade
,full_or_part_time
,hr_responsible_id
,job_code
FROM xxhr_job_stg WHERE empl_id in(SELECT assignment_number FROM
per_all_assignments_f);

-- --------------------------------------------------------------------------------------------
-- CURSOR for job Code
-- --------------------------------------------------------------------------------------------

BEGIN

G_USER_ID := FND_PROFILE.VALUE('USER_ID');
G_LOGIN_ID := FND_PROFILE.VALUE('LOGIN_ID');
v_org_id := FND_PROFILE.VALUE('ORG_ID');
v_resp_id := FND_PROFILE.VALUE('RESP_ID');
v_resp_APPL_id := FND_PROFILE.VALUE('RESP_APPL_ID');

FND_GLOBAL.APPS_INITIALIZE(G_USER_ID,v_resp_id,v_resp_appl_id);

FOR v_job_emp IN job_emp LOOP

-- ----------------------------------------------------------------------------------------
-- Validation For Assignment Id
-- ----------------------------------------------------------------------------------------
SELECT assignment_id
,effective_start_date
,object_version_number
INTO l_assignment_id
,l_effective_date
,v_object_version_number
FROM per_all_assignments_f
WHERE person_id =(SELECT person_id
FROM per_all_people_f
WHERE employee_number = v_job_emp.empl_id);
-- -----------------------------------------------------------------------------------------
-- Validation for job code
-- -----------------------------------------------------------------------------------------
SELECT job_id
INTO l_job_id
FROM per_jobs
WHERE name = v_job_emp.job_code;

-- ----------------------------------------------------------------------------------------
-- Update the Assignment Criteria
-- ----------------------------------------------------------------------------------------

hr_assignment_api.update_emp_asg_criteria
(p_validate => FALSE
,p_effective_date => l_effective_date
,p_datetrack_update_mode => 'CORRECTION'
,p_assignment_id => l_assignment_id
,p_object_version_number => v_object_version_number
,p_job_id => l_job_id
,p_special_ceiling_step_id => V_special_ceiling_step_id
,p_group_name => V_group_name
,p_effective_start_date => V_effective_start_date
,p_effective_end_date => V_effective_end_date
,p_people_group_id => V_people_group_id
,p_org_now_no_manager_warning => V_org_now_no_manager_warning
,p_other_manager_warning => V_other_manager_warning
,p_spp_delete_warning => V_spp_delete_warning
,p_entries_changed_warning => V_entries_changed_warning
,p_tax_district_changed_warning => V_tax_district_changed_warning
,p_soft_coding_keyflex_id => V_soft_coding_keyflex_id
,p_concatenated_segments => V_concatenated_segments
);

DBMS_OUTPUT.enable(500000);
DBMS_OUTPUT.PUT_LINE('Assigned the job_id:'||l_job_id);
COMMIT;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error:'||SQLERRM);
END xxhr_criteria_proc;

END XXHR_JOB_PKG;
/

HR Employee Termination API

Base Tables affected


 PER_ALL_ASSIGNMENTS_ALL
 PER_PERIODS_OF_SERVEICE

Verify Termination Data from Back End:


Using the following tables can able to see the termination data
 PER_PERIODS_OF_SERVEICE
 PER_ALL_PEOPLE_F
 PER_BUSINESS_GROUPS
 PER_PERSON_TYPES

Data file Layout


The Employee Termination API data should be provided in the form of .csv file with fields
separated by delimiter. The first line in file is to describe the fields in the data file.
The following is the layout for Employee Termination API data file. The following fields are
mandatory.

Field Description

EmplID Employee’s ID

Effective Date Employee’s Effective


date
Last Date Worked Employee’s last date
Worked

Termination Date Employee’s Termination


Date
Reason Code Employee’s Reason
Code

IN Parameters:

Field Data type Siz Mandato Description


e ry

p_validate Varchar2 11 Y When this parameter is set


to FALSE (the default
value), the procedure
executes all validation for
that business function
p_effective_date Date Y Employee’s marital status
p_period_of_service_id Date Y Employee’s date of birth
p_actual_termination_date Varchar2 30 Y Employee’s nationality
p_last_standard_process_date Varchar2 1 Y Employee’s Email Address
Field Data type Siz Mandato Description
e ry

p_person_type_id Varchar2 10 Y This parameter is used as


the first day the person
details come into effect.
p_leaving_reason Varchar2 30 Y If p_validate is false, this
uniquely identifies the
person created
p_assignment_status_type_id
p_last_std_process_date_out

OUT Parameters:

Field Data type Siz Mandato Description


e ry

p_object_version_number Varchar2 11 Y When this parameter is set


to FALSE (the default
value), the procedure
executes all validation for
that business function
p_supervisor_warning Number 3 Y Employee’s Record number
p_event_warning Date Y Employee’s last name
p_interview_warning Number 3 Y Employee’s forst name
p_review_warning Date Y Employee’s gender
p_recruiter_warning Date Y Employee’s marital status
p_asg_future_changes_warnin Date Y Employee’s date of birth
g
p_entries_changed_warning Varchar2 10 Y Employee’s original date of
hire
p_pay_proposal_warning Varchar2 30 Y Employee’s nationality
p_dod_warning Varchar2 1 Y Employee’s Email Address

HR Employee Termination API script

-- -----------------------------------------------------------------------------------
-- Procedure Name : xxhr_emp_termination_proc
-- Author's Nam : Sudhakar
-- Creation Date : 12/20/2007
-- Updated Date : 02/19/2008
-- Purpose : This PACKAGE to remove the employee from the database
-- ------------------------------------------------------------------------------------

DECLARE

l_validate_mode BOOLEAN := FALSE;


l_business_group_id NUMBER;
l_employee_no NUMBER;
l_date1 DATE;

-- API Return Variables


l_person_id NUMBER;
l_assignment_id NUMBER;
l_obj_version_number NUMBER;
l_eff_start_date DATE;
l_eff_end_date DATE;
l_comment_id NUMBER;
l_error_text VARCHAR2(1000);
l_last_standard_process_date DATE;
l_obj_no1 NUMBER;
l_obj_no2 NUMBER;
l_supervisor_warning BOOLEAN;
l_event_warning BOOLEAN;
l_interview_warning BOOLEAN;
l_review_warning BOOLEAN;
l_recruiter_warning BOOLEAN;
l_asg_future_changes_warning BOOLEAN;
l_entries_changed_warning VARCHAR2(10);
l_pay_proposal_warning BOOLEAN;
l_dod_warning BOOLEAN;
l_ppos_id NUMBER;

-- Constant variables
l_module_id CONSTANT VARCHAR2(30) := 'XXFTHR_MIGRATION019';

-- Error Handling variables


l_error_message VARCHAR2(150);
l_error_code VARCHAR2(30);
l_error_statement VARCHAR2(50);

-- Count Variables
l_count_total NUMBER := 0;
l_count_success NUMBER := 0; -- Total number of successful rows
l_cnt1 NUMBER :=0;
l_errm VARCHAR2(100);
l_err_at_stmt NUMBER;
-- Cursor definitions
CURSOR c_emp_ter IS
SELECT rowid row_id
, employee_number
, lrl_leave_date
, termination_date
, leave_cd1
, lieu_hours_flat
, lieu_hours_prem
, holiday_balhours
, in_lieu_notice_amount
, assignment_id
, person_id
FROM xxft_emp_termination
WHERE record_loaded='V'
ORDER BY employee_number;

CURSOR c_ppos (c_person_id IN NUMBER) IS


SELECT period_of_service_id,
object_version_number
FROM per_periods_of_service
WHERE person_id = c_person_id;

CURSOR c_FocusThread_code (c_legacy_type IN VARCHAR2, c_legacy_code IN


VARCHAR2) IS
SELECT FocusThread_lookup_cd
FROM xxft_lookup_values
WHERE legacy_lookup_cd = c_legacy_code
AND legacy_lookup_type = c_legacy_type;

CURSOR c_lookup_code (c_lookup_type IN VARCHAR2, c_meaning IN VARCHAR2)


IS
SELECT lookup_code
FROM hr_lookups
WHERE meaning = c_meaning
AND lookup_type = c_lookup_type;

--
BEGIN

DBMS_OUTPUT.PUT_LINE('-------------------------------------------------------------------');
DBMS_OUTPUT.PUT_LINE('-- Started Terminate Employees at: '||to_char(SYSDATE,
'DD-MON-RRRR HH24:MI:SS'));
DBMS_OUTPUT.PUT_LINE('--');

-- Get business group id


SELECT business_group_id
INTO l_business_group_id
FROM per_business_groups
WHERE name = 'Setup Business Group';

--First update person_id and date_from using a corelated subquery to xxft_employee

UPDATE xxft_emp_termination a
SET person_id = (SELECT person_id
FROM xxft_employee b
WHERE a.employee_number = b.employee_number);

UPDATE xxft_emp_termination a
SET assignment_id = (SELECT assignment_id
FROM xxft_employee b
WHERE a.employee_number = b.employee_number);

-- ************************************************************
-- Start Main Loop
-- ************************************************************

FOR rec IN c_emp_ter LOOP

l_err_at_stmt :=10;

l_employee_no := rec.employee_number;

l_person_id := NULL;
l_assignment_id := NULL;

l_last_standard_process_date := last_day(rec.termination_date);
l_obj_no1 := NULL;
--l_obj_no2 := NULL;
l_supervisor_warning := NULL;
l_event_warning := NULL;
l_interview_warning := NULL;
l_review_warning := NULL;
l_recruiter_warning := NULL;
l_asg_future_changes_warning := NULL;
l_entries_changed_warning := NULL;
l_pay_proposal_warning := NULL;
l_dod_warning := NULL;

l_cnt1 := l_cnt1 + 1;

BEGIN

OPEN c_ppos(rec.person_id);
FETCH c_ppos INTO l_ppos_id, l_obj_no1;
IF c_ppos%NOTFOUND THEN
NULL;
END IF;
CLOSE c_ppos;

-- HR_EX_EMPLOYEE_API.ACTUAL_TERMINATION_EMP
-- HR_EX_EMPLOYEE_API.UPDATE_TERM_DETAILS_EMP
-- HR_EX_EMPLOYEE_API.FINAL_PROCESS_EMP

hr_ex_employee_api.actual_termination_emp(
--p_validate => FALSE
p_effective_date => rec.termination_date
,p_period_of_service_id => l_ppos_id
,p_actual_termination_date => rec.termination_date
,p_person_type_id => 6 -- ex employee id
,p_assignment_status_type_id => 3 -- Terminate Assignment status
,p_leaving_reason => rec.leave_cd1
-- OUT
,p_last_standard_process_date => l_last_standard_process_date
,p_object_version_number => l_obj_no1
,p_supervisor_warning => l_supervisor_warning
,p_event_warning => l_event_warning
,p_interview_warning => l_interview_warning
,p_review_warning => l_review_warning
,p_recruiter_warning => l_recruiter_warning
,p_asg_future_changes_warning => l_asg_future_changes_warning
,p_entries_changed_warning => l_entries_changed_warning
,p_pay_proposal_warning => l_pay_proposal_warning
,p_dod_warning => l_dod_warning
);

hr_ex_employee_api.update_term_details_emp
(--p_validate
p_effective_date => rec.termination_date
,p_period_of_service_id => l_ppos_id
--,p_termination_accepted_person
--,p_accepted_termination_date
--,p_comments
--,p_leaving_reason
,p_notified_termination_date => rec.termination_date
,p_projected_termination_date => rec.termination_date
-- OUT
,p_object_version_number => l_obj_no1
);

UPDATE per_all_assignments_f
SET effective_end_date = l_last_standard_process_date
WHERE effective_end_date = to_date ('31-DEC-4712','DD-MON-YYYY')
AND assignment_id = rec.assignment_id;

UPDATE xxft_emp_termination
SET record_loaded = 'Y'
WHERE rowid=rec.row_id;

l_count_success := l_count_success + 1;

EXCEPTION
WHEN OTHERS THEN

l_errm := substr(ltrim(sqlerrm),1,100);

-- dbms_output.put_line (to_char(l_employee_no)||' : '||


-- to_char(l_date1,'DD-MON-YYYY'));

-- dbms_output.put_line(sqlerrm);

INSERT INTO xxft_error_log ( module_id,


emp_no,
error_desc,
run_date)
VALUES ( l_module_id
, rec.employee_number
, l_errm
, sysdate
);

UPDATE xxft_emp_termination
SET record_loaded = 'N'
WHERE rowid=rec.row_id;

END;
l_err_at_stmt :=40;

IF l_cnt1>=10 THEN
COMMIT;
l_cnt1:=0;
END IF;

END LOOP;

COMMIT;

DBMS_OUTPUT.PUT_LINE('No of Terminated records '||to_Char(l_count_success));

IF l_count_success != l_count_total THEN


NULL;
--DBMS_OUTPUT.PUT_LINE('--
*************************************************************');
--DBMS_OUTPUT.PUT_LINE('-- **Please examine the error table for a list of errored
rows**');
--DBMS_OUTPUT.PUT_LINE('--
*************************************************************');
END IF;

DBMS_OUTPUT.PUT_LINE('--');
DBMS_OUTPUT.PUT_LINE('-- Finished Terminate Employees load at: '||
to_char(SYSDATE, 'DD-MON-RRRR HH24:MI:SS'));
DBMS_OUTPUT.PUT_LINE('---------------------------------------------------------------------
-----------');

---------
---------
EXCEPTION
---------
---------

WHEN OTHERS THEN

DBMS_OUTPUT.PUT_LINE('No of records terminated '||to_Char(l_count_success));


DBMS_OUTPUT.PUT_LINE('Error at '|| to_char(l_err_at_stmt) );
DBMS_OUTPUT.PUT_LINE(SQLERRM||SQLCODE);

l_error_message := substr(ltrim(sqlerrm),1,100);
l_error_code := sqlcode;

INSERT INTO xxft_error_log ( module_id,


emp_no,
error_desc,
run_date)
VALUES ( l_module_id
, Null
, l_error_statement||', '||l_error_message||', Error code: '||l_error_code
, sysdate
);

DBMS_OUTPUT.PUT_LINE('Unhandled termination of Terminate Employees at: '||


to_char(SYSDATE, 'DD-MON-RRRR HH24:MI:SS'));
DBMS_OUTPUT.PUT_LINE('---------------------------------------------------------------------
----');
END;
/

Das könnte Ihnen auch gefallen