Search This Blog

Wednesday, May 16, 2012

Delete Organization Information in Oracle HRMS

DECLARE
   ln_ovn   NUMBER := 1;
   CURSOR c
   IS
      SELECT org_information_id, object_version_number
        FROM hr_organization_information
       WHERE TRUNC (creation_date) = TRUNC (SYSDATE)
         AND org_information_context = 'XX_ORG_ROLES'
      UNION
      SELECT org_information_id, object_version_number
        FROM hr_organization_information
       WHERE org_information_context = 'XX_ORG_ROLES'
         AND TRUNC (creation_date) = '01-May-2012';
BEGIN
   FOR i IN c
   LOOP
      ln_ovn := i.object_version_number;
      hr_organization_api.delete_org_manager
                               (p_validate                   => FALSE,
                                p_org_information_id         => i.org_information_id,
                                p_object_version_number      => ln_ovn
                               );
   END LOOP;
END;

Wednesday, April 25, 2012

Formatted Text in Oracle SSHR

1. Go to page where you want to add the formatted text.
2. Persanalize Page
3. Expand All
4. Create Item
5. Give Item Code
6. Text as <Font size = "1" face="Verd​ana" Color="Blu​e"> Instructio​ns </font>
7. Return to Application

Monday, March 26, 2012

Check if string contains all zeros in Oracle

select rpad (nvl (decode('X000',lpad('0',length('X000'),'0'),lpad(' ',length('X000'),' '),'X000'), chr (32)), 15, ' ') from dual

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

Delete Positions in Oracle HRMS through API

declare
ld_edds_date date;
ld_edde_date date;
ln_ovn       NUMBER;
cursor c is
select * from hr_all_positions_f   where trunc(creation_date) = trunc(sysdate);
begin
for i in c
loop
ln_ovn := i.OBJECT_VERSION_NUMBER;
hr_position_api.delete_position
  (p_validate                       => false
  ,p_position_id                    => i.position_id
  ,p_effective_start_date           => ld_edds_date
  ,p_effective_end_date             => ld_edde_date
  ,p_object_version_number          => ln_ovn
  ,p_effective_date                 => '01-Jan-1980'
  ,p_datetrack_mode                 => 'ZAP'
  --,p_security_profile_id        in number      default hr_security.get_security_profile
  );
end LOOP;
end;

Monday, March 5, 2012

Handling New Line in SQL Loader

Use
col_name REPLACE(:col_name,CHR(13) ",

SQL*Loader program as a Concurrent Program in Oracle Apps.

The following steps will describe the process to register a SQL*Loader program as a Concurrent Program in Oracle Apps.

Step 1]

Create the SQL*Loader Control and Data file and place them in Server(ex: $CUSTOM_TOP/bin). Create or check the interface table structures in the backend.

LOAD DATA

INFILE 'test.dat'

APPEND INTO TABLE TESTDEPT

FIELDS TERMINATED BY ','

OPTIONALLY ENCLOSED BY '"'

(deptno,dname,loc)

Control file: test.ctl

12, Research, "Saratoga"
10, "Accounting", Cleveland
11, "Art", Salem

Data file: test.dat



1
CREATE TABLE testdept
2
(deptno NUMBER(2) NOT NULL,



3
dname VARCHAR2(14),
4
loc VARCHAR2(13));





Step 2]

Go to Application Developer > Concurrent > Executables. Define a Concurrent Program Executable. Choose the Execution Method as SQL*Loader and give the Execution File Name as the name of the SQL*Loader control file. Save your work.
Step 3]
Go to Application Developer > Concurrent > Program. Define the Concurrent Program. Attach the executable defined above.
Step 4]

Go to parameters of the concurrent program. Create a parameter to take the server path of the data file. You can also place the default value.
Step 5]

Attach the Concurrent program to a Responsibility through a Request Group.

Step 6]

Go to that Responsibility and Run the Concurrent Program. If successful check the output file that have all data uploading information.