Create Element Input Values API Script
DECLARE
l_effective_date DATE;
l_business_group_id NUMBER := 81;
l_element_type_id NUMBER := NULL;
l_input_value_name VARCHAR2 (100);
l_uom VARCHAR2 (10); -- Number
l_element_name VARCHAR2 (100);
l_input_value_id NUMBER;
l_object_version_number NUMBER;
l_effective_start_date DATE;
l_effective_end_date DATE;
l_default_val_warning BOOLEAN;
l_min_max_warning BOOLEAN;
l_pay_basis_warning BOOLEAN;
l_formula_warning BOOLEAN;
l_assignment_id_warning BOOLEAN;
l_formula_message VARCHAR2 (500) := NULL;
l_error varchar2(2500);
CURSOR cur_ee
IS
SELECT *
FROM XXTZS_ELE_INPUTVALUES_STG
WHERE record_status IS NULL AND sno <= 300;
BEGIN
FOR c1_ee_rec IN cur_ee
LOOP
l_effective_date :=NULL;
l_element_type_id :=NULL;
l_input_value_id :=NULL;
l_object_version_number :=NULL;
BEGIN
SELECT element_type_id, effective_start_date, element_name
INTO l_element_type_id, l_effective_date, l_element_name
FROM pay_element_types_f petf
WHERE TRUNC (SYSDATE) BETWEEN petf.effective_start_date
AND petf.effective_end_date
AND petf.business_group_id = l_business_group_id
AND UPPER (petf.element_name) = UPPER (c1_ee_rec.element_name);
EXCEPTION
WHEN OTHERS
THEN
l_error :='Invalid Element'|| SQLERRM;
END;
IF l_element_type_id IS NOT NULL
THEN
BEGIN
pay_input_value_api.create_input_value
(p_validate => FALSE,
p_effective_date => l_effective_date,--TO_DATE ('01-JAN-1951', 'DD-MON-YYYY'),
p_element_type_id => l_element_type_id,
p_name => c1_ee_rec.NAME,
p_uom => c1_ee_rec.UOM,
P_GENERATE_DB_ITEMS_FLAG => c1_ee_rec.GENERATE_DB_ITEMS_FLAG,
P_DISPLAY_SEQUENCE => c1_ee_rec.DISPLAY_SEQUENCE,
p_input_value_id => l_input_value_id,
p_object_version_number => l_object_version_number,
p_effective_start_date => l_effective_start_date,
p_effective_end_date => l_effective_end_date,
p_default_val_warning => l_default_val_warning,
p_min_max_warning => l_min_max_warning,
p_pay_basis_warning => l_pay_basis_warning,
p_formula_warning => l_formula_warning,
p_assignment_id_warning => l_assignment_id_warning,
p_formula_message => l_formula_message
);
UPDATE XXTZS_ELE_INPUTVALUES_STG
SET record_status = 'S'
WHERE sno = c1_ee_rec.sno;
EXCEPTION
WHEN OTHERS
THEN
l_error := SQLERRM;
UPDATE XXTZS_ELE_INPUTVALUES_STG
SET record_status = 'E',
error_message = l_error
WHERE sno = c1_ee_rec.sno;
END;
ELSE
UPDATE XXTZS_ELE_INPUTVALUES_STG
SET record_status = 'E',
error_message = 'INPUT VALUE ALREADY EXIST'
WHERE sno = c1_ee_rec.sno;
END IF;
END LOOP;
COMMIT;
END;
No comments:
Post a Comment