Tuesday, April 12, 2016

Create employee using Api hr_employee_api.create_employee

 --Firt of all create procedure
 create or replace procedure xx_create_employee
 (
   lp_hire_date         date
  ,lp_business_group_id number
  ,lp_first_name        varchar2
  ,lp_last_name         varchar2
  ,lp_sex               varchar2
  ,lp_date_of_birth     date
  ,lp_known_as          varchar2
 )
 as
 l_employee_number                   per_all_people_f.employee_number%type;
 l_person_id                         per_all_people_f.person_id%type;
 l_assignment_id                     number;
 l_per_object_version_number         number;
 l_asg_object_version_number         number;
 l_per_effective_start_date          date;
 l_per_effective_end_date            date;
 l_full_name                         per_all_people_f.full_name%type;
 l_per_comment_id                    number;
 l_assignment_sequence               number;
 l_assignment_number                 per_all_assignments_f.assignment_number%type;
 l_name_combination_warning          boolean;
 l_assign_payroll_warning            boolean;
 l_orig_hire_warning                 boolean;

begin
hr_employee_api.create_employee
(
--Input data--
   p_hire_date                   => lp_hire_date
  ,p_business_group_id           => lp_business_group_id
  ,p_last_name                   => lp_last_name
  ,p_sex                         => lp_sex
  ,p_first_name                  => lp_first_name
  ,p_middle_names                => null
  ,p_date_of_birth               => lp_date_of_birth
  ,p_known_as                    => lp_known_as
--Output Date--                
 ,p_employee_number              => l_employee_number
 ,p_person_id                    => l_person_id
 ,p_assignment_id                => l_assignment_id
 ,p_per_object_version_number    => l_per_object_version_number
 ,p_asg_object_version_number    => l_asg_object_version_number
 ,p_per_effective_start_date     => l_per_effective_start_date
 ,p_per_effective_end_date       => l_per_effective_end_date
 ,p_full_name                    => l_full_name
 ,p_per_comment_id               => l_per_comment_id 
 ,p_assignment_sequence          => l_assignment_sequence
 ,p_assignment_number            => l_assignment_number
 ,p_name_combination_warning     => l_name_combination_warning
 ,p_assign_payroll_warning       => l_assign_payroll_warning
 ,p_orig_hire_warning            => l_orig_hire_warning
) ;
 commit;

end;
--Execute procedure --
exec xx_create_employee(TO_DATE('01-JUN-2011'), 626, 'Celin','Deon', 'F',  TO_DATE('08-JUN-1991'), 'Celin');

--select created employee from table  to make sure it saved successfully --
select known_as, employee_number from per_all_people_f
where initcap(known_as) = 'Celin';












Saturday, April 9, 2016

Delete pending leaves using reference table PER_ABSENCE_ATTENDANCES

create or replace procedure xx_delete_pending_leaves as

   CURSOR c1 IS

      SELECT hat.transaction_id, hats.transaction_step_id
        FROM hr_api_transactions hat, hr_api_transaction_steps hats
       WHERE hat.transaction_ref_table = 'PER_ABSENCE_ATTENDANCES'
         AND hat.transaction_group = 'ABSENCE_MGMT'
         AND hat.transaction_identifier = 'ABSENCES'
         AND hat.transaction_ref_id IS NOT NULL
         AND hat.status = 'Y'
         AND hat.transaction_id = hats.transaction_id;
        
   l_transaction_id        NUMBER;
   l_transaction_step_id   NUMBER;
   l_error                 VARCHAR2 (300);

BEGIN

  OPEN c1;

   LOOP

      FETCH c1 INTO l_transaction_id, l_transaction_step_id;
       EXIT WHEN c1%NOTFOUND;

      IF l_transaction_step_id IS NOT NULL  THEN

         DELETE FROM hr_api_transaction_values
          WHERE transaction_step_id = l_transaction_step_id;

         DBMS_OUTPUT.put_line

                     (   'Deleted Transaction Value of transaction step id: '

                      || l_transaction_step_id

                     );

      END IF;

      IF l_transaction_id IS NOT NULL THEN    

         DELETE FROM hr_api_transaction_steps
               WHERE transaction_id = l_transaction_id;
         DBMS_OUTPUT.put_line

                           (  
                           'Deleted Transaction step of transaction id: '|| l_transaction_id
                           );

         DELETE FROM hr_api_transactions
               WHERE transaction_id = l_transaction_id;        
         DBMS_OUTPUT.put_line ('Deleted Transaction ID: ' || l_transaction_id);
      END IF;
   END LOOP;
 CLOSE c1;
   COMMIT;

 EXCEPTION

   WHEN OTHERS THEN

      l_error := SUBSTR (SQLERRM, 1, 200);

      DBMS_OUTPUT.put_line (   'Other Error in xx_delete_pending_leaves- ' || l_error);

END xx_delete_pending_leaves;

Delete leave/absence using hr_person_absence_api.delete_person_absence

Step 1:

Create procedure

create or replace procedure apps.xx_absence_delete
 (
   p_absence_attendance_id number
 )
 as
l_object_version_number number;
begin

select object_version_number into l_object_version_number
  from per_absence_attendances
 where absence_attendance_id = p_absence_attendance_id;

hr_person_absence_api.delete_person_absence
(p_validate => FALSE
,p_absence_attendance_id => p_absence_attendance_id--30504
,p_object_version_number => l_object_version_number
);
exception
when others then null;
commit;
end;

Step 2:

