--
declare
--
l_mode varchar2(10) := 'SUSPEND';--'ACTIVATE'
--- IN variables
l_assignment_id number := 123456;
--per_assignment_status_types.assignment_status_type_id%TYPE;
l_assignment_status_type_id number;
l_ovn_asg number := 2;
-- Out variables
l_effective_start_date date;
l_effective_end_date date;
--
begin
--
--***Note - look into the user_status and per_system_status of table per_assignment_status_types
if l_mode = 'ASG' then
/* This API updates the status of an employee assignment to an Active status.
@param p_assignment_status_type_id The new assignment status must have a
* system assignment status of ACTIVE_ASSIGN
*/
--
l_assignment_status_type_id := 1;
--
hr_assignment_api.activate_emp_asg
( P_VALIDATE => false
, P_EFFECTIVE_DATE => trunc(sysdate)
, P_DATETRACK_UPDATE_MODE => 'CORRECTION'
, P_ASSIGNMENT_ID => ln_assignment_id
-- In / Out
, P_OBJECT_VERSION_NUMBER => l_ovn_asg
-- In
, P_ASSIGNMENT_STATUS_TYPE_ID => l_assignment_status_type_id
-- Out
, P_EFFECTIVE_START_DATE => l_effective_start_date
, P_EFFECTIVE_END_DATE => l_effective_end_date
);
dbms_output.put_line('Employee Activated ');
elsif l_mode = 'SUSPEND' then
/* * This API changes the status of an employee assignment to a "Suspended"
* status.
* @param p_assignment_status_type_id The new assignment status. The new
* status must have a system status of SUSP_ASSIGN.
*/
--
l_assignment_status_type_id := 2;
--
hr_assignment_api.suspend_emp_asg
( P_VALIDATE => false
, P_EFFECTIVE_DATE => trunc(sysdate)
, P_DATETRACK_UPDATE_MODE => 'CORRECTION'
, P_ASSIGNMENT_ID => ln_assignment_id
-- In / Out
, P_OBJECT_VERSION_NUMBER => l_ovn_asg
-- In
, P_ASSIGNMENT_STATUS_TYPE_ID => l_assignment_status_type_id
-- Out
, P_EFFECTIVE_START_DATE => l_effective_start_date
, P_EFFECTIVE_END_DATE => l_effective_end_date
);
dbms_output.put_line('Employee Suspended ');
end if ;
--
commit;
--
exception
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback;
end;
--
declare
--
l_mode varchar2(10) := 'SUSPEND';--'ACTIVATE'
--- IN variables
l_assignment_id number := 123456;
--per_assignment_status_types.assignment_status_type_id%TYPE;
l_assignment_status_type_id number;
l_ovn_asg number := 2;
-- Out variables
l_effective_start_date date;
l_effective_end_date date;
--
begin
--
--***Note - look into the user_status and per_system_status of table per_assignment_status_types
if l_mode = 'ASG' then
/* This API updates the status of an employee assignment to an Active status.
@param p_assignment_status_type_id The new assignment status must have a
* system assignment status of ACTIVE_ASSIGN
*/
--
l_assignment_status_type_id := 1;
--
hr_assignment_api.activate_emp_asg
( P_VALIDATE => false
, P_EFFECTIVE_DATE => trunc(sysdate)
, P_DATETRACK_UPDATE_MODE => 'CORRECTION'
, P_ASSIGNMENT_ID => ln_assignment_id
-- In / Out
, P_OBJECT_VERSION_NUMBER => l_ovn_asg
-- In
, P_ASSIGNMENT_STATUS_TYPE_ID => l_assignment_status_type_id
-- Out
, P_EFFECTIVE_START_DATE => l_effective_start_date
, P_EFFECTIVE_END_DATE => l_effective_end_date
);
dbms_output.put_line('Employee Activated ');
elsif l_mode = 'SUSPEND' then
/* * This API changes the status of an employee assignment to a "Suspended"
* status.
* @param p_assignment_status_type_id The new assignment status. The new
* status must have a system status of SUSP_ASSIGN.
*/
--
l_assignment_status_type_id := 2;
--
hr_assignment_api.suspend_emp_asg
( P_VALIDATE => false
, P_EFFECTIVE_DATE => trunc(sysdate)
, P_DATETRACK_UPDATE_MODE => 'CORRECTION'
, P_ASSIGNMENT_ID => ln_assignment_id
-- In / Out
, P_OBJECT_VERSION_NUMBER => l_ovn_asg
-- In
, P_ASSIGNMENT_STATUS_TYPE_ID => l_assignment_status_type_id
-- Out
, P_EFFECTIVE_START_DATE => l_effective_start_date
, P_EFFECTIVE_END_DATE => l_effective_end_date
);
dbms_output.put_line('Employee Suspended ');
end if ;
--
commit;
--
exception
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback;
end;
--
Thanks Abhay!!
ReplyDeleteThanks ;
ReplyDelete