Saturday, April 9, 2016

Delete leave/absence using hr_person_absence_api.delete_person_absence

Step 1:

Create procedure

create or replace procedure apps.xx_absence_delete
 (
   p_absence_attendance_id number
 )
 as
l_object_version_number number;
begin

select object_version_number into l_object_version_number
  from per_absence_attendances
 where absence_attendance_id = p_absence_attendance_id;

hr_person_absence_api.delete_person_absence
(p_validate => FALSE
,p_absence_attendance_id => p_absence_attendance_id--30504
,p_object_version_number => l_object_version_number
);
exception
when others then null;
commit;
end;

Step 2:

Execute procedure

exec xx_absence_delete (30504);

Step 3:

Check deleted leave/absence

select object_version_number
  from per_absence_attendances
 where absence_attendance_id = 30504;