Showing posts with label competence. Show all posts
Showing posts with label competence. Show all posts

Wednesday, December 31, 2014

API to Assign Competency to Employee(s)

Salam Alaikum,

   I share with you guys this API, that i used to delete an Appraisal for employees.It assign the competency to employees. But you can use the same API to assign it (competency) to a specific job or position.

DECLARE
l_competence_element_id number;
l_api_ovn number;

cursor app_data
is
--- note1: profeciency level id
--- note2: person id update
--- note3: competence level id should be added to the competences tables and passed here 
    select a.*,c.competence_id,a.rowid
    from XXX_HR_PER_COMPETENCY a , xxxhrdata.xxx_competencies b ,xxx_competency_levels c
    where 1=1
    and a.COMPETENCY_NAME = b.COMPETENCY_NAME
    and b.COMBINATION = c.COMBINATION;       

BEGIN
    for i_rec in app_data
    loop
   hr_competence_element_api.create_competence_element
      (     
       p_business_group_id                 => fnd_profile.VALUE('PER_BUSINESS_GROUP_ID'),
       p_effective_date                    => TO_DATE ('1900/01/01','YYYY/MM/DD'),        
      
       p_competence_id                     => i_rec.competence_id,
       p_proficiency_level_id              => i_rec.PROFICIENCY_LEVEL_id,
       p_rating_level_id                   => i_rec.LEVEL_NO,
       p_person_id                         => i_rec.person_id,
      
       p_competence_element_id             => l_competence_element_id,
       p_object_version_number             => l_api_ovn
      );
           
      update XXX_HR_PER_COMPETENCY u
      set upload_status = 'Y'
      where i_rec.rowid = u.rowid;
       
     end loop; 
END;

Hope you found it useful guys, feel free to leave a comment if have any note on the subject.     

API to Create HR Competence

Salam Alaikum,

   I share with you guys this API, that i used to Create a Competence. That then can assigned to an employee or more.

DECLARE
   v_competence_id              NUMBER;
   v_competence_definition_id   NUMBER;
   v_object_version_number      NUMBER;
   v_name                       VARCHAR2;

   CURSOR app_data
   IS
      SELECT *
        FROM xxx_competencies;               ---   per_competences_v 
BEGIN
   FOR i_rec IN app_data
   LOOP
   
     hr_competences_api.create_competence
          (p_effective_date                => TO_CHAR ('1900/01/01 00:00:00','YYYY/MM/DD HH24:MI:SS'),
           p_date_from                     => TO_CHAR ('1900/01/01 00:00:00','YYYY/MM/DD HH24:MI:SS'),
           p_business_group_id             => fnd_profile.VALUE('PER_BUISNESS_GROUP_ID'),
           p_description                   => i_rec.competency_description,
           p_competence_alias              => i_rec.competency_name,
          
           p_competence_id                 => v_competence_id,
           p_competence_definition_id      => v_competence_definition_id,
           p_object_version_number         => v_object_version_number,
           p_name                          => v_name
          );

      UPDATE xxx_competencies cbd
         SET cbd.upload_status = 'Y',
             cbd.competence_id = v_competence_id
       WHERE cbd.ROWID = i_rec.ROWID;

   END LOOP;
END;

Hope you found it useful guys, feel free to leave a comment if have any note on the subject.