DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_IVL_INS

Source


1 Package Body pay_ivl_ins as
2 /* $Header: pyivlrhi.pkb 120.0.12010000.6 2009/07/30 12:03:21 npannamp ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_ivl_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_input_value_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_input_value_id  in  number) is
20 --
21   l_proc       varchar2(72) := g_package||'set_base_key_value';
22 --
23 Begin
24   hr_utility.set_location('Entering:'||l_proc, 10);
25   --
26   pay_ivl_ins.g_input_value_id_i := p_input_value_id;
27   --
28   hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 --
32 -- ----------------------------------------------------------------------------
33 -- |----------------------------< dt_insert_dml >-----------------------------|
34 -- ----------------------------------------------------------------------------
35 -- {Start Of Comments}
36 --
37 -- Description:
38 --   This procedure controls the actual dml insert logic for datetrack. The
39 --   functions of this procedure are as follows:
40 --   1) Get the object_version_number.
41 --   2) To set the effective start and end dates to the corresponding
42 --      validation start and end dates. Also, the object version number
43 --      record attribute is set.
44 --   3) To set and unset the g_api_dml status as required (as we are about to
45 --      perform dml).
46 --   4) To insert the row into the schema with the derived effective start
47 --      and end dates and the object version number.
48 --   5) To trap any constraint violations that may have occurred.
49 --   6) To raise any other errors.
50 --
51 -- Prerequisites:
52 --   This is an internal private procedure which must be called from the
53 --   insert_dml and pre_update (logic permitting) procedure and must have
54 --   all mandatory arguments set.
55 --
56 -- In Parameters:
57 --   A Pl/Sql record structure.
58 --
59 -- Post Success:
60 --   The specified row will be inserted into the schema.
61 --
62 -- Post Failure:
63 --   On the insert dml failure it is important to note that we always reset the
64 --   g_api_dml status to false.
65 --   If a check or unique integrity constraint violation is raised the
66 --   constraint_error procedure will be called.
67 --   If any other error is reported, the error will be raised after the
68 --   g_api_dml status is reset.
69 --
70 -- Developer Implementation Notes:
71 --   This is an internal datetrack maintenance procedure which should
72 --   not be modified in anyway.
73 --
74 -- Access Status:
75 --   Internal Row Handler Use Only.
76 --
77 -- {End Of Comments}
78 -- ----------------------------------------------------------------------------
79 Procedure dt_insert_dml
80   (p_rec                     in out nocopy pay_ivl_shd.g_rec_type
81   ,p_effective_date          in date
82   ,p_datetrack_mode          in varchar2
83   ,p_validation_start_date   in date
84   ,p_validation_end_date     in date
85   ) is
86 -- Cursor to select 'old' created AOL who column values
87 --
88   Cursor C_Sel1 Is
89     select t.created_by,
90            t.creation_date
91     from   pay_input_values_f t
92     where  t.input_value_id       = p_rec.input_value_id
93     and    t.effective_start_date =
94              pay_ivl_shd.g_old_rec.effective_start_date
95     and    t.effective_end_date   = (p_validation_start_date - 1);
96 --
97   l_proc                varchar2(72) := g_package||'dt_insert_dml';
98   l_created_by          pay_input_values_f.created_by%TYPE;
99   l_creation_date       pay_input_values_f.creation_date%TYPE;
100   l_last_update_date    pay_input_values_f.last_update_date%TYPE;
101   l_last_updated_by     pay_input_values_f.last_updated_by%TYPE;
102   l_last_update_login   pay_input_values_f.last_update_login%TYPE;
103 --
104 Begin
105   hr_utility.set_location('Entering:'||l_proc, 5);
106   --
107   -- Get the object version number for the insert
108   --
109   p_rec.object_version_number :=
110     dt_api.get_object_version_number
111       (p_base_table_name => 'pay_input_values_f'
112       ,p_base_key_column => 'input_value_id'
113       ,p_base_key_value  => p_rec.input_value_id
114       );
115   --
116   -- Set the effective start and end dates to the corresponding
117   -- validation start and end dates
118   --
119   p_rec.effective_start_date := p_validation_start_date;
120   p_rec.effective_end_date   := p_validation_end_date;
121   --
122   -- If the datetrack_mode is not INSERT then we must populate the WHO
123   -- columns with the 'old' creation values and 'new' updated values.
124   --
125   If (p_datetrack_mode <> hr_api.g_insert) then
126     hr_utility.set_location(l_proc, 10);
127     --
128     -- Select the 'old' created values
129     --
130     Open C_Sel1;
131     Fetch C_Sel1 Into l_created_by, l_creation_date;
132     If C_Sel1%notfound Then
133       --
134       -- The previous 'old' created row has not been found. We need
135       -- to error as an internal datetrack problem exists.
136       --
137       Close C_Sel1;
138       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
139       fnd_message.set_token('PROCEDURE', l_proc);
140       fnd_message.set_token('STEP','10');
141       fnd_message.raise_error;
142     End If;
143     Close C_Sel1;
144     --
145     -- Set the AOL updated WHO values
146     --
147     l_last_update_date   := sysdate;
148     l_last_updated_by    := fnd_global.user_id;
149     l_last_update_login  := fnd_global.login_id;
150   End If;
151   --
152   pay_ivl_shd.g_api_dml := true;  -- Set the api dml status
153   --
154   -- Insert the row into: pay_input_values_f
155   --
156   insert into pay_input_values_f
157       (input_value_id
158       ,effective_start_date
159       ,effective_end_date
160       ,element_type_id
161       ,lookup_type
162       ,business_group_id
163       ,legislation_code
164       ,formula_id
165       ,value_set_id
166       ,display_sequence
167       ,generate_db_items_flag
168       ,hot_default_flag
169       ,mandatory_flag
170       ,name
171       ,uom
172       ,default_value
173       ,legislation_subgroup
174       ,max_value
175       ,min_value
176       ,warning_or_error
177       ,object_version_number
178       ,created_by
179       ,creation_date
180       ,last_update_date
181       ,last_updated_by
182       ,last_update_login
183       )
184   Values
185     (p_rec.input_value_id
186     ,p_rec.effective_start_date
187     ,p_rec.effective_end_date
188     ,p_rec.element_type_id
189     ,p_rec.lookup_type
190     ,p_rec.business_group_id
191     ,p_rec.legislation_code
192     ,p_rec.formula_id
193     ,p_rec.value_set_id
194     ,p_rec.display_sequence
195     ,p_rec.generate_db_items_flag
196     ,p_rec.hot_default_flag
197     ,p_rec.mandatory_flag
198     ,p_rec.name
199     ,p_rec.uom
200     ,p_rec.default_value
201     ,p_rec.legislation_subgroup
202     ,p_rec.max_value
203     ,p_rec.min_value
204     ,p_rec.warning_or_error
205     ,p_rec.object_version_number
206     ,l_created_by
207     ,l_creation_date
208     ,l_last_update_date
209     ,l_last_updated_by
210     ,l_last_update_login
211     );
212   --
213   pay_ivl_shd.g_api_dml := false;   -- Unset the api dml status
214   hr_utility.set_location(' Leaving:'||l_proc, 15);
215 --
216 Exception
217   When hr_api.check_integrity_violated Then
218     -- A check constraint has been violated
219     pay_ivl_shd.g_api_dml := false;   -- Unset the api dml status
220     pay_ivl_shd.constraint_error
221       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
222   When hr_api.unique_integrity_violated Then
223     -- Unique integrity has been violated
224     pay_ivl_shd.g_api_dml := false;   -- Unset the api dml status
225     pay_ivl_shd.constraint_error
226       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
227   When Others Then
228     pay_ivl_shd.g_api_dml := false;   -- Unset the api dml status
229     Raise;
230 End dt_insert_dml;
231 --
232 -- ----------------------------------------------------------------------------
233 -- |-----------------------< create_app_ownerships >--------------------------|
234 -- ----------------------------------------------------------------------------
235 --
236 -- Description:
237 --   This procedure inserts a row into the HR_APPLICATION_OWNERSHIPS table
238 --   when the row handler is called in the appropriate mode.
239 --
240 -- ----------------------------------------------------------------------------
241 PROCEDURE create_app_ownerships(p_pk_column  IN varchar2
242                                ,p_pk_value   IN varchar2) IS
243 --
244 CURSOR csr_definition IS
245   SELECT product_short_name
246     FROM hr_owner_definitions
247    WHERE session_id = hr_startup_data_api_support.g_session_id;
248 --
249 BEGIN
250   --
251   IF (hr_startup_data_api_support.return_startup_mode IN
252                                ('STARTUP','GENERIC')) THEN
253      --
254      FOR c1 IN csr_definition LOOP
255        --
256        INSERT INTO hr_application_ownerships
257          (key_name
258          ,key_value
259          ,product_name
260          )
261        VALUES
262          (p_pk_column
263          ,fnd_number.number_to_canonical(p_pk_value)
264          ,c1.product_short_name
265          );
266      END LOOP;
267   END IF;
268 END create_app_ownerships;
269 --
270 -- ----------------------------------------------------------------------------
271 -- |-----------------------< create_app_ownerships >--------------------------|
272 -- ----------------------------------------------------------------------------
273 PROCEDURE create_app_ownerships(p_pk_column IN varchar2
274                                ,p_pk_value  IN number) IS
275 --
276 BEGIN
277   create_app_ownerships(p_pk_column, to_char(p_pk_value));
278 END create_app_ownerships;
279 --
280 -- ----------------------------------------------------------------------------
281 -- |------------------------------< insert_dml >------------------------------|
282 -- ----------------------------------------------------------------------------
283 Procedure insert_dml
284   (p_rec                   in out nocopy pay_ivl_shd.g_rec_type
285   ,p_effective_date        in date
286   ,p_datetrack_mode        in varchar2
287   ,p_validation_start_date in date
288   ,p_validation_end_date   in date
289   ) is
290 --
291   l_proc        varchar2(72) := g_package||'insert_dml';
292 --
293 Begin
294   hr_utility.set_location('Entering:'||l_proc, 5);
295   --
296   pay_ivl_ins.dt_insert_dml
297     (p_rec                   => p_rec
298     ,p_effective_date        => p_effective_date
299     ,p_datetrack_mode        => p_datetrack_mode
300     ,p_validation_start_date => p_validation_start_date
301     ,p_validation_end_date   => p_validation_end_date
302     );
303   --
304   hr_utility.set_location(' Leaving:'||l_proc, 10);
305 End insert_dml;
306 --
307 -- ----------------------------------------------------------------------------
308 -- |------------------------------< pre_insert >------------------------------|
309 -- ----------------------------------------------------------------------------
310 -- {Start Of Comments}
311 --
312 -- Description:
313 --   This private procedure contains any processing which is required before
314 --   the insert dml. Presently, if the entity has a corresponding primary
315 --   key which is maintained by an associating sequence, the primary key for
316 --   the entity will be populated with the next sequence value in
317 --   preparation for the insert dml.
318 --   Also, if comments are defined for this entity, the comments insert
319 --   logic will also be called, generating a comment_id if required.
320 --
321 -- Prerequisites:
322 --   This is an internal procedure which is called from the ins procedure.
323 --
324 -- In Parameters:
325 --   A Pl/Sql record structure.
326 --
327 -- Post Success:
328 --   Processing continues.
329 --
330 -- Post Failure:
331 --   If an error has occurred, an error message and exception will be raised
332 --   but not handled.
333 --
334 -- Developer Implementation Notes:
335 --   Any pre-processing required before the insert dml is issued should be
336 --   coded within this procedure. As stated above, a good example is the
337 --   generation of a primary key number via a corresponding sequence.
338 --   It is important to note that any 3rd party maintenance should be reviewed
339 --   before placing in this procedure.
340 --
341 -- Access Status:
342 --   Internal Row Handler Use Only.
343 --
344 -- {End Of Comments}
345 -- ----------------------------------------------------------------------------
346 Procedure pre_insert
347   (p_rec                   in out nocopy pay_ivl_shd.g_rec_type
348   ,p_effective_date        in date
349   ,p_datetrack_mode        in varchar2
350   ,p_validation_start_date in date
351   ,p_validation_end_date   in date
352   ) is
353 --
354   Cursor C_Sel1 is select pay_input_values_s.nextval from sys.dual;
355 --
356  Cursor C_Sel2 is
357     Select null
358       from pay_input_values_f
359      where input_value_id =
360              pay_ivl_ins.g_input_value_id_i;
361 --
362   l_proc        varchar2(72) := g_package||'pre_insert';
363   l_exists      varchar2(1);
364 --
365 Begin
366   hr_utility.set_location('Entering:'||l_proc, 5);
367   --
368     If (pay_ivl_ins.g_input_value_id_i is not null) Then
369     --
370     -- Verify registered primary key values not already in use
371     --
372     Open C_Sel2;
373     Fetch C_Sel2 into l_exists;
374     If C_Sel2%found Then
375        Close C_Sel2;
376        --
377        -- The primary key values are already in use.
378        --
379        fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
380        fnd_message.set_token('TABLE_NAME','pay_input_values_f');
381        fnd_message.raise_error;
382     End If;
383     Close C_Sel2;
384     --
385     -- Use registered key values and clear globals
386     --
387     p_rec.input_value_id :=
388       pay_ivl_ins.g_input_value_id_i;
389     pay_ivl_ins.g_input_value_id_i := null;
390   Else
391     --
392     -- No registerd key values, so select the next sequence number
393     --
394     --
395     -- Select the next sequence number
396     --
397     Open C_Sel1;
398     Fetch C_Sel1 Into p_rec.input_value_id;
399     Close C_Sel1;
400   End If;
401   --
402   --
403   hr_utility.set_location(' Leaving:'||l_proc, 10);
404 End pre_insert;
405 --
406 -- ----------------------------------------------------------------------------
407 -- |----------------------------< post_insert >-------------------------------|
408 -- ----------------------------------------------------------------------------
409 -- {Start Of Comments}
410 --
411 -- Description:
412 --   This private procedure contains any processing which is required after
413 --   the insert dml.
414 --
415 -- Prerequisites:
416 --   This is an internal procedure which is called from the ins procedure.
417 --
418 -- In Parameters:
419 --   A Pl/Sql record structure.
420 --
421 -- Post Success:
422 --   Processing continues.
423 --
424 -- Post Failure:
425 --   If an error has occurred, an error message and exception will be raised
426 --   but not handled.
427 --
428 -- Developer Implementation Notes:
429 --   Any post-processing required after the insert dml is issued should be
430 --   coded within this procedure. It is important to note that any 3rd party
431 --   maintenance should be reviewed before placing in this procedure.
432 --
433 -- Access Status:
434 --   Internal Row Handler Use Only.
435 --
436 -- {End Of Comments}
437 -- ----------------------------------------------------------------------------
438 Procedure post_insert
439   (p_rec                   in pay_ivl_shd.g_rec_type
440   ,p_effective_date        in date
441   ,p_datetrack_mode        in varchar2
442   ,p_validation_start_date in date
443   ,p_validation_end_date   in date
444   ) is
445 --
446   l_proc        varchar2(72) := g_package||'post_insert';
447 --
448 Begin
449   hr_utility.set_location('Entering:'||l_proc, 5);
450   begin
451       --
452     -- insert ownerships if applicable
453     create_app_ownerships
454       ('INPUT_VALUE_ID', p_rec.input_value_id
455       );
456     --
457     --
458     pay_ivl_rki.after_insert
459       (p_effective_date
460       => p_effective_date
461       ,p_validation_start_date
462       => p_validation_start_date
463       ,p_validation_end_date
464       => p_validation_end_date
465       ,p_input_value_id
466       => p_rec.input_value_id
467       ,p_effective_start_date
468       => p_rec.effective_start_date
469       ,p_effective_end_date
470       => p_rec.effective_end_date
471       ,p_element_type_id
472       => p_rec.element_type_id
473       ,p_lookup_type
474       => p_rec.lookup_type
475       ,p_business_group_id
476       => p_rec.business_group_id
477       ,p_legislation_code
478       => p_rec.legislation_code
479       ,p_formula_id
480       => p_rec.formula_id
481       ,p_value_set_id
482       => p_rec.value_set_id
483       ,p_display_sequence
484       => p_rec.display_sequence
485       ,p_generate_db_items_flag
486       => p_rec.generate_db_items_flag
487       ,p_hot_default_flag
488       => p_rec.hot_default_flag
489       ,p_mandatory_flag
490       => p_rec.mandatory_flag
491       ,p_name
492       => p_rec.name
493       ,p_uom
494       => p_rec.uom
495       ,p_default_value
496       => p_rec.default_value
497       ,p_legislation_subgroup
498       => p_rec.legislation_subgroup
499       ,p_max_value
500       => p_rec.max_value
501       ,p_min_value
502       => p_rec.min_value
503       ,p_warning_or_error
504       => p_rec.warning_or_error
505       ,p_object_version_number
506       => p_rec.object_version_number
507       );
508     --
509   exception
510     --
511     when hr_api.cannot_find_prog_unit then
512       --
513       hr_api.cannot_find_prog_unit_error
514         (p_module_name => 'PAY_INPUT_VALUES_F'
515         ,p_hook_type   => 'AI');
516       --
517   end;
518   --
519   hr_utility.set_location(' Leaving:'||l_proc, 10);
520 End post_insert;
521 --
522 -- ----------------------------------------------------------------------------
523 -- |-------------------------------< ins_lck >--------------------------------|
524 -- ----------------------------------------------------------------------------
525 -- {Start Of Comments}
526 --
527 -- Description:
528 --   The ins_lck process has one main function to perform. When inserting
529 --   a datetracked row, we must validate the DT mode.
530 --
531 -- Prerequisites:
532 --   This procedure can only be called for the datetrack mode of INSERT.
533 --
534 -- In Parameters:
535 --
536 -- Post Success:
537 --   On successful completion of the ins_lck process the parental
538 --   datetracked rows will be locked providing the p_enforce_foreign_locking
539 --   argument value is TRUE.
540 --   If the p_enforce_foreign_locking argument value is FALSE then the
541 --   parential rows are not locked.
542 --
543 -- Post Failure:
544 --   The Lck process can fail for:
545 --   1) When attempting to lock the row the row could already be locked by
546 --      another user. This will raise the HR_Api.Object_Locked exception.
547 --   2) When attempting to the lock the parent which doesn't exist.
548 --      For the entity to be locked the parent must exist!
549 --
550 -- Developer Implementation Notes:
551 --   None.
552 --
553 -- Access Status:
554 --   Internal Row Handler Use Only.
555 --
556 -- {End Of Comments}
557 -- ----------------------------------------------------------------------------
558 Procedure ins_lck
559   (p_effective_date        in date
560   ,p_datetrack_mode        in varchar2
561   ,p_rec                   in pay_ivl_shd.g_rec_type
562   ,p_validation_start_date out nocopy date
563   ,p_validation_end_date   out nocopy date
564   ) is
565 --
566   l_proc                  varchar2(72) := g_package||'ins_lck';
567   l_validation_start_date date;
568   l_validation_end_date   date;
569 --
570 Begin
571   hr_utility.set_location('Entering:'||l_proc, 5);
572   --
573   -- Validate the datetrack mode mode getting the validation start
574   -- and end dates for the specified datetrack operation.
575   --
576   dt_api.validate_dt_mode
577     (p_effective_date          => p_effective_date
578     ,p_datetrack_mode          => p_datetrack_mode
579     ,p_base_table_name         => 'pay_input_values_f'
580     ,p_base_key_column         => 'input_value_id'
581     ,p_base_key_value          => p_rec.input_value_id
582     ,p_parent_table_name1      => 'pay_element_types_f'
583     ,p_parent_key_column1      => 'element_type_id'
584     ,p_parent_key_value1       => p_rec.element_type_id
585     ,p_enforce_foreign_locking => true
586     ,p_validation_start_date   => l_validation_start_date
587     ,p_validation_end_date     => l_validation_end_date
588     );
589   --
590   -- Set the validation start and end date OUT arguments
591   --
592   p_validation_start_date := l_validation_start_date;
593   p_validation_end_date   := l_validation_end_date;
594   --
595   hr_utility.set_location(' Leaving:'||l_proc, 10);
596   --
597 End ins_lck;
598 --
599 -- ----------------------------------------------------------------------------
600 -- |---------------------------------< ins >----------------------------------|
601 -- ----------------------------------------------------------------------------
602 Procedure ins
603   (p_effective_date              in     date
604   ,p_rec                         in out nocopy pay_ivl_shd.g_rec_type
605   ,p_default_val_warning         out nocopy    boolean
606   ,p_min_max_warning             out nocopy    boolean
607   ,p_pay_basis_warning           out nocopy    boolean
608   ,p_formula_warning             out nocopy    boolean
609   ,p_assignment_id_warning       out nocopy    boolean
610   ,p_formula_message             out nocopy    varchar2
611   ) is
612 --
613   l_proc                        varchar2(72) := g_package||'ins';
614   l_datetrack_mode              varchar2(30) := hr_api.g_insert;
615   l_validation_start_date       date;
616   l_validation_end_date         date;
617 
618   cursor csr_display_sequence is
619     select 1 + nvl(max( display_sequence ), 0)
620     from pay_input_values_f
621     where element_type_id = p_rec.element_type_id;
622 
623 --
624 Begin
625   hr_utility.set_location('Entering:'||l_proc, 5);
626   --
627   -- Call the lock operation
628   --
629   pay_ivl_ins.ins_lck
630     (p_effective_date        => p_effective_date
631     ,p_datetrack_mode        => l_datetrack_mode
632     ,p_rec                   => p_rec
633     ,p_validation_start_date => l_validation_start_date
634     ,p_validation_end_date   => l_validation_end_date
635     );
636   --
637   -- Call the supporting insert validate operations
638   --
639   pay_ivl_bus.insert_validate
640     (p_rec                   => p_rec
641     ,p_effective_date        => p_effective_date
642     ,p_datetrack_mode        => l_datetrack_mode
643     ,p_validation_start_date => l_validation_start_date
644     ,p_validation_end_date   => l_validation_end_date
645     ,p_default_val_warning   => p_default_val_warning
646     ,p_min_max_warning       => p_min_max_warning
647     ,p_pay_basis_warning     => p_pay_basis_warning
648     ,p_formula_warning       => p_formula_warning
649     ,p_assignment_id_warning => p_assignment_id_warning
650     ,p_formula_message       => p_formula_message
651     );
652   --
653   -- Call to raise any errors on multi-message list
654   hr_multi_message.end_validation_set;
655   --
656   -- Call the supporting pre-insert operation
657   --
658   pay_ivl_ins.pre_insert
659     (p_rec                   => p_rec
660     ,p_effective_date        => p_effective_date
661     ,p_datetrack_mode        => l_datetrack_mode
662     ,p_validation_start_date => l_validation_start_date
663     ,p_validation_end_date   => l_validation_end_date
664     );
665 
666   if p_rec.display_sequence is null then
667   open csr_display_sequence;
668   fetch csr_display_sequence into p_rec.display_sequence;
669   close csr_display_sequence;
670   end if;
671   --
672   -- Insert the row
673   --
674   pay_ivl_ins.insert_dml
675     (p_rec                   => p_rec
676     ,p_effective_date        => p_effective_date
677     ,p_datetrack_mode        => l_datetrack_mode
678     ,p_validation_start_date => l_validation_start_date
679     ,p_validation_end_date   => l_validation_end_date
680     );
681   --
682   -- Call the supporting post-insert operation
683   --
684   pay_ivl_ins.post_insert
685     (p_rec                   => p_rec
686     ,p_effective_date        => p_effective_date
687     ,p_datetrack_mode        => l_datetrack_mode
688     ,p_validation_start_date => l_validation_start_date
689     ,p_validation_end_date   => l_validation_end_date
690     );
691 
692   -- Call to raise any errors on multi-message list
693   hr_multi_message.end_validation_set;
694   --
695   hr_utility.set_location('Leaving:'||l_proc,10);
696 end ins;
697 --
698 -- ----------------------------------------------------------------------------
699 -- |---------------------------------< ins >----------------------------------|
700 -- ----------------------------------------------------------------------------
701 Procedure ins
702   (p_effective_date                 in     date
703   ,p_element_type_id                in     number
704   ,p_display_sequence               in     number
705   ,p_generate_db_items_flag         in     varchar2
706   ,p_hot_default_flag               in     varchar2
707   ,p_mandatory_flag                 in     varchar2
708   ,p_name                           in     varchar2
709   ,p_uom                            in     varchar2
710   ,p_lookup_type                    in     varchar2 default null
711   ,p_business_group_id              in     number   default null
712   ,p_legislation_code               in     varchar2 default null
713   ,p_formula_id                     in     number   default null
714   ,p_value_set_id                   in     number   default null
715   ,p_default_value                  in     varchar2 default null
716   ,p_legislation_subgroup           in     varchar2 default null
717   ,p_max_value                      in     varchar2 default null
718   ,p_min_value                      in     varchar2 default null
719   ,p_warning_or_error               in     varchar2 default null
720   ,p_input_value_id                 out nocopy    number
721   ,p_object_version_number          out nocopy    number
722   ,p_effective_start_date           out nocopy    date
723   ,p_effective_end_date             out nocopy    date
724   ,p_default_val_warning            out nocopy    boolean
725   ,p_min_max_warning                out nocopy    boolean
726   ,p_pay_basis_warning              out nocopy    boolean
727   ,p_formula_warning                out nocopy    boolean
728   ,p_assignment_id_warning          out nocopy    boolean
729   ,p_formula_message                out nocopy    varchar2
730   ) is
731 --
732   l_rec         pay_ivl_shd.g_rec_type;
733   l_proc        varchar2(72) := g_package||'ins';
734   l_name        pay_input_values_f.name%type;
735 --
736 Begin
737   hr_utility.set_location('Entering:'||l_proc, 5);
738   --
739   -- Check for Pay Value special case
740   -- whereby 'PAY VALUE' goes into base table
741   -- (instead of base language value)
742   if (p_name = hr_general.pay_value) then
743      l_name := 'Pay Value';
744   else
745      l_name := p_name;
746   end if;
747   --
748   -- Call conversion function to turn arguments into the
749   -- p_rec structure.
750   --
751   l_rec :=
752   pay_ivl_shd.convert_args
753     (null
754     ,null
755     ,null
756     ,p_element_type_id
757     ,p_lookup_type
758     ,p_business_group_id
759     ,p_legislation_code
760     ,p_formula_id
761     ,p_value_set_id
762     ,p_display_sequence
763     ,p_generate_db_items_flag
764     ,p_hot_default_flag
765     ,p_mandatory_flag
766     ,l_name
767     ,p_uom
768     ,p_default_value
769     ,p_legislation_subgroup
770     ,p_max_value
771     ,p_min_value
772     ,p_warning_or_error
773     ,null
774     );
775   --
776   -- Having converted the arguments into the pay_ivl_rec
777   -- plsql record structure we call the corresponding record
778   -- business process.
779   --
780   pay_ivl_ins.ins
781     (p_effective_date
782     ,l_rec
783     ,p_default_val_warning
784     ,p_min_max_warning
785     ,p_pay_basis_warning
786     ,p_formula_warning
787     ,p_assignment_id_warning
788     ,p_formula_message
789     );
790 
791 
792 
793   --
794   -- Set the OUT arguments.
795   --
796   p_input_value_id                   := l_rec.input_value_id;
797   p_effective_start_date             := l_rec.effective_start_date;
798   p_effective_end_date               := l_rec.effective_end_date;
799   p_object_version_number            := l_rec.object_version_number;
800   --
801   pay_ivt_ins.ins_tl
802   (userenv('LANG')
803   ,p_input_value_id
804   ,l_name
805   );
806 
807   --
808   hr_utility.set_location(' Leaving:'||l_proc, 10);
809 End ins;
810 --
811 end pay_ivl_ins;