Search This Blog

Tuesday, March 20, 2012

Data Loader for Lookup Sample dld file and API

To Load Value to the lookups, try following script. If it works, perfect or use data loader instead of breaking your head to debug the API. It is not public API.

DECLARE
   lr_rowid        ROWID  := NULL;
   l_lookup_code   NUMBER;
   CURSOR cur
   IS
      SELECT DISTINCT position_title
                 FROM xx_position_master
             ORDER BY 1;
BEGIN
   FOR i IN cur
   LOOP
      l_lookup_code := NULL;
      SELECT MAX (lookup_code) + 10
        INTO l_lookup_code
        FROM fnd_lookup_values
       WHERE lookup_type = 'XX_POSITION_TITLE'
         AND LANGUAGE = hr_api.userenv_lang;
      BEGIN
         fnd_lookup_values_pkg.insert_row
                             (x_rowid                    => lr_rowid,
                              x_lookup_type              => 'XX_POSITION_TITLE',
                              x_security_group_id        => 0,
                              x_view_application_id      => 3,
                              x_lookup_code              => l_lookup_code,
                              x_tag                      => NULL,
                              x_attribute_category       => NULL,
                              x_attribute1               => NULL,
                              x_attribute2               => NULL,
                              x_attribute3               => NULL,
                              x_attribute4               => NULL,
                              x_enabled_flag             => 'Y',
                              x_start_date_active        => NULL,
                              x_end_date_active          => NULL,
                              x_territory_code           => NULL,
                              x_attribute5               => NULL,
                              x_attribute6               => NULL,
                              x_attribute7               => NULL,
                              x_attribute8               => NULL,
                              x_attribute9               => NULL,
                              x_attribute10              => NULL,
                              x_attribute11              => NULL,
                              x_attribute12              => NULL,
                              x_attribute13              => NULL,
                              x_attribute14              => NULL,
                              x_attribute15              => NULL,
                              x_meaning                  => i.position_title,
                              x_description              => i.position_title,
                              x_creation_date            => SYSDATE,
                              x_created_by               => apps.fnd_global.user_id,
                              x_last_update_date         => SYSDATE,
                              x_last_updated_by          => apps.fnd_global.user_id,
                              x_last_update_login        => apps.fnd_global.login_id
                             );
         DBMS_OUTPUT.put_line ('Success');
         COMMIT;
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line ('Error' || SQLERRM);
      END;
   END LOOP;
END;

DLD Sample File:

Data   tab  Data                                tab  Data                                tab  tab  Date             *dn
10      tab   Administration Manager  tab Administration Manager  tab   tab 01-JAN-1951 *dn
20      tab   Administrator                   tab Administrator                   tab   tab 01-JAN-1951 *dn

No comments:

Post a Comment