Introduction:
Today we’re going to explain how to Create absence api in oracle hrms .
Absence it is an activity for the employee in which HRs are responsible for managing it.
Goal:
create absence for a person using “hr_person_absence_api.create_person_absence” API
Forms Or Pages:
Example:
Create absence api in oracle hrms
API IN/OUT Parameters :
- IN p_validate BOOLEAN— IN p_effective_date DATE
- IN p_person_id NUMBER
- IN p_business_group_id NUMBER
- IN p_absence_attendance_type_id NUMBER
- IN p_date_start DATE
- IN p_date_end DATE
- IN OUT p_absence_days NUMBER
- OUT p_absence_attendance_id NUMBER
- OUT p_object_version_number NUMBER
- OUT p_occurrence NUMBER
- OUT p_dur_dys_less_warning BOOLEAN
- OUT p_dur_hrs_less_warning BOOLEAN
- OUT p_exceeds_pto_entit_warning BOOLEAN
- OUT p_exceeds_run_total_warning BOOLEAN
- OUT p_abs_overlap_warning BOOLEAN
- OUT p_abs_day_after_warning BOOLEAN
- OUT p_dur_overwritten_warning BOOLEAN
API Parameters clarifications:
- @param p_validate If true, then validation alone will be performed and the database will remain unchanged. If false and all validation checks pass, then the database will be modified.
- @param p_effective_date Reference date for validating lookup values are applicable during the start to end active date range. This date does not determine when the changes take effect.
- @param p_person_id Uniquely identifies the person for whom you create the absence.
- @param p_business_group_id The business group under which you record the absence. This is usually the same business group that the person belongs to.
- @param p_absence_attendance_type_id Uniquely identifies the type of absence.
- @param p_date_start The actual start date of the absence.
- @param p_date_end The actual end date of the absence.
- @param p_absence_days The duration of the absence in days. This can only be set when the absence type is associated with an hours-based absence element, or when the absence type has no associated element.
- @param p_absence_attendance_id If p_validate is false, then this uniquely identifies the absence record created. If p_validate is true, then this is set to null.
- @param p_object_version_number If p_validate is false, then set to the version number of the created absence record. If p_validate is true, then the value will be null.
- @param p_occurrence A numerical sequence that denotes the number of absences this person has taken for this type of absence.
- @param p_dur_dys_less_warning If set to true, this serves as a warning that the specified absence duration in days is different from what the system has calculated. The application uses the BG_ABSENCE_DURATION Fast Formula for this calculation if it exists.
- @param p_dur_hrs_less_warning If set to true, this serves as a warning that the specified absence duration in hours is different from what the system has calculated. The application uses the BG_ABSENCE_DURATION Fast Formula for this calculation if it exists.
- @param p_exceeds_pto_entit_warning If set to true, this serves as a warning that the net entitlement of at least one of this person’s accrual plans will be below zero when you apply this absence.
- @param p_exceeds_run_total_warning If set to true, this serves as a warning that the absence’s type is using a decreasing balance and that the running total will be below zero when you apply this absence.
- @param p_abs_overlap_warning If set to true, this serves as a warning that this absence overlaps an existing absence for this person.
- @param p_abs_day_after_warning If set to true, this serves as a warning that this absence starts the day after an existing sickness absence. A sickness absence in this case is one that has an absence category starting with ‘S’.
- @param p_dur_overwritten_warning If set to true, this serves as a warning that the HR: Absence Duration Auto Overwrite profile option is set to ‘Yes’ and that the the system-calculated duration has automatically overwritten the absence duration.
API Calling example:
DECLARE
v_validate BOOLEAN := FALSE;
v_effective_date DATE := trunc (sysdate);
v_person_id NUMBER := 7974;
v_business_group_id NUMBER := 202;
v_absence_attendance_type_id NUMBER := 5; -- Personal Time
v_date_start DATE := to_date ('01-May-2019', 'dd-mon-yyyy');
v_date_end DATE := to_date ('08-May-2019', 'dd-mon-yyyy');
io_absence_days NUMBER := 7;
io_absence_hours NUMBER := NULL;
o_absence_attendance_id NUMBER;
o_object_version_number NUMBER;
o_occurrence NUMBER;
o_dur_dys_less_warning BOOLEAN;
o_dur_hrs_less_warning BOOLEAN;
o_exceeds_pto_entit_warning BOOLEAN;
o_exceeds_run_total_warning BOOLEAN;
o_abs_overlap_warning BOOLEAN;
o_abs_day_after_warning BOOLEAN;
o_dur_overwritten_warning BOOLEAN;
v_error_msg VARCHAR2 (3000);
BEGIN
hr_person_absence_api.create_person_absence (p_validate => v_validate
,p_effective_date => v_effective_date
,p_person_id => v_person_id
,p_business_group_id => v_business_group_id
,p_absence_attendance_type_id => v_absence_attendance_type_id
,p_date_start => v_date_start
,p_date_end => v_date_end
,p_absence_days => io_absence_days
,p_absence_hours => io_absence_hours
,p_absence_attendance_id => o_absence_attendance_id
,p_object_version_number => o_object_version_number
,p_occurrence => o_occurrence
,p_dur_dys_less_warning => o_dur_dys_less_warning
,p_dur_hrs_less_warning => o_dur_hrs_less_warning
,p_exceeds_pto_entit_warning => o_exceeds_pto_entit_warning
,p_exceeds_run_total_warning => o_exceeds_run_total_warning
,p_abs_overlap_warning => o_abs_overlap_warning
,p_abs_day_after_warning => o_abs_day_after_warning
,p_dur_overwritten_warning => o_dur_overwritten_warning);
IF (o_absence_attendance_id IS NOT NULL) THEN
COMMIT;
dbms_output.put_line ('***************************');
dbms_output.put_line ('Output information ....');
dbms_output.put_line ('Absence has been created Successfully....');
dbms_output.put_line ('v_person_id: ' || v_person_id);
dbms_output.put_line ('o_absence_attendance_id: ' || o_absence_attendance_id);
dbms_output.put_line ('v_date_start: ' || v_date_start);
dbms_output.put_line ('v_date_end: ' || v_date_end);
dbms_output.put_line ('***************************');
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line ('***************************');
dbms_output.put_line ('Error informations ....');
v_error_msg := sqlerrm;
dbms_output.put_line ('Absence creation corrupted for person_id: ' || v_person_id);
dbms_output.put_line ('The Error Returned from API is : ' || v_error_msg);
dbms_output.put_line ('***************************');
END;
Final Result:
[convertkit form=1415728]Hope this helpful.
If you found it simple and easy to understand, we would love to provide you and your friends a simple solution for your problems.
Thanks.