DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_LEAVING_REASON_MIG

Source


1 Package BODY hr_leaving_reason_mig as
2 /* $Header: pelearea.pkb 115.4 2002/12/06 11:14:44 pkakar noship $ */
3 
4 -- Package Variables
5 --
6    g_package  varchar2(33) := 'hr_leaving_reason_mig. ';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------------< UPDATE_LEAVING_REASON >------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure leave_reas_mig
13 (ERRBUF                         out nocopy             varchar2
14 ,RETCODE                        out nocopy             number
15 ,p_existing_leaving_reason	in 		VARCHAR2
16 ,p_seeded_leaving_reason	in 		VARCHAR2
17 ,p_date				in	        varchar2)
18 
19  IS
20   --
21   -- Declare cursors and local variables
22   --
23   l_proc                     VARCHAR2(72) := g_package||'leave_reas_mig';
24   l_leaving_reason           VARCHAR(30)  := p_seeded_leaving_reason;
25   l_object_version_number    per_periods_of_service.object_version_number%TYPE;
26   l_count		     NUMBER       := 0;
27   l_total_records            NUMBER;
28   l_effective_date           DATE        := fnd_date.canonical_to_date(p_date);
29   --
30  -- The following cursor selects all the employee's what have a specific leaving
31  -- reason, which has been specified by the customer when running the concurrent
32  -- program.
33  --
34 
35   cursor csr_pds is
36      select pos.period_of_service_id , pos.object_version_number
37      from   per_periods_of_service pos
38      where  pos.leaving_reason = p_existing_leaving_reason
39      order  by pos.period_of_service_id;
40 
41   --
42 
43 begin
44 
45   hr_utility.set_location('Entering:'||l_proc, 10);
46   hr_utility.set_location('Existing Leaving Reason = '||p_existing_leaving_reason, 20);
47   hr_utility.set_location('Seeded Leaving Reason   = '||p_seeded_leaving_reason, 25);
48 --
49   ERRBUF  := NULL;
50   RETCODE := 0;
51 
52   for pds_rec in csr_pds Loop
53   --
54   l_total_records := csr_pds%rowcount;
55 
56   l_object_version_number := pds_rec.object_version_number;
57   hr_utility.set_location('Period_of_service_id = '|| pds_rec.period_of_service_id, 30);
58   --
59   l_count := l_count + 1;
60   --
61        hr_periods_of_service_api.update_pds_details(
62         p_effective_date        => l_effective_date
63        ,p_period_of_service_id  => pds_rec.period_of_service_id
64        ,p_object_version_number => l_object_version_number
65        ,p_leaving_reason	=> p_seeded_leaving_reason
66        );
67 
68   	--
69 	if l_count = 100 then
70 	   commit;
71    	   hr_utility.set_location('Committed : '||l_count||' records.', 40);
72 	   l_count := 0;
73 	end if;
74   	--
75   --
76 
77   End loop;
78   --
79   hr_utility.set_location('Total records: '||l_total_records||' records.', 50);
80   --
81   hr_utility.set_location('Updating lookup table : FND_LOOKUP_VALUES', 60);
82 
83     Update fnd_lookup_values
84     set end_date_active = l_effective_date, enabled_flag = 'N'
85     where lookup_type = 'LEAV_REAS'
86     and lookup_code = p_existing_leaving_reason;
87   --
88   hr_utility.set_location('Updated lookup table : FND_LOOKUP_VALUES', 60);
89   --
90    -- the following is a migration of the ZA_TERMINATION_CATEGORIES
91  --
92    if hr_general2.is_legislation_install('PER','ZA') then
93 	--
94         hr_utility.set_location('    Entering ZA Migration ', 70);
95         --
96  	  per_za_utility_pkg.za_term_cat_update(
97  	  p_existing_leaving_reason =>  p_existing_leaving_reason
98  	 ,p_seeded_leaving_reason   =>  p_seeded_leaving_reason
99          );
100 	--
101          hr_utility.set_location('    Leaving ZA Migration ', 70);
102    --
103    end if;
104 
105  --
106   hr_utility.set_location('Leaving:'||l_proc, 10);
107   --
108 End leave_reas_mig;
109 end HR_LEAVING_REASON_MIG;