--
declare
--
cursor cur_input_name (p_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 = p_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;
--
ln_element_link_id pay_element_links_f.element_link_id%type;
ld_effective_start_date date;
ld_effective_end_date date;
ln_element_entry_id pay_element_entries_f.element_entry_id%type;
ln_object_version_number pay_element_entries_f.object_version_number%type;
lb_create_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;
ln_element_type_id pay_element_types_f.element_type_id%type;
--
ln_assignment_id NUMBER := 12346;
lc_element_name 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
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback to sv_create_element;
end;
/
declare
--
cursor cur_input_name (p_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 = p_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;
--
ln_element_link_id pay_element_links_f.element_link_id%type;
ld_effective_start_date date;
ld_effective_end_date date;
ln_element_entry_id pay_element_entries_f.element_entry_id%type;
ln_object_version_number pay_element_entries_f.object_version_number%type;
lb_create_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;
ln_element_type_id pay_element_types_f.element_type_id%type;
--
ln_assignment_id NUMBER := 12346;
lc_element_name 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
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback to sv_create_element;
end;
/
ORA-20001: The assignment does not exist on 2018/03/14 00:00:00
ReplyDeleteI am getting this error even though the assignment is active on the above date. If I run the API by maually passing the values then it works fine entry is created. But if I run it through concurrent program then it goes in error.
Even am facing same issue ,,,did u fix it ??
Delete