My Oracle Support Banner

Unable to Terminate Secondary Assignment on the Same Date it is Switched from Primary to Secondary Using API (Doc ID 2001898.1)

Last updated on MARCH 14, 2017

Applies to:

Oracle Human Resources - Version 12.1.3 to 12.1 HRMS RUP7 [Release 12.1]
Information in this document applies to any platform.
This note provides a brief overview of .

Symptoms

Problem Statement:

Unable to terminate secondary assignment using API(hr_assignment_api.actual_termination_emp_asg) at the date it was changed from primary to secondary.

Expected Records:

ASSIGNMENT_IDASSIGNMENT_NUMBEREFFECTIVE_START_DATEEFFECTIVE_END_DATEPRIMARY_FLAGASSIGNMENT_STATUS_TYPE_ID
36845 2285 01-JAN-2010 31-DEC-2014 Y 1 (Active Assignment)
36845 2285 01-JAN-2015 31-DEC-4712 N 3 (Terminated Assignment)
36846 2285-2 01-JAN-2015 31-DEC-4712 Y 1 (Active Assignment)

Actual Records:
p_actual_termination_date = date when the secondary assignment (primary_flag = 'N') starts.

ASSIGNMENT_IDASSIGNMENT_NUMBEREFFECTIVE_START_DATEEFFECTIVE_END_DATEPRIMARY_FLAGASSIGNMENT_STATUS_TYPE_ID
36845 2285 01-JAN-2010 31-DEC-2014 Y 1 (Active Assignment)
36845 2285 01-JAN-2015 01-JAN-2015 N 1 (Active Assignment)
36846 2285-2 01-JAN-2015 31-DEC-4712 Y 1 (Active Assignment)
36845 2285 02-JAN-2015 31-DEC-4712 N 3 (Terminated Assignment)

API throws the following HR_7999_ASG_INV_PRIM_ASG error if specifying p_actual_termination_date = a day before the date when the secondary assignment (primary_flag = 'N') starts.

ORA-20001: The assignment must not be a primary assignment.
ORA-06512: at "APPS.HR_ASSIGNMENT_API", line 2983
ORA-06512: at line 15

 

Steps to Reproduce:

The issue can be reproduced at will with the following steps:

  1.  Create an employee on 01-JAN-2010.
  2.  Create a secondary assignment on 01-JAN-2015 and save.
  3.  Check the "Primary" flag of the secondary assignment created in the above step 2 on effective date = 01-JAN-2015 and save.
     The assignment records look as below.

    ASSIGNMENT_ID ASSIGNMENT_NUMBER EFFECTIVE_STAR EFFECTIVE_END_ PRIMARY_FLAG ASSIGNMENT_STATUS_TYPE_ID
    ------------- ----------------- -------------- -------------- ------------ -------------------------
            36845 2285              01-JAN-2010    31-DEC-2014    Y                                    1
            36845 2285              01-JAN-2015    31-DEC-4712    N                                    1
            36846 2285-2           01-JAN-2015    31-DEC-4712    Y                                    1

  4. Run the API to terminate the secondary assignment(primary_flag='N') with p_actual_termination_date = 01-JAN-2015. Do not commit yet.
    declare

     l_object_version_number              number;
     l_p_effective_start_date             date;
     l_effective_end_date                 date;
     l_asg_future_changes_warning         boolean;
     l_entries_changed_warning            varchar2(200);
     l_pay_proposal_warning               boolean;

    begin
         select object_version_number into l_object_version_number
         from   per_all_assignments_f
         where  assignment_id = 36845 and effective_start_date = to_date('01-JAN-2015','DD-MON-YYYY');

     hr_assignment_api.actual_termination_emp_asg(
          p_validate                      => false
         ,p_assignment_id                 => 36845                                --Required
         ,p_object_version_number         => l_object_version_number              --Required/in/out
         ,p_actual_termination_date       => to_date('01-JAN-2015','DD-MON-YYYY') --Required
         ,p_assignment_status_type_id     => 3
         ,p_effective_start_date          => l_p_effective_start_date             --out
         ,p_effective_end_date            => l_effective_end_date                 --out
         ,p_asg_future_changes_warning    => l_asg_future_changes_warning         --out
         ,p_entries_changed_warning       => l_entries_changed_warning            --out
         ,p_pay_proposal_warning          => l_pay_proposal_warning               --out
     );
    end;
    /
  5. Results after running the API.

    ASSIGNMENT_ID ASSIGNMENT_NUMBER EFFECTIVE_STAR EFFECTIVE_END_ PRIMARY_FLAG ASSIGNMENT_STATUS_TYPE_ID
    ------------- ----------------- -------------- -------------- ------------ -------------------------
    36845 2285              01-JAN-2010    31-DEC-2014    Y                                    1
    36845 2285              01-JAN-2015    01-JAN-2015    N                                    1
    36846 2285-2           01-JAN-2015    31-DEC-4712    Y                                    1
    36845 2285              02-JAN-2015    31-DEC-4712    N                                    3

  6. Rollback the change made in the above step 4 and run the API with p_actual_termination_date = 31-DEC-2014.
    declare

     l_object_version_number              number;
     l_p_effective_start_date             date;
     l_effective_end_date                 date;
     l_asg_future_changes_warning         boolean;
     l_entries_changed_warning            varchar2(200);
     l_pay_proposal_warning               boolean;

    begin
         select object_version_number into l_object_version_number
         from   per_all_assignments_f
         where  assignment_id = 36845 and effective_start_date = to_date('01-JAN-2015','DD-MON-YYYY');

     hr_assignment_api.actual_termination_emp_asg(
          p_validate                      => false
         ,p_assignment_id                 => 36845                                --Required
         ,p_object_version_number         => l_object_version_number              --Required/in/out
         ,p_actual_termination_date       => to_date('31-DEC-2014','DD-MON-YYYY') --Required
         ,p_assignment_status_type_id     => 3
         ,p_effective_start_date          => l_p_effective_start_date             --out
         ,p_effective_end_date            => l_effective_end_date                 --out
         ,p_asg_future_changes_warning    => l_asg_future_changes_warning         --out
         ,p_entries_changed_warning       => l_entries_changed_warning            --out
         ,p_pay_proposal_warning          => l_pay_proposal_warning               --out
     );
    end;
    /

      7. Error "ORA-20001: The assignment must not be a primary assignment." occurs.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.