DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PSF_INS

Source


1 Package Body hr_psf_ins as
2 /* $Header: hrpsfrhi.pkb 120.5.12000000.2 2007/02/06 06:59:04 ande 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   --
743 if g_debug then
744   hr_utility.set_location(' Leaving:'||l_proc, 10);
745 end if;
746 End post_insert;
747 --
748 -- ----------------------------------------------------------------------------
749 -- |-------------------------------< ins_lck >--------------------------------|
750 -- ----------------------------------------------------------------------------
751 -- {Start Of Comments}
752 --
753 -- Description:
754 --   The ins_lck process has one main function to perform. When inserting
755 --   a datetracked row, we must validate the DT mode.
756 --   be manipulated.
757 --
758 -- Prerequisites:
759 --   This procedure can only be called for the datetrack mode of INSERT.
760 --
761 -- In Parameters:
762 --
763 -- Post Success:
764 --   On successful completion of the ins_lck process the parental
765 --   datetracked rows will be locked providing the p_enforce_foreign_locking
766 --   argument value is TRUE.
767 --   If the p_enforce_foreign_locking argument value is FALSE then the
768 --   parential rows are not locked.
769 --
770 -- Post Failure:
771 --   The Lck process can fail for:
772 --   1) When attempting to lock the row the row could already be locked by
773 --      another user. This will raise the HR_Api.Object_Locked exception.
774 --   2) When attempting to the lock the parent which doesn't exist.
775 --      For the entity to be locked the parent must exist!
776 --
777 -- Developer Implementation Notes:
778 --   None.
779 --
780 -- Access Status:
781 --   Internal Row Handler Use Only.
782 --
783 -- {End Of Comments}
784 -- ----------------------------------------------------------------------------
785 Procedure ins_lck
786    (p_effective_date  in  date,
787     p_datetrack_mode  in  varchar2,
788     p_rec          in  hr_psf_shd.g_rec_type,
789     p_validation_start_date out nocopy date,
790     p_validation_end_date   out nocopy date) is
791 --
792   l_proc      varchar2(72) ;
793   l_validation_start_date date;
794   l_validation_end_date   date;
795   l_status                varchar2(30);
796 --
797   cursor c1 is
798   select system_type_cd
799   from per_shared_types
800   where shared_type_id = p_rec.availability_status_id;
801 --
802 Begin
803 if g_debug then
804 l_proc         := g_package||'ins_lck';
805   hr_utility.set_location('Entering:'||l_proc, 5);
806 end if;
807   --
808   -- Validate the datetrack mode mode getting the validation start
809   -- and end dates for the specified datetrack operation.
810   --
811   dt_api.validate_dt_mode
812    (p_effective_date    => p_effective_date,
813     p_datetrack_mode    => p_datetrack_mode,
814     p_base_table_name      => 'hr_all_positions_f',
815     p_base_key_column      => 'position_id',
816     p_base_key_value       => p_rec.position_id,
817     p_parent_table_name1      => 'hr_all_positions_f',
818     p_parent_key_column1      => 'successor_position_id',
819     p_parent_key_value1       => p_rec.position_id,
820     p_parent_table_name2      => 'hr_all_positions_f',
821     p_parent_key_column2      => 'supervisor_position_id',
822     p_parent_key_value2       => p_rec.position_id,
823     p_parent_table_name3      => 'hr_all_positions_f',
824     p_parent_key_column3      => 'relief_position_id',
825     p_parent_key_value3       => p_rec.position_id,
826 /*  p_parent_table_name4      => 'hr_all_positions_f',
827     p_parent_key_column4      => 'position_id',
828     p_parent_key_value4       => p_rec.position_id,
829 */
830        p_enforce_foreign_locking => true,
831     p_validation_start_date   => l_validation_start_date,
832     p_validation_end_date     => l_validation_end_date);
833   --
834   -- Set the validation start and end date OUT arguments
835   --
836   p_validation_start_date := l_validation_start_date;
837   p_validation_end_date   := l_validation_end_date;
838   --
839   -- if date_Effective is different from effective_start_date and the status is ACTIVE
840   -- then validation_Start_Date becomes same as date_effective
841   --
842 /*  open c1;
843   fetch c1 into l_status;
844   close c1;
845   if l_status is null then
846      null;
847   end if;
848   if l_status = 'ACTIVE' then
849     if p_rec.date_Effective <> p_validation_start_date then
850       p_validation_start_Date := p_rec.date_Effective;
851     end if;
852   end if;
853   */
854 if g_debug then
855   hr_utility.set_location(' Leaving:'||l_proc, 10);
856 end if;
857 --
858 End ins_lck;
859 --
860 -- ----------------------------------------------------------------------------
861 -- |---------------------------------< ins >----------------------------------|
862 -- ----------------------------------------------------------------------------
863 Procedure ins
864   (
865   p_rec        in out nocopy hr_psf_shd.g_rec_type,
866   p_effective_date in     date,
867   p_validate       in     boolean default false
868   ) is
869 --
870   l_proc       varchar2(72);
871   l_datetrack_mode      varchar2(30) := 'INSERT';
872   l_validation_start_date  date;
873   l_validation_end_date    date;
874 Begin
875 g_debug := hr_utility.debug_enabled;
876 if g_debug then
877 l_proc          := g_package||'ins';
878   hr_utility.set_location('Entering:'||l_proc, 5);
879 end if;
880   --
881   -- Determine if the business process is to be validated.
882   --
883   If p_validate then
884     --
885     -- Issue the savepoint.
886     --
887     SAVEPOINT ins_per_per;
888   End If;
889   --
890   -- Call the lock operation
891   --
892   ins_lck
893    (p_effective_date  => p_effective_date,
894     p_datetrack_mode  => l_datetrack_mode,
895     p_rec          => p_rec,
896     p_validation_start_date => l_validation_start_date,
897     p_validation_end_date   => l_validation_end_date);
898   --
899   -- Call the supporting insert validate operations
900   --
901   hr_psf_bus.insert_validate
902    (p_rec          => p_rec,
903     p_effective_date  => p_effective_date,
904     p_datetrack_mode  => l_datetrack_mode,
905     p_validation_start_date => l_validation_start_date,
906     p_validation_end_date   => l_validation_end_date);
907   --
908   -- Call the supporting pre-insert operation
909   --
910   pre_insert
911    (p_rec          => p_rec,
912     p_effective_date  => p_effective_date,
913     p_datetrack_mode  => l_datetrack_mode,
914     p_validation_start_date => l_validation_start_date,
915     p_validation_end_date   => l_validation_end_date);
916   --
917   -- Insert the row
918   --
919   insert_dml
920    (p_rec          => p_rec,
921     p_effective_date  => p_effective_date,
922     p_datetrack_mode  => l_datetrack_mode,
923     p_validation_start_date => l_validation_start_date,
924     p_validation_end_date   => l_validation_end_date);
925   --
926   --
927   --
928 /*
929   open c1;
930   fetch c1 into l_view_all_positions_flag;
931   close c1;
932 
933   if l_view_all_positions_flag <> 'Y' then
934     insert into per_position_list
935     (position_id, security_profile_id)
936     values
937     (p_rec.position_id, p_rec.security_profile_id);
938   end if;
939 */
940   --
941   -- Call the supporting post-insert operation
942   --
943   post_insert
944    (p_rec          => p_rec,
945     p_effective_date  => p_effective_date,
946     p_datetrack_mode  => l_datetrack_mode,
947     p_validation_start_date => l_validation_start_date,
948     p_validation_end_date   => l_validation_end_date);
949   --
950   -- If we are validating then raise the Validate_Enabled exception
951   --
952   If p_validate then
953     Raise HR_Api.Validate_Enabled;
954   End If;
955   --
956   --
957 if g_debug then
958   hr_utility.set_location(' Leaving:'||l_proc, 10);
959 end if;
960 
961 Exception
962   When HR_Api.Validate_Enabled Then
963     --
964     -- As the Validate_Enabled exception has been raised
965     -- we must rollback to the savepoint
966     --
967     ROLLBACK TO ins_per_per;
968 --
969 end ins;
970 --
971 -- ----------------------------------------------------------------------------
972 -- |---------------------------------< ins >----------------------------------|
973 -- ----------------------------------------------------------------------------
974 Procedure ins
975   (
976   p_position_id                  out nocopy number,
977   p_effective_start_date         out nocopy date,
978   p_effective_end_date           out nocopy date,
979   p_availability_status_id       in number           default null,
980   p_business_group_id            in number,
981   p_entry_step_id                in number           default null,
982   p_entry_grade_rule_id          in number           default null,
983   p_job_id                       in number,
984   p_location_id                  in number           default null,
985   p_organization_id              in number,
986   p_pay_freq_payroll_id          in number           default null,
987   p_position_definition_id       in number,
988   p_position_transaction_id      in number           default null,
989   p_prior_position_id            in number           default null,
990   p_relief_position_id           in number           default null,
991   p_entry_grade_id        in number           default null,
992   p_successor_position_id        in number           default null,
993   p_supervisor_position_id       in number           default null,
994   p_amendment_date               in date             default null,
995   p_amendment_recommendation     in varchar2         default null,
996   p_amendment_ref_number         in varchar2         default null,
997   p_bargaining_unit_cd           in varchar2         default null,
998   p_comments                     in varchar2         default null,
999   p_current_job_prop_end_date    in date             default null,
1000   p_current_org_prop_end_date    in date             default null,
1001   p_avail_status_prop_end_date   in date             default null,
1002   p_date_effective               in date,
1003   p_date_end                     in date             default null,
1004   p_earliest_hire_date           in date             default null,
1005   p_fill_by_date                 in date             default null,
1006   p_frequency                    in varchar2         default null,
1007   p_fte                          in number           default null,
1008   p_max_persons                  in number           default null,
1009   p_name                         in varchar2         default null,
1010   p_overlap_period               in number           default null,
1011   p_overlap_unit_cd              in varchar2         default null,
1012   p_pay_term_end_day_cd          in varchar2         default null,
1013   p_pay_term_end_month_cd        in varchar2         default null,
1014   p_permanent_temporary_flag     in varchar2         default null,
1015   p_permit_recruitment_flag      in varchar2         default null,
1016   p_position_type                in varchar2         default null,
1017   p_posting_description          in varchar2         default null,
1018   p_probation_period             in number           default null,
1019   p_probation_period_unit_cd     in varchar2         default null,
1020   p_replacement_required_flag    in varchar2         default null,
1021   p_review_flag                  in varchar2         default null,
1022   p_seasonal_flag                in varchar2         default null,
1023   p_security_requirements        in varchar2         default null,
1024   p_status                       in varchar2         default null,
1025   p_term_start_day_cd            in varchar2         default null,
1026   p_term_start_month_cd          in varchar2         default null,
1027   p_time_normal_finish           in varchar2         default null,
1028   p_time_normal_start            in varchar2         default null,
1029   p_update_source_cd             in varchar2         default null,
1030   p_working_hours                in number           default null,
1031   p_works_council_approval_flag  in varchar2         default null,
1032   p_work_period_type_cd          in varchar2         default null,
1033   p_work_term_end_day_cd         in varchar2         default null,
1034   p_work_term_end_month_cd       in varchar2         default null,
1035   p_proposed_fte_for_layoff      in number           default null,
1036   p_proposed_date_for_layoff     in date             default null,
1037   p_pay_basis_id                 in  number          default null,
1038   p_supervisor_id                in  number          default null,
1039   p_copied_to_old_table_flag     in  varchar2        default null,
1040   p_information1                 in varchar2         default null,
1041   p_information2                 in varchar2         default null,
1042   p_information3                 in varchar2         default null,
1043   p_information4                 in varchar2         default null,
1044   p_information5                 in varchar2         default null,
1045   p_information6                 in varchar2         default null,
1046   p_information7                 in varchar2         default null,
1047   p_information8                 in varchar2         default null,
1048   p_information9                 in varchar2         default null,
1049   p_information10                in varchar2         default null,
1050   p_information11                in varchar2         default null,
1051   p_information12                in varchar2         default null,
1052   p_information13                in varchar2         default null,
1053   p_information14                in varchar2         default null,
1054   p_information15                in varchar2         default null,
1055   p_information16                in varchar2         default null,
1056   p_information17                in varchar2         default null,
1057   p_information18                in varchar2         default null,
1058   p_information19                in varchar2         default null,
1059   p_information20                in varchar2         default null,
1060   p_information21                in varchar2         default null,
1061   p_information22                in varchar2         default null,
1062   p_information23                in varchar2         default null,
1063   p_information24                in varchar2         default null,
1064   p_information25                in varchar2         default null,
1065   p_information26                in varchar2         default null,
1066   p_information27                in varchar2         default null,
1067   p_information28                in varchar2         default null,
1068   p_information29                in varchar2         default null,
1069   p_information30                in varchar2         default null,
1070   p_information_category         in varchar2         default null,
1071   p_attribute1                   in varchar2         default null,
1072   p_attribute2                   in varchar2         default null,
1073   p_attribute3                   in varchar2         default null,
1074   p_attribute4                   in varchar2         default null,
1075   p_attribute5                   in varchar2         default null,
1076   p_attribute6                   in varchar2         default null,
1077   p_attribute7                   in varchar2         default null,
1078   p_attribute8                   in varchar2         default null,
1079   p_attribute9                   in varchar2         default null,
1080   p_attribute10                  in varchar2         default null,
1081   p_attribute11                  in varchar2         default null,
1082   p_attribute12                  in varchar2         default null,
1083   p_attribute13                  in varchar2         default null,
1084   p_attribute14                  in varchar2         default null,
1085   p_attribute15                  in varchar2         default null,
1086   p_attribute16                  in varchar2         default null,
1087   p_attribute17                  in varchar2         default null,
1088   p_attribute18                  in varchar2         default null,
1089   p_attribute19                  in varchar2         default null,
1090   p_attribute20                  in varchar2         default null,
1091   p_attribute21                  in varchar2         default null,
1092   p_attribute22                  in varchar2         default null,
1093   p_attribute23                  in varchar2         default null,
1094   p_attribute24                  in varchar2         default null,
1095   p_attribute25                  in varchar2         default null,
1096   p_attribute26                  in varchar2         default null,
1097   p_attribute27                  in varchar2         default null,
1098   p_attribute28                  in varchar2         default null,
1099   p_attribute29                  in varchar2         default null,
1100   p_attribute30                  in varchar2         default null,
1101   p_attribute_category           in varchar2         default null,
1102   p_request_id                   in number           default null,
1103   p_program_application_id       in number           default null,
1104   p_program_id                   in number           default null,
1105   p_program_update_date          in date             default null,
1106   p_object_version_number        out nocopy number,
1107   p_effective_date       in date,
1108   p_validate                     in boolean  default false,
1109   p_security_profile_id in number default hr_security.get_security_profile
1110   ) is
1111 --
1112   l_rec     hr_psf_shd.g_rec_type;
1113   l_proc varchar2(72) ;
1114 --
1115 Begin
1116 g_debug := hr_utility.debug_enabled;
1117 if g_debug then
1118 l_proc    := g_package||'ins';
1119   hr_utility.set_location('Entering:'||l_proc, 5);
1120 end if;
1121   --
1122   -- Call conversion function to turn arguments into the
1123   -- p_rec structure.
1124   --
1125   l_rec :=
1126   hr_psf_shd.convert_args
1127   (
1128   null,
1129   null,
1130   null,
1131   p_availability_status_id,
1132   p_business_group_id,
1133   p_entry_step_id,
1134   p_entry_grade_rule_id,
1135   p_job_id,
1136   p_location_id,
1137   p_organization_id,
1138   p_pay_freq_payroll_id,
1139   p_position_definition_id,
1140   p_position_transaction_id,
1141   p_prior_position_id,
1142   p_relief_position_id,
1143   p_entry_grade_id,
1144   p_successor_position_id,
1145   p_supervisor_position_id,
1146   p_amendment_date,
1147   p_amendment_recommendation,
1148   p_amendment_ref_number,
1149   p_bargaining_unit_cd,
1150   p_comments,
1151   p_current_job_prop_end_date,
1152   p_current_org_prop_end_date,
1153   p_avail_status_prop_end_date,
1154   p_date_effective,
1155   p_date_end,
1156   p_earliest_hire_date,
1157   p_fill_by_date,
1158   p_frequency,
1159   p_fte,
1160   p_max_persons,
1161   p_name,
1162   p_overlap_period,
1163   p_overlap_unit_cd,
1164   p_pay_term_end_day_cd,
1165   p_pay_term_end_month_cd,
1166   p_permanent_temporary_flag,
1167   p_permit_recruitment_flag,
1168   p_position_type,
1169   p_posting_description,
1170   p_probation_period,
1171   p_probation_period_unit_cd,
1172   p_replacement_required_flag,
1173   p_review_flag,
1174   p_seasonal_flag,
1175   p_security_requirements,
1176   p_status,
1177   p_term_start_day_cd,
1178   p_term_start_month_cd,
1179   p_time_normal_finish,
1180   p_time_normal_start,
1181   p_update_source_cd,
1182   p_working_hours,
1183   p_works_council_approval_flag,
1184   p_work_period_type_cd,
1185   p_work_term_end_day_cd,
1186   p_work_term_end_month_cd,
1187   p_proposed_fte_for_layoff,
1188   p_proposed_date_for_layoff,
1189   p_pay_basis_id,
1190   p_supervisor_id,
1191   p_copied_to_old_table_flag,
1192   p_information1,
1193   p_information2,
1194   p_information3,
1195   p_information4,
1196   p_information5,
1197   p_information6,
1198   p_information7,
1199   p_information8,
1200   p_information9,
1201   p_information10,
1202   p_information11,
1203   p_information12,
1204   p_information13,
1205   p_information14,
1206   p_information15,
1207   p_information16,
1208   p_information17,
1209   p_information18,
1210   p_information19,
1211   p_information20,
1212   p_information21,
1213   p_information22,
1214   p_information23,
1215   p_information24,
1216   p_information25,
1217   p_information26,
1218   p_information27,
1219   p_information28,
1220   p_information29,
1221   p_information30,
1222   p_information_category,
1223   p_attribute1,
1224   p_attribute2,
1225   p_attribute3,
1226   p_attribute4,
1227   p_attribute5,
1228   p_attribute6,
1229   p_attribute7,
1230   p_attribute8,
1231   p_attribute9,
1232   p_attribute10,
1233   p_attribute11,
1234   p_attribute12,
1235   p_attribute13,
1236   p_attribute14,
1237   p_attribute15,
1238   p_attribute16,
1239   p_attribute17,
1240   p_attribute18,
1241   p_attribute19,
1242   p_attribute20,
1243   p_attribute21,
1244   p_attribute22,
1245   p_attribute23,
1246   p_attribute24,
1247   p_attribute25,
1248   p_attribute26,
1249   p_attribute27,
1250   p_attribute28,
1251   p_attribute29,
1252   p_attribute30,
1253   p_attribute_category,
1254   p_request_id,
1255   p_program_application_id,
1256   p_program_id,
1257   p_program_update_date,
1258   null,
1259   p_security_profile_id
1260   );
1261   --
1262   -- Having converted the arguments into the psf_rec
1263   -- plsql record structure we call the corresponding record
1264   -- business process.
1265   --
1266   ins(l_rec, p_effective_date, p_validate);
1267   --
1268   -- Set the OUT arguments.
1269   --
1270   p_position_id         := l_rec.position_id;
1271   p_effective_start_date   := l_rec.effective_start_date;
1272   p_effective_end_date     := l_rec.effective_end_date;
1273   p_object_version_number  := l_rec.object_version_number;
1274   --
1275   --
1276 if g_debug then
1277   hr_utility.set_location(' Leaving:'||l_proc, 10);
1278 end if;
1279 End ins;
1280 --
1281 end hr_psf_ins;