--
declare
--
cursor cur_input_name(c_ele_name varchar2)
is
select piv.display_sequence
,piv.name
,piv.element_type_id
from pay_element_types_f_tl petl
,pay_element_types_f pet
,pay_input_values_f piv
where petl.element_name = c_ele_name
and petl.language = 'US'
and pet.element_type_id = petl.element_type_id
and piv.element_type_id = pet.element_type_id
order by piv.display_sequence;
--
ld_effective_start_date date;
ld_effective_end_date date;
ln_object_version_number pay_element_entries_f.object_version_number %type;
lb_update_warning boolean;
ln_screen_entry_value pay_element_entry_values_f.screen_entry_value%type;
ln_element_type_id pay_element_types_f.element_type_id%type;
ln_input_value_id1 pay_input_values_f.input_value_id%type;
ln_input_value_id2 pay_input_values_f.input_value_id%type;
ln_input_value_id pay_input_values_f.input_value_id%type;
-- DT API Out Variables
lb_correction boolean;
lb_update boolean;
lb_upover boolean;
lb_upchin boolean;
--
lc_element_name pay_element_types_f.element_name%type := 'AK Element';
lc_emp_num per_all_people_f.employee_number := '123425';
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
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
p_input_value_id1 := ln_input_value_id;
elsif rec_input_name.display_sequence = 2 then -- Employee Rate
p_input_value_id2 := ln_input_value_id;
end if;
end loop;
-- Update Element Entry
-- ------------------------------
pay_element_entry_api.update_element_entry
( -- Input data elements
-- -----------------------------
p_validate => false, --true
p_datetrack_update_mode => lc_dt_mode,
p_effective_date => to_date('25-JUN-2012','DD-MON-YYYY'),
p_business_group_id => fnd_profile.value('PER_BUSINESS_GROUP_ID'),
p_element_entry_id => ln_element_entry_id,
p_object_version_number => ln_object_version_number,
p_input_value_id1 => ln_input_value_id1,
p_entry_value1 => null,
p_input_value_id2 => ln_input_value_id2,
p_entry_value2 => 10,
-- Output data elements
-- --------------------------------
p_effective_start_date => ld_effective_start_date,
p_effective_end_date => ld_effective_end_date,
p_update_warning => lb_update_warning
);
dbms_output.put_line( ' API: pay_element_entry_api.update_element_entry successfull - Element Entry Id: ' );
--
commit;
--
exception
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback to sv_update;
end;
--
declare
--
cursor cur_input_name(c_ele_name varchar2)
is
select piv.display_sequence
,piv.name
,piv.element_type_id
from pay_element_types_f_tl petl
,pay_element_types_f pet
,pay_input_values_f piv
where petl.element_name = c_ele_name
and petl.language = 'US'
and pet.element_type_id = petl.element_type_id
and piv.element_type_id = pet.element_type_id
order by piv.display_sequence;
--
ld_effective_start_date date;
ld_effective_end_date date;
ln_object_version_number pay_element_entries_f.object_version_number %type;
lb_update_warning boolean;
ln_screen_entry_value pay_element_entry_values_f.screen_entry_value%type;
ln_element_type_id pay_element_types_f.element_type_id%type;
ln_input_value_id1 pay_input_values_f.input_value_id%type;
ln_input_value_id2 pay_input_values_f.input_value_id%type;
ln_input_value_id pay_input_values_f.input_value_id%type;
-- DT API Out Variables
lb_correction boolean;
lb_update boolean;
lb_upover boolean;
lb_upchin boolean;
--
lc_element_name pay_element_types_f.element_name%type := 'AK Element';
lc_emp_num per_all_people_f.employee_number := '123425';
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
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
p_input_value_id1 := ln_input_value_id;
elsif rec_input_name.display_sequence = 2 then -- Employee Rate
p_input_value_id2 := ln_input_value_id;
end if;
end loop;
-- Update Element Entry
-- ------------------------------
pay_element_entry_api.update_element_entry
( -- Input data elements
-- -----------------------------
p_validate => false, --true
p_datetrack_update_mode => lc_dt_mode,
p_effective_date => to_date('25-JUN-2012','DD-MON-YYYY'),
p_business_group_id => fnd_profile.value('PER_BUSINESS_GROUP_ID'),
p_element_entry_id => ln_element_entry_id,
p_object_version_number => ln_object_version_number,
p_input_value_id1 => ln_input_value_id1,
p_entry_value1 => null,
p_input_value_id2 => ln_input_value_id2,
p_entry_value2 => 10,
-- Output data elements
-- --------------------------------
p_effective_start_date => ld_effective_start_date,
p_effective_end_date => ld_effective_end_date,
p_update_warning => lb_update_warning
);
dbms_output.put_line( ' API: pay_element_entry_api.update_element_entry successfull - Element Entry Id: ' );
--
commit;
--
exception
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback to sv_update;
end;
--
nice
ReplyDelete