DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_IVL_INS

Source


1 Package Body pay_ivl_ins as
2 /* $Header: pyivlrhi.pkb 120.0 2005/05/29 06:04:43 appldev noship $ */
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 --
365 Begin
362   l_proc        varchar2(72) := g_package||'pre_insert';
363   l_exists      varchar2(1);
364 --
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   --
522 -- ----------------------------------------------------------------------------
519   hr_utility.set_location(' Leaving:'||l_proc, 10);
520 End post_insert;
521 --
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   cursor csr_db_items is
624     select multiple_entries_allowed_flag
625     from pay_element_types_f
626     where element_type_id = p_rec.element_type_id;
627 
628   l_flag pay_element_types_f.multiple_entries_allowed_flag%type;
629 
630 --
631 Begin
632   hr_utility.set_location('Entering:'||l_proc, 5);
633   --
634   -- Call the lock operation
635   --
636   pay_ivl_ins.ins_lck
637     (p_effective_date        => p_effective_date
638     ,p_datetrack_mode        => l_datetrack_mode
639     ,p_rec                   => p_rec
640     ,p_validation_start_date => l_validation_start_date
641     ,p_validation_end_date   => l_validation_end_date
642     );
643   --
644   -- Call the supporting insert validate operations
645   --
646   pay_ivl_bus.insert_validate
647     (p_rec                   => p_rec
648     ,p_effective_date        => p_effective_date
652     ,p_default_val_warning   => p_default_val_warning
649     ,p_datetrack_mode        => l_datetrack_mode
650     ,p_validation_start_date => l_validation_start_date
651     ,p_validation_end_date   => l_validation_end_date
653     ,p_min_max_warning       => p_min_max_warning
654     ,p_pay_basis_warning     => p_pay_basis_warning
655     ,p_formula_warning       => p_formula_warning
656     ,p_assignment_id_warning => p_assignment_id_warning
657     ,p_formula_message       => p_formula_message
658     );
659   --
660   -- Call to raise any errors on multi-message list
661   hr_multi_message.end_validation_set;
662   --
663   -- Call the supporting pre-insert operation
664   --
665   pay_ivl_ins.pre_insert
666     (p_rec                   => p_rec
667     ,p_effective_date        => p_effective_date
668     ,p_datetrack_mode        => l_datetrack_mode
669     ,p_validation_start_date => l_validation_start_date
670     ,p_validation_end_date   => l_validation_end_date
671     );
672 
673   if p_rec.display_sequence is null then
674   open csr_display_sequence;
675   fetch csr_display_sequence into p_rec.display_sequence;
676   close csr_display_sequence;
677   end if;
678   --
679   -- Insert the row
680   --
681   pay_ivl_ins.insert_dml
682     (p_rec                   => p_rec
683     ,p_effective_date        => p_effective_date
684     ,p_datetrack_mode        => l_datetrack_mode
685     ,p_validation_start_date => l_validation_start_date
686     ,p_validation_end_date   => l_validation_end_date
687     );
688   --
689   -- Call the supporting post-insert operation
690   --
691   pay_ivl_ins.post_insert
692     (p_rec                   => p_rec
693     ,p_effective_date        => p_effective_date
694     ,p_datetrack_mode        => l_datetrack_mode
695     ,p_validation_start_date => l_validation_start_date
696     ,p_validation_end_date   => l_validation_end_date
697     );
698 
699   -- Cascade creation of link input values, Balance feeds and db items
700 
701   pay_link_input_values_pkg.create_link_input_value (
702 
703           p_rec.input_value_id,
704           p_rec.element_type_id,
705           l_validation_start_date ,
706           l_validation_end_date ,
707   -- change 115.12
708           p_rec.name,
709           p_rec.hot_default_flag,
710           p_rec.default_value,
711           p_rec.min_value,
712           p_rec.max_value,
713           p_rec.warning_or_error);
714 
715 
716   -- Create balance feeds for pay values
717   --
718   -- change 115.12
719     if (p_rec.name = 'Pay Value'      -- the default
720           or upper (p_rec.name) = upper (hr_general.pay_value)) then
721       hr_balance_feeds.ins_bf_pay_value (p_rec.input_value_id);
722     end if;
723   --
724     -- Create DB item for the input value
725   open csr_db_items;
726   fetch csr_db_items into l_flag;
727   close csr_db_items;
728 
729   if p_rec.generate_db_items_flag = 'Y' then
730     if (l_flag = 'Y' or upper(p_rec.uom) in ('M','N') or upper(p_rec.name) = 'PAY VALUE' ) then
731      pay_input_values_pkg.recreate_db_items
732      (p_rec.element_type_id);
733     end if;
734   end if;
735   --
736   -- Call to raise any errors on multi-message list
737   hr_multi_message.end_validation_set;
738   --
739   hr_utility.set_location('Leaving:'||l_proc,10);
740 end ins;
741 --
742 -- ----------------------------------------------------------------------------
743 -- |---------------------------------< ins >----------------------------------|
744 -- ----------------------------------------------------------------------------
745 Procedure ins
746   (p_effective_date                 in     date
747   ,p_element_type_id                in     number
748   ,p_display_sequence               in     number
749   ,p_generate_db_items_flag         in     varchar2
750   ,p_hot_default_flag               in     varchar2
751   ,p_mandatory_flag                 in     varchar2
752   ,p_name                           in     varchar2
753   ,p_uom                            in     varchar2
754   ,p_lookup_type                    in     varchar2 default null
755   ,p_business_group_id              in     number   default null
756   ,p_legislation_code               in     varchar2 default null
757   ,p_formula_id                     in     number   default null
758   ,p_value_set_id                   in     number   default null
759   ,p_default_value                  in     varchar2 default null
760   ,p_legislation_subgroup           in     varchar2 default null
761   ,p_max_value                      in     varchar2 default null
762   ,p_min_value                      in     varchar2 default null
763   ,p_warning_or_error               in     varchar2 default null
764   ,p_input_value_id                 out nocopy    number
765   ,p_object_version_number          out nocopy    number
766   ,p_effective_start_date           out nocopy    date
767   ,p_effective_end_date             out nocopy    date
768   ,p_default_val_warning            out nocopy    boolean
769   ,p_min_max_warning                out nocopy    boolean
770   ,p_pay_basis_warning              out nocopy    boolean
771   ,p_formula_warning                out nocopy    boolean
772   ,p_assignment_id_warning          out nocopy    boolean
773   ,p_formula_message                out nocopy    varchar2
774   ) is
775 --
776   l_rec         pay_ivl_shd.g_rec_type;
777   l_proc        varchar2(72) := g_package||'ins';
778   l_name        pay_input_values_f.name%type;
779 --
780 Begin
781   hr_utility.set_location('Entering:'||l_proc, 5);
782   --
783   -- Check for Pay Value special case
784   -- whereby 'PAY VALUE' goes into base table
785   -- (instead of base language value)
786   if (p_name = hr_general.pay_value) then
787      l_name := 'Pay Value';
788   else
789      l_name := p_name;
790   end if;
791   --
792   -- Call conversion function to turn arguments into the
793   -- p_rec structure.
794   --
795   l_rec :=
796   pay_ivl_shd.convert_args
797     (null
798     ,null
799     ,null
800     ,p_element_type_id
801     ,p_lookup_type
802     ,p_business_group_id
803     ,p_legislation_code
804     ,p_formula_id
805     ,p_value_set_id
806     ,p_display_sequence
807     ,p_generate_db_items_flag
808     ,p_hot_default_flag
809     ,p_mandatory_flag
810     ,l_name
811     ,p_uom
812     ,p_default_value
813     ,p_legislation_subgroup
814     ,p_max_value
815     ,p_min_value
816     ,p_warning_or_error
817     ,null
818     );
819   --
820   -- Having converted the arguments into the pay_ivl_rec
821   -- plsql record structure we call the corresponding record
822   -- business process.
823   --
824   pay_ivl_ins.ins
825     (p_effective_date
826     ,l_rec
827     ,p_default_val_warning
828     ,p_min_max_warning
829     ,p_pay_basis_warning
830     ,p_formula_warning
831     ,p_assignment_id_warning
832     ,p_formula_message
833     );
834 
835 
836 
837   --
838   -- Set the OUT arguments.
839   --
840   p_input_value_id                   := l_rec.input_value_id;
841   p_effective_start_date             := l_rec.effective_start_date;
842   p_effective_end_date               := l_rec.effective_end_date;
843   p_object_version_number            := l_rec.object_version_number;
844   --
845   pay_ivt_ins.ins_tl
846   (userenv('LANG')
847   ,p_input_value_id
848   ,l_name
849   );
850 
851   --
852   hr_utility.set_location(' Leaving:'||l_proc, 10);
853 End ins;
854 --
855 end pay_ivl_ins;