API Code For FA
API Code For FA
API Code For FA
p_value
=> l_value,
p_sequence
=> i.sequence,
p_object_version_number => l_object_version_number,
p_effective_start_date => l_effective_start_date,
p_effective_end_date
=> l_effective_end_date
);
COMMIT;
DBMS_OUTPUT.put_line ('Grate Rate has been Updated: ' || i.grade_rule_id );
EXCEPTION
WHEN OTHERS THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Inner Exception: ' || l_err_msg);
END;
END LOOP;
-EXCEPTION
WHEN OTHERS THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
END;
-Posted by Abhay Kumar at 3:41 AM No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: API Scripts, Handy Scripts, HRMS
lc_account_name
varchar2(60) := 'Mr A Kumar' ;
lc_account_type
varchar2(60) := '0' ;
lc_bld_s_account_num varchar2(60) := null;
lc_branch_loc
varchar2(60) ;
begin
-select assignment_id
,pay.payroll_name
into ln_assignment_id
,lc_org_pay_method
from per_all_assignments_f ass
,per_all_people_f
per
,pay_all_payrolls_f pay
where ass.person_id = per.person_id
and per.employee_number = lc_employee_num
and trunc(sysdate) between ass.effective_start_date and ass.effective_end_date
and trunc(sysdate) between per.effective_start_date and per.effective_end_date
and pay.payroll_id = ass.payroll_id;
select org_payment_method_id
into ln_org_pay_method_id
from pay_org_payment_methods_f_tl
where org_payment_method_name = lc_org_pay_method
and language = 'US';
-- Create Employee Payment Method
-- -------------------------------------------------hr_personal_pay_method_api.create_personal_pay_method
(-- Input Parameters
p_effective_date
=> ld_eff_date,
p_assignment_id
=> ln_assignment_id,
p_org_payment_method_id
=> ln_org_pay_method_id,
p_priority
=> 1,
p_percentage
=> 100,
p_territory_code
=> lc_territory_code,
p_segment1
=> lc_bank_name,
p_segment2
=> lc_bank_branch,
p_segment3
=> lc_sort_code,
p_segment4
=> lc_account_num,
p_segment5
=> lc_account_name,
p_segment6
=> lc_account_type,
p_segment7
=> lc_bld_s_account_num,
p_segment8
=> lc_branch_loc,
-- Output parameters
p_personal_payment_method_id
=> ln_method_id,
p_external_account_id
=> ln_ext_acc_id,
p_object_version_number
=> ln_obj_ver_num,
p_effective_start_date
=> ld_eff_start_date,
p_effective_end_date
=> ld_eff_end_date,
p_comment_id
=> ln_comment_id
);
commit;
dbms_output.put_line('Done');
--
exception
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback;
end;
-Posted by Abhay Kumar at 3:17 AM No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: API Scripts, HRMS
, p_pei_information2
=> rec_eit_details.begin_date
, p_pei_information3
=> rec_eit_details.end_date
);
dbms_output.put_line('EIT Updated ');
commit;
-exception
when others then
dbms_output.put_line('Update Failed '||sqlerrm);
rollback;
end;
-exception
when no_data_found then
-begin
-- CREATE
ln_per_extra_info_id := null;
ln_ovn_pei
:= null;
-hr_person_extra_info_api.create_person_extra_info
( p_validate
=> false
, p_person_id
=> rec_eit_details.person_id
, p_information_type
=> lc_information_type
, p_pei_information_category => lc_information_cat
, p_pei_information1
=> rec_eit_details.eit_val
, p_pei_information2
=> rec_eit_details.begin_date
, p_pei_information3
=> rec_eit_details.end_date
-- Out
, p_person_extra_info_id
=> ln_per_extra_info_id
, p_object_version_number => ln_ovn_pei
);
-dbms_output.put_line('EIT Created '||ln_per_extra_info_id);
commit;
-exception
when others then
dbms_output.put_line('Creation Failed '||sqlerrm);
rollback;
-end;
-when others then
dbms_output.put_line('Error: Selecting Person Extra Info '||sqlerrm);
end;
-end loop;
-dbms_output.put_line('Done!');
-exception
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback;
end;
-Posted by Abhay Kumar at 3:15 AM No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: API Scripts, HRMS
,p_effective_date
=> trunc(sysdate)
,p_element_entry_id
=> ln_element_entry_id
,p_object_version_number
=> ln_object_version_number
,p_effective_start_date
=> ld_effective_start_date
,p_effective_end_date
=> ld_effective_end_date
,p_delete_warning
=> lb_delete_warning
);
-commit;
-exception
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback;
end;
Posted by Abhay Kumar at 6:42 AM No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: API Scripts, Handy Scripts, HRMS
lc_dt_mode
varchar2(20);
begin
-savepoint sv_update;
-select pee.element_entry_id
,pee.object_version_number
into ln_element_entry_id
,ln_object_version_number
from per_all_people_f
per
,per_all_assignments_f paf
,pay_element_entries_f pee
,pay_element_types_f_tl petl
,pay_element_types_f pet
where per.employee_number = lc_emp_num
and trunc(sysdate) between per.effective_start_date and per.effective_end_date
and paf.person_id
= per.person_id
and trunc(sysdate) between paf.effective_start_date and paf.effective_end_date
and pee.assignment_id = paf.assignment_id
and pee.element_type_id = pet.element_type_id
and trunc(sysdate) between pee.effective_start_date and pee.effective_end_date
and petl.element_name = lc_element_name
and petl.language
= 'US'
and pet.element_type_id = petl.element_type_id;
--Determine the Date Track Mode for Update..
dt_api.find_dt_upd_modes
( p_effective_date
=> trunc(sysdate)
, p_base_table_name
=> 'PAY_ELEMENT_ENTRIES_F'
, p_base_key_column
=> 'ELEMENT_ENTRY_ID'
, p_base_key_value
=> ln_element_entry_id
, p_correction
=> lb_correction
, p_update
=> lb_update
, p_update_override
=> lb_upover
, p_update_change_insert => lb_upchin
);
if lb_upover or lb_upchin then
lc_dt_mode := 'UPDATE_OVERRIDE';
--elsif lb_upchin then
-- p_dt_mode := 'UPDATE_CHANGE_INSERT';
elsif lb_update then
lc_dt_mode := 'UPDATE';
elsif lb_correction then
lc_dt_mode := 'CORRECTION';
end if;
-- Get input value ids
for rec_input_name in cur_input_name(lc_element_name) loop
select piv.input_value_id
into ln_input_value_id
pay_element_types_f.element_type_id%type;
NUMBER := 12346;
pay_element_types_f.element_name%type := 'AK Test Element';
-BEGIN
--savepoint sv_create_element;
--- Get the element type id
select tl.element_type_id
into ln_element_type_id
from pay_element_types_f_tl tl
,pay_element_types_f t
where tl.element_name = lc_element_name
and language = 'US'
and t.element_type_id = tl.element_type_id
and trunc(sysdate) between t.effective_start_date and t.effective_end_date;
-- You can have upto many more input values depending on the element setup, modify the script
accordingly
for rec_input_name in cur_input_name (lc_element_name ) loop
select piv.input_value_id
into ln_input_value_id
from pay_input_values_f piv
where piv.element_type_id = rec_input_name.element_type_id
and piv.name
= rec_input_name.name
;
if rec_input_name.display_sequence = 1 then -- AK Value
ln_input_value_id1 := ln_input_value_id;
elsif rec_input_name.display_sequence = 2 then -- Employee Rate
ln_input_value_id2 := ln_input_value_id;
end if;
-end loop;
-- Get Element Link Id
-- -----------------------------ln_element_link_id := hr_entry_api.get_link
(p_assignment_id => ln_assignment_id,
p_element_type_id => ln_element_type_id,
p_session_date => TRUNC(SYSDATE)
);
dbms_output.put_line( ' API: Element Link Id: ' || ln_element_link_id );
-- Create Element Entry
-- -----------------------------pay_element_entry_api.create_element_entry
( -- Input data elements
-- ----------------------------p_validate
=> false,
p_effective_date
=> TO_DATE('22-JUN-2012','DD-MON-YYYY'),
p_business_group_id => fnd_profile.value('PER_BUSINESS_GROUP_ID'),
p_assignment_id
=> ln_assignment_id,
p_element_link_id
=> ln_element_link_id,
p_entry_type
=> 'E',
p_input_value_id1
=> ln_input_value_id1,
p_entry_value1
=> null,
p_input_value_id2
=> ln_input_value_id2,
p_entry_value2
=> 4,
-- Output data elements
-- -------------------------------p_effective_start_date => ld_effective_start_date,
p_effective_end_date => ld_effective_end_date,
p_element_entry_id
=> ln_element_entry_id,
p_object_version_number => ln_object_version_number,
p_create_warning
=> lb_create_warning
);
dbms_output.put_line( ' API: pay_element_entry_api.create_element_entry successfull - Element
Entry Id: ' || ln_element_entry_id );
--rollback;
commit;
exception
=> l_user_name
varchar2(40);
number := 123456;
,per_person_types
ppt
where papf.person_id = l_person_id
and papf.person_type_id = ppt.person_type_id;
-if l_sys_person_type like 'EX_EMP%' then
select pos.actual_termination_date
into l_act_term_date
from per_all_people_f
papf
,per_periods_of_service pos
where papf.person_id = l_person_id
--AND papf.effective_start_date =
and pos.person_id = papf.person_id ;
/*
* This API is not published, hence not meant for public calls.
*/
hr_ex_employee_api.reverse_terminate_employee
( p_validate
=> false
, p_person_id
=> l_person_id
, p_actual_termination_date => l_act_term_date
, p_clear_details
=> l_clear_details
);
dbms_output.put_line('Employee Reverse Terminated ');
-commit;
-else --CWK
select pos.actual_termination_date
into l_act_term_date
from per_all_people_f
papf
,per_periods_of_placement pos
where papf.person_id = l_person_id
-- AND papf.effective_start_date =
and pos.person_id = papf.person_id ;
/* This API reverses a contingent worker termination.
* This API removes the end date from the period of placement and the
* contingent worker assignments, and reverts the person type to Contingent Worker
*/
hr_contingent_worker_api.reverse_terminate_placement
( p_validate
=> false
, p_person_id
=> l_person_id
, p_actual_termination_date => l_act_term_date
, p_clear_details
=> l_clear_details
, p_fut_actns_exist_warning => l_fut_actns_exist_warning
);
if l_fut_actns_exist_warning then
dbms_output.put_line('Reverse Termination failed for CWK '||sqlerrm);
rollback;
else
dbms_output.put_line('CWK Reverse Terminated ');
commit;
end if;
end if;
-exception
when others then
dbms_output.put_line('Reverse Termination failed. Error Others: '||sqlerrm);
rollback;
end;
-Posted by Abhay Kumar at 3:49 AM No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: API Scripts, HRMS
,p_effective_date
=> l_effective_date
,p_object_version_number => l_object_version_number
,p_person_id
=> l_person_id
,p_date_start
=> l_start_date
,p_termination_reason => l_termination_reason
--,p_attribute_category =>
--,p_attribute1
=>
--,p_attribute2
=>
--,p_attribute3
=>
);
else --Employee
for rec_per IN cur_emp_res loop
per_periods_of_service_pkg.update_row(
p_row_id
=> rec_per.row_id
,p_period_of_service_id
=> rec_per.period_of_service_id
,p_business_group_id
=> rec_per.business_group_id
,p_person_id
=> rec_per.person_id
,p_date_start
=> rec_per.date_start
,p_termination_accepted_per_id => rec_per.termination_accepted_person_id
,p_accepted_termination_date
=> rec_per.accepted_termination_date
,p_actual_termination_date
=> rec_per.actual_termination_date
,p_comments
=> rec_per.comments
,p_final_process_date
=> rec_per.final_process_date
,p_last_standard_process_date => rec_per.last_standard_process_date
,p_leaving_reason
=> l_termination_reason
,p_notified_termination_date
=> rec_per.notified_termination_date
,p_projected_termination_date => rec_per.projected_termination_date
,p_request_id
=> rec_per.request_id
,p_program_application_id
=> rec_per.program_application_id
,p_program_id
=> rec_per.program_id
,p_program_update_date
=> rec_per.program_update_date
,p_attribute_category
=> rec_per.attribute_category
,p_attribute1
=> rec_per.attribute1
,p_attribute2
=> rec_per.attribute2
,p_attribute3
=> rec_per.attribute3
,p_attribute4
=> rec_per.attribute4
,p_attribute5
=> rec_per.attribute5
,p_attribute6
=> rec_per.attribute6
,p_attribute7
=> rec_per.attribute7
,p_attribute8
=> rec_per.attribute8
,p_attribute9
=> rec_per.attribute9
,p_attribute10
=> rec_per.attribute10
,p_attribute11
=> rec_per.attribute11
,p_attribute12
=> rec_per.attribute12
,p_attribute13
=> rec_per.attribute13
,p_attribute14
=> rec_per.attribute14
,p_attribute15
=> rec_per.attribute15
,p_attribute16
=> rec_per.attribute16
,p_attribute17
=> rec_per.attribute17
,p_attribute18
=> rec_per.attribute18
,p_attribute19
=> rec_per.attribute19
,p_attribute20
=> rec_per.attribute20
,p_pds_information_category
=> rec_per.pds_information_category
,p_pds_information1
=> rec_per.pds_information1
,p_pds_information2
,p_pds_information3
,p_pds_information4
,p_pds_information5
,p_pds_information6
,p_pds_information7
,p_pds_information8
,p_pds_information9
,p_pds_information10
,p_pds_information11
,p_pds_information12
,p_pds_information13
,p_pds_information14
,p_pds_information15
,p_pds_information16
,p_pds_information17
,p_pds_information18
,p_pds_information19
,p_pds_information20
,p_pds_information21
,p_pds_information22
,p_pds_information23
,p_pds_information24
,p_pds_information25
,p_pds_information26
,p_pds_information27
,p_pds_information28
,p_pds_information29
,p_pds_information30
,p_adjusted_svc_date
);
=> rec_per.pds_information2
=> rec_per.pds_information3
=> rec_per.pds_information4
=> rec_per.pds_information5
=> rec_per.pds_information6
=> rec_per.pds_information7
=> rec_per.pds_information8
=> rec_per.pds_information9
=> rec_per.pds_information10
=> rec_per.pds_information11
=> rec_per.pds_information12
=> rec_per.pds_information13
=> rec_per.pds_information14
=> rec_per.pds_information15
=> rec_per.pds_information16
=> rec_per.pds_information17
=> rec_per.pds_information18
=> rec_per.pds_information19
=> rec_per.pds_information20
=> rec_per.pds_information21
=> rec_per.pds_information22
=> rec_per.pds_information23
=> rec_per.pds_information24
=> rec_per.pds_information25
=> rec_per.pds_information26
=> rec_per.pds_information27
=> rec_per.pds_information28
=> rec_per.pds_information29
=> rec_per.pds_information30
=> rec_per.adjusted_svc_date
end loop;
end if;
-commit;
-exception
when others then
dbms_output.put_line('Update Placement/Employement Details. Error OTHERS while validating: '||
sqlerrm);
rollback;
end;
-Posted by Abhay Kumar at 2:49 AM 2 comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: API Scripts, HRMS
varchar2(1) := 'N';
varchar2(600);
l_person_id
number := 123456;
l_le_terminate_cwk_exception exception;
--- DECLARE variables for hr_contingent_worker_api.actual_termination_placement
--- IN variables
l_effective_date
date := trunc(sysdate);
l_termination_reason
per_periods_of_placement.leaving_reason%type := 'AGE_REACHED';
l_person_type_id
per_person_types.person_type_id%type := 1120;
l_period_of_service_id
per_periods_of_placement.period_of_service_id%type;
l_actual_termination_date per_periods_of_placement.actual_termination_date%type
:=trunc(sysdate);
l_last_standard_process_date per_periods_of_placement.last_standard_process_date%type :=
trunc(sysdate+10);
l_object_version_number
per_periods_of_placement.object_version_number%type;
l_start_date
per_periods_of_placement.date_start%type;
l_notif_term_date
date;
--- OUT variables
l_supervisor_warning
boolean := false;
l_event_warning
boolean := false;
l_interview_warning
boolean := false;
l_review_warning
boolean := false;
l_recruiter_warning
boolean := false;
l_asg_future_changes_warning boolean := false;
l_entries_changed_warning varchar2(300);
l_pay_proposal_warning
boolean := false;
l_dod_warning
boolean := false;
--- DECLARE variables for hr_contingent_worker_api.final_process_placement
--- IN variables
l_final_process_date
per_periods_of_service.final_process_date%type;
--- OUT variables
l_org_now_no_manager_warning boolean := false;
-begin
-begin
select pos.period_of_placement_id, pos.object_version_number, date_start
into l_period_of_service_id, l_object_version_number, l_start_date
from per_periods_of_placement pos
where pos.person_id = l_person_id;
exception
when others then
l_terminate_msg := 'Error while selecting cwk details : '||substr(sqlerrm,1,150);
raise l_le_terminate_cwk_exception;
end;
-savepoint terminate_cwk_s1;
-begin
/*
This API covers the first step in terminating a period of placement and
all current assignments for a cwk, identified by person_id and date_start.
You can use the API to set the actual termination date, the last standard
process date, the new assignment status and the new person type
*/
hr_contingent_worker_api.actual_termination_placement
(p_validate
=> false
,p_effective_date
=> l_effective_date
,p_person_id
=> l_person_id
,p_date_start
=> l_start_date
,p_person_type_id
=> l_person_type_id
,p_actual_termination_date
=> l_actual_termination_date
,p_termination_reason
=> l_termination_reason
--In/Out
,p_object_version_number
=> l_object_version_number
,p_last_standard_process_date => l_last_standard_process_date
--Out
,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
);
if l_object_version_number is null then
l_terminate_cwk_flag := 'N';
l_terminate_msg
:= 'Warning validating API:
hr_contingent_worker_api.actual_termination_placement';
raise l_le_terminate_cwk_exception;
end if;
l_terminate_cwk_flag := 'Y';
exception
when others then
l_terminate_msg := 'Error validating API: hr_contingent_worker_api.actual_termination_placement :
'||substr(sqlerrm,1,150);
raise l_le_terminate_cwk_exception;
end; --hr_contingent_worker_api.actual_termination_placement
if l_terminate_cwk_flag = 'Y' then
begin
/*
This API covers the second step in terminating a period of placement and
all current assignments for an cwk. It updates the period of placement
details and date-effectively deletes all the contingent worker assignments
as of the final process date.
*/
hr_contingent_worker_api.final_process_placement (
p_validate
=> false
,p_person_id
=> l_person_id
,p_date_start
=> l_start_date
--In/Out
,p_object_version_number
=> l_object_version_number
,p_final_process_date
=> l_final_process_date
--Out