You are on page 1of 37

Hardcoded HRMS API Examples (Doc ID 1505063.

1) To Bottom

In this Document

Goal
Solution
hr_applicant_api.create_gb_applicant
hr_applicant_api.hire_applicant
hr_application_api.update_apl_details
hr_assignment_api.create_secondary_emp_asg
hr_assignment_api.delete_assignment
hr_assignment_api.create_gb_secondary_emp_asg
hr_assignment_api.set_new_primary_asg
hr_assignment_api.actual_termination_emp_asg
hr_assignment_api.update_emp_asg
hr_assignment_api.update_emp_asg_criteria
hr_contact_rel_api.create_contact
hr_contact_rel_api.delete_contact_relationship
hr_contingent_worker.convert_to_cwk
hr_contract_api.create_contract
hr_employee_api.create_gb_employee
hr_employee_api.re_hire_ex_employee
hr_ex_employee_api.actual_termination_emp
hr_grade_rate_value_api.update_grade_rate_value
hr_location_api.create_location
hr_maintain_proposal_api.insert_salary_proposal
hr_person_api.delete_person
hr_person_absence_api.update_person_absence
hr_person_absence_api.create_person_absence
hr_person_extra_info.update_person_extra_info
hr_person_extra_info.create_person_extra_info
hr_position_api.update_position
hr_position_api.delete_position
hr_position_api.create_position
hr_person_api.update_person
hr_person_api.update_gb_person
hr_sit_api.create_sit
hr_sit_api.update_sit
hr_upload_proposal_api.upload_salary_proposal
hr_user_acct_api.create_user_acct
per_qualifications_api.update_qualification
per_vacancy_api.create_vacancy
References

APPLIES TO:

Oracle Human Resources - Version 11.5.10.2 and later


Information in this document applies to any platform.
DISCLAIMER: If you need any assistance to debug or help write this code you will
need to consult a resource outside of Oracle support.

Oracle Support policy does not include assistance in creation or troubleshooting of


custom code within Oracle Applications.

Support analysts may address questions regarding basic functionality, but the charter
does not allow Support to assist in debugging custom code.
Oracle Consulting is available as a resource for those customers who require
assistance with debugging custom code for the Oracle Applications.
Service offerings are available at:

http://www.oracle.com/consulting/index.html?content.html

GOAL

List of APIs

This document gives guidance, with the help of examples, on how to use various
HRMS API's with hardcoded examples.

 For details of API usage please refer to Note 72310.1: Understanding and
Using APIs in Oracle HRMS

This code is to be run in SQLplus as the APPS user.

The examples are basic wrappers to allow the API with the minimum required
parameters. Additional parameters may then be added to suit your business
requirements.

Please ensure that id's and other parameters are correct for your business group
and change appropriately
DISCLAIMER: If you need any assistance to debug or help write this code you will need to consul
Oracle Support policy does not include assistance in creation or troubleshooting of custom code within O

Support analysts may address questions regarding basic functionality, but the charter does not allow Sup
Oracle Consulting is available as a resource for those customers who require assistance with debugging c

Service offerings are available at: http://www.oracle.com/consulting/index.html?content.html

SOLUTION

The following are examples only. Do not cut and paste these to use in your
instances as is. They are not warranted to work in this manner.

You will need to write your own code for your instance based on whether you are a
fully installed Oracle Human Resources environment or a shared HR installed Oracle
Human Resources environment.

Shared HR installed Oracle Human Resources environments are limited as to what


can and cannot be used within API's.

If you are unaware of what data can and cannot be used within your environment,
please go to the following note for validation.

Note 462586.1How To Access API References via the Oracle Integration Repository

hr_applicant_api.create_gb_applicant

set serverout on;


declare
l_person_id per_people_f.person_id%TYPE;
l_assignment_id per_assignments_f.assignment_id%TYPE;
l_per_object_version_number per_people_f.object_version_number
%TYPE;
l_asg_object_version_number per_people_f.object_version_number
%TYPE;
l_apl_object_version_number per_applications.object_version_nu
mber%TYPE;
l_per_effective_start_date per_people_v.effective_start_date%T
YPE;
l_per_effective_end_date per_people_v.effective_end_date%TYPE;
l_full_name per_people_f.full_name%TYPE;
l_per_comment_id per_people_f.comment_id%TYPE;
l_application_id per_applications.application_id%TYPE;
l_assignment_sequence per_people_assignments_view.assignme
nt_sequence%TYPE;
l_applicant_number per_people_f.applicant_number%TYPE;
l_name_combination_warning boolean;
l_assign_payroll_warning boolean;
l_orig_hire_warning boolean;
begin
hr_applicant_api.create_gb_applicant
(
P_VALIDATE => FALSE
,P_DATE_RECEIVED => to_date('31-DEC-1999','DD-MON-YYYY')
,P_DATE_OF_BIRTH => to_date('01-OCT-1985','DD-MON-YYYY')
,P_BUSINESS_GROUP_ID => 1379
,P_LAST_NAME => 'VF-TEST3'
,P_APPLICANT_NUMBER => l_applicant_number
,P_PERSON_ID => L_PERSON_ID
,P_ASSIGNMENT_ID => L_ASSIGNMENT_ID
,P_APPLICATION_ID => l_application_id
,P_PER_OBJECT_VERSION_NUMBER => L_PER_OBJECT_VERSION_NUMBER
,P_ASG_OBJECT_VERSION_NUMBER => L_ASG_OBJECT_VERSION_NUMBER
,P_APL_OBJECT_VERSION_NUMBER => L_APL_OBJECT_VERSION_NUMBER
,P_PER_EFFECTIVE_START_DATE => L_PER_EFFECTIVE_START_DATE
,P_PER_EFFECTIVE_END_DATE => L_PER_EFFECTIVE_END_DATE
,P_FULL_NAME => L_FULL_NAME
,P_PER_COMMENT_ID => L_PER_COMMENT_ID
,P_ASSIGNMENT_SEQUENCE => L_ASSIGNMENT_SEQUENCE
,P_NAME_COMBINATION_WARNING => L_NAME_COMBINATION_WARNING
,P_ORIG_HIRE_WARNING => L_ORIG_HIRE_WARNING
);
end;
/

-- Go to API List

hr_applicant_api.hire_applicant

set serveroutput on;

declare
L_PERSON_ID number := 71303;
l_assignment_id number := 74691;
l_object_version_number number := 2;
L_EMPLOYEE_NUMBER varchar2(100);
l_person_type_id number := 95;
l_CONCATENATED_SEGMENTS VARCHAR2 (1000);
l_CAGR_GRADE_DEF_ID NUMBER;
l_CAGR_CONCATENATED_SEGMENTS VARCHAR2 (1000);
l_GROUP_NAME VARCHAR2 (1000);
l_COMMENT_ID NUMBER;
l_PEOPLE_GROUP_ID NUMBER;
l_SOFT_CODING_KEYFLEX_ID NUMBER ;
l_EFFECTIVE_START_DATE DATE;
l_EFFECTIVE_END_DATE DATE;
l_ASSIGN_PAYROLL_WARNING boolean;
l_UNACCEPTED_ASG_DEL_WARNING boolean;
l_ORIG_HIRE_WARNING boolean;

begin

hr_applicant_api.hire_applicant
(P_VALIDATE => FALSE,
P_hire_DATE => trunc(SYSDATE),
P_PERSON_ID => l_person_id,
P_ASSIGNMENT_ID => l_assignment_id,
P_PERSON_TYPE_ID => l_person_type_id,
P_PER_OBJECT_VERSION_NUMBER => l_object_version_number,
P_EMPLOYEE_NUMBER => l_employee_number,
P_per_EFFECTIVE_START_DATE => l_effective_start_date,
P_per_EFFECTIVE_END_DATE => l_effective_end_date,
P_UNACCEPTED_ASG_DEL_WARNING => l_UNACCEPTED_ASG_DEL_WARNING,
P_ASSIGN_PAYROLL_WARNING => l_ASSIGN_PAYROLL_WARNING);

end;
/

-- Go to API List

hr_application_api.update_apl_details

set serveroutput on;

declare

l_true boolean := false;


l_application_id number := 2592;
l_obj NUMBER;
l_person_id number :=7814;
l_attrib4 varchar2(30) :='Applicant';

cursor csr_ovn is
select max(object_version_number)
from per_people_f where person_id=l_person_id;

begin

open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

hr_application_api.update_apl_details
(
p_validate => l_true
, p_application_id => l_application_id
, p_object_version_number => l_obj
, p_appl_attribute4 => l_attrib4
);
end;
/

-- Go to API List
hr_assignment_api.create_secondary_emp_asg

set serveroutput on;

declare
l_date date := to_date('01-MAR-2012','DD-MON-
YYYY');
l_assignment_number varchar2(30);
l_group_name varchar2(100);
l_concatenated_segments varchar2(100);
l_cagr_grade_def_id number;
l_cagr_concatenated_segments varchar2(100);
l_assignment_id number;
l_soft_coding_keyflex_id number;
l_effective_end_date date;
l_assignment_sequence number;
l_comment_id number;
l_other_manager_warning boolean;
l_hourly_salaried_warning boolean;
l_gsp_post_process_warning varchar2(100);
l_people_group_id number := 169;
l_ovn number;
l_person_id number := 367;
l_organization_id number := 647;
l_payroll_id number := 112;
l_location_id number := 431;

begin
hr_assignment_api.create_secondary_emp_asg
(p_validate => FALSE,
p_effective_date => to_date('01-
MAR-2012','DD-MON-YYYY'),
p_person_id => l_person_id,
p_organization_id =>
l_organization_id,
p_payroll_id => l_payroll_id,
p_location_id => l_location_id,
p_assignment_number =>
l_assignment_number,
p_group_name => l_group_name,
p_concatenated_segments =>
l_concatenated_segments,
p_cagr_grade_def_id =>
l_cagr_grade_def_id,
p_cagr_concatenated_segments =>
l_cagr_concatenated_segments,
p_assignment_id =>
l_assignment_id,
p_soft_coding_keyflex_id =>
l_soft_coding_keyflex_id,
p_people_group_id =>
l_people_group_id,
p_object_version_number => l_ovn,
p_effective_start_date => l_date,
p_effective_end_date =>
l_effective_end_date,
p_assignment_sequence =>
l_assignment_sequence,
p_comment_id => l_comment_id,
p_other_manager_warning =>
l_other_manager_warning,
p_hourly_salaried_warning =>
l_hourly_salaried_warning,
p_gsp_post_process_warning =>
l_gsp_post_process_warning
);
end;
/

-- Go to API List

hr_assignment_api.delete_assignment

set serveroutput on;


declare
v_date date := to_date('21052012','ddmmyyyy');
v_assignment_id number;
v_person_id number;
l_aantal number;
l_effective_start_date per_all_assignments_f.effective_star
t_date%TYPE;
l_effective_end_date per_all_assignments_f.effective_end_
date%TYPE;
l_loc_change_tax_inssues boolean;
l_delete_asg_budgets boolean;
l_org_now_no_manager_warning boolean;
l_element_salary_warning boolean;
l_element_entries_warning boolean;
l_spp_warning boolean;
l_cost_warning Boolean;
l_life_events_exists Boolean;
l_cobra_coverage_elements Boolean;
l_assgt_term_elements Boolean;
l_object_version_number number;
l_fout varchar2(3);
l_assignment_id per_all_assignments_f.assignment_id%
type;
l_asg_obj_version_number per_all_assignments_f.object_version
_number%type;
l_assignment_sequence number;
l_assignment_number per_all_assignments_f.assignment_num
ber%type;
l_assign_payroll_warning boolean;
l_ontslag per_periods_of_service%rowtype;
l_rowid varchar2(2000);
l_dodwarning boolean;
l_s_final_process_date date;
l_s_actual_termination_date date;
l_assignment_status_type_id per_all_assignments_f.assignment_sta
tus_type_id%type;
l_requery_required varchar2(1);
l_rowid rowid;
cursor c_obj is
select object_version_number
from per_all_assignments_f paaf
where paaf.person_id = v_person_id
and paaf.assignment_id = v_assignment_id
and v_date between paaf.effective_start_date and
paaf.effective_end_date;

begin

v_assignment_id := 35158;
v_person_id := 34634;
open c_obj;
fetch c_obj into l_object_version_number;
close c_obj;

begin
hr_assignment_api.delete_assignment
(p_validate => FALSE
,p_effective_date
=> v_date -1
,p_datetrack_mode =>
'DELETE_NEXT_CHANGE'
,p_assignment_id => v_assignment_id
,p_object_version_number =>
l_object_version_number
,p_effective_start_date =>
l_effective_start_date
,p_effective_end_date =>
l_effective_end_date
,p_loc_change_tax_issues =>
l_loc_change_tax_inssues
,p_delete_asg_budgets =>
l_delete_asg_budgets
,p_org_now_no_manager_warning =>
l_org_now_no_manager_warning
,p_element_salary_warning =>
l_element_salary_warning
,p_element_entries_warning =>
l_element_entries_warning
,p_spp_warning => l_spp_warning
,P_cost_warning => l_cost_warning
,p_life_events_exists =>
l_life_events_exists
,p_cobra_coverage_elements =>
l_cobra_coverage_elements
,p_assgt_term_elements =>
l_assgt_term_elements);
--
exception
when others then
dbms_output.put_line(substr(sqlerrm,1,200));
end;

end;
/

-- Go to API List

hr_assignment_api.create_gb_secondary_emp_asg

DECLARE
vv_group_name VARCHAR2(150);
vn_people_group_id NUMBER;
vn_assignment_sequence NUMBER;
vn_comment_id NUMBER;
vb_other_manager_warning BOOLEAN;
vb_hourly_salaried_warning BOOLEAN;
vn_cagr_grade_def_id NUMBER;
vv_cagr_concatenated_segments VARCHAR2(150);
vt_assignment_number VARCHAR2(50);
vt_assignment_id NUMBER;
vt_ass_object_version_number NUMBER;
vt_ass_eff_from_date DATE;
vt_ass_eff_to_date DATE;
BEGIN
vt_assignment_number := NULL;
hr_assignment_api.create_gb_secondary_emp_asg(p_validate
=> FALSE,
p_effective_date
=> TRUNC(SYSDATE),
p_person_id
=> 33255,
p_organization_id
=> 8464,
--OPTIONAL
p_job_id
=> 52906,
p_location_id
=> 519,
--IN/OUT
p_assignment_number
=> vt_assignment_number,
--OUT
p_group_name
=> vv_group_name,
p_assignment_id
=> vt_assignment_id,
p_people_group_id
=> vn_people_group_id,
p_object_version_num
ber => vt_ass_object_version_number,
p_effective_start_da
te => vt_ass_eff_from_date,
p_effective_end_date
=> vt_ass_eff_to_date,
p_assignment_sequenc
e => vn_assignment_sequence,
p_comment_id
=> vn_comment_id,
p_other_manager_warn
ing => vb_other_manager_warning,
p_hourly_salaried_wa
rning => vb_hourly_salaried_warning,
p_cagr_grade_def_id
=> vn_cagr_grade_def_id,
p_cagr_concatenated_
segments => vv_cagr_concatenated_segments
);
DBMS_OUTPUT.put_line('ID: ' || vt_assignment_id || ', number: ' ||
vt_assignment_number);
END;
/
-- Go to API List

hr_assignment_api.set_new_primary_asg
DECLARE

l_object_version_number per_all_assignments_f.object_version
_number%type;
l_primary_assignment_id per_all_assignments_f.assignment_id%
type;
l_primary_ovn per_all_assignments_f.object_version
_number%type;
x_end_date DATE;
x_start_date DATE;
x_ovn per_all_assignments_f.object_version
_number%type;

BEGIN
hr_assignment_api.set_new_primary_asg(p_validate => FALSE,
p_effective_dat
e => '02-JUN-2010',
p_person_id
=> 60130,
p_assignment_id
=> 59381,
p_object_versio
n_number => x_ovn,
p_effective_sta
rt_date => x_start_date,
p_effective_end
_date => x_end_date);
end;
/

-- Go to API List

hr_assignment_api.actual_termination_emp_asg

DECLARE

l_object_version_number per_all_assignments_f.object_version
_number%type;
l_primary_assignment_id per_all_assignments_f.assignment_id%
type;
l_primary_ovn per_all_assignments_f.object_version
_number%type;
x_end_date DATE;
x_start_date DATE;
x_ovn per_all_assignments_f.object_version
_number%type;
x_asg_future_changes_warning BOOLEAN;
x_entries_changed_warning VARCHAR2(100);
x_pay_proposal_warning BOOLEAN;
BEGIN
select max(object_version_number)
into l_primary_ovn
from per_all_assignments_f
where assignment_id=59380;
hr_assignment_api.actual_termination_emp_asg
(p_validate => FALSE,
p_assignment_id => 59380,
p_object_version_number => l_primary_ovn,
p_actual_termination_date => '03-JUN-2010',
p_effective_start_date => x_start_date,
p_effective_end_date => x_end_date,
p_asg_future_changes_warning =>
x_asg_future_changes_warning,
p_entries_changed_warning =>
x_entries_changed_warning,
p_pay_proposal_warning =>
x_pay_proposal_warning);
end;
/

-- Go to API List

hr_assignment_api.update_emp_asg

set serveroutput on;


DECLARE
i_effective_date DATE := to_date('01-
DEC-2012', 'DD-MON-YYYY');
i_datetrack_update_mode VARCHAR2 (30) := 'CORRECTION';
i_assignment_id NUMBER := 34078;
l_obj NUMBER;
io_cagr_grade_def_id NUMBER;
o_cagr_concatenated_segments VARCHAR2 (240);
o_concatenated_segments VARCHAR2 (240);
o_comment_id NUMBER;
o_effective_start_date DATE;
o_effective_end_date DATE;
o_no_managers_warning BOOLEAN;
o_other_manager_warning BOOLEAN;
o_hourly_salaried_warning BOOLEAN;
o_gsp_post_process_warning VARCHAR2 (240);

l_people_group_id NUMBER;
l_object_version_number NUMBER;
l_special_ceiling_step_id NUMBER;
l_soft_coding_keyflex_id NUMBER;
l_group_name VARCHAR2 (240);
l_effective_start_date DATE;
l_effective_end_date DATE;
l_org_now_no_manager_warning BOOLEAN;
l_other_manager_warning BOOLEAN;
l_spp_delete_warning BOOLEAN;
l_entries_changed_warning VARCHAR2 (240);
l_tax_district_changed_warning BOOLEAN;
l_concatenated_segments VARCHAR2 (240);
l_projected_assignment_end date;
cursor csr_ovn is
select max(object_version_number)
from per_assignments_f where assignment_id=i_assignment_id;
begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

hr_assignment_api.update_emp_asg
(
p_effective_date => i_effective_date,
p_datetrack_update_mode => i_datetrack_update_mode,
p_assignment_id => i_assignment_id,
p_object_version_number => l_obj,
p_cagr_grade_def_id => io_cagr_grade_def_id,
p_cagr_concatenated_segments =>
o_cagr_concatenated_segments,
p_concatenated_segments => o_concatenated_segments,
p_soft_coding_keyflex_id => l_soft_coding_keyflex_id,
p_comment_id => o_comment_id,
p_effective_start_date => o_effective_start_date,
p_effective_end_date => o_effective_end_date,
p_no_managers_warning => o_no_managers_warning,
p_other_manager_warning => o_other_manager_warning,
p_hourly_salaried_warning => o_hourly_salaried_warning,
p_gsp_post_process_warning => o_gsp_post_process_warning
,p_assignment_number => 'YY123'
);
end;
/

-- Go to API List

hr_assignment_api.update_emp_asg_criteria

set serveroutput on;

declare
l_date date := to_date('01-OCT-2009', 'DD-MON-
YYYY');
l_true boolean := false;
l_assign_id number := 32923;
l_obj NUMBER;
l_datetrack_update_mode VARCHAR2(30);
l_organization_id number;
l_special_ceiling_step_id number;
l_EFFECTIVE_START_DATE DATE;
l_EFFECTIVE_END_DATE DATE;
l_people_group_id number;
l_group_name varchar2(30);
l_org_now_no_manager_warning BOOLEAN;
l_other_manager_warning boolean;
l_spp_delete_warning boolean;
l_entries_changed_warning varchar2(30);
l_tax_district_changed_warning boolean;

cursor csr_ovn is
select max(object_version_number)
from per_assignments_f where assignment_id=32923;

begin

open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

hr_assignment_api.update_emp_asg_criteria
(
P_VALIDATE => l_true
,P_EFFECTIVE_DATE => l_date
,P_DATETRACK_UPDATE_MODE => 'CORRECTION'
,P_ASSIGNMENT_ID => l_assign_id
,P_OBJECT_VERSION_NUMBER => l_obj
-- ,p_organization_id => 626
,p_special_ceiling_step_id => l_special_ceiling_step_id
,P_effective_start_date => l_effective_start_date
,p_effective_end_date => l_effective_end_date
,p_people_group_id => l_people_group_id
,p_group_name => l_group_name
,p_org_now_no_manager_warning => l_org_now_no_manager_warning
,p_other_manager_warning => l_other_manager_warning
,p_spp_delete_warning => l_spp_delete_warning
,p_entries_changed_warning => l_entries_changed_warning
,p_tax_district_changed_warning => l_tax_district_changed_warning
, p_segment11 => 'Abbott, Mr. John'
);
end;
/

-- Go to API List

hr_contact_rel_api.create_contact

set serveroutput on;

DECLARE
l_validate_mode BOOLEAN := FALSE;
l_datetrack_update_mode VARCHAR2(30);
l_row_id ROWID;
l_business_group_id NUMBER;
l_contact_type VARCHAR2(30);
l_contact_title VARCHAR2(30);
l_primary_flag VARCHAR2(30);
l_attribute16 VARCHAR2(150);
l_contact_full_name VARCHAR2(240);
l_person_type_id NUMBER;
l_sex VARCHAR2(30);
l_per_start_date DATE;
l_per_end_date DATE;
l_per_comment_id NUMBER;
l_name_comb_warning BOOLEAN;
l_contact_relationship_id NUMBER;
l_contact_rel_ovn NUMBER;
l_contact_person_id NUMBER;
l_contact_person_ovn NUMBER;
l_errors VARCHAR2(100);
L_ORIG_HIRE_WARNING boolean;
BEGIN
HR_CONTACT_REL_API.CREATE_CONTACT
( P_VALIDATE => FALSE
, P_DATE_START => '04-AUG-1999'
, P_START_DATE => '04-AUG-1999'
, P_BUSINESS_GROUP_ID => 626
, P_PERSON_ID => 367
-- , P_CONTACT_PERSON_ID => NULL
, P_CONTACT_TYPE => 'F'
, P_PRIMARY_CONTACT_FLAG => 'N'
, P_CONT_ATTRIBUTE16 => NULL
, P_LAST_NAME => 'BLOGGY1'
, P_SEX => 'M'
, P_PERSON_TYPE_ID => 101
, P_DATE_OF_BIRTH => '12-SEP-1977'
, P_FIRST_NAME => 'FRED'
--, P_TITLE => l_contact_title
, P_CONTACT_RELATIONSHIP_ID => l_contact_relationship_id
, P_CTR_OBJECT_VERSION_NUMBER => l_contact_rel_ovn
, P_PER_PERSON_ID => l_contact_person_id
, P_PER_OBJECT_VERSION_NUMBER => l_contact_person_ovn
, P_PER_EFFECTIVE_START_DATE => l_per_start_date
, P_PER_EFFECTIVE_END_DATE => l_per_end_date
, P_FULL_NAME => l_contact_full_name
, P_PER_COMMENT_ID => l_per_comment_id
, P_NAME_COMBINATION_WARNING => l_name_comb_warning
, P_ORIG_HIRE_WARNING => L_ORIG_HIRE_WARNING
);
END;
/

-- Go to API List

hr_contact_rel_api.delete_contact_relationship

CONTACT_RELATIONSHIP_ID
OVN

DECLARE
l_true_boolean := FALSE;
l_contact_relationship_id := 147;
l_object_version_number := 7;

BEGIN
hr_contact_rel_api.delete_contact_relationship
(
l_true_boolean
, l_contact_relationship_id
, l_object_version_number
);
END;
/

-- Go to API List
hr_contingent_worker.convert_to_cwk

DECLARE
-- Start of Variable declarations, Initialize Variables with
appropriate values to test the script
-- VARCHAR2 size is set to 2000 by default, please enter target
table name to retrieve the exact limit
-- Input Variables
V_VALIDATE BOOLEAN;
V_EFFECTIVE_DATE DATE := to_date('01-JAN-
2014','DD-MON-YYYY');
V_PERSON_ID NUMBER :=14350;
-- In Out Variables
V_OBJECT_VERSION_NUMBER NUMBER;
V_NPW_NUMBER VARCHAR2(2000);
-- Input Variables
V_PROJECTED_PLACEMENT_END DATE;
V_PERSON_TYPE_ID NUMBER;
V_DATETRACK_UPDATE_MODE VARCHAR2(2000);
-- Output Variables
V_PER_EFFECTIVE_START_DATE DATE;
V_PER_EFFECTIVE_END_DATE DATE;
V_PDP_OBJECT_VERSION_NUMBER NUMBER;
V_ASSIGNMENT_ID NUMBER;
V_ASG_OBJECT_VERSION_NUMBER NUMBER;
V_ASSIGNMENT_SEQUENCE NUMBER;
cursor csr_ovn is
select max(object_version_number)
from per_all_people_f where person_id=v_person_id;
begin
open csr_ovn;
fetch csr_ovn into V_OBJECT_VERSION_NUMBER;
close csr_ovn;
-- Calling API HR_CONTINGENT_WORKER_API.CONVERT_TO_CWK
HR_CONTINGENT_WORKER_API.CONVERT_TO_CWK(P_VALIDATE
=> FALSE
,P_EFFECTIVE_DATE
=> V_EFFECTIVE_DATE
,P_PERSON_ID
=> V_PERSON_ID
,P_OBJECT_VERSION_NUMBER
=> V_OBJECT_VERSION_NUMBER
,P_NPW_NUMBER
=> V_NPW_NUMBER
,P_PROJECTED_PLACEMENT_END
=> V_PROJECTED_PLACEMENT_END
,P_PERSON_TYPE_ID
=> V_PERSON_TYPE_ID
,P_DATETRACK_UPDATE_MODE
=> V_DATETRACK_UPDATE_MODE
,P_PER_EFFECTIVE_START_DAT
E => V_PER_EFFECTIVE_START_DATE
,P_PER_EFFECTIVE_END_DATE
=> V_PER_EFFECTIVE_END_DATE
,P_PDP_OBJECT_VERSION_NUMB
ER => V_PDP_OBJECT_VERSION_NUMBER
,P_ASSIGNMENT_ID
=> V_ASSIGNMENT_ID
,P_ASG_OBJECT_VERSION_NUMB
ER => V_ASG_OBJECT_VERSION_NUMBER
,P_ASSIGNMENT_SEQUENCE
=> V_ASSIGNMENT_SEQUENCE
);
END;
/

-- Go to API List

hr_contract_api.create_contract

set serveroutput on;


Declare

/* Out variables */
p_validate boolean default false;
p_contract_id number;
p_effective_start_date date;
p_effective_end_date date;
p_object_version_number number;
l_date date := to_date('01-JAN-
2013','DD-MON-YYYY');
/* In variables*/

p_person_id number;
p_reference varchar2(240);
p_type varchar2(240);
p_status varchar2(240);
p_effective_date date;

BEGIN

hr_contract_api.create_contract (
p_validate => false
,p_contract_id => p_contract_id
,p_effective_start_date => p_effective_start_date
,p_effective_end_date => p_effective_end_date
,p_object_version_number => p_object_version_number
,p_person_id => 18689
,p_reference => 9874 -- Random number
,p_type => 'UNSPECIFIED_PERIOD' -- defined
by the CONTRACT_TYPE lookup type.
,p_status => 'A-ACTIVE' -- defined by the
CONTRACT_STATUS lookup type.
,p_effective_date => l_date
);
END;
/

-- Go to API List

hr_employee_api.create_gb_employee

set serverout on;


declare
l_employee_number per_people_f.employee_number%TYPE;
l_person_id per_people_f.person_id%TYPE;
l_assignment_id per_assignments_f.assignment_id%TYPE;
l_per_object_version_number per_people_f.object_version_number
%TYPE;
l_asg_object_version_number per_people_f.object_version_number
%TYPE;
l_per_effective_start_date per_people_v.effective_start_date%T
YPE;
l_per_effective_end_date per_people_v.effective_end_date%TYPE;
l_full_name per_people_f.full_name%TYPE;
l_per_comment_id per_people_f.comment_id%TYPE;
l_assignment_sequence per_people_assignments_view.assignme
nt_sequence%TYPE;
l_assignment_number per_people_assignments_view.assignment
_number%TYPE;
l_name_combination_warning boolean;
l_assign_payroll_warning boolean;

begin
hr_employee_api.create_gb_employee
(
p_validate => FALSE
,p_hire_date => to_date('01-Jul-2000','DD-MON-YYYY')
,p_business_group_id => 1021
,p_first_name => 'FONGY'
,p_last_name => 'FONGY'
,p_sex => 'M'
,p_ni_number => 'WP934486A'
,p_employee_number => l_employee_number
,p_person_id => l_person_id
,p_assignment_id => l_assignment_id
,p_per_object_version_number => l_per_object_version_number

,p_asg_object_version_number => l_asg_object_version_number


,p_per_effective_start_date => l_per_effective_start_date
,p_per_effective_end_date => l_per_effective_end_date
,p_full_name => l_full_name
,p_per_comment_id => l_per_comment_id
,p_assignment_sequence => l_assignment_sequence
,p_assignment_number => l_assignment_number
,p_name_combination_warning => l_name_combination_warning
,p_assign_payroll_warning => l_assign_payroll_warning
);
dbms_output.put_line ('Person ID: ' || to_char(l_person_id));
end;
/

-- Go to API List

hr_employee_api.re_hire_ex_employee

DECLARE

l_object_version_number per_all_people_f.object_version_number%t
ype;
x_assignment_id per_all_people_f.assignment_id%type;
x_asg_object_version_number per_all_people_f.object_version_number%t
ype;
x_effective_start_date DATE;
x_effective_end_date DATE;
x_assignment_sequence per_all_assignments_f.assignment_sequenc
e%type;
x_assignment_number per_all_assignments_f.assignment_number%
type;
x_assign_payroll_warning BOOLEAN;

BEGIN
select max(object_version_number)
into l_object_version_number
from per_all_people_f
where person_id=72302;

hr_employee_api.re_hire_ex_employee(
p_validate => false,
P_hire_date => sysdate,
P_person_id => 72302,
p_per_object_version_number => l_object_version_number,
p_person_type_id => 44,
p_rehire_reason => null,
p_assignment_id => x_assignment_id,
p_asg_object_version_number =>
x_asg_object_version_number,
p_per_effective_start_date => x_effective_start_date,
p_per_effective_end_date => x_effective_end_date,
p_assignment_sequence => x_assignment_sequence,
p_assignment_number => x_assignment_number,
p_assign_payroll_warning => x_assign_payroll_warning)
end;
/

-- Go to API List

hr_ex_employee_api.actual_termination_emp

set serveroutput on;

declare

l_period_of_service_id number := 3123;


l_date date := to_date('01-AUG-2000', 'DD-MON-
YYYY');
l_true boolean := false;
l_leaving_reason varchar2(2000) := 'QPJ';
l_term_date date := to_date('31-AUG-2000', 'DD-MON-
YYYY');
l_lsp_date date := to_date('31-AUG-2000', 'DD-MON-
YYYY');
l_batch_id number := 103;
l_fp_date date := to_date('31-AUG-2000', 'DD-MON-
YYYY');
l_obj number;
l_actual_termination_date date := to_date('31-AUG-2000', 'DD-
MON-YYYY');
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(30);
l_PAY_PROPOSAL_WARNING BOOLEAN;

cursor csr_ovn is
select max(object_version_number)
from per_periods_of_Service where period_of_service_id=3123;

begin

open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

-- execute API to insert leave date

hr_ex_employee_api.actual_termination_emp
(
p_validate => l_true
,p_effective_date => l_date
,p_period_of_service_id => l_period_of_service_id
,p_object_version_number => l_obj
,p_leaving_reason => l_leaving_reason
,p_actual_termination_date => l_actual_termination_date
,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


);
end;
/

-- Go to API List

hr_grade_rate_value_api.update_grade_rate_value

declare
l_rule_id number := 218;
l_ovn number;
l_start_date date;
l_end_date date;
l_eff_date date := trunc(sysdate + 2);
begin
select object_version_number into l_ovn
from pay_grade_rules_f where grade_rule_id = l_rule_id
and l_eff_date between effective_start_date and
effective_end_date;
hr_grade_rate_value_api.update_grade_rate_value
(p_effective_date => trunc(sysdate + 2)
,p_datetrack_update_mode => 'CORRECTION'
,p_grade_rule_id => l_rule_id
,p_object_version_number => l_ovn
,p_minimum => 8000
,p_effective_start_date => l_start_date
,p_effective_end_date => l_end_date);
end;
/

-- Go to API List

hr_location_api.create_location
set serveroutput on;
DECLARE
l_location_id NUMBER;
l_object_version_number NUMBER;
BEGIN
apps.hr_location_api.create_location (
p_effective_date => SYSDATE,
p_validate => FALSE,
p_location_code => 'TEST_LOCATION',
p_description => 'TEST Location',
p_address_line_1 => 'TEST Avenue',
p_country => 'GB',
p_postal_code => 'XXXX',
p_telephone_number_1 => '1234567',
p_town_or_city => 'TEST Town',
-- p_business_group_id => '626',
p_style => 'GB',
p_location_id => l_location_id,
p_object_version_number => l_object_version_number
);
END;

-- Go to API List

hr_maintain_proposal_api.insert_salary_proposal

DECLARE
l_pay_proposal_id number;
l_element_entry_id number;
l_inv_next_sal_date_warning boolean;
l_proposed_salary_warning boolean;
l_approved_warning boolean;
l_payroll_warning boolean;
l_object_version_number number;

BEGIN
hr_maintain_proposal_api.insert_salary_proposal
(p_pay_proposal_id =>l_pay_proposal_id
,p_assignment_id => 5093 -- *** Enter your assignment_id
here
,p_business_group_id => 1496 -- *** Enter your
business_group_id here
,p_change_date => to_date('01-APR-2001','DD-MON-YYYY')
,p_proposal_reason => 'NEWH' -- *** Enter your own reason
here
,p_proposed_salary_n => 17500
,p_object_version_number => l_object_version_number
,p_multiple_components => 'N'
,p_approved => 'Y'
,p_validate => FALSE
,p_element_entry_id => l_element_entry_id
,p_inv_next_sal_date_warning => l_inv_next_sal_date_warning
,p_proposed_salary_warning => l_proposed_salary_warning
,p_approved_warning => l_approved_warning
,p_payroll_warning => l_payroll_warning);

END;
/

-- Go to API List

hr_organization_api.create_organization

set serveroutput on;

declare
l_date date := to_date('01-jan-
2000','DD-MON-YYYY');
l_true boolean := false;
l_business_group_id number := 626;
l_language_code varchar2(10) := 'US';
l_name varchar2(80) := 'NJ TEST ORG';
l_internal_external_flag varchar2(80) := 'INT';
l_organization_id number;
l_object_version_number number;
l_duplicate_org_warning boolean;

begin
hr_organization_api.create_organization
( p_validate => l_true
,p_effective_date => l_date
,p_language_code => l_language_code
,p_business_group_id => l_business_group_id
,p_date_from => l_date
,p_name => l_name
,p_internal_external_flag => l_internal_external_flag
,p_organization_id => l_organization_id
,p_object_version_number => l_object_version_number
,P_duplicate_org_warning => l_duplicate_org_warning
);
end;
/

-- Go to API List
hr_person_api.delete_person

DECLARE
-- Input Variables
l_validate BOOLEAN := FALSE;
l_effective_date DATE := SYSDATE; -- eneter deletion date - in this
case sysdate is used
l_person_id NUMBER := xxxx; -- enter person_id
l_perform_predel_validation BOOLEAN := FALSE;
-- Output Variables
l_person_org_manager_warning VARCHAR2(2000);
BEGIN
-- Calling API HR_PERSON_API.DELETE_PERSON
hr_person_api.delete_person(p_validate =>
l_validate ,
p_effective_date =>
l_effective_date ,
p_person_id =>
l_person_id ,
p_perform_predel_validation =>
l_perform_predel_validation ,
p_person_org_manager_warning =>
l_person_org_manager_warning );
--
dbms_output.put_line('Person deleted successfully');
--
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error : ' || sqlerrm);
END;
/

-- Go to API List

hr_person_absence_api.update_person_absence

DECLARE
l_absence_days Number :=3;
l_absence_hours Number;
l_absence_attendance_id Number
:=194537;
l_obj Number;
l_dur_dys_less_warning boolean;

l_dur_hrs_less_warning boolean;

l_exceeds_pto_entit_warning boolean;

l_exceeds_run_total_warning boolean;

l_abs_overlap_warning boolean;

l_abs_day_after_warning boolean;

l_dur_overwritten_warning boolean;
l_del_element_entry_warning boolean;
l_date_start date :=to_date('01-sep-2011','DD-MON-YYYY');
l_date_end date:=to_date('15-sep-2011','DD-MON-YYYY');

cursor csr_ovn is
select max(object_version_number)
from per_absence_attendances where
absence_attendance_id=l_absence_attendance_id;
begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

hr_person_absence_api.update_person_absence
(p_validate => FALSE
,p_effective_date => to_date('01-SEP-
2011','DD-MON-YYYY')
,p_absence_attendance_id => l_absence_attend
ance_id
,p_abs_attendance_reason_id => 74
-- the reason before was null - now changing to id 74 (COLD)
,p_absence_days => l_absence_days
,p_absence_hours => l_absence_hours

,p_object_version_number => l_obj


,p_dur_dys_less_warning => l_dur_dys_less_war
ning
,p_dur_hrs_less_warning => l_dur_hrs_less_war
ning
,p_exceeds_pto_entit_warning => l_exceeds_pto_enti
t_warning
,p_exceeds_run_total_warning => l_exceeds_run_tota
l_warning
,p_abs_overlap_warning => l_abs_overlap_warn
ing
,p_abs_day_after_warning => l_abs_day_after_wa
rning
,p_dur_overwritten_warning => l_dur_overwritten_
warning
,p_del_element_entry_warning => l_del_element_ent
ry_warning
);
END;
/

-- Go to API List

hr_person_absence_api.create_person_absence

set serveroutput on;

DECLARE
l_absence_days Number :=2;
l_absence_hours Number;
l_absence_attendance_id Number;

l_object_version_number Number;

l_occurance Number;

l_dur_dys_less_warning boolean;
l_dur_hrs_less_warning boolean;

l_exceeds_pto_entit_warning boolean;

l_exceeds_run_total_warning boolean;

l_abs_overlap_warning boolean;

l_abs_day_after_warning boolean;

l_dur_overwritten_warning boolean;
BEGIN
HR_PERSON_ABSENCE_API.create_person_absence

(p_validate =>
FALSE
,p_effective_date => to_date('01-APR-2002','DD-MON-
YYYY')
,p_person_id =>
2831
,p_business_group_id =>
1379
,p_absence_attendance_type_id =>
272
,p_abs_attendance_reason_id =>
443

,p_date_start => to_date('01-APR-2002','DD-MON-


YYYY')

,p_date_end => to_date('02-APR-2002','DD-MON-


YYYY')

,p_absence_days =>
l_absence_days
,p_absence_hours =>
l_absence_hours

,p_absence_attendance_id =>
l_absence_attendance_id

,p_object_version_number =>
l_object_version_number

,p_occurrence =>
l_occurance
,p_dur_dys_less_warning =>
l_dur_dys_less_warning

,p_dur_hrs_less_warning =>
l_dur_hrs_less_warning

,p_exceeds_pto_entit_warning =>
l_exceeds_pto_entit_warning

,p_exceeds_run_total_warning =>
l_exceeds_run_total_warning

,p_abs_overlap_warning =>
l_abs_overlap_warning
,p_abs_day_after_warning => l_abs_day_after_warning
,p_dur_overwritten_warning =>
l_dur_overwritten_warning

);

END;
/

-- Go to API List

hr_person_extra_info.update_person_extra_info

set serveroutput on;

DECLARE
l_true BOOLEAN :=FALSE;
l_PERSON_EXTRA_INFO_ID NUMBER :=101041;
l_PEI_INFORMATION3 VARCHAR(200) := TO_CHAR(to_date('01-JAN-
2012','DD-MON-YYYY'),'YYYY/MM/DD HH24:MI:SS') ;
l_OBJ NUMBER;

CURSOR csr_ovn
IS
SELECT MAX(object_version_number)
FROM per_people_extra_info
WHERE PERSON_EXTRA_INFO_ID = l_PERSON_EXTRA_INFO_ID;
BEGIN
OPEN csr_ovn;
FETCH csr_ovn INTO l_obj;
CLOSE csr_ovn;

HR_PERSON_EXTRA_INFO_API.UPDATE_PERSON_EXTRA_INFO
(
p_validate => l_true
,P_PERSON_EXTRA_INFO_ID => l_PERSON_EXTRA_INFO_ID
,p_PEI_INFORMATION3 => l_PEI_INFORMATION3
,p_object_version_number => l_obj
);
END;

-- Go to API List

hr_person_extra_info.create_person_extra_info

set serveroutput on;

DECLARE
l_true BOOLEAN :=FALSE;
l_PERSON_ID NUMBER :=31785;
l_INFORMATION_TYPE VARCHAR2(2000) := 'LAST_NAME_DETAILS';
l_pei_information_category VARCHAR2(2000) := 'LAST_NAME_DETAILS';
l_PEI_INFORMATION1 VARCHAR2(2000) := 'Test1';
l_PEI_INFORMATION2 VARCHAR2(2000) := 'Test2';
l_PEI_INFORMATION3 VARCHAR(200) := TO_CHAR(to_date('01-
JAN-1999','DD-MON-YYYY'),'YYYY/MM/DD HH24:MI:SS');
-- Output Variables
l_PERSON_EXTRA_INFO_ID NUMBER;
l_OBJ NUMBER;

CURSOR csr_ovn
IS
SELECT MAX(object_version_number)
FROM per_all_people_f
WHERE person_id=l_person_id;
BEGIN
OPEN csr_ovn;
FETCH csr_ovn INTO l_obj;
CLOSE csr_ovn;

HR_PERSON_EXTRA_INFO_API.CREATE_PERSON_EXTRA_INFO
(
p_validate => l_true
,p_person_id => l_person_id
,p_INFORMATION_TYPE => l_INFORMATION_TYPE
,p_pei_information_category => l_pei_information_category
,p_PEI_INFORMATION1 => l_PEI_INFORMATION1
,p_PEI_INFORMATION2 => l_PEI_INFORMATION2
,p_PEI_INFORMATION3 => l_PEI_INFORMATION3
,p_PERSON_EXTRA_INFO_ID => l_PERSON_EXTRA_INFO_ID
,p_object_version_number => l_obj
);
end;

-- Go to API List

hr_position_api.update_position

DECLARE
l_true BOOLEAN :=FALSE;
l_obj NUMBER;
l_DATE_EFFECTIVE DATE :=to_date('01-Jan-
2012','DD-MON-YYYY');
l_POSITION_ID NUMBER :=110471;
l_POSITION_DEFINITION_ID NUMBER;
l_NAME VARCHAR2(500) :='NJ Single.';
l_position_type VARCHAR2(100) := 'NONE';
L_EFFECTIVE_DATE_START DATE;
L_EFFECTIVE_DATE_END DATE;
L_VALID_GRADES_CHANGED_WARNING BOOLEAN;
l_datetrack_mode VARCHAR2(100) :='CORRECTION';

CURSOR csr_ovn
IS
SELECT MAX(object_version_number)
FROM hr_all_positions_f
WHERE position_id=l_POSITION_ID;

BEGIN
OPEN csr_ovn;
FETCH csr_ovn INTO l_obj;
CLOSE csr_ovn;
HR_POSITION_API.UPDATE_POSITION
(
p_validate => l_true
,p_position_id => l_POSITION_ID
,p_effective_start_date => l_EFFECTIVE_DATE_START
,p_effective_end_date => l_EFFECTIVE_DATE_END
,p_position_definition_id => l_POSITION_DEFINITION_ID
,p_valid_grades_changed_warning => L_VALID_GRADES_CHANGED_WARNIN
G
,p_name => l_NAME
,p_position_type => l_position_type -- changing
position type
,p_object_version_number => l_obj
,p_effective_date => l_DATE_EFFECTIVE
,p_datetrack_mode => l_datetrack_mode
);
END;

-- Go to API List

hr_position_api.delete_position

set serveroutput on;

declare

l_true boolean :=false;


l_POSITION_ID NUMBER := 75502;
l_DATE DATE := to_date('01-feb-2013',
'DD-MON-YYYY');
l_obj NUMBER;
l_datetrack_mode varchar(30) := 'ZAP';
l_date1 Date;
l_date2 Date;

cursor csr_ovn is
select max(object_version_number)
from hr_All_positions_f where position_id=l_POSITION_ID;
begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

hr_position_api.delete_position
(
p_validate => l_true
,p_position_id => l_POSITION_ID
,p_object_version_number => l_obj
,p_datetrack_mode => l_datetrack_mode
,p_effective_date => l_date
,p_security_profile_id => 42
,p_effective_start_date => l_date1
,p_effective_end_date => l_date2
);
end;
/
-- Go to API List

hr_position_api.create_position
set serveroutput on;

declare

l_true boolean :=false;


l_obj NUMBER;
l_JOB_ID NUMBER :=614;
l_ORGANIZATION_ID NUMBER :=1379;
l_DATE_EFFECTIVE DATE := to_date('01-DEC-2000',
'DD-MON-YYYY');
l_POSITION_ID NUMBER;
l_POSITION_DEFINITION_ID NUMBER;
l_NAME VARCHAR2(30);
l_segment1 VARCHAR(30) :='NJ TEST POSITION';
l_segment2 VARCHAR2(30) :='10';

begin

hr_position_api.create_position
(
p_validate => l_true
, p_object_version_number => l_obj
, p_JOB_ID => l_JOB_ID
, p_ORGANIZATION_ID => l_ORGANIZATION_ID
, p_DATE_EFFECTIVE => l_DATE_EFFECTIVE
, p_POSITION_ID => l_POSITION_ID
, p_POSITION_DEFINITION_ID => l_POSITION_DEFINITION_ID
, p_NAME => l_NAME
, p_segment1 => l_segment1
, p_segment2 => l_segment2
, p_location_id => 2694
);
end;
/

-- Go to API List

hr_person_api.update_person

set serveroutput on;

DECLARE

l_date date := to_date('01-APR-2010', 'DD-MON-YYYY');


l_true boolean := false;
l_person_id number := 35848;
l_employee_number varchar2(30) := '1178';
l_obj NUMBER :=4;
l_comment_id number;
l_EFFECTIVE_START_DATE DATE;
l_EFFECTIVE_END_DATE DATE;
l_name_combination_warning BOOLEAN;
l_assign_payroll_warning boolean;
l_orig_hire_warning BOOLEAN;
l_full_name VARCHAR2(30);
l_last_name VARCHAR2(30) := 'DIFFERENT';

BEGIN

hr_person_api.update_person
(
p_validate => l_true
, p_effective_date => l_date
, p_datetrack_update_mode => 'CORRECTION'
, p_person_id => l_person_id
, p_object_version_number => l_obj
, p_last_name => l_last_name
, p_employee_number => l_employee_number
, p_effective_start_date => l_effective_start_date
, p_effective_end_date => l_effective_end_date
, p_full_name => l_full_name
, p_comment_id => l_comment_id
, p_name_combination_warning => l_name_combination_warning
, p_assign_payroll_warning => l_assign_payroll_warning
, p_orig_hire_warning => l_orig_hire_warning
);
end;
/

-- Go to API List

hr_person_api.update_gb_person
set serveroutput on;

declare
l_date date := to_date('01-SEP-2002', 'DD-
MON-YYYY');
l_true boolean := false;
l_person_id number := 367
l_employee_number varchar2(30) := '4';
l_obj NUMBER;
l_attribute1 VARCHAR2(30) := 'Yes';
l_comment_id number;
l_datetrack_update_mode VARCHAR2(30);
l_EFFECTIVE_START_DATE DATE := to_date('01-DEC-2002',
'DD-MON-YYYY');
l_EFFECTIVE_END_DATE DATE;
l_name_combination_warning BOOLEAN;
l_assign_payroll_warning boolean;
l_full_name VARCHAR2(30) := '-Anthony--Ambrose';
l_orig_hire_warning BOOLEAN;

cursor csr_ovn is
select max(object_version_number)
from per_people_f where person_id=l_person_id;

begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

hr_person_api.update_gb_person
(
p_validate => l_true
, p_effective_date => l_date
, p_datetrack_update_mode => 'CORRECTION'
, p_person_id => l_person_id
, p_object_version_number => l_obj
, p_employee_number => l_employee_number
, p_attribute1 => l_attribute1
, p_effective_start_date => l_effective_start_date
, p_effective_end_date => l_effective_end_date
, p_full_name => l_full_name
, p_comment_id => l_comment_id
, p_name_combination_warning => l_name_combination_warnin
g
, p_assign_payroll_warning => l_assign_payroll_warning
, p_orig_hire_warning => l_orig_hire_warning
);
end;
/

-- Go to API List

hr_sit_api.create_sit

declare
l_date date := to_date('02-DEC-2002', 'DD-
MON-YYYY');
l_true boolean := false;
l_person_id number := 2831;
l_obj NUMBER;
l_business_group_id number := 1379;
l_id_flex_num number := 51058;
l_analysis_criteria_id number;
l_person_analysis_id number;
l_p_segment1 varchar2(250) := '30';
l_p_segment2 varchar2(250) := '30';
l_p_segment3 varchar2(250) := '10';
l_p_segment4 varchar2(250) := '30-jan-2002';
cursor csr_ovn is
select max(object_version_number)
from per_people_f where person_id=l_person_id;
begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;
hr_sit_api.create_sit
(
p_validate => l_true
, p_effective_date => l_date
, p_person_id => l_person_id
, p_pea_object_version_number => l_obj
, p_business_group_id => l_business_group_id
, p_id_flex_num => l_id_flex_num
, p_analysis_criteria_id => l_analysis_criteria_id
, p_person_analysis_id => l_person_analysis_id
, p_segment1 => l_p_segment1
, p_segment2 => l_p_segment2
, p_segment3 => l_p_segment3
, p_segment4 => l_p_segment4
);
end;
/

-- Go to API List

hr_sit_api.update_sit
set serveroutput on;

declare

l_date date := to_date('01-DEC-2000', 'DD-


MON-YYYY');
l_true boolean := false;
l_person_id number := 2831;
l_obj NUMBER;
l_business_group_id number := 1379;
l_id_flex_num number := 51058;
l_analysis_criteria_id number := 2029;
l_person_analysis_id number := 1735;

cursor csr_ovn is
select max(object_version_number)
from per_people_f where person_id=l_person_id;

begin

open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

hr_sit_api.update_sit
(
p_validate => l_true
, p_effective_date => l_date
, p_person_id => l_person_id
, p_pea_object_version_number => l_obj
, p_business_group_id => l_business_group_id
, p_id_flex_num => l_id_flex_num
, p_analysis_criteria_id => l_analysis_criteria_id
, p_person_analysis_id => l_person_analysis_id
, p_segment1 => '30'
, p_segment2 => '40'
, p_segment3 => '10'
, p_segment4 => '21-JUL-2001'

);

end;
/
-- Go to API List

hr_upload_proposal_api.upload_salary_proposal
set serveroutput on;

declare

L_VALIDATE BOOLEAN := FALSE;


L_BUSINESS_GROUP_ID NUMBER := 626;
L_PROPOSAL_REASON VARCHAR2(20) := 'COL';
L_PAY_PROPOSAL_ID NUMBER := null;
L_OBJECT_VERSION_NUMBER NUMBER := null;
L_COMPONENT_REASON VARCHAR2(10) := null;
L_APPROVED_1 VARCHAR2(10) := null;
L_COMPONENT_ID_1 NUMBER := null;
L_PPC_OBJECT_VERSION_NUMBER_1 NUMBER := null;
L_APPROVED_2 VARCHAR2(10) := null;
L_COMPONENT_ID_2 NUMBER := null;
L_PPC_OBJECT_VERSION_NUMBER_2 NUMBER := null;
L_APPROVED_3 VARCHAR2(10) := null;
L_COMPONENT_ID_3 NUMBER := null;
L_PPC_OBJECT_VERSION_NUMBER_3 NUMBER := null;
L_APPROVED_4 VARCHAR2(10) := null;
L_COMPONENT_ID_4 NUMBER := null;
L_PPC_OBJECT_VERSION_NUMBER_4 NUMBER := null;
L_APPROVED_5 VARCHAR2(10) := null;
L_COMPONENT_ID_5 NUMBER := null;
L_PPC_OBJECT_VERSION_NUMBER_5 NUMBER := null;
L_APPROVED_6 VARCHAR2(10) := null;
L_COMPONENT_ID_6 NUMBER := null;
L_PPC_OBJECT_VERSION_NUMBER_6 NUMBER := null;
L_APPROVED_7 VARCHAR2(10) := null;
L_COMPONENT_ID_7 NUMBER := null;
L_PPC_OBJECT_VERSION_NUMBER_7 NUMBER := null;
L_APPROVED_8 VARCHAR2(10) := null;
L_COMPONENT_ID_8 NUMBER := null;
L_PPC_OBJECT_VERSION_NUMBER_8 NUMBER := null;
L_APPROVED_9 VARCHAR2(10) := null;
L_COMPONENT_ID_9 NUMBER := null;
L_PPC_OBJECT_VERSION_NUMBER_9 NUMBER := null;
L_APPROVED_10 VARCHAR2(10) := null;
L_COMPONENT_ID_10 NUMBER := null;
L_PPC_OBJECT_VERSION_NUMBER_10 NUMBER := null;
L_PYP_PROPOSED_SAL_WARNING BOOLEAN := FALSE;
l_ADDITIONAL_COMP_WARNING BOOLEAN := FALSE;

L_PERSON NUMBER := 517;


L_ASSIGNMENT NUMBER := 524;
L_START_DATE DATE := NULL;
L_END_DATE DATE := NULL;

L_MSG VARCHAR2(200) := NULL;


L_STATUS VARCHAR2(10) := 'VALID';
L_COUNTER NUMBER := 0;

l_date date := to_date('01-Aug-2013', 'DD-MON-YYYY');


l_proposed_salary VARCHAR2(30) := '21000.00';
l_err_num NUMBER;
l_err_msg VARCHAR2(100);

begin
hr_upload_proposal_api.upload_salary_proposal
( p_validate => FALSE
, p_change_date => l_date
, p_business_group_id => l_business_group_id
, p_assignment_id => l_assignment
, p_proposed_salary => l_proposed_salary
, p_proposal_reason => l_proposal_reason
, p_pay_proposal_id => l_pay_proposal_id
, p_object_version_number => l_object_version_number
, p_component_reason_1 => l_component_reason
, p_approved_1 => l_approved_1
, p_component_id_1 => l_component_id_1
, p_ppc_object_version_number_1 => l_ppc_object_version_number_1
, p_component_reason_2 => l_component_reason
, p_approved_2 => l_approved_2
, p_component_id_2 => l_component_id_2
, p_ppc_object_version_number_2 => l_ppc_object_version_number_2
, p_component_reason_3 => l_component_reason
, p_approved_3 => l_approved_3
, p_component_id_3 => l_component_id_3
, p_ppc_object_version_number_3 => l_ppc_object_version_number_3
, p_component_reason_4 => l_component_reason
, p_approved_4 => l_approved_4
, p_component_id_4 => l_component_id_4
, p_ppc_object_version_number_4 => l_ppc_object_version_number_4
, p_component_reason_5 => l_component_reason
, p_approved_5 => l_approved_5
, p_component_id_5 => l_component_id_5
, p_ppc_object_version_number_5 => l_ppc_object_version_number_5
, p_component_reason_6 => l_component_reason
, p_approved_6 => l_approved_6
, p_component_id_6 => l_component_id_6
, p_ppc_object_version_number_6 => l_ppc_object_version_number_6
, p_component_reason_7 => l_component_reason
, p_approved_7 => l_approved_7
, p_component_id_7 => l_component_id_7
, p_ppc_object_version_number_7 => l_ppc_object_version_number_7
, p_component_reason_8 => l_component_reason
, p_approved_8 => l_approved_8
, p_component_id_8 => l_component_id_8
, p_ppc_object_version_number_8 => l_ppc_object_version_number_8
, p_component_reason_9 => l_component_reason
, p_approved_9 => l_approved_9
, p_component_id_9 => l_component_id_9
, p_ppc_object_version_number_9 => l_ppc_object_version_number_9
, p_component_reason_10 => l_component_reason
, p_approved_10 => l_approved_10
, p_component_id_10 => l_component_id_10
, p_ppc_object_version_number_10 => l_ppc_object_version_number_10
, p_pyp_proposed_sal_warning => l_pyp_proposed_sal_warning
, p_additional_comp_warning => l_additional_comp_warning
);
end;
/

-- Go to API List
hr_user_acct_api.create_user_acct

set serveroutput on;

declare

l_business_group_id number := 1379;


l_user_id number := 123456;
l_true boolean := false;
l_per_effective_start_date date := to_date('26-JUL-2001',
'DD-MON-YYYY');
l_per_effective_end_date date := to_date('31-DEC-4712', 'DD-
MON-YYYY');
l_assignment_id number := 3976;
l_asg_effective_start_date date := to_date('26-JUL-2001', 'DD-
MON-YYYY');
l_asg_effective_end_date date := to_date('31-DEC-4712', 'DD-
MON-YYYY');
l_date_from date := to_date('26-JUL-2001', 'DD-MON-
YYYY');
l_date_to date := to_date('31-DEC-4712', 'DD-MON-
YYYY');
l_hire_date date := to_date('26-JUL-2001', 'DD-MON-
YYYY');
l_org_structure_id number := 192;
l_org_structure_version_id number := 249;
l_parent_org_id number := 1;
l_single_org_id number := 1;
l_run_type varchar2(30) := 'Bum';

begin

hr_user_acct_api.create_user_acct
(
p_validate => l_true
,p_business_group_id => l_business_group_id

,p_user_id => l_user_id


,p_per_effective_start_date => l_per_effective_start_date
,p_per_effective_end_date => l_per_effective_end_date
,p_assignment_id => l_assignment_id
,p_asg_effective_start_date => l_asg_effective_start_date
,p_asg_effective_end_date => l_asg_effective_end_date
,p_date_from => l_date_from
,p_date_to => l_date_to
,p_hire_date => l_hire_date
,p_org_structure_id => l_org_structure_id
,p_org_structure_version_id => l_org_structure_version_id
,p_parent_org_id => l_parent_org_id
,p_single_org_id => l_single_org_id
,p_run_type => l_run_type
);
end;
/

-- Go to API List
per_qualifications_api.update_qualification

set serveroutput on;


declare
l_date date := to_date('27-JAN-
2012', 'DD-MON-YYYY');
l_true boolean := false;
l_QUALIFICATION_ID number := 56905;
l_obj NUMBER;
l_title varchar2(100) := 'UPDATED_API' ;

cursor csr_ovn is
select max(object_version_number)
from per_qualifications where person_id=32063;
begin
open csr_ovn;
fetch csr_ovn into l_obj;
close csr_ovn;

per_qualifications_api.UPDATE_QUALIFICATION(
p_effective_date => l_date
,p_qualification_id => l_QUALIFICATION_ID
,p_title => l_title
,p_object_version_number => l_obj
);
end;
/

-- Go to API List

per_vacancy_api.create_vacancy

DECLARE

l_object_version_number NUMBER;
l_vacancy_id NUMBER;
l_inv_pos_grade_warning BOOLEAN;
l_inv_job_grade_warning BOOLEAN;

BEGIN
per_vacancy_api.create_vacancy
(
p_validate => FALSE,
p_effective_date => SYSDATE,
p_requisition_id => 121231,
p_date_from => SYSDATE,
p_name => 'IRCDUMMY',
p_business_group_id => 626,
p_description => 'Creating Dummy IRC Vac',
p_position_id => 1251,
p_job_id => 204,
p_organization_id => 1218,
p_number_of_openings => 100,
p_object_version_number => l_object_version_number,
p_vacancy_id => l_vacancy_id,
p_inv_pos_grade_warning => l_inv_pos_grade_warning,
p_inv_job_grade_warning => l_inv_job_grade_warning
);
END;

hr_sp_placement_api.Update_spp

DECLARE
V_ERR VARCHAR2 (1000) := NULL;
V_OBJECT_VERSION_NUMBER number := 5 ;
V_EFFECTIVE_START_DATE DATE;
V_EFFECTIVE_END_DATE DATE;
V_PLACEMENT_ID NUMBER;
V_increment_number Varchar2(10) := 1;
BEGIN

hr_sp_placement_api.Update_spp (
p_validate => FALSE,
p_effective_date => TRunc(sysdate),
p_datetrack_mode => 'CORRECTION',
p_placement_id => 1719,
p_object_version_number => v_object_version_number,
p_AUTO_INCREMENT_FLAG => 'Y',
p_step_id => 2310,
p_increment_number => V_increment_number,
p_effective_start_date => V_EFFECTIVE_START_DATE,
p_effective_end_date => V_EFFECTIVE_END_DATE );

DBMS_OUTPUT.put_line (' API: Check Auto Increment Flag' );


EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLERRM);
END;

-- Go to API List

<

This document gives guidance,with the help of examples,


on how to use various HRMS API's with hardcoded examples.

For details of API usage please refer to Note 72310.1:


Understanding and Using APIs in Oracle HRMS

This code is to be run in SQLplus as the APPS user.

It is a basic wrapper to allow the API with the minimum


required parameters. Additional parameters may then be
added to suit your business requirements.

Ensure that the assignment id and other parameters are


correct for your business group and change appropriately

You might also like