Friday, July 24, 2015

Terminate Employee Oracle EBS (Calling API)

Employee data could be terminated from back end using oracle HRMS API (HR_EX_EMPLOYEE_API.ACTUAL_TERMINATION_EMP).

Declare
CURSOR c_emp_cur
      IS
         SELECT ppos.period_of_service_id, ppos.object_version_number,
                papf.person_type_id, yte.termination_date end_date, yte.ID
           FROM per_all_people_f papf,
                per_periods_of_service ppos,
                ynppo_temp_employee yte
          WHERE papf.person_id = ppos.person_id
            AND SYSDATE BETWEEN papf.effective_start_date
                            AND papf.effective_end_date
            AND SYSDATE BETWEEN ppos.date_start
                            AND COALESCE (ppos.projected_termination_date,
                                          actual_termination_date,
                                          SYSDATE
                                         )
            AND yte.employee_code = papf.employee_number
            AND yte.flag = 'T'
            AND yte.status IS NULL;

      l_validate                       BOOLEAN        := FALSE;
      l_period_of_service_id           NUMBER;
      l_object_version_number          NUMBER;
      l_actual_notice_period_date      DATE;
      l_effective_date                 DATE;
      l_supervisor_warning             BOOLEAN;
      l_event_warning                  BOOLEAN;
      l_interview_warning              BOOLEAN;
      l_review_warning                 BOOLEAN;
      l_recruiter_warning              BOOLEAN;
      l_asg_future_changes_warning     BOOLEAN;
      l_f_asg_future_changes_warning   BOOLEAN;
      l_pay_proposal_warning           BOOLEAN;
      l_dod_warning                    BOOLEAN;
      l_final_process_date             DATE;
      l_org_now_no_manager_warning     BOOLEAN;
      l_entries_changed_warning        VARCHAR2 (255);
      l_f_entries_changed_warning      VARCHAR2 (255);
      l_alu_change_warning             VARCHAR2 (255);
      l_person_type_id                 NUMBER;
      l_last_std_process_date_out      DATE;
   BEGIN
      FOR c_emp_rec IN c_emp_cur
      LOOP
         l_period_of_service_id := c_emp_rec.period_of_service_id;
         l_object_version_number := c_emp_rec.object_version_number;
         l_actual_notice_period_date := c_emp_rec.end_date;
         l_effective_date := c_emp_rec.end_date;
         l_person_type_id := c_emp_rec.person_type_id;

         BEGIN
            hr_ex_employee_api.actual_termination_emp
               (p_validate                        => l_validate,
                p_effective_date                  => l_effective_date,
                p_period_of_service_id            => l_period_of_service_id,
                p_object_version_number           => l_object_version_number,
                p_actual_termination_date         => l_actual_notice_period_date,
                p_last_standard_process_date      => l_actual_notice_period_date,
                --p_person_type_id => l_person_type_id,
                --,p_leaving_reason => 'RESS'
                p_last_std_process_date_out       => l_last_std_process_date_out,
                p_supervisor_warning              => l_supervisor_warning,
                p_event_warning                   => l_event_warning,
                p_interview_warning               => l_interview_warning,
                p_review_warning                  => l_review_warning,
                p_recruiter_warning               => l_recruiter_warning,
                p_asg_future_changes_warning      => l_asg_future_changes_warning,
                p_entries_changed_warning         => l_entries_changed_warning,
                p_pay_proposal_warning            => l_pay_proposal_warning,
                p_dod_warning                     => l_dod_warning,
                p_alu_change_warning              => l_alu_change_warning
               );

            UPDATE ynppo_temp_employee
               SET status = 'Terminated'
             WHERE ID = c_emp_rec.ID;
       
         EXCEPTION
            WHEN OTHERS
            THEN
               UPDATE ynppo_temp_employee
                  SET status = 'Not Terminated'
                WHERE ID = c_emp_rec.ID;
                dbms_output.put_line(SQLERRM);
         END;
      END LOOP;
   END;



The YNPPO_TEMP_EMPLOYEE is staging table to store employee data which will be terminated using API.
Diposkan oleh Imam Tri Harsono di 22:40  
Email This
BlogThis!
Share to Twitter
Share to Facebook
Share to Pinterest

Label: Human Resource API
Reaksi:
Update Employee Oracle EBS (Calling API)

Employee data could be inserted from back end using oracle HRMS API (HR_PERSON_API.UPDATE_PERSON).

Declare
CURSOR c_emp
      IS
         SELECT *
           FROM ynppo_temp_employee yte
          WHERE yte.status IS NULL AND yte.flag = 'U';

      ln_object_version_number      per_all_people_f.object_version_number%TYPE;
      lc_dt_ud_mode                 VARCHAR2 (100)                    := NULL;
      ln_assignment_id              per_all_assignments_f.assignment_id%TYPE;
      lc_employee_number            per_all_people_f.employee_number%TYPE;

      lb_correction                 BOOLEAN;
      lb_update                     BOOLEAN;
      lb_update_override            BOOLEAN;
      lb_update_change_insert       BOOLEAN;

      ld_effective_start_date       DATE;
      ld_effective_end_date         DATE;
      lc_full_name                  per_all_people_f.full_name%TYPE;
      ln_comment_id                 per_all_people_f.comment_id%TYPE;
      lb_name_combination_warning   BOOLEAN;
      lb_assign_payroll_warning     BOOLEAN;
      lb_orig_hire_warning          BOOLEAN;
      v_person_id                   NUMBER;
      v_object_version_number       NUMBER;
      v_effective_start_date        DATE;
      v_assignment_id               NUMBER;
   BEGIN
      FOR r_emp IN c_emp
      LOOP
         lc_employee_number := r_emp.employee_code;

         BEGIN
            SELECT papf.person_id, papf.object_version_number,
                   papf.effective_start_date, paaf.assignment_id
              INTO v_person_id, v_object_version_number,
                   v_effective_start_date, v_assignment_id
              FROM per_all_people_f papf, per_all_assignments_f paaf
             WHERE papf.employee_number = r_emp.employee_code
               AND TRUNC (SYSDATE) BETWEEN TRUNC (papf.effective_start_date)
                                       AND TRUNC (papf.effective_end_date)
               AND TRUNC (SYSDATE) BETWEEN TRUNC (paaf.effective_start_date)
                                       AND TRUNC (paaf.effective_end_date)
               AND papf.person_id = paaf.person_id;
         EXCEPTION
            WHEN OTHERS
            THEN
               v_person_id := 0;
               v_person_id := NULL;
         END;

         IF v_person_id = 0
         THEN
            NULL;
         ELSE
       
            -- Update Employee API
            -- ---------------------------------
            IF TRUNC (r_emp.effective_start_date) <>
                                               TRUNC (v_effective_start_date)
            THEN
               lc_dt_ud_mode := 'UPDATE';
            ELSE
               lc_dt_ud_mode := 'CORRECTION';
            END IF;

            BEGIN
               hr_person_api.update_person
                  ( -- Input Data Elements
                    -- ------------------------------
                   p_effective_date                => TRUNC (r_emp.effective_start_date),
                   p_datetrack_update_mode         => lc_dt_ud_mode,
                   p_person_id                     => v_person_id,
                   p_first_name                    => r_emp.first_name,
                   p_last_name                     => r_emp.last_name,
                   p_middle_names                  => r_emp.middle_names,
                   p_sex                           => r_emp.gender,
                   p_date_of_birth                 => r_emp.date_of_birth,
                   p_title                         => r_emp.title,
                   p_email_address                 => r_emp.email,
                   p_national_identifier           => lc_employee_number,
                   p_attribute1                    => r_emp.LEVELS,
                   p_attribute2                    => r_emp.level_desc,
                   p_attribute3                    => r_emp.position_code,
                   p_attribute4                    => r_emp.position_desc,
                   p_attribute5                    => r_emp.dept_code,
                   p_attribute6                    => r_emp.department,
                   p_attribute7                    => r_emp.sub_dept_code,
                   p_attribute8                    => r_emp.sub_depat,
                   p_attribute9                    => r_emp.plant_code,
                   p_attribute10                   => r_emp.plant,
                   p_attribute11                   => r_emp.supervise_emp_code,
                   p_attribute12                   => r_emp.old_employee_code,
                   -- Output Data Elements
                   -- ----------------------------------
                   p_employee_number               => lc_employee_number,
                   p_object_version_number         => v_object_version_number,
                   p_effective_start_date          => ld_effective_start_date,
                   p_effective_end_date            => ld_effective_end_date,
                   p_full_name                     => lc_full_name,
                   p_comment_id                    => ln_comment_id,
                   p_name_combination_warning      => lb_name_combination_warning,
                   p_assign_payroll_warning        => lb_assign_payroll_warning,
                   p_orig_hire_warning             => lb_orig_hire_warning
                  );

               UPDATE ynppo_temp_employee
                  SET status = 'Updated'
                WHERE ID = r_emp.ID;
            EXCEPTION
               WHEN OTHERS
               THEN
                  --ROLLBACK;
                  UPDATE ynppo_temp_employee
                     SET status = 'Not Updated'
                   WHERE ID = r_emp.ID;

                  DBMS_OUTPUT.put_line (SQLERRM);
            END;
         -- COMMIT;
         END IF;
      END LOOP;
   END;

1 comment:

  1. Most prostate cancers are adenocarcinomas, cancers that arise in glandular cells of the prostate’s epithelial tissue. Prostate cancers usually progress slowly and produce no symptoms in the initial stages. Eventually, the tumor may enlarge like mine use too, the prostate gland, pressing on the urethra and causing painful or frequent urination and blood in the urine. So I was so uncomfortable with this prostate cancer diseases then I decided to do online search on how to cure cancer because I well have read a lot about herbal medicine,I came across a lot of testimony how Dr Itua cure HIV/herpes then Cancer was listed below the comment.with courage I contacted Dr Itua and he sent me his herbal medicine through Courier service then I was asked to pick it up at my post office which i quickly did. I contacted Dr Itua that i have received my herbal medicine so he instructs me on how to drink it for three weeks and that is how Dr Itua Herbal Medicine cure my prostate Cancer, The treatment takes three weeks and I was cured completely. Dr Itua is a god sent and I thank him every day of my life. Contact him now On:Email:drituaherbalcenter@gmail.com/Whatsapp:+2348149277967.
    He listed to that he can as well cure the following diseases below.... Cerebral Amides. Lung Cancer, Alzheimer's disease, Adrenocortical carcinoma. Alma, Uterine Cancer, Breast Cancer, Allergic diseases. Kidney cancer, Love Spell, Colo rectal cancer, Lottery Spell, Bladder Cancer, Skin Cancer, HIV /Aids, Herpes, Non-Hodgkin lymphoma, Inflammatory bowel disease, Copd, Diabetes, Hepatitis

    ReplyDelete