How to create Payroll Assignment Set using Oracle API

The sample script is used to create an assignment set using an API. You can create an assignment from the assignment set creation window in Oracle but you will not be able to query the terminated employees on the Assignment set creation window as the intended behavior of the form is to pick only the active employees, so this is one of the sample scenario where you need to use the scripts (test scripts) to create the assignment set for any set of criteria(i.e select list to add the assignments to the assignment set)

Anonymous block:

DECLARE
p_rowid VARCHAR2 (32767) := NULL;
p_assignment_set_id NUMBER;
p_include_or_exclude VARCHAR2 (32767) := ‘I’;

CURSOR c1
IS
SELECT assignment_id
FROM per_all_assignments_f paaf
WHERE SYSDATE BETWEEN effective_start_date AND effective_end_date
AND assignment_type = ‘E’
AND primary_flag = ‘Y’
AND paaf.payroll_id = 163
UNION
SELECT assignment_id
FROM per_all_assignments_f paaf,
per_all_people_f papf,
per_periods_of_service ppos
WHERE SYSDATE BETWEEN papf.effective_start_date
AND papf.effective_end_date
AND assignment_type = ‘E’
AND primary_flag = ‘Y’
AND paaf.person_id = papf.person_id
AND papf.person_id = ppos.person_id
AND ppos.actual_termination_date BETWEEN paaf.effective_start_date
AND paaf.effective_end_date
AND current_employee_flag IS NULL
AND paaf.payroll_id = 163;
BEGIN

hr_assignment_sets_pkg.insert_row (
p_business_group_id => 0,
p_payroll_id => 163,
p_assignment_set_name => ‘Test Payroll Assignment set’
|| TO_CHAR (SYSDATE,
‘DD_MON_RRRR_HH24_MI_SS’),
p_formula_id => NULL,
p_status => ‘A’,
p_assignment_set_id => p_assignment_set_id);

p_rowid := NULL;

FOR i IN c1
LOOP
apps.hr_assignment_set_amds_pkg.insert_row (
p_rowid => p_rowid,
p_assignment_id => i.assignment_id,
p_assignment_set_id => p_assignment_set_id,
p_include_or_exclude => p_include_or_exclude);
END LOOP;

— dbms_output.put_line(‘Assignment Set Name’||p_assignment_set_name);
DBMS_OUTPUT.put_line (‘Assignment Set Id’ || p_assignment_set_id);
END;
/

COMMIT;

Recent Posts