Introduction:
In real life in any organization we have multiple absences like but not limited to (Marriage Leave, Annual leave, unauthorized leave, authorized leave, Sick leave. Oracle has given an absence types to classify each and every absence in the system.
Goal:
Create a new absence Type using “hr_absence_type_api.create_absence_type” API
Forms Or Pages:
Example:
Create a new absence type in oracle apps
API IN/OUT Parameters :
— IN p_language_code VARCHAR2.
— IN p_business_group_id NUMBER.
— IN p_input_value_id NUMBER.
— IN p_date_effective DATE.
— IN p_date_end DATE.
— IN p_name VARCHAR2.
— IN p_absence_category VARCHAR2.
— IN p_hours_or_days VARCHAR2.
— IN p_inc_or_dec_flag VARCHAR2.
— IN p_absence_overlap_flag VARCHAR2.
— OUT p_absence_attendance_type_id NUMBER.
— OUT p_object_version_number NUMBER.
API Parameters clarifications:
- @param p_language_code Specifies to which language the translation values apply. You can set to the base or any installed language. The default value of hr_api.userenv_lang is equivalent to the RDBMS userenv(‘LANG’) function value.
- @param p_business_group_id Identifies the business group in which the absence attendance type is to be created.
- @param p_input_value_id Identifies the input value of an element entry to associate with the absence attendance type.
- @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_date_effective The start date for this absence attendance type.
- @param p_date_end If p_validate is false, and a value not passed, will be set to end date of input value if less than end of time. If p_validate is true, set to the value passed in.
- @param p_name The unique name for the absence attendance type.
- @param p_absence_category The category for the absence attendance type. Valid values are defined by the ‘ABSENCE_CATEGORY’ lookup type Table Base “HR_LOOKUPS”
- @param p_hours_or_days Specifies the unit of measure associated with this absence attendance type, valid values are ‘H’ for hours and ‘D’ for days. Please Note that The value must correspond with the unit of measure of the input value if set. If p_input_value_id is not set, p_hours_or_days must be null.
- @param p_inc_or_dec_flag Specifies whether this absence attendance type should have an increasing or decreasing total. Valid values are ‘I’ for increasing, and ‘D’ for decreasing. Must be null if p_input_value is not set.
- @param p_absence_overlap_flag Identifies whether overlap of absence is permitted to the Absence Type or not.
- @param p_absence_attendance_type_id If p_validate is false, uniquely identifies the absence attendance type created. If p_validate is true, set to null.
- @param p_object_version_number If p_validate is false, then set to the version number of the created absence attendance type. If p_validate is true, then the value will be null.
API Calling example:
DECLARE
v_business_group_id NUMBER := 202;
v_input_value_id NUMBER := 52144;
v_date_effective DATE := to_date ('01-JAN-1900');
v_date_end DATE := NULL;
v_name VARCHAR2 (25) := 'Oraask Type';
v_absence_attendance_type_id NUMBER := NULL;
v_object_version_number NUMBER := NULL;
BEGIN
hr_absence_type_api.create_absence_type (p_language_code => 'US'
,p_business_group_id => v_business_group_id
,p_input_value_id => v_input_value_id
,p_date_effective => v_date_effective
,p_date_end => v_date_end
,p_name => v_name
,p_absence_category => 'V'
,p_hours_or_days => 'H', --D:- Day H:- Houre
p_inc_or_dec_flag => 'I', --I:- increase D:- Decrease
p_absence_overlap_flag => 'N'
,p_absence_attendance_type_id => v_absence_attendance_type_id
,p_object_version_number => v_object_version_number);
dbms_output.put_line ('********************************');
dbms_output.put_line ('absence_attendance_type_id = ' || v_absence_attendance_type_id);
IF (v_absence_attendance_type_id IS NOT NULL) THEN
COMMIT;
END IF;
dbms_output.put_line ('********************************');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'Create absence type API is faild with error : ' || sqlerrm );
dbms_output.put_line ('********************************');
END;