DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ASG_INS

Source


1 Package Body ben_asg_ins as
2 /* $Header: beasgrhi.pkb 120.0.12010000.3 2008/08/25 13:43:54 ppentapa ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)    := '  ben_asg_ins.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_insert_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml insert logic for datetrack. The
17 --   functions of this procedure are as follows:
18 --   1) Get the object_version_number.
19 --   2) To set the effective start and end dates to the corresponding
20 --      validation start and end dates. Also, the object version number
21 --      record attribute is set.
22 --   3) To set and unset the g_api_dml status as required (as we are about to
23 --      perform dml).
24 --   4) To insert the row into the schema with the derived effective start
25 --      and end dates and the object version number.
26 --   5) To trap any constraint violations that may have occurred.
27 --   6) To raise any other errors.
28 --
29 -- Pre Conditions:
30 --   This is an internal private procedure which must be called from the
31 --   insert_dml and pre_update (logic permitting) procedure and must have
32 --   all mandatory arguments set.
33 --
34 -- In Arguments:
35 --   A Pl/Sql record structre.
36 --
37 -- Post Success:
38 --   The specified row will be inserted into the schema.
39 --
40 -- Post Failure:
41 --   On the insert dml failure it is important to note that we always reset the
42 --   g_api_dml status to false.
43 --   If a check or unique integrity constraint violation is raised the
44 --   constraint_error procedure will be called.
45 --   If any other error is reported, the error will be raised after the
46 --   g_api_dml status is reset.
47 --
48 -- Developer Implementation Notes:
49 --   This is an internal datetrack maintenance procedure which should
50 --   not be modified in anyway.
51 --
52 -- Access Status:
53 --   Internal Table Handler Use Only.
54 --
55 -- {End Of Comments}
56 -- ----------------------------------------------------------------------------
57 Procedure dt_insert_dml
58     (p_rec              in out nocopy per_asg_shd.g_rec_type,
59      p_effective_date     in    date,
60      p_datetrack_mode     in    varchar2,
61      p_validation_start_date in    date,
62      p_validation_end_date     in    date
63         ) is
64 --
65 -- Cursor to select 'old' created AOL who column values
66 --
67   Cursor C_Sel1 Is
68     select asg.created_by,
69            asg.creation_date
70     from   per_all_assignments_f asg
71     where  asg.assignment_id        = p_rec.assignment_id
72     and    asg.effective_start_date =
73              per_asg_shd.g_old_rec.effective_start_date
74     and    asg.effective_end_date   = (p_validation_start_date - 1);
75 --
76   l_proc        varchar2(72) := g_package||'dt_insert_dml';
77   l_created_by          per_all_assignments_f.created_by%TYPE;
78   l_creation_date       per_all_assignments_f.creation_date%TYPE;
79   l_last_update_date       per_all_assignments_f.last_update_date%TYPE;
80   l_last_updated_by     per_all_assignments_f.last_updated_by%TYPE;
81   l_last_update_login   per_all_assignments_f.last_update_login%TYPE;
82 --
83 Begin
84   hr_utility.set_location('Entering:'||l_proc, 5);
85   --
86   -- Get the object version number for the insert
87   --
88   p_rec.object_version_number :=
89     dt_api.get_object_version_number
90     (p_base_table_name => 'per_all_assignments_f',
91      p_base_key_column => 'assignment_id',
92      p_base_key_value  => p_rec.assignment_id);
93   --
94   -- Set the effective start and end dates to the corresponding
95   -- validation start and end dates
96   --
97   p_rec.effective_start_date := p_validation_start_date;
98   p_rec.effective_end_date   := p_validation_end_date;
99   --
100   -- If the datetrack_mode is not INSERT then we must populate the WHO
101   -- columns with the 'old' creation values and 'new' updated values.
102   --
103   If (p_datetrack_mode <> 'INSERT') then
104     hr_utility.set_location(l_proc, 10);
105     --
106     -- Select the 'old' created values
107     --
108     Open C_Sel1;
109     Fetch C_Sel1 Into l_created_by, l_creation_date;
110     If C_Sel1%notfound Then
111       --
112       -- The previous 'old' created row has not been found. We need
113       -- to error as an internal datetrack problem exists.
114       --
115       Close C_Sel1;
116       hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
117       hr_utility.set_message_token('PROCEDURE', l_proc);
118       hr_utility.set_message_token('STEP','10');
119       hr_utility.raise_error;
120     End If;
121     Close C_Sel1;
122     --
123     -- Set the AOL updated WHO values
124     --
125     l_last_update_date   := sysdate;
126     l_last_updated_by    := fnd_global.user_id;
127     l_last_update_login  := fnd_global.login_id;
128   End If;
129   --
130   per_asg_shd.g_api_dml := true;  -- Set the api dml status
131   --
132   -- Insert the row into: per_all_assignments_f
133   --
134   insert into per_all_assignments_f
135   (    assignment_id,
136     effective_start_date,
137     effective_end_date,
138     business_group_id,
139     recruiter_id,
140     grade_id,
141     position_id,
142     job_id,
143     assignment_status_type_id,
144     payroll_id,
145     location_id,
146     person_referred_by_id,
147     supervisor_id,
148     special_ceiling_step_id,
149     person_id,
150     recruitment_activity_id,
151     source_organization_id,
152     organization_id,
153     people_group_id,
154     soft_coding_keyflex_id,
155     vacancy_id,
156     pay_basis_id,
157     assignment_sequence,
158     assignment_type,
159     primary_flag,
160     application_id,
161     assignment_number,
162     change_reason,
163     comment_id,
164     date_probation_end,
165     default_code_comb_id,
166     employment_category,
167     frequency,
168     internal_address_line,
169     manager_flag,
170     normal_hours,
171     perf_review_period,
172     perf_review_period_frequency,
173     period_of_service_id,
174     probation_period,
175     probation_unit,
176     sal_review_period,
177     sal_review_period_frequency,
178     set_of_books_id,
179     source_type,
180     time_normal_finish,
181     time_normal_start,
182     bargaining_unit_code,
183     labour_union_member_flag,
184     hourly_salaried_code,
185     request_id,
186     program_application_id,
187     program_id,
188     program_update_date,
189     ass_attribute_category,
190     ass_attribute1,
191     ass_attribute2,
192     ass_attribute3,
193     ass_attribute4,
194     ass_attribute5,
195     ass_attribute6,
196     ass_attribute7,
197     ass_attribute8,
198     ass_attribute9,
199     ass_attribute10,
200     ass_attribute11,
201     ass_attribute12,
202     ass_attribute13,
203     ass_attribute14,
204     ass_attribute15,
205     ass_attribute16,
206     ass_attribute17,
207     ass_attribute18,
208     ass_attribute19,
209     ass_attribute20,
210     ass_attribute21,
211     ass_attribute22,
212     ass_attribute23,
213     ass_attribute24,
214     ass_attribute25,
215     ass_attribute26,
216     ass_attribute27,
217     ass_attribute28,
218     ass_attribute29,
219     ass_attribute30,
220     title,
221     contract_id,
222     establishment_id,
223     collective_agreement_id,
224     cagr_grade_def_id,
225     cagr_id_flex_num,
226     object_version_number,
227     created_by,
228     creation_date,
229     last_update_date,
230     last_updated_by,
231     last_update_login,
232     notice_period,
233     notice_period_uom,
234     employee_category,
235     work_at_home,
236     job_post_source_name,
237     posting_content_id,
238     period_of_placement_date_start,
239     vendor_id,
240     vendor_employee_number,
241     vendor_assignment_number,
242     assignment_category,
243     project_title,
244     applicant_rank
245   )
246   Values
247   (    p_rec.assignment_id,
248     p_rec.effective_start_date,
249     p_rec.effective_end_date,
250     p_rec.business_group_id,
251     p_rec.recruiter_id,
252     p_rec.grade_id,
253     p_rec.position_id,
254     p_rec.job_id,
255     p_rec.assignment_status_type_id,
256     p_rec.payroll_id,
257     p_rec.location_id,
258     p_rec.person_referred_by_id,
259     p_rec.supervisor_id,
260     p_rec.special_ceiling_step_id,
261     p_rec.person_id,
262     p_rec.recruitment_activity_id,
263     p_rec.source_organization_id,
264     p_rec.organization_id,
265     p_rec.people_group_id,
266     p_rec.soft_coding_keyflex_id,
267     p_rec.vacancy_id,
268     p_rec.pay_basis_id,
269     p_rec.assignment_sequence,
270     p_rec.assignment_type,
271     p_rec.primary_flag,
272     p_rec.application_id,
273     p_rec.assignment_number,
274     p_rec.change_reason,
275     p_rec.comment_id,
276     p_rec.date_probation_end,
277     p_rec.default_code_comb_id,
278     p_rec.employment_category,
279     p_rec.frequency,
280     p_rec.internal_address_line,
281     p_rec.manager_flag,
282     p_rec.normal_hours,
283     p_rec.perf_review_period,
284     p_rec.perf_review_period_frequency,
285     p_rec.period_of_service_id,
286     p_rec.probation_period,
287     p_rec.probation_unit,
288     p_rec.sal_review_period,
289     p_rec.sal_review_period_frequency,
290     p_rec.set_of_books_id,
291     p_rec.source_type,
292     p_rec.time_normal_finish,
293         p_rec.time_normal_start,
294         p_rec.bargaining_unit_code,
295         p_rec.labour_union_member_flag,
296         p_rec.hourly_salaried_code,
297     p_rec.request_id,
298     p_rec.program_application_id,
299     p_rec.program_id,
300     p_rec.program_update_date,
301     p_rec.ass_attribute_category,
302     p_rec.ass_attribute1,
303     p_rec.ass_attribute2,
304     p_rec.ass_attribute3,
305     p_rec.ass_attribute4,
306     p_rec.ass_attribute5,
307     p_rec.ass_attribute6,
308     p_rec.ass_attribute7,
309     p_rec.ass_attribute8,
310     p_rec.ass_attribute9,
311     p_rec.ass_attribute10,
312     p_rec.ass_attribute11,
313     p_rec.ass_attribute12,
314     p_rec.ass_attribute13,
315     p_rec.ass_attribute14,
316     p_rec.ass_attribute15,
317     p_rec.ass_attribute16,
318     p_rec.ass_attribute17,
319     p_rec.ass_attribute18,
320     p_rec.ass_attribute19,
321     p_rec.ass_attribute20,
322     p_rec.ass_attribute21,
323     p_rec.ass_attribute22,
324     p_rec.ass_attribute23,
325     p_rec.ass_attribute24,
326     p_rec.ass_attribute25,
327     p_rec.ass_attribute26,
328     p_rec.ass_attribute27,
329     p_rec.ass_attribute28,
330     p_rec.ass_attribute29,
331     p_rec.ass_attribute30,
332     p_rec.title,
333     p_rec.contract_id,
334     p_rec.establishment_id,
335     p_rec.collective_agreement_id,
336     p_rec.cagr_grade_def_id,
337     p_rec.cagr_id_flex_num,
338     p_rec.object_version_number,
339     l_created_by,
340     l_creation_date,
341     l_last_update_date,
342     l_last_updated_by,
343     l_last_update_login,
344     p_rec.notice_period,
345     p_rec.notice_period_uom,
346     p_rec.employee_category,
347     p_rec.work_at_home,
348     p_rec.job_post_source_name,
349     p_rec.posting_content_id,
350     p_rec.period_of_placement_date_start,
351     p_rec.vendor_id,
352     p_rec.vendor_employee_number,
353     p_rec.vendor_assignment_number,
354     p_rec.assignment_category,
355     p_rec.project_title,
356     p_rec.applicant_rank
357   );
358   --
359   per_asg_shd.g_api_dml := false;   -- Unset the api dml status
360   hr_utility.set_location(' Leaving:'||l_proc, 15);
361 --
362 Exception
363   When hr_api.check_integrity_violated Then
364     -- A check constraint has been violated
365     per_asg_shd.g_api_dml := false;   -- Unset the api dml status
366     per_asg_shd.constraint_error
367       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
368   When hr_api.unique_integrity_violated Then
369     -- Unique integrity has been violated
370     per_asg_shd.g_api_dml := false;   -- Unset the api dml status
371     per_asg_shd.constraint_error
372       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
373   When Others Then
374     per_asg_shd.g_api_dml := false;   -- Unset the api dml status
375     Raise;
376 End dt_insert_dml;
377 --
378 -- ----------------------------------------------------------------------------
382     (p_rec              in out nocopy per_asg_shd.g_rec_type,
379 -- |------------------------------< insert_dml >------------------------------|
380 -- ----------------------------------------------------------------------------
381 Procedure insert_dml
383      p_effective_date     in    date,
384      p_datetrack_mode     in    varchar2,
385      p_validation_start_date in    date,
386      p_validation_end_date     in    date) is
387 --
388   l_proc    varchar2(72) := g_package||'insert_dml';
389 --
390 Begin
391   hr_utility.set_location('Entering:'||l_proc, 5);
392   --
393   dt_insert_dml(p_rec            => p_rec,
394         p_effective_date    => p_effective_date,
395         p_datetrack_mode    => p_datetrack_mode,
396                p_validation_start_date    => p_validation_start_date,
397         p_validation_end_date    => p_validation_end_date);
398   --
399   hr_utility.set_location(' Leaving:'||l_proc, 10);
400 End insert_dml;
401 --
402 -- ----------------------------------------------------------------------------
403 -- |------------------------------< pre_insert >------------------------------|
404 -- ----------------------------------------------------------------------------
405 -- {Start Of Comments}
406 --
407 -- Description:
408 --   This private procedure contains any processing which is required before
409 --   the insert dml. Presently, if the entity has a corresponding primary
410 --   key which is maintained by an associating sequence, the primary key for
411 --   the entity will be populated with the next sequence value in
412 --   preparation for the insert dml.
413 --   Also, if comments are defined for this entity, the comments insert
414 --   logic will also be called, generating a comment_id if required.
415 --
416 -- Pre Conditions:
417 --   This is an internal procedure which is called from the ins procedure.
418 --
419 -- In Arguments:
420 --   A Pl/Sql record structre.
421 --
422 -- Post Success:
423 --   Processing continues.
424 --
425 -- Post Failure:
426 --   If an error has occurred, an error message and exception will be raised
427 --   but not handled.
428 --
429 -- Developer Implementation Notes:
430 --   Any pre-processing required before the insert dml is issued should be
431 --   coded within this procedure. As stated above, a good example is the
432 --   generation of a primary key number via a corresponding sequence.
433 --   It is important to note that any 3rd party maintenance should be reviewed
434 --   before placing in this procedure.
435 --
436 -- Access Status:
437 --   Internal Table Handler Use Only.
438 --
439 -- {End Of Comments}
440 -- ----------------------------------------------------------------------------
441 Procedure pre_insert
442     (p_rec              in out nocopy per_asg_shd.g_rec_type,
443      p_effective_date        in date,
444      p_datetrack_mode        in varchar2,
445      p_validation_start_date    in date,
446      p_validation_end_date        in date) is
447 --
448   l_proc    varchar2(72) := g_package||'pre_insert';
449   l_benefits    varchar2(1);
450 --
451   Cursor C_Sel1 is select per_assignments_s.nextval from sys.dual;
452 --
453 Begin
454   hr_utility.set_location('Entering:'||l_proc, 1);
455   --
456   -- Select the next sequence number
457   --
458   Open C_Sel1;
459   Fetch C_Sel1 Into p_rec.assignment_id;
460   Close C_Sel1;
461   hr_utility.set_location(l_proc, 10);
462   --
463   -- Insert the comment text if comments exist
464   --
465   If (p_rec.comment_text is not null) then
466     hr_comm_api.ins(p_comment_id        => p_rec.comment_id,
467                     p_source_table_name => 'PER_ALL_ASSIGNMENTS_F',
468                     p_comment_text      => p_rec.comment_text);
469   End If;
470   hr_utility.set_location(l_proc, 20);
471   --
472   -- Generate date probation end
473   --
474   -- Business Rule Mapping
475   -- =====================
476   -- Rule CHK_DATE_PROBATION_END c,e and f
477   -- Rule CHK_PROBATION_PERIOD c
478   -- Rule CHK_PROBATION_UNIT d
479   --
480   per_asg_bus2.gen_date_probation_end
481     (p_assignment_id         =>  p_rec.assignment_id
482     ,p_effective_date        =>  P_effective_date
483     ,p_probation_unit        =>  p_rec.probation_unit
484     ,p_probation_period      =>  p_rec.probation_period
485     ,p_validation_start_date =>  p_validation_start_date
486     ,p_object_version_number =>  p_rec.object_version_number
487     ,p_date_probation_end    =>  p_rec.date_probation_end
488     );
489   --
490   hr_utility.set_location(l_proc, 30);
491   --
492 End pre_insert;
493 --
494 -- ----------------------------------------------------------------------------
495 -- |-----------------------------< post_insert >------------------------------|
496 -- ----------------------------------------------------------------------------
497 -- {Start Of Comments}
498 --
499 -- Description:
500 --   This private procedure contains any processing which is required after the
501 --   insert dml.
502 --
503 -- Pre Conditions:
504 --   This is an internal procedure which is called from the ins procedure.
505 --
506 -- In Arguments:
507 --   A Pl/Sql record structre.
508 --
509 -- Post Success:
510 --   Processing continues.
511 --
515 --
512 -- Post Failure:
513 --   If an error has occurred, an error message and exception will be raised
514 --   but not handled.
516 -- Developer Implementation Notes:
517 --   Any post-processing required after the insert dml is issued should be
518 --   coded within this procedure. It is important to note that any 3rd party
519 --   maintenance should be reviewed before placing in this procedure.
520 --
521 -- Access Status:
522 --   Internal Table Handler Use Only.
523 --
524 -- {End Of Comments}
525 -- ----------------------------------------------------------------------------
526 Procedure post_insert
527     (p_rec              in per_asg_shd.g_rec_type,
528      p_effective_date     in date,
529      p_datetrack_mode     in varchar2,
530      p_validation_start_date in date,
531      p_validation_end_date     in date) is
532 --
533   l_proc    varchar2(72) := g_package||'post_insert';
534 --
535 Begin
536   hr_utility.set_location('Entering:'||l_proc, 5);
537   --
538   g_trgr_loc_chg := FALSE; --Bug 2666342
539 
540   ben_dt_trgr_handle.assignment
541     (p_rowid                   => null
542     ,p_assignment_id           => p_rec.assignment_id
543     ,p_business_group_id       => p_rec.business_group_id
544     ,p_person_id               => p_rec.person_id
545     ,p_effective_start_date    => p_rec.effective_start_date
546     ,p_effective_end_date      => p_rec.effective_end_date
547     ,p_assignment_status_type_id  => p_rec.assignment_status_type_id
548     ,p_assignment_type         => p_rec.assignment_type
549     ,p_organization_id         => p_rec.organization_id
550     ,p_primary_flag            => p_rec.primary_flag
551     ,p_change_reason           => p_rec.change_reason
552     ,p_employment_category     => p_rec.employment_category
553     ,p_frequency               => p_rec.frequency
554     ,p_grade_id                => p_rec.grade_id
555     ,p_job_id                  => p_rec.job_id
556     ,p_position_id             => p_rec.position_id
557     ,p_location_id             => p_rec.location_id
558     ,p_normal_hours            => p_rec.normal_hours
559     ,p_payroll_id              => p_rec.payroll_id
560     ,p_pay_basis_id            => p_rec.pay_basis_id
561     ,p_bargaining_unit_code    => p_rec.bargaining_unit_code
562     ,p_labour_union_member_flag => p_rec.labour_union_member_flag
563     ,p_hourly_salaried_code    => p_rec.hourly_salaried_code
564     ,p_people_group_id    => p_rec.people_group_id
565     ,p_ass_attribute1 => p_rec.ass_attribute1
566     ,p_ass_attribute2 => p_rec.ass_attribute2
567     ,p_ass_attribute3 => p_rec.ass_attribute3
568     ,p_ass_attribute4 => p_rec.ass_attribute4
569     ,p_ass_attribute5 => p_rec.ass_attribute5
570     ,p_ass_attribute6 => p_rec.ass_attribute6
571     ,p_ass_attribute7 => p_rec.ass_attribute7
572     ,p_ass_attribute8 => p_rec.ass_attribute8
573     ,p_ass_attribute9 => p_rec.ass_attribute9
574     ,p_ass_attribute10 => p_rec.ass_attribute10
575     ,p_ass_attribute11 => p_rec.ass_attribute11
576     ,p_ass_attribute12 => p_rec.ass_attribute12
577     ,p_ass_attribute13 => p_rec.ass_attribute13
578     ,p_ass_attribute14 => p_rec.ass_attribute14
579     ,p_ass_attribute15 => p_rec.ass_attribute15
580     ,p_ass_attribute16 => p_rec.ass_attribute16
581     ,p_ass_attribute17 => p_rec.ass_attribute17
582     ,p_ass_attribute18 => p_rec.ass_attribute18
583     ,p_ass_attribute19 => p_rec.ass_attribute19
584     ,p_ass_attribute20 => p_rec.ass_attribute20
585     ,p_ass_attribute21 => p_rec.ass_attribute21
586     ,p_ass_attribute22 => p_rec.ass_attribute22
587     ,p_ass_attribute23 => p_rec.ass_attribute23
588     ,p_ass_attribute24 => p_rec.ass_attribute24
589     ,p_ass_attribute25 => p_rec.ass_attribute25
590     ,p_ass_attribute26 => p_rec.ass_attribute26
591     ,p_ass_attribute27 => p_rec.ass_attribute27
592     ,p_ass_attribute28 => p_rec.ass_attribute28
593     ,p_ass_attribute29 => p_rec.ass_attribute29
594     ,p_ass_attribute30 => p_rec.ass_attribute30
595     );
596 
597     -- Reset the variable after checking for Assignment LEs
598     g_trgr_loc_chg := TRUE;
599   --
600   -- Start of API User Hook for post_insert.
601   --
602   begin
603     per_asg_rki.after_insert
604       (p_effective_date                 => p_effective_date
605       ,p_validation_start_date          => p_validation_start_date
606       ,p_validation_end_date            => p_validation_end_date
607       ,p_assignment_id                  => p_rec.assignment_id
608       ,p_effective_start_date           => p_rec.effective_start_date
609       ,p_effective_end_date             => p_rec.effective_end_date
610       ,p_business_group_id              => p_rec.business_group_id
611       ,p_recruiter_id                   => p_rec.recruiter_id
612       ,p_grade_id                       => p_rec.grade_id
613       ,p_position_id                    => p_rec.position_id
614       ,p_job_id                         => p_rec.job_id
615       ,p_assignment_status_type_id      => p_rec.assignment_status_type_id
616       ,p_payroll_id                     => p_rec.payroll_id
617       ,p_location_id                    => p_rec.location_id
618       ,p_person_referred_by_id          => p_rec.person_referred_by_id
619       ,p_supervisor_id                  => p_rec.supervisor_id
620       ,p_special_ceiling_step_id        => p_rec.special_ceiling_step_id
621       ,p_person_id                      => p_rec.person_id
622       ,p_recruitment_activity_id        => p_rec.recruitment_activity_id
626       ,p_soft_coding_keyflex_id         => p_rec.soft_coding_keyflex_id
623       ,p_source_organization_id         => p_rec.source_organization_id
624       ,p_organization_id                => p_rec.organization_id
625       ,p_people_group_id                => p_rec.people_group_id
627       ,p_vacancy_id                     => p_rec.vacancy_id
628       ,p_pay_basis_id                   => p_rec.pay_basis_id
629       ,p_assignment_sequence            => p_rec.assignment_sequence
630       ,p_assignment_type                => p_rec.assignment_type
631       ,p_primary_flag                   => p_rec.primary_flag
632       ,p_application_id                 => p_rec.application_id
633       ,p_assignment_number              => p_rec.assignment_number
634       ,p_change_reason                  => p_rec.change_reason
635       ,p_comment_id                     => p_rec.comment_id
636       ,p_date_probation_end             => p_rec.date_probation_end
637       ,p_default_code_comb_id           => p_rec.default_code_comb_id
638       ,p_employment_category            => p_rec.employment_category
639       ,p_frequency                      => p_rec.frequency
640       ,p_internal_address_line          => p_rec.internal_address_line
641       ,p_manager_flag                   => p_rec.manager_flag
642       ,p_normal_hours                   => p_rec.normal_hours
643       ,p_perf_review_period             => p_rec.perf_review_period
644       ,p_perf_review_period_frequen     => p_rec.perf_review_period_frequency
645       ,p_period_of_service_id           => p_rec.period_of_service_id
646       ,p_probation_period               => p_rec.probation_period
647       ,p_probation_unit                 => p_rec.probation_unit
648       ,p_sal_review_period              => p_rec.sal_review_period
649       ,p_sal_review_period_frequen      => p_rec.sal_review_period_frequency
650       ,p_set_of_books_id                => p_rec.set_of_books_id
651       ,p_source_type                    => p_rec.source_type
652       ,p_time_normal_finish             => p_rec.time_normal_finish
653       ,p_time_normal_start              => p_rec.time_normal_start
654       ,p_bargaining_unit_code           => p_rec.bargaining_unit_code
655       ,p_labour_union_member_flag       => p_rec.labour_union_member_flag
656       ,p_hourly_salaried_code           => p_rec.hourly_salaried_code
657       ,p_request_id                     => p_rec.request_id
658       ,p_program_application_id         => p_rec.program_application_id
659       ,p_program_id                     => p_rec.program_id
660       ,p_program_update_date            => p_rec.program_update_date
661       ,p_ass_attribute_category         => p_rec.ass_attribute_category
662       ,p_ass_attribute1                 => p_rec.ass_attribute1
663       ,p_ass_attribute2                 => p_rec.ass_attribute2
664       ,p_ass_attribute3                 => p_rec.ass_attribute3
665       ,p_ass_attribute4                 => p_rec.ass_attribute4
666       ,p_ass_attribute5                 => p_rec.ass_attribute5
667       ,p_ass_attribute6                 => p_rec.ass_attribute6
668       ,p_ass_attribute7                 => p_rec.ass_attribute7
669       ,p_ass_attribute8                 => p_rec.ass_attribute8
670       ,p_ass_attribute9                 => p_rec.ass_attribute9
671       ,p_ass_attribute10                => p_rec.ass_attribute10
672       ,p_ass_attribute11                => p_rec.ass_attribute11
673       ,p_ass_attribute12                => p_rec.ass_attribute12
674       ,p_ass_attribute13                => p_rec.ass_attribute13
675       ,p_ass_attribute14                => p_rec.ass_attribute14
676       ,p_ass_attribute15                => p_rec.ass_attribute15
677       ,p_ass_attribute16                => p_rec.ass_attribute16
678       ,p_ass_attribute17                => p_rec.ass_attribute17
679       ,p_ass_attribute18                => p_rec.ass_attribute18
680       ,p_ass_attribute19                => p_rec.ass_attribute19
681       ,p_ass_attribute20                => p_rec.ass_attribute20
682       ,p_ass_attribute21                => p_rec.ass_attribute21
683       ,p_ass_attribute22                => p_rec.ass_attribute22
684       ,p_ass_attribute23                => p_rec.ass_attribute23
685       ,p_ass_attribute24                => p_rec.ass_attribute24
686       ,p_ass_attribute25                => p_rec.ass_attribute25
687       ,p_ass_attribute26                => p_rec.ass_attribute26
688       ,p_ass_attribute27                => p_rec.ass_attribute27
689       ,p_ass_attribute28                => p_rec.ass_attribute28
690       ,p_ass_attribute29                => p_rec.ass_attribute29
691       ,p_ass_attribute30                => p_rec.ass_attribute30
692       ,p_title                          => p_rec.title
693       ,p_contract_id                    => p_rec.contract_id
694       ,p_establishment_id               => p_rec.establishment_id
695       ,p_collective_agreement_id        => p_rec.collective_agreement_id
696       ,p_cagr_grade_def_id              => p_rec.cagr_grade_def_id
697       ,p_cagr_id_flex_num               => p_rec.cagr_id_flex_num
698       ,p_object_version_number          => p_rec.object_version_number
699       ,p_notice_period          => p_rec.notice_period
700       ,p_notice_period_uom      => p_rec.notice_period_uom
701       ,p_employee_category      => p_rec.employee_category
702       ,p_work_at_home           => p_rec.work_at_home
703       ,p_job_post_source_name       => p_rec.job_post_source_name
704       ,p_posting_content_id             => p_rec.posting_content_id
705       ,p_placement_date_start           => p_rec.period_of_placement_date_start
706       ,p_vendor_id                      => p_rec.vendor_id
707       ,p_vendor_employee_number          => p_rec.vendor_employee_number
711       ,p_applicant_rank                 => p_rec.applicant_rank
708       ,p_vendor_assignment_number       => p_rec.vendor_assignment_number
709       ,p_assignment_category            => p_rec.assignment_category
710       ,p_project_title                  => p_rec.project_title
712       ,p_grade_ladder_pgm_id	        => p_rec.grade_ladder_pgm_id
713       ,p_supervisor_assignment_id       => p_rec.supervisor_assignment_id  --Bug 2976136
714       ,p_vendor_site_id                 => p_rec.vendor_site_id
715       ,p_po_header_id                   => p_rec.po_header_id
716       ,p_po_line_id                     => p_rec.po_line_id
717       ,p_projected_assignment_end       => p_rec.projected_assignment_end
718       );
719   exception
720     when hr_api.cannot_find_prog_unit then
721       hr_api.cannot_find_prog_unit_error
722         (p_module_name => 'PER_ALL_ASSIGNMENTS_F'
723         ,p_hook_type   => 'AI'
724         );
725   end;
726   -- End of API User Hook for post_insert.
727   --
728   hr_utility.set_location(' Leaving:'||l_proc, 10);
729 End post_insert;
730 -- ----------------------------------------------------------------------------
731 -- |-------------------------------< ins_lck >--------------------------------|
732 -- ----------------------------------------------------------------------------
733 -- {Start Of Comments}
734 --
735 -- Description:
736 --   The ins_lck process has one main function to perform. When inserting
737 --   a datetracked row, we must validate the DT mode.
738 --   be manipulated.
739 --
740 -- Pre Conditions:
741 --   This procedure can only be called for the datetrack mode of INSERT.
742 --
743 -- In Arguments:
744 --
745 -- Post Success:
746 --   On successful completion of the ins_lck process the parental
747 --   datetracked rows will be locked providing the p_enforce_foreign_locking
748 --   argument value is TRUE.
749 --   If the p_enforce_foreign_locking argument value is FALSE then the
750 --   parential rows are not locked.
751 --
752 -- Post Failure:
753 --   The Lck process can fail for:
754 --   1) When attempting to lock the row the row could already be locked by
755 --      another user. This will raise the HR_Api.Object_Locked exception.
756 --   2) When attempting to the lock the parent which doesn't exist.
757 --      For the entity to be locked the parent must exist!
758 --
759 -- Developer Implementation Notes:
760 --   None.
761 --
762 -- Access Status:
763 --   Internal Table Handler Use Only.
764 --
765 -- {End Of Comments}
766 -- ----------------------------------------------------------------------------
767 Procedure ins_lck
768     (p_effective_date     in  date,
769      p_datetrack_mode     in  varchar2,
770      p_rec              in  per_asg_shd.g_rec_type,
771      p_validation_start_date out nocopy date,
772      p_validation_end_date     out nocopy date) is
773 --
774   l_proc          varchar2(72) := g_package||'ins_lck';
775   l_validation_start_date date;
776   l_validation_end_date      date;
777 --
778 Begin
779   hr_utility.set_location('Entering:'||l_proc, 5);
780   --
781   -- Validate the datetrack mode getting the validation start
782   -- and end dates for the specified datetrack operation.
783   --
784   -- added position_id in parent table validation SCNair [VM]
785   --
786   -- Removed reference to pay_payrolls_f
787   -- as part of fix for bug 1056246.
788   --
789 
790          --parent_table_name1      => 'pay_payrolls_f',
791          --parent_key_column1      => 'payroll_id',
792          --parent_key_value1       => p_rec.payroll_id,
793   dt_api.validate_dt_mode
794         (p_effective_date          => p_effective_date,
795          p_datetrack_mode          => p_datetrack_mode,
796          p_base_table_name         => 'per_all_assignments_f',
797          p_base_key_column         => 'assignment_id',
798          p_base_key_value          => p_rec.assignment_id,
799          p_parent_table_name1     => 'per_all_people_f',
800          p_parent_key_column1     => 'person_id',
801          p_parent_key_value1      => p_rec.person_id,
802          p_enforce_foreign_locking => false, --true,
803          p_validation_start_date   => l_validation_start_date,
804          p_validation_end_date     => l_validation_end_date);
805   --
806   -- Set the validation start and end date OUT arguments
807   --
808   p_validation_start_date := l_validation_start_date;
809   p_validation_end_date   := l_validation_end_date;
810   --
811   hr_utility.set_location(' Leaving:'||l_proc, 15);
812 --
813 End ins_lck;
814 --
815 -- ----------------------------------------------------------------------------
816 -- |---------------------------------< ins >----------------------------------|
817 -- ----------------------------------------------------------------------------
818 Procedure ins
819   (
820   p_rec                       in out nocopy per_asg_shd.g_rec_type,
821   p_effective_date             in     date,
822   p_validate                   in     boolean default false,
823   p_validate_df_flex           in     boolean default true,
824   p_other_manager_warning      out nocopy boolean,
825   p_hourly_salaried_warning    out nocopy boolean
826   ) is
827 --
828   l_proc            varchar2(72) := g_package||'ins';
829   l_datetrack_mode        varchar2(30) := 'INSERT';
830   l_validation_start_date    date;
834 Begin
831   l_validation_end_date        date;
832   l_inv_pos_grade_warning       boolean;
833 --
835   hr_utility.set_location('Entering:'||l_proc, 5);
836   --
837   -- Determine if the business process is to be validated.
838   --
839   If p_validate then
840     --
841     -- Issue the savepoint.
842     --
843     SAVEPOINT ins_ben_asg;
844     --
845   End If;
846   --
847   -- Call the lock operation
848   --
849   ins_lck
850     (p_effective_date     => p_effective_date,
851      p_datetrack_mode     => l_datetrack_mode,
852      p_rec              => p_rec,
853          p_validation_start_date => l_validation_start_date,
854          p_validation_end_date   => l_validation_end_date
855         );
856 
857 
858   /*
859 
860   --
861   -- Validation Removed for default benefits assignment creation
862   --
863   --
864 
865   -- Call the supporting insert validate operations
866   --
867   per_asg_bus1.insert_validate
868     (p_rec                  => p_rec,
869      p_effective_date          => p_effective_date,
870      p_datetrack_mode          => l_datetrack_mode,
871      p_validation_start_date      => l_validation_start_date,
872      p_validation_end_date          => l_validation_end_date,
873          p_validate_df_flex           => p_validate_df_flex,
874          p_other_manager_warning      => p_other_manager_warning,
875          p_hourly_salaried_warning    => p_hourly_salaried_warning,
876          p_inv_pos_grade_warning      => l_inv_pos_grade_warning
877         );
878 
879   */
880 
881   --
882   -- Check Business Group
883   --
884   hr_api.validate_bus_grp_id(p_rec.business_group_id);
885 
886   --
887   -- Generate Assignment Sequence
888   --
889   per_asg_bus2.gen_assignment_sequence
890     (p_assignment_type      =>  p_rec.assignment_type
891     ,p_person_id            =>  p_rec.person_id
892     ,p_assignment_sequence  =>  p_rec.assignment_sequence
893     );
894 
895   --
896   -- Generate / Check Assignment Number
897   --
898   per_asg_bus1.gen_chk_assignment_number
899     (p_assignment_id          =>  p_rec.assignment_id
900     ,p_business_group_id      =>  p_rec.business_group_id
901     ,p_assignment_type        =>  p_rec.assignment_type
902     ,p_assignment_sequence    =>  p_rec.assignment_sequence
903     ,p_assignment_number      =>  p_rec.assignment_number
904     ,p_person_id              =>  p_rec.person_id
905     ,p_effective_date         =>  p_effective_date
906     ,p_object_version_number  =>  p_rec.object_version_number
907     );
908 
909 
910   --
911   -- Call the supporting pre-insert operation
912   --
913   pre_insert
914      (p_rec             => p_rec,
915      p_effective_date     => p_effective_date,
916      p_datetrack_mode     => l_datetrack_mode,
917      p_validation_start_date => l_validation_start_date,
918      p_validation_end_date     => l_validation_end_date
919         );
920   --
921   -- Insert the row
922   --
923   insert_dml
924      (p_rec             => p_rec,
925      p_effective_date     => p_effective_date,
926      p_datetrack_mode     => l_datetrack_mode,
927      p_validation_start_date => l_validation_start_date,
928      p_validation_end_date     => l_validation_end_date
929         );
930   --
931   -- Call the supporting post-insert operation
932   --
933   post_insert
934      (p_rec             => p_rec,
935      p_effective_date     => p_effective_date,
936      p_datetrack_mode     => l_datetrack_mode,
937      p_validation_start_date => l_validation_start_date,
938      p_validation_end_date     => l_validation_end_date
939         );
940   --
941   -- If we are validating then raise the Validate_Enabled exception
942   --
943   If p_validate then
944     Raise HR_Api.Validate_Enabled;
945   End If;
946   --
947   hr_utility.set_location(' Leaving:'||l_proc, 10);
948 Exception
949   When HR_Api.Validate_Enabled Then
950     --
951     -- As the Validate_Enabled exception has been raised
952     -- we must rollback to the savepoint
953     --
954     ROLLBACK TO ins_ben_asg;
955 end ins;
956 --
957 -- ----------------------------------------------------------------------------
958 -- |---------------------------------< ins >----------------------------------|
959 -- ----------------------------------------------------------------------------
960 Procedure ins
961   (
962   p_assignment_id                out nocopy number,
963   p_effective_start_date         out nocopy date,
964   p_effective_end_date           out nocopy date,
965   p_business_group_id            in number,
966   p_recruiter_id                 in number           default null,
967   p_grade_id                     in number           default null,
968   p_position_id                  in number           default null,
969   p_job_id                       in number           default null,
970   p_assignment_status_type_id    in number,
971   p_payroll_id                   in number           default null,
972   p_location_id                  in number           default null,
973   p_person_referred_by_id        in number           default null,
977   p_recruitment_activity_id      in number           default null,
974   p_supervisor_id                in number           default null,
975   p_special_ceiling_step_id      in number           default null,
976   p_person_id                    in number,
978   p_source_organization_id       in number           default null,
979   p_organization_id              in number,
980   p_people_group_id              in number           default null,
981   p_soft_coding_keyflex_id       in number           default null,
982   p_vacancy_id                   in number           default null,
983   p_pay_basis_id                 in number           default null,
984   p_assignment_sequence          out nocopy number,
985   p_assignment_type              in varchar2,
986   p_primary_flag                 in varchar2,
987   p_application_id               in number           default null,
988   p_assignment_number            in out nocopy varchar2,
989   p_change_reason                in varchar2         default null,
990   p_comment_id                   out nocopy number,
991   p_comments                     in varchar2         default null,
992   p_date_probation_end           in date             default null,
993   p_default_code_comb_id         in number           default null,
994   p_employment_category          in varchar2         default null,
995   p_frequency                    in varchar2         default null,
996   p_internal_address_line        in varchar2         default null,
997   p_manager_flag                 in varchar2         default null,
998   p_normal_hours                 in number           default null,
999   p_perf_review_period           in number           default null,
1000   p_perf_review_period_frequency in varchar2         default null,
1001   p_period_of_service_id         in number           default null,
1002   p_probation_period             in number           default null,
1003   p_probation_unit               in varchar2         default null,
1004   p_sal_review_period            in number           default null,
1005   p_sal_review_period_frequency  in varchar2         default null,
1006   p_set_of_books_id              in number           default null,
1007   p_source_type                  in varchar2         default null,
1008   p_time_normal_finish           in varchar2         default null,
1009   p_time_normal_start            in varchar2         default null,
1010   p_bargaining_unit_code         in varchar2         default null,
1011   p_labour_union_member_flag     in varchar2         default 'N',
1012   p_hourly_salaried_code         in varchar2         default null,
1013   p_request_id                   in number           default null,
1014   p_program_application_id       in number           default null,
1015   p_program_id                   in number           default null,
1016   p_program_update_date          in date             default null,
1017   p_ass_attribute_category       in varchar2         default null,
1018   p_ass_attribute1               in varchar2         default null,
1019   p_ass_attribute2               in varchar2         default null,
1020   p_ass_attribute3               in varchar2         default null,
1021   p_ass_attribute4               in varchar2         default null,
1022   p_ass_attribute5               in varchar2         default null,
1023   p_ass_attribute6               in varchar2         default null,
1024   p_ass_attribute7               in varchar2         default null,
1025   p_ass_attribute8               in varchar2         default null,
1026   p_ass_attribute9               in varchar2         default null,
1027   p_ass_attribute10              in varchar2         default null,
1028   p_ass_attribute11              in varchar2         default null,
1029   p_ass_attribute12              in varchar2         default null,
1030   p_ass_attribute13              in varchar2         default null,
1031   p_ass_attribute14              in varchar2         default null,
1032   p_ass_attribute15              in varchar2         default null,
1033   p_ass_attribute16              in varchar2         default null,
1034   p_ass_attribute17              in varchar2         default null,
1035   p_ass_attribute18              in varchar2         default null,
1036   p_ass_attribute19              in varchar2         default null,
1037   p_ass_attribute20              in varchar2         default null,
1038   p_ass_attribute21              in varchar2         default null,
1039   p_ass_attribute22              in varchar2         default null,
1040   p_ass_attribute23              in varchar2         default null,
1041   p_ass_attribute24              in varchar2         default null,
1042   p_ass_attribute25              in varchar2         default null,
1043   p_ass_attribute26              in varchar2         default null,
1044   p_ass_attribute27              in varchar2         default null,
1045   p_ass_attribute28              in varchar2         default null,
1046   p_ass_attribute29              in varchar2         default null,
1047   p_ass_attribute30              in varchar2         default null,
1048   p_title                        in varchar2         default null,
1049   p_validate_df_flex             in boolean          default true,
1050   p_object_version_number        out nocopy number,
1051   p_other_manager_warning        out nocopy boolean,
1052   p_hourly_salaried_warning      out nocopy boolean,
1053   p_effective_date         in date,
1054   p_validate             in boolean   default false ,
1055   p_contract_id                  in number           default null,
1059   p_cagr_id_flex_num             in number           default null,
1056   p_establishment_id             in number           default null,
1057   p_collective_agreement_id      in number           default null,
1058   p_cagr_grade_def_id            in number           default null,
1060   p_notice_period        in number       default null,
1061   p_notice_period_uom        in varchar2         default null,
1062   p_employee_category        in varchar2         default null,
1063   p_work_at_home         in varchar2         default null,
1064   p_job_post_source_name     in varchar2         default null,
1065   p_posting_content_id           in number           default null,
1066   p_placement_date_start         in date             default null,
1067   p_vendor_id                    in number           default null,
1068   p_vendor_employee_number        in varchar2         default null,
1069   p_vendor_assignment_number     in varchar2         default null,
1070   p_assignment_category          in varchar2         default null,
1071   p_project_title                in varchar2         default null,
1072   p_applicant_rank               in number           default null
1073 )
1074  is
1075 --
1076   l_rec        per_asg_shd.g_rec_type;
1077   l_proc    varchar2(72) := g_package||'ins';
1078 --
1079 Begin
1080   hr_utility.set_location('Entering:'||l_proc, 5);
1081   --
1082   -- Call conversion function to turn arguments into the
1083   -- p_rec structure.
1084   --
1085   l_rec :=
1086   per_asg_shd.convert_args
1087   (
1088   null,
1089   null,
1090   null,
1091   p_business_group_id,
1092   p_recruiter_id,
1093   p_grade_id,
1094   p_position_id,
1095   p_job_id,
1096   p_assignment_status_type_id,
1097   p_payroll_id,
1098   p_location_id,
1099   p_person_referred_by_id,
1100   p_supervisor_id,
1101   p_special_ceiling_step_id,
1102   p_person_id,
1103   p_recruitment_activity_id,
1104   p_source_organization_id,
1105   p_organization_id,
1106   p_people_group_id,
1107   p_soft_coding_keyflex_id,
1108   p_vacancy_id,
1109   p_pay_basis_id,
1110   null,
1111   p_assignment_type,
1112   p_primary_flag,
1113   p_application_id,
1114   p_assignment_number,
1115   p_change_reason,
1116   null,
1117   p_comments,
1118   p_date_probation_end,
1119   p_default_code_comb_id,
1120   p_employment_category,
1121   p_frequency,
1122   p_internal_address_line,
1123   p_manager_flag,
1124   p_normal_hours,
1125   p_perf_review_period,
1126   p_perf_review_period_frequency,
1127   p_period_of_service_id,
1128   p_probation_period,
1129   p_probation_unit,
1130   p_sal_review_period,
1131   p_sal_review_period_frequency,
1132   p_set_of_books_id,
1133   p_source_type,
1134   p_time_normal_finish,
1135   p_time_normal_start,
1136   p_bargaining_unit_code,
1137   p_labour_union_member_flag,
1138   p_hourly_salaried_code,
1139   p_request_id,
1140   p_program_application_id,
1141   p_program_id,
1142   p_program_update_date,
1143   p_ass_attribute_category,
1144   p_ass_attribute1,
1145   p_ass_attribute2,
1146   p_ass_attribute3,
1147   p_ass_attribute4,
1148   p_ass_attribute5,
1149   p_ass_attribute6,
1150   p_ass_attribute7,
1151   p_ass_attribute8,
1152   p_ass_attribute9,
1153   p_ass_attribute10,
1154   p_ass_attribute11,
1155   p_ass_attribute12,
1156   p_ass_attribute13,
1157   p_ass_attribute14,
1158   p_ass_attribute15,
1159   p_ass_attribute16,
1160   p_ass_attribute17,
1161   p_ass_attribute18,
1162   p_ass_attribute19,
1163   p_ass_attribute20,
1164   p_ass_attribute21,
1165   p_ass_attribute22,
1166   p_ass_attribute23,
1167   p_ass_attribute24,
1168   p_ass_attribute25,
1169   p_ass_attribute26,
1170   p_ass_attribute27,
1171   p_ass_attribute28,
1172   p_ass_attribute29,
1173   p_ass_attribute30,
1174   p_title,
1175   null ,
1176   p_contract_id,
1177   p_establishment_id,
1178   p_collective_agreement_id,
1179   p_cagr_grade_def_id,
1180   p_cagr_id_flex_num,
1181   p_notice_period,
1182   p_notice_period_uom,
1183   p_employee_category,
1184   p_work_at_home,
1185   p_job_post_source_name,
1186   p_posting_content_id,
1187   p_placement_date_start,
1188   p_vendor_id,
1189   p_vendor_employee_number,
1190   p_vendor_assignment_number,
1191   p_assignment_category,
1192   p_project_title,
1193   p_applicant_rank,
1194   null,
1195   null,  --Bug 2976136
1196   null ,---  p_vendor_site_id
1197   null, ---  p_po_header_id
1198   null, ---  p_po_line_id
1199   null ---   p_projected_assignment_end
1200   );
1201   --
1202   -- Having converted the arguments into the per_asg_rec
1203   -- plsql record structure we call the corresponding record
1204   -- business process.
1205   --
1206   ins(l_rec,
1207       p_effective_date,
1208       p_validate,
1209       p_validate_df_flex,
1210       p_other_manager_warning,
1211       p_hourly_salaried_warning
1212      );
1213   --
1214   -- Set the OUT arguments.
1215   --
1216   p_assignment_id            := l_rec.assignment_id;
1217   p_effective_start_date      := l_rec.effective_start_date;
1218   p_effective_end_date        := l_rec.effective_end_date;
1219   p_object_version_number     := l_rec.object_version_number;
1220   p_comment_id                  := l_rec.comment_id;
1221   p_assignment_number           := l_rec.assignment_number;
1222   p_assignment_sequence         := l_rec.assignment_sequence;
1223   --
1224   hr_utility.set_location(' Leaving:'||l_proc, 10);
1225 End ins;
1226 --
1227 end ben_asg_ins;