Sunday, January 11, 2015

API To Create Employee Qualification

Salam Alaikum,

   I share this API, that creates an employee qualification, but please note that it needs that some prerequisites for this API is needed. Like qualification type should be already created and qualification_type_id should be input to the create_qualification API. As for establishment and establishment_id to be input for the API. And lastly, the employee should be an attendant of the establishment and attendance_id should be input to the API.

The following queries might help to understand the API more clearly:

SELECT qualification_type_id, NAME
  FROM per_qualification_types_tl
 WHERE 1 = 1 AND LANGUAGE = 'US';


SELECT establishment_id,NAME
  FROM per_establishments
 WHERE 1 = 1;


SELECT attendance_id
  FROM per_establishment_attend_v
 WHERE     1 = 1
       AND person_id = 'xx'
       AND establishment_id = 'establishment_id';

   And this is the API:

DECLARE
   l_qualification_id        NUMBER;
   l_object_version_number   NUMBER;
  
   CURSOR per_edu
   IS
      SELECT xx_edu.ROWID,
             xx_edu.*
        FROM xxx_emp_edu_school_info xx_edu
       WHERE 1 = 1 AND NVL (upload_status, 'N') = 'N';

BEGIN
   FOR i_rec IN per_edu
   LOOP
      fnd_profile.put ('PER_PERSON_ID', i_rec.person_id);
      per_qualifications_api.create_qualification
          (p_validate                      => FALSE,
           p_effective_date                => SYSDATE,
           p_qualification_type_id         => i_rec.qualification_type_id,
           p_attendance_id                 => i_rec.attendance_id,
           p_business_group_id             => fnd_profile.VALUE
                                                      ('PER_BUSINESS_GROUP_ID'),
           p_person_id                     => i_rec.person_id,
           p_awarded_date                  => SYSDATE,
           p_start_date                    => SYSDATE,
           p_qua_information_category      => 'SA',
           p_qua_information1              => 'EARENED',
           p_qualification_id              => l_qualification_id,
           p_object_version_number         => l_object_version_number
          );

      UPDATE xxx_emp_edu_school_info
         SET upload_status = 'Y',
             qualification_id = l_qualification_id
       WHERE ROWID = i_rec.ROWID;
      
       commit;
   END LOOP;
END;
  Hope you found it useful guys, feel free to leave a comment if have any note on the subject.       

No comments:

Post a Comment