Execute procedure

exec xx_absence_delete (30504);

Step 3:

Check deleted leave/absence

select object_version_number
  from per_absence_attendances
 where absence_attendance_id = 30504;

Wednesday, April 6, 2016

Enter Absence/Leave in Oracle HRMS using API

First of All we will create procedure.

CREATE OR REPLACE procedure APPS.xx_absence_insert
(
p_person_id                  number,
p_business_group_id          number,
p_absence_attendance_type_id number,
p_abs_attendance_reason_id   number,
p_effective_date             varchar2,
p_date_start                 varchar2,
p_date_end                   varchar2,
p_absence_days               number
)
as

l_absence_hours               Number;
l_absence_attendance_id       Number;                                               
l_object_version_number       Number;                                                
l_occurance                   Number;                                                
l_dur_dys_less_warning        boolean;                                               
l_dur_hrs_less_warning        boolean;                                               
l_exceeds_pto_entit_warning   boolean;                                               
l_exceeds_run_total_warning   boolean;                                               
l_abs_overlap_warning         boolean;                                               
l_abs_day_after_warning       boolean;                                               
l_dur_overwritten_warning     boolean;
l_absence_days                Number := p_absence_days;

BEGIN

HR_PERSON_ABSENCE_API.create_person_absence                                                                 
  (
   p_validate                    => FALSE                                
  ,p_effective_date              => to_date(p_effective_date, 'DD-MON-YYYY')                                            
  ,p_person_id                   => p_person_id                                          
  ,p_business_group_id           => p_business_group_id                                        
  ,p_absence_attendance_type_id  => p_absence_attendance_type_id                                          
  ,p_abs_attendance_reason_id    => p_abs_attendance_reason_id                                                              
  ,p_date_start                  => to_date(p_date_start , 'DD-MON-YYYY')                                                                   
  ,p_date_end                    => to_date(p_date_end, 'DD-MON-YYYY')                                                            
  ,p_absence_days                => l_absence_days                                             
  ,p_absence_hours               => l_absence_hours                                                                                  
  ,p_absence_attendance_id       => l_absence_attendance_id                                               
  ,p_object_version_number       => l_object_version_number                                                 
  ,p_occurrence                  => l_occurance                                                
  ,p_dur_dys_less_warning        => l_dur_dys_less_warning                                              
  ,p_dur_hrs_less_warning        => l_dur_hrs_less_warning                                              
  ,p_exceeds_pto_entit_warning   => l_exceeds_pto_entit_warning                                               
  ,p_exceeds_run_total_warning   => l_exceeds_run_total_warning                                               
  ,p_abs_overlap_warning         => l_abs_overlap_warning                                               
  ,p_abs_day_after_warning       => l_abs_day_after_warning  
  ,p_dur_overwritten_warning     => l_dur_overwritten_warning                                              
  );
  commit; 
                                                                                          
END;

Now we will execute procedure

exec xx_absence_insert(373, 626, 51, 78, '28-APR-2002','28-APR-2002','29-APR-2002',to_number(to_date('29-APR-2002','DD-MON-YYYY')-to_date('28-APR-2002','DD-MON-YYYY'))+1);

Now we will confirm the leave entry by using select statement

select distinct papf.full_name,
       paa.date_start,
       paa.date_end,
       paa.absence_days,
       paa.creation_date
 from per_absence_attendances paa, per_all_people_f papf
where papf.person_id = paa.person_id
  and paa.business_group_id = 626
  /*and paa.person_id          = 373*/
  and paa.absence_attendance_type_id = 51
  and trunc(sysdate) = trunc(paa.creation_date)
order by paa.creation_date desc;

Wednesday, March 30, 2016

Integration between OBIEE and Oracle E-Business Suite

Configuring OBIEE to use the Oracle E-Business Suite for authentication is straight forward and can be completed in a test environment with only a small amount of effort.  It is technically accomplished through the sharing of the E-Business Suite session cookie.
Further documentation on the specific steps to configure OBIEE to use the E-Business Suite for authentication can be found on Metalink as well as in the OBIEE documentation.  A high level summary is as follows:
  1. Using the BI Admin client tool, modify the RPD file to add a connection to the E-Business Suite database.
  2. Add an initialization block to the RPD file that calls the E-Business Suite API APP_SESSION.validate_icx_session and then call FND_GLOBAL to collect the variables resp_id, resp_appl_id, security_group_id, resp_name, user_id, employee_id and user_name.
  3. Edit the OBIEE configuration files authenicationschema.xml and instanceconfig.xml
  4. Create a menu function to launch OBIEE. You must use the SSWA OracleOasis.jsp$mode=OBIEE
  5. Populate the system profile option ‘FND: Oracle Business Intelligence Suite EE base URL’ with the url for OBIEE. For example: http://theobieeserver.yourcompany.com:9704
  6. Upload the modified RPD file using Enterprise Manager and bounce all OBIEE services

Thursday, December 31, 2015

Query to get list of active employee having Marketing Manager Position


select distinct paa.assignment_number, ppx.first_name, ps.name
from per_all_assignments_f paa,
per_people_x ppx, per_all_positions ps
where paa.position_id = ps.position_id

and ps.name = 'Marketing Manager'               
and paa.business_group_id = 7671 -- use your business group id
and ppx.person_id = paa.person_id
and trunc(sysdate) between trunc(ppx.effective_start_date) and trunc(ppx.effective_end_date)                  
order by paa.assignment_number;

R12 User Guide