Cost Allocation Create/Update - HRMS APIs
Cost Allocation Create/Update - HRMS APIs
--
declare
--
l_action varchar2(10) := 'CREATE';--'UPDATE'
--
--- DECLARE variables for PAY_COST_ALLOCATION_API
--- IN variables
l_assignment_id number := 123456;
l_business_group_id number := 101;
l_proportion pay_cost_allocations_f.proportion%type := 1;
l_cost_code varchar2(20) := '14';
l_company varchar2(20) := 'AK';
l_business varchar2(20) := 'GRT';
l_budget_code varchar2(20) := '99999';
l_account varchar2(20) := '0000';
--- OUT variables
l_combination_name varchar2(100);
l_cost_allocation_id number;
l_cost_effective_start_date date;
l_cost_effective_end_date date;
l_cost_allocation_keyflex_id pay_cost_allocation_keyflex.cost_allocation_keyflex_id%type;
l_cost_obj_version_number number;
--
begin
/*
* This API creates/updates cost allocations.
* Requires a valid assignment.
*/
if l_action = 'CREATE' then
--
l_cost_allocation_id := null;
--
pay_cost_allocation_api.create_cost_allocation (p_validate => false
,p_effective_date => trunc(sysdate)
,p_assignment_id => l_assignment_id
,p_proportion => l_proportion
,p_business_group_id => l_business_group_id
,p_segment1 => l_company
,p_segment2 => l_business
,p_segment3 => l_cost_code
,p_segment4 => l_budget_code
,p_segment5 => l_account
-- Out
,p_combination_name => l_combination_name
,p_cost_allocation_id => l_cost_allocation_id
,p_effective_start_date => l_cost_effective_start_date
,p_effective_end_date => l_cost_effective_end_date
,p_object_version_number => l_cost_obj_version_number
-- In / Out
,p_cost_allocation_keyflex_id => l_cost_allocation_keyflex_id
);
if l_cost_obj_version_number is null then
dbms_output.put_line('Cost Allocation creation failed '||sqlerrm);
rollback;
else
dbms_output.put_line('Cost Allocation created');
commit;
end if;
else
--
l_cost_obj_version_number := 3;
l_cost_allocation_id := 345612;
--
pay_cost_allocation_api.update_cost_allocation
( p_validate => false
, p_effective_date => trunc(sysdate)
, p_datetrack_update_mode => 'UPDATE'
, p_cost_allocation_id => l_cost_allocation_id
, p_proportion => l_proportion
, p_segment1 => l_company
, p_segment2 => l_business
, p_segment3 => l_cost_code
, p_segment4 => l_budget_code
, p_segment5 => l_account
-- In / Out
, p_cost_allocation_keyflex_id => l_cost_allocation_keyflex_id
, p_object_version_number => l_cost_obj_version_number
-- Out
, p_effective_start_date => l_cost_effective_start_date
, p_effective_end_date => l_cost_effective_end_date
, p_combination_name => l_combination_name
);
if l_cost_obj_version_number > 3 then
dbms_output.put_line('Cost Allocation updated');
commit;
else
dbms_output.put_line('Cost Allocation updation failed '||sqlerrm);
rollback;
end if;
end if;
--
exception
when others then
dbms_output.put_line('pay_cost_allocation_api API failed with error :'||sqlerrm);
rollback;
end;
--
No comments:
Post a Comment