DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PSF_INS

Source


1 Package Body hr_psf_ins as
2 /* $Header: hrpsfrhi.pkb 120.14.12020000.5 2013/04/12 18:20:17 pathota ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_psf_ins.';  -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_position_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_position_id  in  number) is
20 --
21   l_proc       varchar2(72) ;
22 --
23 Begin
24 g_debug := hr_utility.debug_enabled;
25 if g_debug then
26 l_proc        := g_package||'set_base_key_value';
27   hr_utility.set_location('Entering:'||l_proc, 10);
28 end if;
29   --
30   hr_psf_ins.g_position_id_i := p_position_id;
31   --
32 if g_debug then
33   hr_utility.set_location(' Leaving:'||l_proc, 20);
34 end if;
35 End set_base_key_value;
36 --
37 -- ----------------------------------------------------------------------------
38 -- |----------------------------< dt_insert_dml >-----------------------------|
39 -- ----------------------------------------------------------------------------
40 -- {Start Of Comments}
41 --
42 -- Description:
43 --   This procedure controls the actual dml insert logic for datetrack. The
44 --   functions of this procedure are as follows:
45 --   1) Get the object_version_number.
46 --   2) To set the effective start and end dates to the corresponding
47 --      validation start and end dates. Also, the object version number
48 --      record attribute is set.
49 --   3) To insert the row into the schema with the derived effective start
50 --      and end dates and the object version number.
51 --   4) To trap any constraint violations that may have occurred.
52 --   5) To raise any other errors.
53 --
54 -- Prerequisites:
55 --   This is an internal private procedure which must be called from the
56 --   insert_dml and pre_update (logic permitting) procedure and must have
57 --   all mandatory arguments set.
58 --
59 -- In Parameters:
60 --   A Pl/Sql record structre.
61 --
62 -- Post Success:
63 --   The specified row will be inserted into the schema.
64 --
65 -- Post Failure:
66 --   If a check or unique integrity constraint violation is raised the
67 --   constraint_error procedure will be called.
68 --
69 -- Developer Implementation Notes:
70 --   This is an internal datetrack maintenance procedure which should
71 --   not be modified in anyway.
72 --
73 -- Access Status:
74 --   Internal Row Handler Use Only.
75 --
76 -- {End Of Comments}
77 -- ----------------------------------------------------------------------------
78 Procedure dt_insert_dml
79    (p_rec          in out nocopy hr_psf_shd.g_rec_type,
80     p_effective_date  in   date,
81     p_datetrack_mode  in   varchar2,
82     p_validation_start_date in   date,
83     p_validation_end_date   in   date) is
84 --
85 -- Cursor to select 'old' created AOL who column values
86 --
87   Cursor C_Sel1 Is
88     select t.created_by,
89            t.creation_date
90     from   hr_all_positions_f t
91     where  t.position_id       = p_rec.position_id
92     and    t.effective_start_date =
93              hr_psf_shd.g_old_rec.effective_start_date
94     and    t.effective_end_date   = (p_validation_start_date - 1);
95 --
96   l_proc    varchar2(72) ;
97   l_created_by          hr_all_positions_f.created_by%TYPE;
98   l_creation_date       hr_all_positions_f.creation_date%TYPE;
99   l_last_update_date    hr_all_positions_f.last_update_date%TYPE;
100   l_last_updated_by     hr_all_positions_f.last_updated_by%TYPE;
101   l_last_update_login   hr_all_positions_f.last_update_login%TYPE;
102 --
103 Begin
104 if g_debug then
105   l_proc     := g_package||'dt_insert_dml';
106   hr_utility.set_location('Entering:'||l_proc, 5);
107 end if;
108   --
109   -- Get the object version number for the insert
110   --
111   p_rec.object_version_number :=
112     dt_api.get_object_version_number
113    (p_base_table_name => 'hr_all_positions_f',
114     p_base_key_column => 'position_id',
115     p_base_key_value  => p_rec.position_id);
116   --
117   -- Set the effective start and end dates to the corresponding
118   -- validation start and end dates
119   --
120   p_rec.effective_start_date := p_validation_start_date;
121   p_rec.effective_end_date   := p_validation_end_date;
122   --
123   -- If the datetrack_mode is not INSERT then we must populate the WHO
124   -- columns with the 'old' creation values and 'new' updated values.
125   --
126   If (p_datetrack_mode <> 'INSERT') then
127 if g_debug then
128     hr_utility.set_location(l_proc, 10);
129 end if;
130     --
131     -- Select the 'old' created values
132     --
133     Open C_Sel1;
134     Fetch C_Sel1 Into l_created_by, l_creation_date;
135     If C_Sel1%notfound Then
136       --
137       -- The previous 'old' created row has not been found. We need
138       -- to error as an internal datetrack problem exists.
139       --
140       Close C_Sel1;
141       hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
142       hr_utility.set_message_token('PROCEDURE', l_proc);
143       hr_utility.set_message_token('STEP','10');
144       hr_utility.raise_error;
145     End If;
146     Close C_Sel1;
147     --
148     -- Set the AOL updated WHO values
149     --
150     l_last_update_date   := sysdate;
151     l_last_updated_by    := fnd_global.user_id;
152     l_last_update_login  := fnd_global.login_id;
153   End If;
154   --
155   --
156   -- Insert the row into: hr_all_positions_f
157   --
158   insert into hr_all_positions_f
159   (   position_id,
160    effective_start_date,
161    effective_end_date,
162    availability_status_id,
163    business_group_id,
164    entry_step_id,
165    entry_grade_rule_id,
166    job_id,
167    location_id,
168    organization_id,
169    pay_freq_payroll_id,
170    position_definition_id,
171    position_transaction_id,
172    prior_position_id,
173    relief_position_id,
174    entry_grade_id,
175    successor_position_id,
176    supervisor_position_id,
177    amendment_date,
178    amendment_recommendation,
179    amendment_ref_number,
180    bargaining_unit_cd,
181    current_job_prop_end_date,
182    current_org_prop_end_date,
183    avail_status_prop_end_date,
184    date_effective,
185    date_end,
186    earliest_hire_date,
187    fill_by_date,
188    frequency,
189    fte,
190    max_persons,
191    name,
192    overlap_period,
193    overlap_unit_cd,
194    pay_term_end_day_cd,
195    pay_term_end_month_cd,
196    permanent_temporary_flag,
197    permit_recruitment_flag,
198    position_type,
199    posting_description,
200    probation_period,
201    probation_period_unit_cd,
202    replacement_required_flag,
203    review_flag,
204    seasonal_flag,
205    security_requirements,
206    status,
207    term_start_day_cd,
208    term_start_month_cd,
209    time_normal_finish,
210    time_normal_start,
211    update_source_cd,
212    working_hours,
213    works_council_approval_flag,
214    work_period_type_cd,
215    work_term_end_day_cd,
216    work_term_end_month_cd,
217         comments,
218         proposed_fte_for_layoff,
219         proposed_date_for_layoff,
220         pay_basis_id,
221         supervisor_id,
222         copied_to_old_table_flag,
223    information1,
224    information2,
225    information3,
226    information4,
227    information5,
228    information6,
229    information7,
230    information8,
231    information9,
232    information10,
233    information11,
234    information12,
235    information13,
236    information14,
237    information15,
238    information16,
239    information17,
240    information18,
241    information19,
242    information20,
243    information21,
244    information22,
245    information23,
246    information24,
247    information25,
248    information26,
249    information27,
250    information28,
251    information29,
252    information30,
253    information_category,
254    attribute1,
255    attribute2,
256    attribute3,
257    attribute4,
258    attribute5,
259    attribute6,
260    attribute7,
261    attribute8,
262    attribute9,
263    attribute10,
264    attribute11,
265    attribute12,
266    attribute13,
267    attribute14,
268    attribute15,
269    attribute16,
270    attribute17,
271    attribute18,
272    attribute19,
273    attribute20,
274    attribute21,
275    attribute22,
276    attribute23,
277    attribute24,
278    attribute25,
279    attribute26,
280    attribute27,
281    attribute28,
282    attribute29,
283    attribute30,
284    attribute_category,
285    request_id,
286    program_application_id,
287    program_id,
288    program_update_date,
289    object_version_number
290       , created_by,
291       creation_date,
292       last_update_date,
293       last_updated_by,
294       last_update_login
295   )
296   Values
297   (   p_rec.position_id,
298    p_rec.effective_start_date,
299    p_rec.effective_end_date,
300    p_rec.availability_status_id,
301    p_rec.business_group_id,
302    p_rec.entry_step_id,
303    p_rec.entry_grade_rule_id,
304    p_rec.job_id,
305    p_rec.location_id,
306    p_rec.organization_id,
307    p_rec.pay_freq_payroll_id,
308    p_rec.position_definition_id,
309    p_rec.position_transaction_id,
310    p_rec.prior_position_id,
311    p_rec.relief_position_id,
312    p_rec.entry_grade_id,
313    p_rec.successor_position_id,
314    p_rec.supervisor_position_id,
315    p_rec.amendment_date,
316    p_rec.amendment_recommendation,
317    p_rec.amendment_ref_number,
318    p_rec.bargaining_unit_cd,
319    p_rec.current_job_prop_end_date,
320    p_rec.current_org_prop_end_date,
321    p_rec.avail_status_prop_end_date,
322    p_rec.date_effective,
323    p_rec.date_end,
324    p_rec.earliest_hire_date,
325    p_rec.fill_by_date,
326    p_rec.frequency,
327    p_rec.fte,
328    p_rec.max_persons,
329    p_rec.name,
330    p_rec.overlap_period,
331    p_rec.overlap_unit_cd,
332    p_rec.pay_term_end_day_cd,
333    p_rec.pay_term_end_month_cd,
334    p_rec.permanent_temporary_flag,
335    p_rec.permit_recruitment_flag,
336    p_rec.position_type,
337    p_rec.posting_description,
338    p_rec.probation_period,
339    p_rec.probation_period_unit_cd,
340    p_rec.replacement_required_flag,
341    p_rec.review_flag,
342    p_rec.seasonal_flag,
343    p_rec.security_requirements,
344    p_rec.status,
345    p_rec.term_start_day_cd,
346    p_rec.term_start_month_cd,
347    p_rec.time_normal_finish,
348    p_rec.time_normal_start,
349    p_rec.update_source_cd,
350    p_rec.working_hours,
351    p_rec.works_council_approval_flag,
352    p_rec.work_period_type_cd,
353    p_rec.work_term_end_day_cd,
354    p_rec.work_term_end_month_cd,
355         p_rec.comments,
356         p_rec.proposed_fte_for_layoff,
357         p_rec.proposed_date_for_layoff,
358         p_rec.pay_basis_id,
359         p_rec.supervisor_id,
360         p_rec.copied_to_old_table_flag,
361    p_rec.information1,
362    p_rec.information2,
363    p_rec.information3,
364    p_rec.information4,
365    p_rec.information5,
366    p_rec.information6,
367    p_rec.information7,
368    p_rec.information8,
369    p_rec.information9,
370    p_rec.information10,
371    p_rec.information11,
372    p_rec.information12,
373    p_rec.information13,
374    p_rec.information14,
375    p_rec.information15,
376    p_rec.information16,
377    p_rec.information17,
378    p_rec.information18,
379    p_rec.information19,
380    p_rec.information20,
381    p_rec.information21,
382    p_rec.information22,
383    p_rec.information23,
384    p_rec.information24,
385    p_rec.information25,
386    p_rec.information26,
387    p_rec.information27,
388    p_rec.information28,
389    p_rec.information29,
390    p_rec.information30,
391    p_rec.information_category,
392    p_rec.attribute1,
393    p_rec.attribute2,
394    p_rec.attribute3,
395    p_rec.attribute4,
396    p_rec.attribute5,
397    p_rec.attribute6,
398    p_rec.attribute7,
399    p_rec.attribute8,
400    p_rec.attribute9,
401    p_rec.attribute10,
402    p_rec.attribute11,
403    p_rec.attribute12,
404    p_rec.attribute13,
405    p_rec.attribute14,
406    p_rec.attribute15,
407    p_rec.attribute16,
408    p_rec.attribute17,
409    p_rec.attribute18,
410    p_rec.attribute19,
411    p_rec.attribute20,
412    p_rec.attribute21,
413    p_rec.attribute22,
414    p_rec.attribute23,
415    p_rec.attribute24,
416    p_rec.attribute25,
417    p_rec.attribute26,
418    p_rec.attribute27,
419    p_rec.attribute28,
420    p_rec.attribute29,
421    p_rec.attribute30,
422    p_rec.attribute_category,
423    p_rec.request_id,
424    p_rec.program_application_id,
425    p_rec.program_id,
426    p_rec.program_update_date,
427    p_rec.object_version_number
428    , l_created_by,
429       l_creation_date,
430       l_last_update_date,
431       l_last_updated_by,
432       l_last_update_login
433   );
434   --
435 if g_debug then
436   hr_utility.set_location(' Leaving:'||l_proc, 15);
437 end if;
438 --
439 Exception
440   When hr_api.check_integrity_violated Then
441     -- A check constraint has been violated
442     hr_psf_shd.constraint_error
443       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
444   When hr_api.unique_integrity_violated Then
445     -- Unique integrity has been violated
446     hr_psf_shd.constraint_error
447       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
448   When Others Then
449     Raise;
450 End dt_insert_dml;
451 --
452 -- ----------------------------------------------------------------------------
453 -- |------------------------------< insert_dml >------------------------------|
454 -- ----------------------------------------------------------------------------
455 Procedure insert_dml
456    (p_rec          in out nocopy hr_psf_shd.g_rec_type,
457     p_effective_date  in   date,
458     p_datetrack_mode  in   varchar2,
459     p_validation_start_date in   date,
460     p_validation_end_date   in   date) is
461 --
462   l_proc varchar2(72) ;
463 --
464 Begin
465 g_debug := hr_utility.debug_enabled;
466 if g_debug then
467  l_proc   := g_package||'insert_dml';
468   hr_utility.set_location('Entering:'||l_proc, 5);
469 end if;
470   --
471   dt_insert_dml(p_rec         => p_rec,
472       p_effective_date  => p_effective_date,
473       p_datetrack_mode  => p_datetrack_mode,
474             p_validation_start_date => p_validation_start_date,
475       p_validation_end_date   => p_validation_end_date);
476   --
477 if g_debug then
478   hr_utility.set_location(' Leaving:'||l_proc, 10);
479 end if;
480 End insert_dml;
481 --
482 -- ----------------------------------------------------------------------------
483 -- |------------------------------< pre_insert >------------------------------|
484 -- ----------------------------------------------------------------------------
485 -- {Start Of Comments}
486 --
487 -- Description:
488 --   This private procedure contains any processing which is required before
489 --   the insert dml. Presently, if the entity has a corresponding primary
490 --   key which is maintained by an associating sequence, the primary key for
491 --   the entity will be populated with the next sequence value in
492 --   preparation for the insert dml.
493 --   Also, if comments are defined for this entity, the comments insert
494 --   logic will also be called, generating a comment_id if required.
495 --
496 -- Prerequisites:
497 --   This is an internal procedure which is called from the ins procedure.
498 --
499 -- In Parameters:
500 --   A Pl/Sql record structre.
501 --
502 -- Post Success:
503 --   Processing continues.
504 --
505 -- Post Failure:
506 --   If an error has occurred, an error message and exception will be raised
507 --   but not handled.
508 --
509 -- Developer Implementation Notes:
510 --   Any pre-processing required before the insert dml is issued should be
511 --   coded within this procedure. As stated above, a good example is the
512 --   generation of a primary key number via a corresponding sequence.
513 --   It is important to note that any 3rd party maintenance should be reviewed
514 --   before placing in this procedure.
515 --
516 -- Access Status:
517 --   Internal Row Handler Use Only.
518 --
519 -- {End Of Comments}
520 -- ----------------------------------------------------------------------------
521 Procedure pre_insert
522    (p_rec         in out nocopy hr_psf_shd.g_rec_type,
523     p_effective_date    in date,
524     p_datetrack_mode    in varchar2,
525     p_validation_start_date   in date,
526     p_validation_end_date     in date) is
527 --
528   l_proc varchar2(72);
529 --
530   cursor C_Sel1 is select hr_all_positions_f_s.nextval from sys.dual;
531 --
532 --
533 Begin
534 if g_debug then
535  l_proc   := g_package||'pre_insert';
536   hr_utility.set_location('Entering:'||l_proc, 5);
537 end if;
538   --
539   --
540   -- Select the next sequence number
541   --
542   Open C_Sel1;
543   Fetch C_Sel1 Into p_rec.position_id;
544   Close C_Sel1;
545   --
546   --
547 if g_debug then
548   hr_utility.set_location(' Leaving:'||l_proc, 10);
549 end if;
550 End pre_insert;
551 --
552 -- ----------------------------------------------------------------------------
553 -- |-----------------------------< post_insert >------------------------------|
554 -- ----------------------------------------------------------------------------
555 -- {Start Of Comments}
556 --
557 -- Description:
558 --   This private procedure contains any processing which is required after the
559 --   insert dml.
560 --
561 -- Prerequisites:
562 --   This is an internal procedure which is called from the ins procedure.
563 --
564 -- In Parameters:
565 --   A Pl/Sql record structre.
566 --
567 -- Post Success:
568 --   Processing continues.
569 --
570 -- Post Failure:
571 --   If an error has occurred, an error message and exception will be raised
572 --   but not handled.
573 --
574 -- Developer Implementation Notes:
575 --   Any post-processing required after the insert dml is issued should be
576 --   coded within this procedure. It is important to note that any 3rd party
577 --   maintenance should be reviewed before placing in this procedure.
578 --
579 -- Access Status:
580 --   Internal Row Handler Use Only.
581 --
582 -- {End Of Comments}
583 -- ----------------------------------------------------------------------------
584 Procedure post_insert
585    (p_rec          in hr_psf_shd.g_rec_type,
586     p_effective_date  in date,
587     p_datetrack_mode  in varchar2,
588     p_validation_start_date in date,
589     p_validation_end_date   in date) is
590 --
591   l_proc varchar2(72) ;
592 --
593 Begin
594 if g_debug then
595  l_proc   := g_package||'post_insert';
596   hr_utility.set_location('Entering:'||l_proc, 5);
597 end if;
598   -- Start of API User Hook for post_insert.
599   begin
600   hr_psf_rki.after_insert(
601   p_position_id                  => p_rec.position_id                 ,
602   p_effective_start_date         => p_rec.effective_start_date        ,
603   p_effective_end_date           => p_rec.effective_end_date          ,
604   p_availability_status_id       => p_rec.availability_status_id      ,
605   p_business_group_id            => p_rec.business_group_id           ,
606   p_entry_step_id                => p_rec.entry_step_id               ,
607   p_entry_grade_rule_id          => p_rec.entry_grade_rule_id         ,
608   p_job_id                       => p_rec.job_id                      ,
609   p_location_id                  => p_rec.location_id                 ,
610   p_organization_id              => p_rec.organization_id             ,
611   p_pay_freq_payroll_id          => p_rec.pay_freq_payroll_id         ,
612   p_position_definition_id       => p_rec.position_definition_id      ,
613   p_position_transaction_id      => p_rec.position_transaction_id     ,
614   p_prior_position_id            => p_rec.prior_position_id           ,
615   p_relief_position_id           => p_rec.relief_position_id          ,
616   p_entry_grade_id               => p_rec.entry_grade_id              ,
617   p_successor_position_id        => p_rec.successor_position_id       ,
618   p_supervisor_position_id       => p_rec.supervisor_position_id      ,
619   p_amendment_date               => p_rec.amendment_date              ,
620   p_amendment_recommendation     => p_rec.amendment_recommendation    ,
621   p_amendment_ref_number         => p_rec.amendment_ref_number        ,
622   p_bargaining_unit_cd           => p_rec.bargaining_unit_cd          ,
623   p_comments                     => p_rec.comments                    ,
624   p_current_job_prop_end_date    => p_rec.current_job_prop_end_date   ,
625   p_current_org_prop_end_date    => p_rec.current_org_prop_end_date   ,
626   p_avail_status_prop_end_date   => p_rec.avail_status_prop_end_date  ,
627   p_date_effective               => p_rec.date_effective              ,
628   p_date_end                     => p_rec.date_end                    ,
629   p_earliest_hire_date           => p_rec.earliest_hire_date          ,
630   p_fill_by_date                 => p_rec.fill_by_date                ,
631   p_frequency                    => p_rec.frequency                   ,
632   p_fte                          => p_rec.fte                         ,
633   p_max_persons                  => p_rec.max_persons                 ,
634   p_name                         => p_rec.name                        ,
635   p_overlap_period               => p_rec.overlap_period              ,
636   p_overlap_unit_cd              => p_rec.overlap_unit_cd             ,
637   p_pay_term_end_day_cd          => p_rec.pay_term_end_day_cd         ,
638   p_pay_term_end_month_cd        => p_rec.pay_term_end_month_cd       ,
639   p_permanent_temporary_flag     => p_rec.permanent_temporary_flag    ,
640   p_permit_recruitment_flag      => p_rec.permit_recruitment_flag     ,
641   p_position_type                => p_rec.position_type               ,
642   p_posting_description          => p_rec.posting_description         ,
643   p_probation_period             => p_rec.probation_period            ,
644   p_probation_period_unit_cd     => p_rec.probation_period_unit_cd    ,
645   p_replacement_required_flag    => p_rec.replacement_required_flag   ,
646   p_review_flag                  => p_rec.review_flag                 ,
647   p_seasonal_flag                => p_rec.seasonal_flag               ,
648   p_security_requirements        => p_rec.security_requirements       ,
649   p_status                       => p_rec.status                      ,
650   p_term_start_day_cd            => p_rec.term_start_day_cd           ,
651   p_term_start_month_cd          => p_rec.term_start_month_cd         ,
652   p_time_normal_finish           => p_rec.time_normal_finish          ,
653   p_time_normal_start            => p_rec.time_normal_start           ,
654   p_update_source_cd             => p_rec.update_source_cd            ,
655   p_working_hours                => p_rec.working_hours               ,
656   p_works_council_approval_flag  => p_rec.works_council_approval_flag ,
657   p_work_period_type_cd          => p_rec.work_period_type_cd         ,
658   p_work_term_end_day_cd         => p_rec.work_term_end_day_cd        ,
659   p_work_term_end_month_cd       => p_rec.work_term_end_month_cd      ,
660   p_proposed_fte_for_layoff      => p_rec.proposed_fte_for_layoff     ,
661   p_proposed_date_for_layoff     => p_rec.proposed_date_for_layoff    ,
662   p_pay_basis_id                 => p_rec.pay_basis_id                ,
663   p_supervisor_id                => p_rec.supervisor_id               ,
664   p_copied_to_old_table_flag     => p_rec.copied_to_old_table_flag    ,
665   p_information1                 => p_rec.information1                ,
666   p_information2                 => p_rec.information2                ,
667   p_information3                 => p_rec.information3                ,
668   p_information4                 => p_rec.information4                ,
669   p_information5                 => p_rec.information5                ,
670   p_information6                 => p_rec.information6                ,
671   p_information7                 => p_rec.information7                ,
672   p_information8                 => p_rec.information8                ,
673   p_information9                 => p_rec.information9                ,
674   p_information10                => p_rec.information10               ,
675   p_information11                => p_rec.information11               ,
676   p_information12                => p_rec.information12               ,
677   p_information13                => p_rec.information13               ,
678   p_information14                => p_rec.information14               ,
679   p_information15                => p_rec.information15               ,
680   p_information16                => p_rec.information16               ,
681   p_information17                => p_rec.information17               ,
682   p_information18                => p_rec.information18               ,
683   p_information19                => p_rec.information19               ,
684   p_information20                => p_rec.information20               ,
685   p_information21                => p_rec.information21               ,
686   p_information22                => p_rec.information22               ,
687   p_information23                => p_rec.information23               ,
688   p_information24                => p_rec.information24               ,
689   p_information25                => p_rec.information25               ,
690   p_information26                => p_rec.information26               ,
691   p_information27                => p_rec.information27               ,
692   p_information28                => p_rec.information28               ,
693   p_information29                => p_rec.information29               ,
694   p_information30                => p_rec.information30               ,
695   p_information_category         => p_rec.information_category        ,
696   p_attribute1                   => p_rec.attribute1                  ,
697   p_attribute2                   => p_rec.attribute2                  ,
698   p_attribute3                   => p_rec.attribute3                  ,
699   p_attribute4                   => p_rec.attribute4                  ,
700   p_attribute5                   => p_rec.attribute5                  ,
701   p_attribute6                   => p_rec.attribute6                  ,
702   p_attribute7                   => p_rec.attribute7                  ,
703   p_attribute8                   => p_rec.attribute8                  ,
704   p_attribute9                   => p_rec.attribute9                  ,
705   p_attribute10                  => p_rec.attribute10                 ,
706   p_attribute11                  => p_rec.attribute11                 ,
707   p_attribute12                  => p_rec.attribute12                 ,
708   p_attribute13                  => p_rec.attribute13                 ,
709   p_attribute14                  => p_rec.attribute14                 ,
710   p_attribute15                  => p_rec.attribute15                 ,
711   p_attribute16                  => p_rec.attribute16                 ,
712   p_attribute17                  => p_rec.attribute17                 ,
713   p_attribute18                  => p_rec.attribute18                 ,
714   p_attribute19                  => p_rec.attribute19                 ,
715   p_attribute20                  => p_rec.attribute20                 ,
716   p_attribute21                  => p_rec.attribute21                 ,
717   p_attribute22                  => p_rec.attribute22                 ,
718   p_attribute23                  => p_rec.attribute23                 ,
719   p_attribute24                  => p_rec.attribute24                 ,
720   p_attribute25                  => p_rec.attribute25                 ,
721   p_attribute26                  => p_rec.attribute26                 ,
722   p_attribute27                  => p_rec.attribute27                 ,
723   p_attribute28                  => p_rec.attribute28                 ,
724   p_attribute29                  => p_rec.attribute29                 ,
725   p_attribute30                  => p_rec.attribute30                 ,
726   p_attribute_category           => p_rec.attribute_category          ,
727   p_request_id                   => p_rec.request_id                  ,
728   p_program_application_id       => p_rec.program_application_id      ,
729   p_program_id                   => p_rec.program_id                  ,
730   p_program_update_date          => p_rec.program_update_date         ,
731   p_object_version_number        => p_rec.object_version_number       ,
732   p_effective_date         => p_effective_date       );
733   exception
734     when hr_api.cannot_find_prog_unit then
735       hr_api.cannot_find_prog_unit_error
736         (p_module_name => 'HR_ALL_POSITIONS'
737         ,p_hook_type   => 'AI'
738         );
739   End ;
740   --
741   --hr_psf_shd.position_wf_sync(p_rec.position_id , p_validation_start_date);
742     hr_psf_shd.position_wf_sync(p_position_id => p_rec.position_id
743                             , p_effective_date => p_validation_start_date
744                             , p_action         => 'INSERT'
745                             , p_eff_start_date => p_rec.effective_start_date
746                             , p_eff_end_date   => p_rec.effective_end_date );
747   --
748 if g_debug then
749   hr_utility.set_location(' Leaving:'||l_proc, 10);
750 end if;
751 End post_insert;
752 --
753 -- ----------------------------------------------------------------------------
754 -- |-------------------------------< ins_lck >--------------------------------|
755 -- ----------------------------------------------------------------------------
756 -- {Start Of Comments}
757 --
758 -- Description:
759 --   The ins_lck process has one main function to perform. When inserting
760 --   a datetracked row, we must validate the DT mode.
761 --   be manipulated.
762 --
763 -- Prerequisites:
764 --   This procedure can only be called for the datetrack mode of INSERT.
765 --
766 -- In Parameters:
767 --
768 -- Post Success:
769 --   On successful completion of the ins_lck process the parental
770 --   datetracked rows will be locked providing the p_enforce_foreign_locking
771 --   argument value is TRUE.
772 --   If the p_enforce_foreign_locking argument value is FALSE then the
773 --   parential rows are not locked.
774 --
775 -- Post Failure:
776 --   The Lck process can fail for:
777 --   1) When attempting to lock the row the row could already be locked by
778 --      another user. This will raise the HR_Api.Object_Locked exception.
779 --   2) When attempting to the lock the parent which doesn't exist.
780 --      For the entity to be locked the parent must exist!
781 --
782 -- Developer Implementation Notes:
783 --   None.
784 --
785 -- Access Status:
786 --   Internal Row Handler Use Only.
787 --
788 -- {End Of Comments}
789 -- ----------------------------------------------------------------------------
790 Procedure ins_lck
791    (p_effective_date  in  date,
792     p_datetrack_mode  in  varchar2,
793     p_rec          in  hr_psf_shd.g_rec_type,
794     p_validation_start_date out nocopy date,
795     p_validation_end_date   out nocopy date) is
796 --
797   l_proc      varchar2(72) ;
798   l_validation_start_date date;
799   l_validation_end_date   date;
800   l_status                varchar2(30);
801 --
802   cursor c1 is
803   select system_type_cd
804   from per_shared_types
805   where shared_type_id = p_rec.availability_status_id;
806 --
807 Begin
808 if g_debug then
809 l_proc         := g_package||'ins_lck';
810   hr_utility.set_location('Entering:'||l_proc, 5);
811 end if;
812   --
813   -- Validate the datetrack mode mode getting the validation start
814   -- and end dates for the specified datetrack operation.
815   --
816   dt_api.validate_dt_mode
817    (p_effective_date    => p_effective_date,
818     p_datetrack_mode    => p_datetrack_mode,
819     p_base_table_name      => 'hr_all_positions_f',
820     p_base_key_column      => 'position_id',
821     p_base_key_value       => p_rec.position_id,
822     p_parent_table_name1      => 'hr_all_positions_f',
823     p_parent_key_column1      => 'successor_position_id',
824     p_parent_key_value1       => p_rec.position_id,
825     p_parent_table_name2      => 'hr_all_positions_f',
826     p_parent_key_column2      => 'supervisor_position_id',
827     p_parent_key_value2       => p_rec.position_id,
828     p_parent_table_name3      => 'hr_all_positions_f',
829     p_parent_key_column3      => 'relief_position_id',
830     p_parent_key_value3       => p_rec.position_id,
831 /*  p_parent_table_name4      => 'hr_all_positions_f',
832     p_parent_key_column4      => 'position_id',
833     p_parent_key_value4       => p_rec.position_id,
834 */
835        p_enforce_foreign_locking => true,
836     p_validation_start_date   => l_validation_start_date,
837     p_validation_end_date     => l_validation_end_date);
838   --
839   -- Set the validation start and end date OUT arguments
840   --
841   p_validation_start_date := l_validation_start_date;
842   p_validation_end_date   := l_validation_end_date;
843   --
844   -- if date_Effective is different from effective_start_date and the status is ACTIVE
845   -- then validation_Start_Date becomes same as date_effective
846   --
847 /*  open c1;
848   fetch c1 into l_status;
849   close c1;
850   if l_status is null then
851      null;
852   end if;
853   if l_status = 'ACTIVE' then
854     if p_rec.date_Effective <> p_validation_start_date then
855       p_validation_start_Date := p_rec.date_Effective;
856     end if;
857   end if;
858   */
859 if g_debug then
860   hr_utility.set_location(' Leaving:'||l_proc, 10);
861 end if;
862 --
863 End ins_lck;
864 --
865 -- ----------------------------------------------------------------------------
866 -- |---------------------------------< ins >----------------------------------|
867 -- ----------------------------------------------------------------------------
868 Procedure ins
869   (
870   p_rec        in out nocopy hr_psf_shd.g_rec_type,
871   p_effective_date in     date,
872   p_validate       in     boolean default false
873   ) is
874 --
875   l_proc       varchar2(72);
876   l_datetrack_mode      varchar2(30) := 'INSERT';
877   l_validation_start_date  date;
878   l_validation_end_date    date;
879 Begin
880 g_debug := hr_utility.debug_enabled;
881 if g_debug then
882 l_proc          := g_package||'ins';
883   hr_utility.set_location('Entering:'||l_proc, 5);
884 end if;
885   --
886   -- Determine if the business process is to be validated.
887   --
888   If p_validate then
889     --
890     -- Issue the savepoint.
891     --
892     SAVEPOINT ins_per_per;
893   End If;
894   --
895   -- Call the lock operation
896   --
897   ins_lck
898    (p_effective_date  => p_effective_date,
899     p_datetrack_mode  => l_datetrack_mode,
900     p_rec          => p_rec,
901     p_validation_start_date => l_validation_start_date,
902     p_validation_end_date   => l_validation_end_date);
903   --
904   -- Call the supporting insert validate operations
905   --
906   hr_psf_bus.insert_validate
907    (p_rec          => p_rec,
908     p_effective_date  => p_effective_date,
909     p_datetrack_mode  => l_datetrack_mode,
910     p_validation_start_date => l_validation_start_date,
911     p_validation_end_date   => l_validation_end_date);
912   --
913   -- Call the supporting pre-insert operation
914   --
915   pre_insert
916    (p_rec          => p_rec,
917     p_effective_date  => p_effective_date,
918     p_datetrack_mode  => l_datetrack_mode,
919     p_validation_start_date => l_validation_start_date,
920     p_validation_end_date   => l_validation_end_date);
921   --
922   -- Insert the row
923   --
924   insert_dml
925    (p_rec          => p_rec,
926     p_effective_date  => p_effective_date,
927     p_datetrack_mode  => l_datetrack_mode,
928     p_validation_start_date => l_validation_start_date,
929     p_validation_end_date   => l_validation_end_date);
930   --
931   --
932   --
933 /*
934   open c1;
935   fetch c1 into l_view_all_positions_flag;
936   close c1;
937 
938   if l_view_all_positions_flag <> 'Y' then
939     insert into per_position_list
940     (position_id, security_profile_id)
941     values
942     (p_rec.position_id, p_rec.security_profile_id);
943   end if;
944 */
945   --
946   -- Call the supporting post-insert operation
947   --
948   post_insert
949    (p_rec          => p_rec,
950     p_effective_date  => p_effective_date,
951     p_datetrack_mode  => l_datetrack_mode,
952     p_validation_start_date => l_validation_start_date,
953     p_validation_end_date   => l_validation_end_date);
954   --
955   -- If we are validating then raise the Validate_Enabled exception
956   --
957   If p_validate then
958     Raise HR_Api.Validate_Enabled;
959   End If;
960   --
961   --
962 if g_debug then
963   hr_utility.set_location(' Leaving:'||l_proc, 10);
964 end if;
965 
966 Exception
967   When HR_Api.Validate_Enabled Then
968     --
969     -- As the Validate_Enabled exception has been raised
970     -- we must rollback to the savepoint
971     --
972     ROLLBACK TO ins_per_per;
973 --
974 end ins;
975 --
976 -- ----------------------------------------------------------------------------
977 -- |---------------------------------< ins >----------------------------------|
978 -- ----------------------------------------------------------------------------
979 Procedure ins
980   (
981   p_position_id                  out nocopy number,
982   p_effective_start_date         out nocopy date,
983   p_effective_end_date           out nocopy date,
984   p_availability_status_id       in number           default null,
985   p_business_group_id            in number,
986   p_entry_step_id                in number           default null,
987   p_entry_grade_rule_id          in number           default null,
988   p_job_id                       in number,
989   p_location_id                  in number           default null,
990   p_organization_id              in number,
991   p_pay_freq_payroll_id          in number           default null,
992   p_position_definition_id       in number,
993   p_position_transaction_id      in number           default null,
994   p_prior_position_id            in number           default null,
995   p_relief_position_id           in number           default null,
996   p_entry_grade_id        in number           default null,
997   p_successor_position_id        in number           default null,
998   p_supervisor_position_id       in number           default null,
999   p_amendment_date               in date             default null,
1000   p_amendment_recommendation     in varchar2         default null,
1001   p_amendment_ref_number         in varchar2         default null,
1002   p_bargaining_unit_cd           in varchar2         default null,
1003   p_comments                     in varchar2         default null,
1004   p_current_job_prop_end_date    in date             default null,
1005   p_current_org_prop_end_date    in date             default null,
1006   p_avail_status_prop_end_date   in date             default null,
1007   p_date_effective               in date,
1008   p_date_end                     in date             default null,
1009   p_earliest_hire_date           in date             default null,
1010   p_fill_by_date                 in date             default null,
1011   p_frequency                    in varchar2         default null,
1012   p_fte                          in number           default null,
1013   p_max_persons                  in number           default null,
1014   p_name                         in varchar2         default null,
1015   p_overlap_period               in number           default null,
1016   p_overlap_unit_cd              in varchar2         default null,
1017   p_pay_term_end_day_cd          in varchar2         default null,
1018   p_pay_term_end_month_cd        in varchar2         default null,
1019   p_permanent_temporary_flag     in varchar2         default null,
1020   p_permit_recruitment_flag      in varchar2         default null,
1021   p_position_type                in varchar2         default null,
1022   p_posting_description          in varchar2         default null,
1023   p_probation_period             in number           default null,
1024   p_probation_period_unit_cd     in varchar2         default null,
1025   p_replacement_required_flag    in varchar2         default null,
1026   p_review_flag                  in varchar2         default null,
1027   p_seasonal_flag                in varchar2         default null,
1028   p_security_requirements        in varchar2         default null,
1029   p_status                       in varchar2         default null,
1030   p_term_start_day_cd            in varchar2         default null,
1031   p_term_start_month_cd          in varchar2         default null,
1032   p_time_normal_finish           in varchar2         default null,
1033   p_time_normal_start            in varchar2         default null,
1034   p_update_source_cd             in varchar2         default null,
1035   p_working_hours                in number           default null,
1036   p_works_council_approval_flag  in varchar2         default null,
1037   p_work_period_type_cd          in varchar2         default null,
1038   p_work_term_end_day_cd         in varchar2         default null,
1039   p_work_term_end_month_cd       in varchar2         default null,
1040   p_proposed_fte_for_layoff      in number           default null,
1041   p_proposed_date_for_layoff     in date             default null,
1042   p_pay_basis_id                 in  number          default null,
1043   p_supervisor_id                in  number          default null,
1044   p_copied_to_old_table_flag     in  varchar2        default null,
1045   p_information1                 in varchar2         default null,
1046   p_information2                 in varchar2         default null,
1047   p_information3                 in varchar2         default null,
1048   p_information4                 in varchar2         default null,
1049   p_information5                 in varchar2         default null,
1050   p_information6                 in varchar2         default null,
1051   p_information7                 in varchar2         default null,
1052   p_information8                 in varchar2         default null,
1053   p_information9                 in varchar2         default null,
1054   p_information10                in varchar2         default null,
1055   p_information11                in varchar2         default null,
1056   p_information12                in varchar2         default null,
1057   p_information13                in varchar2         default null,
1058   p_information14                in varchar2         default null,
1059   p_information15                in varchar2         default null,
1060   p_information16                in varchar2         default null,
1061   p_information17                in varchar2         default null,
1062   p_information18                in varchar2         default null,
1063   p_information19                in varchar2         default null,
1064   p_information20                in varchar2         default null,
1065   p_information21                in varchar2         default null,
1066   p_information22                in varchar2         default null,
1067   p_information23                in varchar2         default null,
1068   p_information24                in varchar2         default null,
1069   p_information25                in varchar2         default null,
1070   p_information26                in varchar2         default null,
1071   p_information27                in varchar2         default null,
1072   p_information28                in varchar2         default null,
1073   p_information29                in varchar2         default null,
1074   p_information30                in varchar2         default null,
1075   p_information_category         in varchar2         default null,
1076   p_attribute1                   in varchar2         default null,
1077   p_attribute2                   in varchar2         default null,
1078   p_attribute3                   in varchar2         default null,
1079   p_attribute4                   in varchar2         default null,
1080   p_attribute5                   in varchar2         default null,
1081   p_attribute6                   in varchar2         default null,
1082   p_attribute7                   in varchar2         default null,
1083   p_attribute8                   in varchar2         default null,
1084   p_attribute9                   in varchar2         default null,
1085   p_attribute10                  in varchar2         default null,
1086   p_attribute11                  in varchar2         default null,
1087   p_attribute12                  in varchar2         default null,
1088   p_attribute13                  in varchar2         default null,
1089   p_attribute14                  in varchar2         default null,
1090   p_attribute15                  in varchar2         default null,
1091   p_attribute16                  in varchar2         default null,
1092   p_attribute17                  in varchar2         default null,
1093   p_attribute18                  in varchar2         default null,
1094   p_attribute19                  in varchar2         default null,
1095   p_attribute20                  in varchar2         default null,
1096   p_attribute21                  in varchar2         default null,
1097   p_attribute22                  in varchar2         default null,
1098   p_attribute23                  in varchar2         default null,
1099   p_attribute24                  in varchar2         default null,
1100   p_attribute25                  in varchar2         default null,
1101   p_attribute26                  in varchar2         default null,
1102   p_attribute27                  in varchar2         default null,
1103   p_attribute28                  in varchar2         default null,
1104   p_attribute29                  in varchar2         default null,
1105   p_attribute30                  in varchar2         default null,
1106   p_attribute_category           in varchar2         default null,
1107   p_request_id                   in number           default null,
1108   p_program_application_id       in number           default null,
1109   p_program_id                   in number           default null,
1110   p_program_update_date          in date             default null,
1111   p_object_version_number        out nocopy number,
1112   p_effective_date       in date,
1113   p_validate                     in boolean  default false,
1114   p_security_profile_id in number default hr_security.get_security_profile
1115   ) is
1116 --
1117   l_rec     hr_psf_shd.g_rec_type;
1118   l_proc varchar2(72) ;
1119 --
1120 Begin
1121 g_debug := hr_utility.debug_enabled;
1122 if g_debug then
1123 l_proc    := g_package||'ins';
1124   hr_utility.set_location('Entering:'||l_proc, 5);
1125 end if;
1126   --
1127   -- Call conversion function to turn arguments into the
1128   -- p_rec structure.
1129   --
1130   l_rec :=
1131   hr_psf_shd.convert_args
1132   (
1133   null,
1134   null,
1135   null,
1136   p_availability_status_id,
1137   p_business_group_id,
1138   p_entry_step_id,
1139   p_entry_grade_rule_id,
1140   p_job_id,
1141   p_location_id,
1142   p_organization_id,
1143   p_pay_freq_payroll_id,
1144   p_position_definition_id,
1145   p_position_transaction_id,
1146   p_prior_position_id,
1147   p_relief_position_id,
1148   p_entry_grade_id,
1149   p_successor_position_id,
1150   p_supervisor_position_id,
1151   p_amendment_date,
1152   p_amendment_recommendation,
1153   p_amendment_ref_number,
1154   p_bargaining_unit_cd,
1155   p_comments,
1156   p_current_job_prop_end_date,
1157   p_current_org_prop_end_date,
1158   p_avail_status_prop_end_date,
1159   p_date_effective,
1160   p_date_end,
1161   p_earliest_hire_date,
1162   p_fill_by_date,
1163   p_frequency,
1164   p_fte,
1165   p_max_persons,
1166   p_name,
1167   p_overlap_period,
1168   p_overlap_unit_cd,
1169   p_pay_term_end_day_cd,
1170   p_pay_term_end_month_cd,
1171   p_permanent_temporary_flag,
1172   p_permit_recruitment_flag,
1173   p_position_type,
1174   p_posting_description,
1175   p_probation_period,
1176   p_probation_period_unit_cd,
1177   p_replacement_required_flag,
1178   p_review_flag,
1179   p_seasonal_flag,
1180   p_security_requirements,
1181   p_status,
1182   p_term_start_day_cd,
1183   p_term_start_month_cd,
1184   p_time_normal_finish,
1185   p_time_normal_start,
1186   p_update_source_cd,
1187   p_working_hours,
1188   p_works_council_approval_flag,
1189   p_work_period_type_cd,
1190   p_work_term_end_day_cd,
1191   p_work_term_end_month_cd,
1192   p_proposed_fte_for_layoff,
1193   p_proposed_date_for_layoff,
1194   p_pay_basis_id,
1195   p_supervisor_id,
1196   p_copied_to_old_table_flag,
1197   p_information1,
1198   p_information2,
1199   p_information3,
1200   p_information4,
1201   p_information5,
1202   p_information6,
1203   p_information7,
1204   p_information8,
1205   p_information9,
1206   p_information10,
1207   p_information11,
1208   p_information12,
1209   p_information13,
1210   p_information14,
1211   p_information15,
1212   p_information16,
1213   p_information17,
1214   p_information18,
1215   p_information19,
1216   p_information20,
1217   p_information21,
1218   p_information22,
1219   p_information23,
1220   p_information24,
1221   p_information25,
1222   p_information26,
1223   p_information27,
1224   p_information28,
1225   p_information29,
1226   p_information30,
1227   p_information_category,
1228   p_attribute1,
1229   p_attribute2,
1230   p_attribute3,
1231   p_attribute4,
1232   p_attribute5,
1233   p_attribute6,
1234   p_attribute7,
1235   p_attribute8,
1236   p_attribute9,
1237   p_attribute10,
1238   p_attribute11,
1239   p_attribute12,
1240   p_attribute13,
1241   p_attribute14,
1242   p_attribute15,
1243   p_attribute16,
1244   p_attribute17,
1245   p_attribute18,
1246   p_attribute19,
1247   p_attribute20,
1248   p_attribute21,
1249   p_attribute22,
1250   p_attribute23,
1251   p_attribute24,
1252   p_attribute25,
1253   p_attribute26,
1254   p_attribute27,
1255   p_attribute28,
1256   p_attribute29,
1257   p_attribute30,
1258   p_attribute_category,
1259   p_request_id,
1260   p_program_application_id,
1261   p_program_id,
1262   p_program_update_date,
1263   null,
1264   p_security_profile_id
1265   );
1266   --
1267   -- Having converted the arguments into the psf_rec
1268   -- plsql record structure we call the corresponding record
1269   -- business process.
1270   --
1271   ins(l_rec, p_effective_date, p_validate);
1272   --
1273   -- Set the OUT arguments.
1274   --
1275   p_position_id         := l_rec.position_id;
1276   p_effective_start_date   := l_rec.effective_start_date;
1277   p_effective_end_date     := l_rec.effective_end_date;
1278   p_object_version_number  := l_rec.object_version_number;
1279   --
1280   --
1281 if g_debug then
1282   hr_utility.set_location(' Leaving:'||l_proc, 10);
1283 end if;
1284 End ins;
1285 --
1286 end hr_psf_ins;