DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PER_CM_API

Source


1 Package Body ben_PER_CM_api as
2 /* $Header: bepcmapi.pkb 120.2 2010/08/10 17:24:32 pvelvano ship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  ben_PER_CM_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |------------------------< create_PER_CM >---------------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_PER_CM
13   (p_validate                       in  boolean   default false
14   ,p_per_cm_id                      out nocopy number
15   ,p_effective_start_date           out nocopy date
16   ,p_effective_end_date             out nocopy date
17   ,p_lf_evt_ocrd_dt                 in  date      default null
18   ,p_rqstbl_untl_dt                 in  date      default null
19   ,p_ler_id                         in  number    default null
20   ,p_per_in_ler_id                  in  number    default null
21   ,p_prtt_enrt_actn_id              in  number    default null
22   ,p_person_id                      in  number    default null
23   ,p_bnf_person_id                  in  number    default null
24   ,p_dpnt_person_id                 in  number    default null
25   ,p_cm_typ_id                      in  number    default null
26   ,p_business_group_id              in  number    default null
27   ,p_pcm_attribute_category         in  varchar2  default null
28   ,p_pcm_attribute1                 in  varchar2  default null
29   ,p_pcm_attribute2                 in  varchar2  default null
30   ,p_pcm_attribute3                 in  varchar2  default null
31   ,p_pcm_attribute4                 in  varchar2  default null
32   ,p_pcm_attribute5                 in  varchar2  default null
33   ,p_pcm_attribute6                 in  varchar2  default null
34   ,p_pcm_attribute7                 in  varchar2  default null
35   ,p_pcm_attribute8                 in  varchar2  default null
36   ,p_pcm_attribute9                 in  varchar2  default null
37   ,p_pcm_attribute10                in  varchar2  default null
38   ,p_pcm_attribute11                in  varchar2  default null
39   ,p_pcm_attribute12                in  varchar2  default null
40   ,p_pcm_attribute13                in  varchar2  default null
41   ,p_pcm_attribute14                in  varchar2  default null
42   ,p_pcm_attribute15                in  varchar2  default null
43   ,p_pcm_attribute16                in  varchar2  default null
44   ,p_pcm_attribute17                in  varchar2  default null
45   ,p_pcm_attribute18                in  varchar2  default null
46   ,p_pcm_attribute19                in  varchar2  default null
47   ,p_pcm_attribute20                in  varchar2  default null
48   ,p_pcm_attribute21                in  varchar2  default null
49   ,p_pcm_attribute22                in  varchar2  default null
50   ,p_pcm_attribute23                in  varchar2  default null
51   ,p_pcm_attribute24                in  varchar2  default null
52   ,p_pcm_attribute25                in  varchar2  default null
53   ,p_pcm_attribute26                in  varchar2  default null
54   ,p_pcm_attribute27                in  varchar2  default null
55   ,p_pcm_attribute28                in  varchar2  default null
56   ,p_pcm_attribute29                in  varchar2  default null
57   ,p_pcm_attribute30                in  varchar2  default null
58   ,p_request_id                     in  number    default null
59   ,p_program_application_id         in  number    default null
60   ,p_program_id                     in  number    default null
61   ,p_program_update_date            in  date      default null
62   ,p_object_version_number          out nocopy number
63   ,p_effective_date                 in  date
64   ) is
65   --
66   -- Declare cursors and local variables
67   --
68   l_per_cm_id ben_per_cm_f.per_cm_id%TYPE;
69   l_effective_start_date ben_per_cm_f.effective_start_date%TYPE;
70   l_effective_end_date ben_per_cm_f.effective_end_date%TYPE;
71   l_proc varchar2(72) := g_package||'create_PER_CM';
72   l_object_version_number ben_per_cm_f.object_version_number%TYPE;
73   --
74 begin
75   --
76   hr_utility.set_location('Entering:'|| l_proc, 10);
77   --
78   -- Issue a savepoint if operating in validation only mode
79   --
80   savepoint create_PER_CM;
81   --
82   hr_utility.set_location(l_proc, 20);
83   --
84   -- Process Logic
85   --
86   begin
87     --
88     -- Start of API User Hook for the before hook of create_PER_CM
89     --
90     ben_PER_CM_bk1.create_PER_CM_b
91       (p_lf_evt_ocrd_dt                 =>  p_lf_evt_ocrd_dt
92       ,p_rqstbl_untl_dt                 =>  p_rqstbl_untl_dt
93       ,p_ler_id                         =>  p_ler_id
94       ,p_per_in_ler_id                  =>  p_per_in_ler_id
95       ,p_prtt_enrt_actn_id              =>  p_prtt_enrt_actn_id
96       ,p_person_id                      =>  p_person_id
97       ,p_bnf_person_id                  =>  p_bnf_person_id
98       ,p_dpnt_person_id                 =>  p_dpnt_person_id
99       ,p_cm_typ_id                      =>  p_cm_typ_id
100       ,p_business_group_id              =>  p_business_group_id
101       ,p_pcm_attribute_category         =>  p_pcm_attribute_category
102       ,p_pcm_attribute1                 =>  p_pcm_attribute1
103       ,p_pcm_attribute2                 =>  p_pcm_attribute2
104       ,p_pcm_attribute3                 =>  p_pcm_attribute3
105       ,p_pcm_attribute4                 =>  p_pcm_attribute4
106       ,p_pcm_attribute5                 =>  p_pcm_attribute5
107       ,p_pcm_attribute6                 =>  p_pcm_attribute6
108       ,p_pcm_attribute7                 =>  p_pcm_attribute7
109       ,p_pcm_attribute8                 =>  p_pcm_attribute8
110       ,p_pcm_attribute9                 =>  p_pcm_attribute9
111       ,p_pcm_attribute10                =>  p_pcm_attribute10
112       ,p_pcm_attribute11                =>  p_pcm_attribute11
113       ,p_pcm_attribute12                =>  p_pcm_attribute12
114       ,p_pcm_attribute13                =>  p_pcm_attribute13
115       ,p_pcm_attribute14                =>  p_pcm_attribute14
116       ,p_pcm_attribute15                =>  p_pcm_attribute15
117       ,p_pcm_attribute16                =>  p_pcm_attribute16
118       ,p_pcm_attribute17                =>  p_pcm_attribute17
119       ,p_pcm_attribute18                =>  p_pcm_attribute18
120       ,p_pcm_attribute19                =>  p_pcm_attribute19
121       ,p_pcm_attribute20                =>  p_pcm_attribute20
122       ,p_pcm_attribute21                =>  p_pcm_attribute21
123       ,p_pcm_attribute22                =>  p_pcm_attribute22
124       ,p_pcm_attribute23                =>  p_pcm_attribute23
125       ,p_pcm_attribute24                =>  p_pcm_attribute24
126       ,p_pcm_attribute25                =>  p_pcm_attribute25
127       ,p_pcm_attribute26                =>  p_pcm_attribute26
128       ,p_pcm_attribute27                =>  p_pcm_attribute27
129       ,p_pcm_attribute28                =>  p_pcm_attribute28
130       ,p_pcm_attribute29                =>  p_pcm_attribute29
131       ,p_pcm_attribute30                =>  p_pcm_attribute30
132       ,p_request_id                     =>  p_request_id
133       ,p_program_application_id         =>  p_program_application_id
134       ,p_program_id                     =>  p_program_id
135       ,p_program_update_date            =>  p_program_update_date
136       ,p_effective_date                 =>  trunc(p_effective_date));
137     --
138   exception
139     --
140     when hr_api.cannot_find_prog_unit then
141       --
142       hr_api.cannot_find_prog_unit_error
143         (p_module_name => 'CREATE_PER_CM'
144         ,p_hook_type   => 'BP');
145     --
146     -- End of API User Hook for the before hook of create_PER_CM
147     --
148   end;
149   --
150   ben_pcm_ins.ins
151     (p_per_cm_id                     => l_per_cm_id
152     ,p_effective_start_date          => l_effective_start_date
153     ,p_effective_end_date            => l_effective_end_date
154     ,p_lf_evt_ocrd_dt                => p_lf_evt_ocrd_dt
155     ,p_rqstbl_untl_dt                => p_rqstbl_untl_dt
156     ,p_ler_id                        => p_ler_id
157     ,p_per_in_ler_id                 => p_per_in_ler_id
158     ,p_prtt_enrt_actn_id             => p_prtt_enrt_actn_id
159     ,p_person_id                     => p_person_id
160     ,p_bnf_person_id                 => p_bnf_person_id
161     ,p_dpnt_person_id                => p_dpnt_person_id
162     ,p_cm_typ_id                     => p_cm_typ_id
163     ,p_business_group_id             => p_business_group_id
164     ,p_pcm_attribute_category        => p_pcm_attribute_category
165     ,p_pcm_attribute1                => p_pcm_attribute1
166     ,p_pcm_attribute2                => p_pcm_attribute2
167     ,p_pcm_attribute3                => p_pcm_attribute3
168     ,p_pcm_attribute4                => p_pcm_attribute4
169     ,p_pcm_attribute5                => p_pcm_attribute5
170     ,p_pcm_attribute6                => p_pcm_attribute6
171     ,p_pcm_attribute7                => p_pcm_attribute7
172     ,p_pcm_attribute8                => p_pcm_attribute8
173     ,p_pcm_attribute9                => p_pcm_attribute9
174     ,p_pcm_attribute10               => p_pcm_attribute10
175     ,p_pcm_attribute11               => p_pcm_attribute11
176     ,p_pcm_attribute12               => p_pcm_attribute12
177     ,p_pcm_attribute13               => p_pcm_attribute13
178     ,p_pcm_attribute14               => p_pcm_attribute14
179     ,p_pcm_attribute15               => p_pcm_attribute15
180     ,p_pcm_attribute16               => p_pcm_attribute16
181     ,p_pcm_attribute17               => p_pcm_attribute17
182     ,p_pcm_attribute18               => p_pcm_attribute18
183     ,p_pcm_attribute19               => p_pcm_attribute19
184     ,p_pcm_attribute20               => p_pcm_attribute20
185     ,p_pcm_attribute21               => p_pcm_attribute21
186     ,p_pcm_attribute22               => p_pcm_attribute22
187     ,p_pcm_attribute23               => p_pcm_attribute23
188     ,p_pcm_attribute24               => p_pcm_attribute24
189     ,p_pcm_attribute25               => p_pcm_attribute25
190     ,p_pcm_attribute26               => p_pcm_attribute26
191     ,p_pcm_attribute27               => p_pcm_attribute27
192     ,p_pcm_attribute28               => p_pcm_attribute28
193     ,p_pcm_attribute29               => p_pcm_attribute29
194     ,p_pcm_attribute30               => p_pcm_attribute30
195     ,p_request_id                    => p_request_id
196     ,p_program_application_id        => p_program_application_id
197     ,p_program_id                    => p_program_id
198     ,p_program_update_date           => p_program_update_date
199     ,p_object_version_number         => l_object_version_number
200     ,p_effective_date                => trunc(p_effective_date));
201   --
202   begin
203     --
204     -- Start of API User Hook for the after hook of create_PER_CM
205     --
206     ben_PER_CM_bk1.create_PER_CM_a
207       (p_per_cm_id                      =>  l_per_cm_id
208       ,p_effective_start_date           =>  l_effective_start_date
209       ,p_effective_end_date             =>  l_effective_end_date
210       ,p_lf_evt_ocrd_dt                 =>  p_lf_evt_ocrd_dt
211       ,p_rqstbl_untl_dt                 =>  p_rqstbl_untl_dt
212       ,p_ler_id                         =>  p_ler_id
213       ,p_per_in_ler_id                  =>  p_per_in_ler_id
214       ,p_prtt_enrt_actn_id              =>  p_prtt_enrt_actn_id
215       ,p_person_id                      =>  p_person_id
216       ,p_bnf_person_id                  =>  p_bnf_person_id
217       ,p_dpnt_person_id                 =>  p_dpnt_person_id
218       ,p_cm_typ_id                      =>  p_cm_typ_id
219       ,p_business_group_id              =>  p_business_group_id
220       ,p_pcm_attribute_category         =>  p_pcm_attribute_category
221       ,p_pcm_attribute1                 =>  p_pcm_attribute1
222       ,p_pcm_attribute2                 =>  p_pcm_attribute2
223       ,p_pcm_attribute3                 =>  p_pcm_attribute3
224       ,p_pcm_attribute4                 =>  p_pcm_attribute4
225       ,p_pcm_attribute5                 =>  p_pcm_attribute5
226       ,p_pcm_attribute6                 =>  p_pcm_attribute6
227       ,p_pcm_attribute7                 =>  p_pcm_attribute7
228       ,p_pcm_attribute8                 =>  p_pcm_attribute8
229       ,p_pcm_attribute9                 =>  p_pcm_attribute9
230       ,p_pcm_attribute10                =>  p_pcm_attribute10
231       ,p_pcm_attribute11                =>  p_pcm_attribute11
232       ,p_pcm_attribute12                =>  p_pcm_attribute12
233       ,p_pcm_attribute13                =>  p_pcm_attribute13
234       ,p_pcm_attribute14                =>  p_pcm_attribute14
235       ,p_pcm_attribute15                =>  p_pcm_attribute15
236       ,p_pcm_attribute16                =>  p_pcm_attribute16
237       ,p_pcm_attribute17                =>  p_pcm_attribute17
238       ,p_pcm_attribute18                =>  p_pcm_attribute18
239       ,p_pcm_attribute19                =>  p_pcm_attribute19
240       ,p_pcm_attribute20                =>  p_pcm_attribute20
241       ,p_pcm_attribute21                =>  p_pcm_attribute21
242       ,p_pcm_attribute22                =>  p_pcm_attribute22
243       ,p_pcm_attribute23                =>  p_pcm_attribute23
244       ,p_pcm_attribute24                =>  p_pcm_attribute24
245       ,p_pcm_attribute25                =>  p_pcm_attribute25
246       ,p_pcm_attribute26                =>  p_pcm_attribute26
247       ,p_pcm_attribute27                =>  p_pcm_attribute27
248       ,p_pcm_attribute28                =>  p_pcm_attribute28
249       ,p_pcm_attribute29                =>  p_pcm_attribute29
250       ,p_pcm_attribute30                =>  p_pcm_attribute30
251       ,p_request_id                     =>  p_request_id
252       ,p_program_application_id         =>  p_program_application_id
253       ,p_program_id                     =>  p_program_id
254       ,p_program_update_date            =>  p_program_update_date
255       ,p_object_version_number          =>  l_object_version_number
256       ,p_effective_date                 =>  trunc(p_effective_date));
257     --
258   exception
259     --
260     when hr_api.cannot_find_prog_unit then
261       --
262       hr_api.cannot_find_prog_unit_error
263         (p_module_name => 'CREATE_PER_CM'
264         ,p_hook_type   => 'AP');
265     --
266     -- End of API User Hook for the after hook of create_PER_CM
267     --
268   end;
269   --
270   hr_utility.set_location(l_proc, 60);
271   --
272   -- When in validation only mode raise the Validate_Enabled exception
273   --
274   if p_validate then
275     raise hr_api.validate_enabled;
276   end if;
277   --
278   -- Set all output arguments
279   --
280   p_per_cm_id := l_per_cm_id;
281   p_effective_start_date := l_effective_start_date;
282   p_effective_end_date := l_effective_end_date;
283   p_object_version_number := l_object_version_number;
284   --
285   hr_utility.set_location(' Leaving:'||l_proc, 70);
286   --
287 exception
288   --
289   when hr_api.validate_enabled then
290     --
291     -- As the Validate_Enabled exception has been raised
292     -- we must rollback to the savepoint
293     --
294     ROLLBACK TO create_PER_CM;
295     --
296     -- Only set output warning arguments
297     -- (Any key or derived arguments must be set to null
298     -- when validation only mode is being used.)
299     --
300     p_per_cm_id := null;
301     p_effective_start_date := null;
302     p_effective_end_date := null;
303     p_object_version_number  := null;
304     hr_utility.set_location(' Leaving:'||l_proc, 80);
305     --
306   when others then
307     --
308     -- A validation or unexpected error has occured
309     --
310     ROLLBACK TO create_PER_CM;
311     p_per_cm_id := null;
312     p_effective_start_date := null;
313     p_effective_end_date := null;
314     p_object_version_number  := null;
315     hr_utility.set_location(' Leaving:'||l_proc, 90);
316     raise;
317     --
318 end create_PER_CM;
319 --
320 -- ----------------------------------------------------------------------------
321 -- |------------------------< create_PER_CM_perf >----------------------------|
322 -- ----------------------------------------------------------------------------
323 --
324 procedure create_PER_CM_perf
325   (p_validate                       in  boolean   default false
326   ,p_per_cm_id                      out nocopy number
327   ,p_effective_start_date           out nocopy date
328   ,p_effective_end_date             out nocopy date
329   ,p_lf_evt_ocrd_dt                 in  date      default null
330   ,p_rqstbl_untl_dt                 in  date      default null
331   ,p_ler_id                         in  number    default null
332   ,p_per_in_ler_id                  in  number    default null
333   ,p_prtt_enrt_actn_id              in  number    default null
334   ,p_person_id                      in  number    default null
335   ,p_bnf_person_id                  in  number    default null
336   ,p_dpnt_person_id                 in  number    default null
337   ,p_cm_typ_id                      in  number    default null
338   ,p_business_group_id              in  number    default null
339   ,p_pcm_attribute_category         in  varchar2  default null
340   ,p_pcm_attribute1                 in  varchar2  default null
341   ,p_pcm_attribute2                 in  varchar2  default null
342   ,p_pcm_attribute3                 in  varchar2  default null
343   ,p_pcm_attribute4                 in  varchar2  default null
344   ,p_pcm_attribute5                 in  varchar2  default null
345   ,p_pcm_attribute6                 in  varchar2  default null
346   ,p_pcm_attribute7                 in  varchar2  default null
347   ,p_pcm_attribute8                 in  varchar2  default null
348   ,p_pcm_attribute9                 in  varchar2  default null
349   ,p_pcm_attribute10                in  varchar2  default null
350   ,p_pcm_attribute11                in  varchar2  default null
351   ,p_pcm_attribute12                in  varchar2  default null
352   ,p_pcm_attribute13                in  varchar2  default null
353   ,p_pcm_attribute14                in  varchar2  default null
354   ,p_pcm_attribute15                in  varchar2  default null
355   ,p_pcm_attribute16                in  varchar2  default null
356   ,p_pcm_attribute17                in  varchar2  default null
357   ,p_pcm_attribute18                in  varchar2  default null
358   ,p_pcm_attribute19                in  varchar2  default null
359   ,p_pcm_attribute20                in  varchar2  default null
360   ,p_pcm_attribute21                in  varchar2  default null
361   ,p_pcm_attribute22                in  varchar2  default null
362   ,p_pcm_attribute23                in  varchar2  default null
363   ,p_pcm_attribute24                in  varchar2  default null
364   ,p_pcm_attribute25                in  varchar2  default null
365   ,p_pcm_attribute26                in  varchar2  default null
366   ,p_pcm_attribute27                in  varchar2  default null
367   ,p_pcm_attribute28                in  varchar2  default null
368   ,p_pcm_attribute29                in  varchar2  default null
369   ,p_pcm_attribute30                in  varchar2  default null
370   ,p_request_id                     in  number    default null
371   ,p_program_application_id         in  number    default null
372   ,p_program_id                     in  number    default null
373   ,p_program_update_date            in  date      default null
374   ,p_object_version_number          out nocopy number
375   ,p_effective_date                 in  date
376   ) is
377   --
378   -- Declare cursors and local variables
379   --
380   l_per_cm_id ben_per_cm_f.per_cm_id%TYPE;
381   l_effective_start_date ben_per_cm_f.effective_start_date%TYPE;
382   l_effective_end_date ben_per_cm_f.effective_end_date%TYPE;
383   l_proc varchar2(72) := g_package||'create_PER_CM';
384   l_object_version_number ben_per_cm_f.object_version_number%TYPE;
385   --
386   cursor c_seq is
387     select ben_per_cm_f_s.nextval
388     from   sys.dual;
389   --
390   l_validation_start_date date;
391   l_validation_end_date date;
392   --
393 begin
394   --
395   -- Issue a savepoint if operating in validation only mode
396   --
397   savepoint create_PER_CM;
398   --
399   -- Process Logic
400   --
401   begin
402     --
403     -- Start of API User Hook for the before hook of create_PER_CM
404     --
405     ben_PER_CM_bk1.create_PER_CM_b
406       (p_lf_evt_ocrd_dt                 =>  p_lf_evt_ocrd_dt
407       ,p_rqstbl_untl_dt                 =>  p_rqstbl_untl_dt
408       ,p_ler_id                         =>  p_ler_id
409       ,p_per_in_ler_id                  =>  p_per_in_ler_id
410       ,p_prtt_enrt_actn_id              =>  p_prtt_enrt_actn_id
411       ,p_person_id                      =>  p_person_id
412       ,p_bnf_person_id                  =>  p_bnf_person_id
413       ,p_dpnt_person_id                 =>  p_dpnt_person_id
414       ,p_cm_typ_id                      =>  p_cm_typ_id
415       ,p_business_group_id              =>  p_business_group_id
416       ,p_pcm_attribute_category         =>  p_pcm_attribute_category
417       ,p_pcm_attribute1                 =>  p_pcm_attribute1
418       ,p_pcm_attribute2                 =>  p_pcm_attribute2
419       ,p_pcm_attribute3                 =>  p_pcm_attribute3
420       ,p_pcm_attribute4                 =>  p_pcm_attribute4
421       ,p_pcm_attribute5                 =>  p_pcm_attribute5
422       ,p_pcm_attribute6                 =>  p_pcm_attribute6
423       ,p_pcm_attribute7                 =>  p_pcm_attribute7
424       ,p_pcm_attribute8                 =>  p_pcm_attribute8
425       ,p_pcm_attribute9                 =>  p_pcm_attribute9
426       ,p_pcm_attribute10                =>  p_pcm_attribute10
427       ,p_pcm_attribute11                =>  p_pcm_attribute11
428       ,p_pcm_attribute12                =>  p_pcm_attribute12
429       ,p_pcm_attribute13                =>  p_pcm_attribute13
430       ,p_pcm_attribute14                =>  p_pcm_attribute14
431       ,p_pcm_attribute15                =>  p_pcm_attribute15
432       ,p_pcm_attribute16                =>  p_pcm_attribute16
433       ,p_pcm_attribute17                =>  p_pcm_attribute17
434       ,p_pcm_attribute18                =>  p_pcm_attribute18
435       ,p_pcm_attribute19                =>  p_pcm_attribute19
436       ,p_pcm_attribute20                =>  p_pcm_attribute20
437       ,p_pcm_attribute21                =>  p_pcm_attribute21
438       ,p_pcm_attribute22                =>  p_pcm_attribute22
439       ,p_pcm_attribute23                =>  p_pcm_attribute23
440       ,p_pcm_attribute24                =>  p_pcm_attribute24
441       ,p_pcm_attribute25                =>  p_pcm_attribute25
442       ,p_pcm_attribute26                =>  p_pcm_attribute26
443       ,p_pcm_attribute27                =>  p_pcm_attribute27
444       ,p_pcm_attribute28                =>  p_pcm_attribute28
445       ,p_pcm_attribute29                =>  p_pcm_attribute29
446       ,p_pcm_attribute30                =>  p_pcm_attribute30
447       ,p_request_id                     =>  p_request_id
448       ,p_program_application_id         =>  p_program_application_id
449       ,p_program_id                     =>  p_program_id
450       ,p_program_update_date            =>  p_program_update_date
451       ,p_effective_date                 =>  trunc(p_effective_date));
452     --
453   exception
454     --
455     when hr_api.cannot_find_prog_unit then
456       --
457       hr_api.cannot_find_prog_unit_error
458         (p_module_name => 'CREATE_PER_CM'
459         ,p_hook_type   => 'BP');
460     --
461     -- End of API User Hook for the before hook of create_PER_CM
462     --
463   end;
464   --
465   --
466   -- Set sequence
467   --
468   open c_seq;
469     --
470     fetch c_seq into l_per_cm_id;
471     --
472   close c_seq;
473   --
474   -- Post insert row handler hook
475   --
476   dt_api.validate_dt_mode
477     (p_effective_date          => trunc(p_effective_date),
478      p_datetrack_mode          => 'INSERT',
479      p_base_table_name         => 'ben_per_cm_f',
480      p_base_key_column         => 'per_cm_id',
481      p_base_key_value          => p_per_cm_id,
482      p_parent_table_name1      => 'ben_cm_typ_f',
483      p_parent_key_column1      => 'cm_typ_id',
484      p_parent_key_value1       => p_cm_typ_id,
485      p_parent_table_name2      => 'ben_prtt_enrt_actn_f',
486      p_parent_key_column2      => 'prtt_enrt_actn_id',
487      p_parent_key_value2       => p_prtt_enrt_actn_id,
488      p_enforce_foreign_locking => false,
489      p_validation_start_date   => l_validation_start_date,
490      p_validation_end_date     => l_validation_end_date);
491   --
492   l_effective_start_date := l_validation_start_date;
493   l_effective_end_date := l_validation_end_date;
494   l_object_version_number := 1;
495   --
496   insert into ben_per_cm_f
497     (per_cm_id
498     ,effective_start_date
499     ,effective_end_date
500     ,lf_evt_ocrd_dt
501     ,rqstbl_untl_dt
502     ,ler_id
503     ,per_in_ler_id
504     ,prtt_enrt_actn_id
505     ,person_id
506     ,bnf_person_id
507     ,dpnt_person_id
508     ,cm_typ_id
509     ,business_group_id
510     ,pcm_attribute_category
511     ,pcm_attribute1
512     ,pcm_attribute2
513     ,pcm_attribute3
514     ,pcm_attribute4
515     ,pcm_attribute5
516     ,pcm_attribute6
517     ,pcm_attribute7
518     ,pcm_attribute8
519     ,pcm_attribute9
520     ,pcm_attribute10
521     ,pcm_attribute11
522     ,pcm_attribute12
523     ,pcm_attribute13
524     ,pcm_attribute14
525     ,pcm_attribute15
526     ,pcm_attribute16
527     ,pcm_attribute17
528     ,pcm_attribute18
529     ,pcm_attribute19
530     ,pcm_attribute20
531     ,pcm_attribute21
532     ,pcm_attribute22
533     ,pcm_attribute23
534     ,pcm_attribute24
535     ,pcm_attribute25
536     ,pcm_attribute26
537     ,pcm_attribute27
538     ,pcm_attribute28
539     ,pcm_attribute29
540     ,pcm_attribute30
541     ,request_id
542     ,program_application_id
543     ,program_id
544     ,program_update_date
545     ,object_version_number)
546   values
547     (l_per_cm_id
548     ,l_effective_start_date
549     ,l_effective_end_date
550     ,p_lf_evt_ocrd_dt
551     ,p_rqstbl_untl_dt
552     ,p_ler_id
553     ,p_per_in_ler_id
554     ,p_prtt_enrt_actn_id
555     ,p_person_id
556     ,p_bnf_person_id
557     ,p_dpnt_person_id
558     ,p_cm_typ_id
559     ,p_business_group_id
560     ,p_pcm_attribute_category
561     ,p_pcm_attribute1
562     ,p_pcm_attribute2
563     ,p_pcm_attribute3
564     ,p_pcm_attribute4
565     ,p_pcm_attribute5
566     ,p_pcm_attribute6
567     ,p_pcm_attribute7
568     ,p_pcm_attribute8
569     ,p_pcm_attribute9
570     ,p_pcm_attribute10
571     ,p_pcm_attribute11
572     ,p_pcm_attribute12
573     ,p_pcm_attribute13
574     ,p_pcm_attribute14
575     ,p_pcm_attribute15
576     ,p_pcm_attribute16
577     ,p_pcm_attribute17
578     ,p_pcm_attribute18
579     ,p_pcm_attribute19
580     ,p_pcm_attribute20
581     ,p_pcm_attribute21
582     ,p_pcm_attribute22
583     ,p_pcm_attribute23
584     ,p_pcm_attribute24
585     ,p_pcm_attribute25
586     ,p_pcm_attribute26
587     ,p_pcm_attribute27
588     ,p_pcm_attribute28
589     ,p_pcm_attribute29
590     ,p_pcm_attribute30
591     ,p_request_id
592     ,p_program_application_id
593     ,p_program_id
594     ,p_program_update_date
595     ,l_object_version_number);
596   --
597    -- Start of API User Hook for post_insert.
598   --
599   begin
600     --
601     ben_pcm_rki.after_insert
602       (p_per_cm_id                     =>l_per_cm_id
603       ,p_effective_start_date          =>l_effective_start_date
604       ,p_effective_end_date            =>l_effective_end_date
605       ,p_lf_evt_ocrd_dt                =>p_lf_evt_ocrd_dt
606       ,p_rqstbl_untl_dt                =>p_rqstbl_untl_dt
607       ,p_ler_id                        =>p_ler_id
608       ,p_per_in_ler_id                 =>p_per_in_ler_id
609       ,p_prtt_enrt_actn_id             =>p_prtt_enrt_actn_id
610       ,p_person_id                     =>p_person_id
611       ,p_bnf_person_id                 =>p_bnf_person_id
612       ,p_dpnt_person_id                =>p_dpnt_person_id
613       ,p_cm_typ_id                     =>p_cm_typ_id
614       ,p_business_group_id             =>p_business_group_id
615       ,p_pcm_attribute_category        =>p_pcm_attribute_category
616       ,p_pcm_attribute1                =>p_pcm_attribute1
617       ,p_pcm_attribute2                =>p_pcm_attribute2
618       ,p_pcm_attribute3                =>p_pcm_attribute3
619       ,p_pcm_attribute4                =>p_pcm_attribute4
620       ,p_pcm_attribute5                =>p_pcm_attribute5
621       ,p_pcm_attribute6                =>p_pcm_attribute6
622       ,p_pcm_attribute7                =>p_pcm_attribute7
623       ,p_pcm_attribute8                =>p_pcm_attribute8
624       ,p_pcm_attribute9                =>p_pcm_attribute9
625       ,p_pcm_attribute10               =>p_pcm_attribute10
626       ,p_pcm_attribute11               =>p_pcm_attribute11
627       ,p_pcm_attribute12               =>p_pcm_attribute12
628       ,p_pcm_attribute13               =>p_pcm_attribute13
629       ,p_pcm_attribute14               =>p_pcm_attribute14
630       ,p_pcm_attribute15               =>p_pcm_attribute15
631       ,p_pcm_attribute16               =>p_pcm_attribute16
632       ,p_pcm_attribute17               =>p_pcm_attribute17
633       ,p_pcm_attribute18               =>p_pcm_attribute18
634       ,p_pcm_attribute19               =>p_pcm_attribute19
635       ,p_pcm_attribute20               =>p_pcm_attribute20
636       ,p_pcm_attribute21               =>p_pcm_attribute21
637       ,p_pcm_attribute22               =>p_pcm_attribute22
638       ,p_pcm_attribute23               =>p_pcm_attribute23
639       ,p_pcm_attribute24               =>p_pcm_attribute24
640       ,p_pcm_attribute25               =>p_pcm_attribute25
641       ,p_pcm_attribute26               =>p_pcm_attribute26
642       ,p_pcm_attribute27               =>p_pcm_attribute27
643       ,p_pcm_attribute28               =>p_pcm_attribute28
644       ,p_pcm_attribute29               =>p_pcm_attribute29
645       ,p_pcm_attribute30               =>p_pcm_attribute30
646       ,p_request_id                    =>p_request_id
647       ,p_program_application_id        =>p_program_application_id
648       ,p_program_id                    =>p_program_id
649       ,p_program_update_date           =>p_program_update_date
650       ,p_object_version_number         =>l_object_version_number
651       ,p_effective_date                =>trunc(p_effective_date)
652       ,p_validation_start_date         =>l_validation_start_date
653       ,p_validation_end_date           =>l_validation_end_date);
654     --
655   exception
656     --
657     when hr_api.cannot_find_prog_unit then
658       --
659       hr_api.cannot_find_prog_unit_error
660         (p_module_name => 'ben_per_cm_f'
661         ,p_hook_type   => 'AI');
662       --
663   end;
664   --
665   -- End of API User Hook for post_insert.
666   --
667   begin
668     --
669     -- Start of API User Hook for the after hook of create_PER_CM
670     --
671     ben_PER_CM_bk1.create_PER_CM_a
672       (p_per_cm_id                      =>  l_per_cm_id
673       ,p_effective_start_date           =>  l_effective_start_date
674       ,p_effective_end_date             =>  l_effective_end_date
675       ,p_lf_evt_ocrd_dt                 =>  p_lf_evt_ocrd_dt
676       ,p_rqstbl_untl_dt                 =>  p_rqstbl_untl_dt
677       ,p_ler_id                         =>  p_ler_id
678       ,p_per_in_ler_id                  =>  p_per_in_ler_id
679       ,p_prtt_enrt_actn_id              =>  p_prtt_enrt_actn_id
680       ,p_person_id                      =>  p_person_id
681       ,p_bnf_person_id                  =>  p_bnf_person_id
682       ,p_dpnt_person_id                 =>  p_dpnt_person_id
683       ,p_cm_typ_id                      =>  p_cm_typ_id
684       ,p_business_group_id              =>  p_business_group_id
685       ,p_pcm_attribute_category         =>  p_pcm_attribute_category
686       ,p_pcm_attribute1                 =>  p_pcm_attribute1
687       ,p_pcm_attribute2                 =>  p_pcm_attribute2
688       ,p_pcm_attribute3                 =>  p_pcm_attribute3
689       ,p_pcm_attribute4                 =>  p_pcm_attribute4
690       ,p_pcm_attribute5                 =>  p_pcm_attribute5
691       ,p_pcm_attribute6                 =>  p_pcm_attribute6
692       ,p_pcm_attribute7                 =>  p_pcm_attribute7
693       ,p_pcm_attribute8                 =>  p_pcm_attribute8
694       ,p_pcm_attribute9                 =>  p_pcm_attribute9
695       ,p_pcm_attribute10                =>  p_pcm_attribute10
696       ,p_pcm_attribute11                =>  p_pcm_attribute11
697       ,p_pcm_attribute12                =>  p_pcm_attribute12
698       ,p_pcm_attribute13                =>  p_pcm_attribute13
699       ,p_pcm_attribute14                =>  p_pcm_attribute14
700       ,p_pcm_attribute15                =>  p_pcm_attribute15
701       ,p_pcm_attribute16                =>  p_pcm_attribute16
702       ,p_pcm_attribute17                =>  p_pcm_attribute17
703       ,p_pcm_attribute18                =>  p_pcm_attribute18
704       ,p_pcm_attribute19                =>  p_pcm_attribute19
705       ,p_pcm_attribute20                =>  p_pcm_attribute20
706       ,p_pcm_attribute21                =>  p_pcm_attribute21
707       ,p_pcm_attribute22                =>  p_pcm_attribute22
708       ,p_pcm_attribute23                =>  p_pcm_attribute23
709       ,p_pcm_attribute24                =>  p_pcm_attribute24
710       ,p_pcm_attribute25                =>  p_pcm_attribute25
711       ,p_pcm_attribute26                =>  p_pcm_attribute26
712       ,p_pcm_attribute27                =>  p_pcm_attribute27
713       ,p_pcm_attribute28                =>  p_pcm_attribute28
714       ,p_pcm_attribute29                =>  p_pcm_attribute29
715       ,p_pcm_attribute30                =>  p_pcm_attribute30
716       ,p_request_id                     =>  p_request_id
717       ,p_program_application_id         =>  p_program_application_id
718       ,p_program_id                     =>  p_program_id
719       ,p_program_update_date            =>  p_program_update_date
720       ,p_object_version_number          =>  l_object_version_number
721       ,p_effective_date                 =>  trunc(p_effective_date));
722     --
723   exception
724     --
725     when hr_api.cannot_find_prog_unit then
726       --
727       hr_api.cannot_find_prog_unit_error
728         (p_module_name => 'CREATE_PER_CM'
729         ,p_hook_type   => 'AP');
730     --
731     -- End of API User Hook for the after hook of create_PER_CM
732     --
733   end;
734   --
735   hr_utility.set_location(l_proc, 60);
736   --
737   -- When in validation only mode raise the Validate_Enabled exception
738   --
739   if p_validate then
740     raise hr_api.validate_enabled;
741   end if;
742   --
743   -- Set all output arguments
744   --
745   p_per_cm_id := l_per_cm_id;
746   p_effective_start_date := l_effective_start_date;
747   p_effective_end_date := l_effective_end_date;
748   p_object_version_number := l_object_version_number;
749   --
750   hr_utility.set_location(' Leaving:'||l_proc, 70);
751   --
752 exception
753   --
754   when hr_api.validate_enabled then
755     --
756     -- As the Validate_Enabled exception has been raised
757     -- we must rollback to the savepoint
758     --
759     ROLLBACK TO create_PER_CM;
760     --
761     -- Only set output warning arguments
762     -- (Any key or derived arguments must be set to null
763     -- when validation only mode is being used.)
764     --
765     p_per_cm_id := null;
766     p_effective_start_date := null;
767     p_effective_end_date := null;
768     p_object_version_number  := null;
769     hr_utility.set_location(' Leaving:'||l_proc, 80);
770     --
771   when others then
772     --
773     -- A validation or unexpected error has occured
774     --
775     ROLLBACK TO create_PER_CM;
776     p_per_cm_id := null;
777     p_effective_start_date := null;
778     p_effective_end_date := null;
779     p_object_version_number  := null;
780     hr_utility.set_location(' Leaving:'||l_proc, 90);
781     raise;
782     --
783 end create_PER_CM_perf;
784 -- ----------------------------------------------------------------------------
785 -- |------------------------< update_PER_CM >---------------------------------|
786 -- ----------------------------------------------------------------------------
787 --
788 procedure update_PER_CM
789   (p_validate                       in  boolean   default false
790   ,p_per_cm_id                      in  number
791   ,p_effective_start_date           out nocopy date
792   ,p_effective_end_date             out nocopy date
793   ,p_lf_evt_ocrd_dt                 in  date      default hr_api.g_date
794   ,p_rqstbl_untl_dt                 in  date      default hr_api.g_date
795   ,p_ler_id                         in  number    default hr_api.g_number
796   ,p_per_in_ler_id                  in  number    default hr_api.g_number
797   ,p_prtt_enrt_actn_id              in  number    default hr_api.g_number
798   ,p_person_id                      in  number    default hr_api.g_number
799   ,p_bnf_person_id                  in  number    default hr_api.g_number
800   ,p_dpnt_person_id                 in  number    default hr_api.g_number
801   ,p_cm_typ_id                      in  number    default hr_api.g_number
802   ,p_business_group_id              in  number    default hr_api.g_number
803   ,p_pcm_attribute_category         in  varchar2  default hr_api.g_varchar2
804   ,p_pcm_attribute1                 in  varchar2  default hr_api.g_varchar2
805   ,p_pcm_attribute2                 in  varchar2  default hr_api.g_varchar2
806   ,p_pcm_attribute3                 in  varchar2  default hr_api.g_varchar2
807   ,p_pcm_attribute4                 in  varchar2  default hr_api.g_varchar2
808   ,p_pcm_attribute5                 in  varchar2  default hr_api.g_varchar2
809   ,p_pcm_attribute6                 in  varchar2  default hr_api.g_varchar2
810   ,p_pcm_attribute7                 in  varchar2  default hr_api.g_varchar2
811   ,p_pcm_attribute8                 in  varchar2  default hr_api.g_varchar2
812   ,p_pcm_attribute9                 in  varchar2  default hr_api.g_varchar2
813   ,p_pcm_attribute10                in  varchar2  default hr_api.g_varchar2
814   ,p_pcm_attribute11                in  varchar2  default hr_api.g_varchar2
815   ,p_pcm_attribute12                in  varchar2  default hr_api.g_varchar2
816   ,p_pcm_attribute13                in  varchar2  default hr_api.g_varchar2
817   ,p_pcm_attribute14                in  varchar2  default hr_api.g_varchar2
818   ,p_pcm_attribute15                in  varchar2  default hr_api.g_varchar2
819   ,p_pcm_attribute16                in  varchar2  default hr_api.g_varchar2
820   ,p_pcm_attribute17                in  varchar2  default hr_api.g_varchar2
821   ,p_pcm_attribute18                in  varchar2  default hr_api.g_varchar2
822   ,p_pcm_attribute19                in  varchar2  default hr_api.g_varchar2
823   ,p_pcm_attribute20                in  varchar2  default hr_api.g_varchar2
824   ,p_pcm_attribute21                in  varchar2  default hr_api.g_varchar2
825   ,p_pcm_attribute22                in  varchar2  default hr_api.g_varchar2
826   ,p_pcm_attribute23                in  varchar2  default hr_api.g_varchar2
827   ,p_pcm_attribute24                in  varchar2  default hr_api.g_varchar2
828   ,p_pcm_attribute25                in  varchar2  default hr_api.g_varchar2
829   ,p_pcm_attribute26                in  varchar2  default hr_api.g_varchar2
830   ,p_pcm_attribute27                in  varchar2  default hr_api.g_varchar2
831   ,p_pcm_attribute28                in  varchar2  default hr_api.g_varchar2
832   ,p_pcm_attribute29                in  varchar2  default hr_api.g_varchar2
833   ,p_pcm_attribute30                in  varchar2  default hr_api.g_varchar2
834   ,p_request_id                     in  number    default hr_api.g_number
835   ,p_program_application_id         in  number    default hr_api.g_number
836   ,p_program_id                     in  number    default hr_api.g_number
837   ,p_program_update_date            in  date      default hr_api.g_date
838   ,p_object_version_number          in out nocopy number
839   ,p_effective_date                 in  date
840   ,p_datetrack_mode                 in  varchar2) is
841   --
842   -- Declare cursors and local variables
843   --
844   l_proc varchar2(72) := g_package||'update_PER_CM';
845   l_object_version_number ben_per_cm_f.object_version_number%TYPE;
846   l_effective_start_date ben_per_cm_f.effective_start_date%TYPE;
847   l_effective_end_date ben_per_cm_f.effective_end_date%TYPE;
848   --
849 begin
850   --
851   hr_utility.set_location('Entering:'|| l_proc, 10);
852   --
853   -- Issue a savepoint if operating in validation only mode
854   --
855   savepoint update_PER_CM;
856   --
857   hr_utility.set_location(l_proc, 20);
858   --
859   -- Process Logic
860   --
861   l_object_version_number := p_object_version_number;
862   --
863   begin
864     --
865     -- Start of API User Hook for the before hook of update_PER_CM
866     --
867     ben_PER_CM_bk2.update_PER_CM_b
868       (p_per_cm_id                      =>  p_per_cm_id
869       ,p_lf_evt_ocrd_dt                 =>  p_lf_evt_ocrd_dt
870       ,p_rqstbl_untl_dt                 =>  p_rqstbl_untl_dt
871       ,p_ler_id                         =>  p_ler_id
872       ,p_per_in_ler_id                  =>  p_per_in_ler_id
873       ,p_prtt_enrt_actn_id              =>  p_prtt_enrt_actn_id
874       ,p_person_id                      =>  p_person_id
875       ,p_bnf_person_id                  =>  p_bnf_person_id
876       ,p_dpnt_person_id                 =>  p_dpnt_person_id
877       ,p_cm_typ_id                      =>  p_cm_typ_id
878       ,p_business_group_id              =>  p_business_group_id
879       ,p_pcm_attribute_category         =>  p_pcm_attribute_category
880       ,p_pcm_attribute1                 =>  p_pcm_attribute1
881       ,p_pcm_attribute2                 =>  p_pcm_attribute2
882       ,p_pcm_attribute3                 =>  p_pcm_attribute3
883       ,p_pcm_attribute4                 =>  p_pcm_attribute4
884       ,p_pcm_attribute5                 =>  p_pcm_attribute5
885       ,p_pcm_attribute6                 =>  p_pcm_attribute6
886       ,p_pcm_attribute7                 =>  p_pcm_attribute7
887       ,p_pcm_attribute8                 =>  p_pcm_attribute8
888       ,p_pcm_attribute9                 =>  p_pcm_attribute9
889       ,p_pcm_attribute10                =>  p_pcm_attribute10
890       ,p_pcm_attribute11                =>  p_pcm_attribute11
891       ,p_pcm_attribute12                =>  p_pcm_attribute12
892       ,p_pcm_attribute13                =>  p_pcm_attribute13
893       ,p_pcm_attribute14                =>  p_pcm_attribute14
894       ,p_pcm_attribute15                =>  p_pcm_attribute15
895       ,p_pcm_attribute16                =>  p_pcm_attribute16
896       ,p_pcm_attribute17                =>  p_pcm_attribute17
897       ,p_pcm_attribute18                =>  p_pcm_attribute18
898       ,p_pcm_attribute19                =>  p_pcm_attribute19
899       ,p_pcm_attribute20                =>  p_pcm_attribute20
900       ,p_pcm_attribute21                =>  p_pcm_attribute21
901       ,p_pcm_attribute22                =>  p_pcm_attribute22
902       ,p_pcm_attribute23                =>  p_pcm_attribute23
903       ,p_pcm_attribute24                =>  p_pcm_attribute24
904       ,p_pcm_attribute25                =>  p_pcm_attribute25
905       ,p_pcm_attribute26                =>  p_pcm_attribute26
906       ,p_pcm_attribute27                =>  p_pcm_attribute27
907       ,p_pcm_attribute28                =>  p_pcm_attribute28
908       ,p_pcm_attribute29                =>  p_pcm_attribute29
909       ,p_pcm_attribute30                =>  p_pcm_attribute30
910       ,p_request_id                     =>  p_request_id
911       ,p_program_application_id         =>  p_program_application_id
912       ,p_program_id                     =>  p_program_id
913       ,p_program_update_date            =>  p_program_update_date
914       ,p_object_version_number          =>  p_object_version_number
915       ,p_effective_date                 =>  trunc(p_effective_date)
916       ,p_datetrack_mode                 =>  p_datetrack_mode);
917     --
918   exception
919     --
920     when hr_api.cannot_find_prog_unit then
921       --
922       hr_api.cannot_find_prog_unit_error
923         (p_module_name => 'UPDATE_PER_CM'
924         ,p_hook_type   => 'BP');
925     --
926     -- End of API User Hook for the before hook of update_PER_CM
927     --
928   end;
929   --
930   ben_pcm_upd.upd
931     (p_per_cm_id                     => p_per_cm_id
932     ,p_effective_start_date          => l_effective_start_date
933     ,p_effective_end_date            => l_effective_end_date
934     ,p_lf_evt_ocrd_dt                => p_lf_evt_ocrd_dt
935     ,p_rqstbl_untl_dt                => p_rqstbl_untl_dt
936     ,p_ler_id                        => p_ler_id
937     ,p_per_in_ler_id                 => p_per_in_ler_id
938     ,p_prtt_enrt_actn_id             => p_prtt_enrt_actn_id
939     ,p_person_id                     => p_person_id
940     ,p_bnf_person_id                 => p_bnf_person_id
941     ,p_dpnt_person_id                => p_dpnt_person_id
942     ,p_cm_typ_id                     => p_cm_typ_id
943     ,p_business_group_id             => p_business_group_id
944     ,p_pcm_attribute_category        => p_pcm_attribute_category
945     ,p_pcm_attribute1                => p_pcm_attribute1
946     ,p_pcm_attribute2                => p_pcm_attribute2
947     ,p_pcm_attribute3                => p_pcm_attribute3
948     ,p_pcm_attribute4                => p_pcm_attribute4
949     ,p_pcm_attribute5                => p_pcm_attribute5
950     ,p_pcm_attribute6                => p_pcm_attribute6
951     ,p_pcm_attribute7                => p_pcm_attribute7
952     ,p_pcm_attribute8                => p_pcm_attribute8
953     ,p_pcm_attribute9                => p_pcm_attribute9
954     ,p_pcm_attribute10               => p_pcm_attribute10
955     ,p_pcm_attribute11               => p_pcm_attribute11
956     ,p_pcm_attribute12               => p_pcm_attribute12
957     ,p_pcm_attribute13               => p_pcm_attribute13
958     ,p_pcm_attribute14               => p_pcm_attribute14
959     ,p_pcm_attribute15               => p_pcm_attribute15
960     ,p_pcm_attribute16               => p_pcm_attribute16
961     ,p_pcm_attribute17               => p_pcm_attribute17
962     ,p_pcm_attribute18               => p_pcm_attribute18
963     ,p_pcm_attribute19               => p_pcm_attribute19
964     ,p_pcm_attribute20               => p_pcm_attribute20
965     ,p_pcm_attribute21               => p_pcm_attribute21
966     ,p_pcm_attribute22               => p_pcm_attribute22
967     ,p_pcm_attribute23               => p_pcm_attribute23
968     ,p_pcm_attribute24               => p_pcm_attribute24
969     ,p_pcm_attribute25               => p_pcm_attribute25
970     ,p_pcm_attribute26               => p_pcm_attribute26
971     ,p_pcm_attribute27               => p_pcm_attribute27
972     ,p_pcm_attribute28               => p_pcm_attribute28
973     ,p_pcm_attribute29               => p_pcm_attribute29
974     ,p_pcm_attribute30               => p_pcm_attribute30
975     ,p_request_id                    => p_request_id
976     ,p_program_application_id        => p_program_application_id
977     ,p_program_id                    => p_program_id
978     ,p_program_update_date           => p_program_update_date
979     ,p_object_version_number         => l_object_version_number
980     ,p_effective_date                => trunc(p_effective_date)
981     ,p_datetrack_mode                => p_datetrack_mode);
982   --
983   begin
984     --
985     -- Start of API User Hook for the after hook of update_PER_CM
986     --
987     ben_PER_CM_bk2.update_PER_CM_a
988       (p_per_cm_id                      =>  p_per_cm_id
989       ,p_effective_start_date           =>  l_effective_start_date
990       ,p_effective_end_date             =>  l_effective_end_date
991       ,p_lf_evt_ocrd_dt                 =>  p_lf_evt_ocrd_dt
992       ,p_rqstbl_untl_dt                 =>  p_rqstbl_untl_dt
993       ,p_ler_id                         =>  p_ler_id
994       ,p_per_in_ler_id                  =>  p_per_in_ler_id
995       ,p_prtt_enrt_actn_id              =>  p_prtt_enrt_actn_id
996       ,p_person_id                      =>  p_person_id
997       ,p_bnf_person_id                  =>  p_bnf_person_id
998       ,p_dpnt_person_id                 =>  p_dpnt_person_id
999       ,p_cm_typ_id                      =>  p_cm_typ_id
1000       ,p_business_group_id              =>  p_business_group_id
1001       ,p_pcm_attribute_category         =>  p_pcm_attribute_category
1002       ,p_pcm_attribute1                 =>  p_pcm_attribute1
1003       ,p_pcm_attribute2                 =>  p_pcm_attribute2
1004       ,p_pcm_attribute3                 =>  p_pcm_attribute3
1005       ,p_pcm_attribute4                 =>  p_pcm_attribute4
1006       ,p_pcm_attribute5                 =>  p_pcm_attribute5
1007       ,p_pcm_attribute6                 =>  p_pcm_attribute6
1008       ,p_pcm_attribute7                 =>  p_pcm_attribute7
1009       ,p_pcm_attribute8                 =>  p_pcm_attribute8
1010       ,p_pcm_attribute9                 =>  p_pcm_attribute9
1011       ,p_pcm_attribute10                =>  p_pcm_attribute10
1012       ,p_pcm_attribute11                =>  p_pcm_attribute11
1013       ,p_pcm_attribute12                =>  p_pcm_attribute12
1014       ,p_pcm_attribute13                =>  p_pcm_attribute13
1015       ,p_pcm_attribute14                =>  p_pcm_attribute14
1016       ,p_pcm_attribute15                =>  p_pcm_attribute15
1017       ,p_pcm_attribute16                =>  p_pcm_attribute16
1018       ,p_pcm_attribute17                =>  p_pcm_attribute17
1019       ,p_pcm_attribute18                =>  p_pcm_attribute18
1020       ,p_pcm_attribute19                =>  p_pcm_attribute19
1021       ,p_pcm_attribute20                =>  p_pcm_attribute20
1022       ,p_pcm_attribute21                =>  p_pcm_attribute21
1023       ,p_pcm_attribute22                =>  p_pcm_attribute22
1024       ,p_pcm_attribute23                =>  p_pcm_attribute23
1025       ,p_pcm_attribute24                =>  p_pcm_attribute24
1026       ,p_pcm_attribute25                =>  p_pcm_attribute25
1027       ,p_pcm_attribute26                =>  p_pcm_attribute26
1028       ,p_pcm_attribute27                =>  p_pcm_attribute27
1029       ,p_pcm_attribute28                =>  p_pcm_attribute28
1030       ,p_pcm_attribute29                =>  p_pcm_attribute29
1031       ,p_pcm_attribute30                =>  p_pcm_attribute30
1032       ,p_request_id                     =>  p_request_id
1033       ,p_program_application_id         =>  p_program_application_id
1034       ,p_program_id                     =>  p_program_id
1035       ,p_program_update_date            =>  p_program_update_date
1036       ,p_object_version_number          =>  l_object_version_number
1037       ,p_effective_date                 =>  trunc(p_effective_date)
1038       ,p_datetrack_mode                 =>  p_datetrack_mode);
1039     --
1040   exception
1041     --
1042     when hr_api.cannot_find_prog_unit then
1043       --
1044       hr_api.cannot_find_prog_unit_error
1045         (p_module_name => 'UPDATE_PER_CM'
1046         ,p_hook_type   => 'AP');
1047     --
1048     -- End of API User Hook for the after hook of update_PER_CM
1049     --
1050   end;
1051   --
1052   hr_utility.set_location(l_proc, 60);
1053   --
1054   -- When in validation only mode raise the Validate_Enabled exception
1055   --
1056   if p_validate then
1057     raise hr_api.validate_enabled;
1058   end if;
1059   --
1060   -- Set all output arguments
1061   --
1062   p_object_version_number := l_object_version_number;
1063   p_effective_start_date := l_effective_start_date;
1064   p_effective_end_date := l_effective_end_date;
1065   --
1066   hr_utility.set_location(' Leaving:'||l_proc, 70);
1067   --
1068 exception
1069   --
1070   when hr_api.validate_enabled then
1071     --
1072     -- As the Validate_Enabled exception has been raised
1073     -- we must rollback to the savepoint
1074     --
1075     ROLLBACK TO update_PER_CM;
1076     --
1077     -- Only set output warning arguments
1078     -- (Any key or derived arguments must be set to null
1079     -- when validation only mode is being used.)
1080     --
1081     hr_utility.set_location(' Leaving:'||l_proc, 80);
1082     --
1083   when others then
1084     --
1085     -- A validation or unexpected error has occured
1086     --
1087     ROLLBACK TO update_PER_CM;
1088     p_effective_start_date := null;
1089     p_effective_end_date := null;
1090     hr_utility.set_location(' Leaving:'||l_proc, 90);
1091     raise;
1092     --
1093 end update_PER_CM;
1094 -- ----------------------------------------------------------------------------
1095 -- |------------------------< delete_PER_CM >---------------------------------|
1096 -- ----------------------------------------------------------------------------
1097 --
1098 procedure delete_PER_CM
1099   (p_validate                       in  boolean  default false
1100   ,p_per_cm_id                      in  number
1101   ,p_effective_start_date           out nocopy date
1102   ,p_effective_end_date             out nocopy date
1103   ,p_object_version_number          in out nocopy number
1104   ,p_effective_date                 in  date
1105   ,p_datetrack_mode                 in  varchar2) is
1106   --
1107   -- Declare cursors and local variables
1108   --
1109   -- Cursor to find rows from ben_per_cm_trgr
1110   --
1111   cursor c_per_cm_trgr is
1112     select per_cm_trgr_id,
1113            object_version_number,
1114            effective_start_date,
1115            effective_end_date
1116     from   ben_per_cm_trgr_f
1117     where  per_cm_id = p_per_cm_id
1118     and    p_effective_date
1119            between effective_start_date
1120            and     effective_end_date;
1121   --
1122   -- Cursor to find rows from ben_per_cm_usg
1123   --
1124   cursor c_per_cm_usg is
1125     select per_cm_usg_id,
1126            object_version_number,
1127            effective_start_date,
1128            effective_end_date
1129     from   ben_per_cm_usg_f
1130     where  per_cm_id = p_per_cm_id
1131     and    p_effective_date
1132            between effective_start_date
1133            and     effective_end_date;
1134   --
1135   -- Cursor to find rows from ben_per_cm_trgr_prvdd
1136   --
1137   cursor c_per_cm_prvdd is
1138     select per_cm_prvdd_id,
1139            object_version_number,
1140            effective_start_date,
1141            effective_end_date
1142     from   ben_per_cm_prvdd_f
1143     where  per_cm_id = p_per_cm_id
1144     and    p_effective_date
1145            between effective_start_date
1146            and     effective_end_date;
1147   --
1148   l_proc varchar2(72) := g_package||'update_PER_CM';
1149   l_object_version_number ben_per_cm_f.object_version_number%TYPE;
1150   l_effective_start_date ben_per_cm_f.effective_start_date%TYPE;
1151   l_effective_end_date ben_per_cm_f.effective_end_date%TYPE;
1152   --
1153 begin
1154   --
1155   hr_utility.set_location('Entering:'|| l_proc, 10);
1156   --
1157   -- Issue a savepoint if operating in validation only mode
1158   --
1159   savepoint delete_PER_CM;
1160   --
1161   hr_utility.set_location(l_proc, 20);
1162   --
1163   -- Process Logic
1164   --
1165   l_object_version_number := p_object_version_number;
1166   --
1167   --
1168   begin
1169     --
1170     -- Start of API User Hook for the before hook of delete_PER_CM
1171     --
1172     ben_PER_CM_bk3.delete_PER_CM_b
1173       (p_per_cm_id                      => p_per_cm_id
1174       ,p_object_version_number          => p_object_version_number
1175       ,p_effective_date                 => trunc(p_effective_date)
1176       ,p_datetrack_mode                 => p_datetrack_mode);
1177     --
1178   exception
1179     --
1180     when hr_api.cannot_find_prog_unit then
1181       --
1182       hr_api.cannot_find_prog_unit_error
1183         (p_module_name => 'DELETE_PER_CM'
1184         ,p_hook_type   => 'BP');
1185     --
1186     -- End of API User Hook for the before hook of delete_PER_CM
1187     --
1188   end;
1189 
1190   /* Bug 9964529: While backing out the LE, while deleting the communication
1191   records in future change mode, first open the results of parent table ie ben_per_cm_f
1192   and then open the results of child tables ben_per_cm_trgr_f,ben_per_cm_usg_f,ben_per_cm_prvdd_f*/
1193   if(ben_back_out_life_event.g_backout_flag = 'Y') then
1194 	  ben_pcm_del.del
1195 	    (p_per_cm_id                     => p_per_cm_id
1196 	    ,p_effective_start_date          => l_effective_start_date
1197 	    ,p_effective_end_date            => l_effective_end_date
1198 	    ,p_object_version_number         => l_object_version_number
1199 	    ,p_effective_date                => p_effective_date
1200 	    ,p_datetrack_mode                => p_datetrack_mode);
1201   end if;
1202   --
1203   -- Before deleting the row, delete the child rows in per_cm_trgr, per_cm_usg
1204   -- and per_cm_prvdd.
1205   --
1206   -- Delete from per_cm_trgr.
1207   --
1208   for l_rec in c_per_cm_trgr loop
1209     --
1210     ben_per_cm_trgr_api.delete_per_cm_trgr
1211       (p_validate              => FALSE
1212       ,p_per_cm_trgr_id        => l_rec.per_cm_trgr_id
1213       ,p_effective_start_date  => l_rec.effective_start_date
1214       ,p_effective_end_date    => l_rec.effective_end_date
1215       ,p_object_version_number => l_rec.object_version_number
1216       ,p_effective_date        => p_effective_date
1217       ,p_datetrack_mode        => p_datetrack_mode);
1218     --
1219   end loop;
1220   --
1221   -- Delete from per_cm_trgr_usg.
1222   --
1223   for l_rec in c_per_cm_usg loop
1224     --
1225     ben_per_cm_usg_api.delete_per_cm_usg
1226       (p_validate              => FALSE
1227       ,p_per_cm_usg_id         => l_rec.per_cm_usg_id
1228       ,p_effective_start_date  => l_rec.effective_start_date
1229       ,p_effective_end_date    => l_rec.effective_end_date
1230       ,p_object_version_number => l_rec.object_version_number
1231       ,p_effective_date        => p_effective_date
1232       ,p_datetrack_mode        => p_datetrack_mode);
1233     --
1234   end loop;
1235   --
1236   -- Delete from per_cm_prvdd.
1237   --
1238   for l_rec in c_per_cm_prvdd loop
1239     --
1240     ben_per_cm_prvdd_api.delete_per_cm_prvdd
1241       (p_validate              => FALSE
1242       ,p_per_cm_prvdd_id       => l_rec.per_cm_prvdd_id
1243       ,p_effective_start_date  => l_rec.effective_start_date
1244       ,p_effective_end_date    => l_rec.effective_end_date
1245       ,p_object_version_number => l_rec.object_version_number
1246       ,p_effective_date        => p_effective_date
1247       ,p_datetrack_mode        => p_datetrack_mode);
1248     --
1249   end loop;
1250   --
1251   -- Call the pcm rowhandler to delete the row.
1252   --
1253   /* Bug 9964529: While deleting the communication records when a LE is processed, first end the results of
1254   child tables ie ben_per_cm_trgr_f,ben_per_cm_usg_f,ben_per_cm_prvdd_f and then
1255   end the result of parent table ben_per_cm_f*/
1256  if( nvl(ben_back_out_life_event.g_backout_flag,'N') = 'N') then
1257 	  ben_pcm_del.del
1258 	    (p_per_cm_id                     => p_per_cm_id
1259 	    ,p_effective_start_date          => l_effective_start_date
1260 	    ,p_effective_end_date            => l_effective_end_date
1261 	    ,p_object_version_number         => l_object_version_number
1262 	    ,p_effective_date                => p_effective_date
1263 	    ,p_datetrack_mode                => p_datetrack_mode);
1264   end if;
1265 
1266 
1267   --
1268   begin
1269     --
1270     -- Start of API User Hook for the after hook of delete_PER_CM
1271     --
1272     ben_PER_CM_bk3.delete_PER_CM_a
1273       (p_per_cm_id                      =>  p_per_cm_id
1274       ,p_effective_start_date           =>  l_effective_start_date
1275       ,p_effective_end_date             =>  l_effective_end_date
1276       ,p_object_version_number          =>  l_object_version_number
1277       ,p_effective_date                 =>  trunc(p_effective_date)
1278       ,p_datetrack_mode                 =>  p_datetrack_mode);
1279     --
1280   exception
1281     --
1282     when hr_api.cannot_find_prog_unit then
1283       --
1284       hr_api.cannot_find_prog_unit_error
1285         (p_module_name => 'DELETE_PER_CM'
1286         ,p_hook_type   => 'AP');
1287     --
1288     -- End of API User Hook for the after hook of delete_PER_CM
1289     --
1290   end;
1291   --
1292   hr_utility.set_location(l_proc, 60);
1293   --
1294   -- When in validation only mode raise the Validate_Enabled exception
1295   --
1296   if p_validate then
1297     raise hr_api.validate_enabled;
1298   end if;
1299   --
1300   hr_utility.set_location(' Leaving:'||l_proc, 70);
1301   --
1302 exception
1303   --
1304   when hr_api.validate_enabled then
1305     --
1306     -- As the Validate_Enabled exception has been raised
1307     -- we must rollback to the savepoint
1308     --
1309     ROLLBACK TO delete_PER_CM;
1310     --
1311     -- Only set output warning arguments
1312     -- (Any key or derived arguments must be set to null
1313     -- when validation only mode is being used.)
1314     --
1315     p_effective_start_date := null;
1316     p_effective_end_date := null;
1317     --
1318   when others then
1319     --
1320     -- A validation or unexpected error has occured
1321     --
1322     ROLLBACK TO delete_PER_CM;
1323     p_effective_start_date := null;
1324     p_effective_end_date := null;
1325     hr_utility.set_location(' Leaving:'||l_proc, 90);
1326     raise;
1327     --
1328 end delete_PER_CM;
1329 --
1330 -- ----------------------------------------------------------------------------
1331 -- |-------------------------------< lck >------------------------------------|
1332 -- ----------------------------------------------------------------------------
1333 --
1334 procedure lck
1335   (p_per_cm_id                      in     number
1336   ,p_object_version_number          in     number
1337   ,p_effective_date                 in     date
1338   ,p_datetrack_mode                 in     varchar2
1339   ,p_validation_start_date          out nocopy    date
1340   ,p_validation_end_date            out nocopy    date) is
1341   --
1342   --
1343   -- Declare cursors and local variables
1344   --
1345   l_proc varchar2(72) := g_package||'lck';
1346   l_validation_start_date date;
1347   l_validation_end_date date;
1348   --
1349 begin
1350   --
1351   hr_utility.set_location('Entering:'|| l_proc, 10);
1352   --
1353   ben_pcm_shd.lck
1354      (p_per_cm_id                  => p_per_cm_id
1355      ,p_validation_start_date      => l_validation_start_date
1356      ,p_validation_end_date        => l_validation_end_date
1357      ,p_object_version_number      => p_object_version_number
1358      ,p_effective_date             => p_effective_date
1359      ,p_datetrack_mode             => p_datetrack_mode);
1360   --
1361   hr_utility.set_location(' Leaving:'||l_proc, 70);
1362   --
1363 end lck;
1364 --
1365 procedure create_PER_CM_W
1366   (p_per_cm_id                      out nocopy number
1367   ,p_effective_start_date           out nocopy varchar --- change
1368   ,p_effective_end_date             out nocopy varchar --- change
1369   ,p_lf_evt_ocrd_dt                 in  varchar   default null  --- change
1370   ,p_ler_id                         in  number    default null
1371   ,p_per_in_ler_id                  in  number    default null
1372   ,p_person_id                      in  number    default null
1373   ,p_cm_typ_id                      in  number    default null
1374   ,p_business_group_id              in  number    default null
1375   ,p_object_version_number          out nocopy number
1376   ,p_effective_date                 in  varchar
1377   ,p_return_status                  out nocopy varchar) is  --- change
1378 
1379   l_per_cm_id                  number;
1380   l_effective_start_date      date;
1381   l_effective_end_date        date;
1382   l_object_version_number      number;
1383   l_lf_evt_ocrd_dt             date;
1384   l_validate                   boolean := false;
1385   l_effective_date             date;
1386 begin
1387   fnd_msg_pub.initialize;
1388   p_return_status := 'S';
1389 
1390   l_effective_date := to_date(p_effective_date, 'rrrr/mm/dd');
1391   l_lf_evt_ocrd_dt  := to_date(p_lf_evt_ocrd_dt, 'rrrr/mm/dd');
1392 
1393 
1394   create_PER_CM
1395     (p_validate                       =>  l_validate
1396     ,p_per_cm_id                      =>  l_per_cm_id
1397     ,p_effective_start_date           =>  l_effective_start_date
1398     ,p_effective_end_date             =>  l_effective_end_date
1399     ,p_lf_evt_ocrd_dt                 =>  l_lf_evt_ocrd_dt
1400     ,p_rqstbl_untl_dt                 =>  null
1401     ,p_ler_id                         =>  p_ler_id
1402     ,p_per_in_ler_id                  =>  p_per_in_ler_id
1403     ,p_prtt_enrt_actn_id              =>  null
1404     ,p_person_id                      =>  p_person_id
1405     ,p_bnf_person_id                  =>  null
1406     ,p_dpnt_person_id                 =>  null
1407     ,p_cm_typ_id                      =>  p_cm_typ_id
1408     ,p_business_group_id              =>  p_business_group_id
1409     ,p_pcm_attribute_category         =>  null
1410     ,p_pcm_attribute1                 =>  null
1411     ,p_pcm_attribute2                 =>  null
1412     ,p_pcm_attribute3                 =>  null
1413     ,p_pcm_attribute4                 =>  null
1414     ,p_pcm_attribute5                 =>  null
1415     ,p_pcm_attribute6                 =>  null
1416     ,p_pcm_attribute7                 =>  null
1417     ,p_pcm_attribute8                 =>  null
1418     ,p_pcm_attribute9                 =>  null
1419     ,p_pcm_attribute10                =>  null
1420     ,p_pcm_attribute11                =>  null
1421     ,p_pcm_attribute12                =>  null
1422     ,p_pcm_attribute13                =>  null
1423     ,p_pcm_attribute14                =>  null
1424     ,p_pcm_attribute15                =>  null
1425     ,p_pcm_attribute16                =>  null
1426     ,p_pcm_attribute17                =>  null
1427     ,p_pcm_attribute18                =>  null
1428     ,p_pcm_attribute19                =>  null
1429     ,p_pcm_attribute20                =>  null
1430     ,p_pcm_attribute21                =>  null
1431     ,p_pcm_attribute22                =>  null
1432     ,p_pcm_attribute23                =>  null
1433     ,p_pcm_attribute24                =>  null
1434     ,p_pcm_attribute25                =>  null
1435     ,p_pcm_attribute26                =>  null
1436     ,p_pcm_attribute27                =>  null
1437     ,p_pcm_attribute28                =>  null
1438     ,p_pcm_attribute29                =>  null
1439     ,p_pcm_attribute30                =>  null
1440     ,p_request_id                     =>  null
1441     ,p_program_application_id         =>  null
1442     ,p_program_id                     =>  null
1443     ,p_program_update_date            =>  null
1444     ,p_object_version_number          =>  p_object_version_number
1445     ,p_effective_date                 =>  l_effective_date
1446     );
1447 
1448   p_effective_start_date := to_char(l_effective_start_date , 'rrrr/mm/dd');
1449   p_effective_end_date := to_char(l_effective_end_date , 'rrrr/mm/dd');
1450 /*exception
1451   --
1452   when others then
1453     p_return_status := 'E';
1454     fnd_msg_pub.initialize;
1455     fnd_msg_pub.add;
1456 */
1457   --
1458 end create_per_cm_w;
1459 
1460 end ben_PER_CM_api;