Wednesday, December 31, 2014

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.    

1 comment: