DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ADD_INS

Source


1 Package Body per_add_ins as
2 /* $Header: peaddrhi.pkb 120.8 2011/11/15 11:36:00 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_add_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_address_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_address_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   per_add_ins.g_address_id_i := p_address_id;
27   --
28   hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 
32 --
33 -- ----------------------------------------------------------------------------
34 -- |------------------------------< insert_dml >------------------------------|
35 -- ----------------------------------------------------------------------------
36 -- {Start Of Comments}
37 --
38 -- Description:
39 --   This procedure controls the actual dml insert logic. The functions of this
40 --   procedure are as follows:
41 --   1) Initialise the object_version_number to 1 if the object_version_number
42 --      is defined as an attribute for this entity.
43 --   2) To set and unset the g_api_dml status as required (as we are about to
44 --      perform dml).
45 --   3) To insert the row into the schema.
46 --   4) To trap any constraint violations that may have occurred.
47 --   5) To raise any other errors.
48 --
49 -- Pre Conditions:
50 --   This is an internal private procedure which must be called from the ins
51 --   procedure and must have all mandatory arguments set (except the
52 --   object_version_number which is initialised within this procedure).
53 --
54 -- In Arguments:
55 --   A Pl/Sql record structre.
56 --
57 -- Post Success:
58 --   The specified row will be inserted into the schema.
59 --
60 -- Post Failure:
61 --   On the insert dml failure it is important to note that we always reset the
62 --   g_api_dml status to false.
63 --   If a check, unique or parent integrity constraint violation is raised the
64 --   constraint_error procedure will be called.
65 --   If any other error is reported, the error will be raised after the
66 --   g_api_dml status is reset.
67 --
68 -- Developer Implementation Notes:
69 --   None.
70 --
71 -- Access Status:
72 --   Internal Table Handler Use Only.
73 --
74 -- {End Of Comments}
75 -- ----------------------------------------------------------------------------
76 Procedure insert_dml(p_rec in out nocopy per_add_shd.g_rec_type) is
77 --
78   l_proc  varchar2(72) := g_package||'insert_dml';
79 --
80 Begin
81   hr_utility.set_location('Entering:'||l_proc, 5);
82   p_rec.object_version_number := 1;  -- Initialise the object version
83   --
84   per_add_shd.g_api_dml := true;  -- Set the api dml status
85   --
86   -- Insert the row into: per_addresses
87   --
88   insert into per_addresses
89   (	address_id,
90 	business_group_id,
91 	person_id,
92 	date_from,
93 	primary_flag,
94         derived_locale,
95 	style,
96 	address_line1,
97 	address_line2,
98 	address_line3,
99 	address_type,
100 	comments,
101 	country,
102 	date_to,
103 	postal_code,
104 	region_1,
105 	region_2,
106 	region_3,
107 	telephone_number_1,
108 	telephone_number_2,
109 	telephone_number_3,
110 	town_or_city,
111 	request_id,
112 	program_application_id,
113 	program_id,
114 	program_update_date,
115 	addr_attribute_category,
116 	addr_attribute1,
117 	addr_attribute2,
118 	addr_attribute3,
119 	addr_attribute4,
120 	addr_attribute5,
121 	addr_attribute6,
122 	addr_attribute7,
123 	addr_attribute8,
124 	addr_attribute9,
125 	addr_attribute10,
126 	addr_attribute11,
127 	addr_attribute12,
128 	addr_attribute13,
129 	addr_attribute14,
130 	addr_attribute15,
131 	addr_attribute16,
132 	addr_attribute17,
133 	addr_attribute18,
134 	addr_attribute19,
135 	addr_attribute20,
136 	add_information13,
137 	add_information14,
138 	add_information15,
139 	add_information16,
140 	add_information17,
141 	add_information18,
142 	add_information19,
143 	add_information20,
144         party_id,          -- HR/TCA merge
145 	geometry,
146 	object_version_number
147   )
148   Values
149   (	p_rec.address_id,
150 	p_rec.business_group_id,
151 	p_rec.person_id,
152 	p_rec.date_from,
153 	p_rec.primary_flag,
154         p_rec.derived_locale,
155 	p_rec.style,
156 	p_rec.address_line1,
157 	p_rec.address_line2,
158 	p_rec.address_line3,
159 	p_rec.address_type,
160 	p_rec.comments,
161 	p_rec.country,
162 	p_rec.date_to,
163 	p_rec.postal_code,
164 	p_rec.region_1,
165 	p_rec.region_2,
166 	p_rec.region_3,
167 	p_rec.telephone_number_1,
168 	p_rec.telephone_number_2,
169 	p_rec.telephone_number_3,
170 	p_rec.town_or_city,
171 	p_rec.request_id,
172 	p_rec.program_application_id,
173 	p_rec.program_id,
174 	p_rec.program_update_date,
175 	p_rec.addr_attribute_category,
176 	p_rec.addr_attribute1,
177 	p_rec.addr_attribute2,
178 	p_rec.addr_attribute3,
179 	p_rec.addr_attribute4,
180 	p_rec.addr_attribute5,
181 	p_rec.addr_attribute6,
182 	p_rec.addr_attribute7,
183 	p_rec.addr_attribute8,
184 	p_rec.addr_attribute9,
185 	p_rec.addr_attribute10,
186 	p_rec.addr_attribute11,
187 	p_rec.addr_attribute12,
188 	p_rec.addr_attribute13,
189 	p_rec.addr_attribute14,
190 	p_rec.addr_attribute15,
191 	p_rec.addr_attribute16,
192 	p_rec.addr_attribute17,
193 	p_rec.addr_attribute18,
194 	p_rec.addr_attribute19,
195 	p_rec.addr_attribute20,
196 	p_rec.add_information13,
197 	p_rec.add_information14,
198 	p_rec.add_information15,
199 	p_rec.add_information16,
200 	p_rec.add_information17,
201 	p_rec.add_information18,
202 	p_rec.add_information19,
203 	p_rec.add_information20,
204 	p_rec.party_id,          -- HR/TCA merge
205 	p_rec.geometry,
206 	p_rec.object_version_number
207   );
208   --
209   per_add_shd.g_api_dml := false;   -- Unset the api dml status
210   --
211   hr_utility.set_location(' Leaving:'||l_proc, 10);
212 Exception
213   When hr_api.check_integrity_violated Then
214     -- A check constraint has been violated
215     per_add_shd.g_api_dml := false;   -- Unset the api dml status
216     per_add_shd.constraint_error
217       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
218   When hr_api.parent_integrity_violated Then
219     -- Parent integrity has been violated
220     per_add_shd.g_api_dml := false;   -- Unset the api dml status
221     per_add_shd.constraint_error
222       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
223   When hr_api.unique_integrity_violated Then
224     -- Unique integrity has been violated
225     per_add_shd.g_api_dml := false;   -- Unset the api dml status
226     per_add_shd.constraint_error
227       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
228   When Others Then
229     per_add_shd.g_api_dml := false;   -- Unset the api dml status
230     Raise;
231 End insert_dml;
232 --
233 -- ----------------------------------------------------------------------------
234 -- |------------------------------< pre_insert >------------------------------|
235 -- ----------------------------------------------------------------------------
236 -- {Start Of Comments}
237 --
238 -- Description:
239 --   This private procedure contains any processing which is required before
240 --   the insert dml. Presently, if the entity has a corresponding primary
241 --   key which is maintained by an associating sequence, the primary key for
242 --   the entity will be populated with the next sequence value in
243 --   preparation for the insert dml.
244 --
245 -- Pre Conditions:
246 --   This is an internal procedure which is called from the ins procedure.
247 --
248 -- In Arguments:
249 --   A Pl/Sql record structre.
250 --
251 -- Post Success:
252 --   Processing continues.
253 --
254 -- Post Failure:
255 --   If an error has occurred, an error message and exception will be raised
256 --   but not handled.
257 --
258 -- Developer Implementation Notes:
259 --   Any pre-processing required before the insert dml is issued should be
260 --   coded within this procedure. As stated above, a good example is the
261 --   generation of a primary key number via a corresponding sequence.
262 --   It is important to note that any 3rd party maintenance should be reviewed
263 --   before placing in this procedure.
264 --
265 -- Access Status:
266 --   Internal Table Handler Use Only.
267 --
268 -- {End Of Comments}
269 -- ----------------------------------------------------------------------------
270 Procedure pre_insert(p_rec  in out nocopy per_add_shd.g_rec_type) is
271 --
272   l_proc  varchar2(72) := g_package||'pre_insert';
273   l_exists varchar2(1);
274 --
275   Cursor C_Sel1 is select per_addresses_s.nextval from sys.dual;
276 --
277   Cursor C_Sel2 is
278          select null
279                 from per_addresses
280                 where address_id = per_add_ins.g_address_id_i;
281 --
282   l_date        date;
283   l_last_update date;
284 --
285   l_number_table dbms_describe.number_table;
286   l_varchar_table dbms_describe.varchar2_table;
287   l_package_exists boolean;
288   l_package_name varchar2(2000);
289 --
290 Begin
291   hr_utility.set_location('Entering:'||l_proc, 10);
292   --
293   if per_add_ins.g_address_id_i is not null then
294     --
295     -- Verify registered primary key values not already in use
296     --
297     Open C_Sel2;
298     Fetch C_Sel2 into l_exists;
299     If C_Sel2%found then
300       Close C_Sel2;
301       --
302       -- The primary key values are already in use.
303       --
304       fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
305       fnd_message.set_token('TABLE_NAME','per_addresses');
306       fnd_message.raise_error;
307     end if;
308     Close C_Sel2;
309     --
310     -- Use registered key values and clear globals
311     --
312     p_rec.address_id :=
313       per_add_ins.g_address_id_i;
314     per_add_ins.g_address_id_i := null;
315   else
316     --
317     -- Select the next sequence number
318     --
319     Open C_Sel1;
320     Fetch C_Sel1 Into p_rec.address_id;
321     Close C_Sel1;
322   end if;
323   --
324   hr_utility.set_location(' Leaving:'||l_proc, 10);
325   --
326   -- Enhancement added for Location Searching
327   --
328   hr_utility.set_location(' Entering:'||l_proc, 11);
329   if(  (fnd_profile.value('IRC_INSTALLED_FLAG') in ('Y','D')) and
330        (fnd_profile.value('IRC_GEOCODE_HOST')is not null)
331     ) then
332     p_rec.geometry := Irc_location_utility.address2geometry
333       (address_line1       => p_rec.address_line1
334       ,address_line2       => p_rec.address_line2
335       ,address_line3       => p_rec.address_line3
336       ,address_line4       => p_rec.town_or_city
337       ,address_line5       => p_rec.region_1
338       ,address_line6       => p_rec.region_2
339       ,address_line7       => p_rec.region_3
340       ,address_line8       => p_rec.postal_code
341       ,country             => p_rec.country
342       );
343   end if;
344   hr_utility.set_location(' Leaving:'||l_proc, 12);
345 -- Set taxation address defaults
346 
347   begin    -- Block begin .Bug# 2416832
348   --
349   hr_utility.set_location('Entering:'||l_proc, 15);
350   If p_rec.style = 'US' and
351      p_rec.primary_flag = 'Y'and
352      p_rec.add_information17 IS NULL and
353      p_rec.add_information18 IS NULL and
354      p_rec.add_information19 IS NULL and
355      p_rec.add_information20 IS NULL
356   Then
357   hr_utility.set_location('Entering:'||l_proc, 17);
358 --
359 -- Bug 3363711 Starts Here
360 --
361      l_date := TO_DATE('01/01/'||(TO_CHAR(p_rec.date_from,'YYYY')),
362                                    'DD/MM/YYYY');
363 --
364 -- Bug 3363711 Ends Here
365 --
366      Select max(date_from) into l_last_update
367      From per_addresses_v
368      Where person_id = p_rec.person_id and
369            primary_flag = 'Y' and
370            date_from <= p_rec.date_from;
371 
372      --If l_date <= l_last_update    --  Fix for the issue in the bug#11867899
373      If l_date < l_last_update
374      Then
375        Select
376          nvl(add_information17,''),
377          nvl(add_information18,''),
378          nvl(add_information19,''),
379          nvl(add_information20,'')
380          into
381          p_rec.add_information17,
382          p_rec.add_information18,
383          p_rec.add_information19,
384          p_rec.add_information20
385        From per_addresses_v
386        Where
387          person_id = p_rec.person_id and
388          primary_flag = 'Y' and
389          date_from =
390            (Select max(date_from)
391             From per_addresses_v
392             Where date_from between l_date and p_rec.date_from and
393                   person_id = p_rec.person_id and
394                   primary_flag = 'Y');
395      Else
396        Select town_or_city,
397               region_1,
398               region_2,
399               postal_code
400        Into   p_rec.add_information18,
401               p_rec.add_information19,
402               p_rec.add_information17,
403               p_rec.add_information20
404        From   per_addresses_v
405        Where  person_id = p_rec.person_id and
406               primary_flag = 'Y' and
407               l_date between date_from and
408               nvl(date_to, TO_DATE('31/12/4712', 'DD/MM/YYYY')) and
409               region_2 = 'IN';
410      End if;
411    --
412   hr_utility.set_location(' Leaving:'||l_proc, 17);
413    End if;
414 --
415    EXCEPTION
416      WHEN NO_DATA_FOUND THEN
417      p_rec.add_information17 := '';
418      p_rec.add_information18 := '';
419      p_rec.add_information19 := '';
420      p_rec.add_information20 := '';
421    --
422    end;    -- Block end. Bug# 2416832
423 --
424   per_add_shd.derive_locale(p_rec);
425 --
426   hr_utility.set_location(' Leaving:'||l_proc, 15);
427 End pre_insert;
428 --
429 -- ----------------------------------------------------------------------------
430 -- |-----------------------------< post_insert >------------------------------|
431 -- ----------------------------------------------------------------------------
432 -- {Start Of Comments}
433 --
434 -- Description:
435 --   This private procedure contains any processing which is required after the
436 --   insert dml.
437 --
438 -- Pre Conditions:
439 --   This is an internal procedure which is called from the ins procedure.
440 --
441 -- In Arguments:
442 --   A Pl/Sql record structre.
443 --
444 -- Post Success:
445 --   Processing continues.
446 --
447 -- Post Failure:
448 --   If an error has occurred, an error message and exception will be raised
449 --   but not handled.
450 --
451 -- Developer Implementation Notes:
452 --   Any post-processing required after the insert dml is issued should be
453 --   coded within this procedure. It is important to note that any 3rd party
454 --   maintenance should be reviewed before placing in this procedure.
455 --
456 -- Access Status:
457 --   Internal Table Handler Use Only.
458 --
459 -- {End Of Comments}
460 -- ----------------------------------------------------------------------------
461 Procedure post_insert(p_rec                 in per_add_shd.g_rec_type
462 	             ,p_effective_date	  in date
463                      ,p_validate_county     in boolean
464                      ) is
465 
466   --
467   l_proc  varchar2(72) := g_package||'post_insert';
468   --
469   --
470   -- Fix for WWBUG 1408379
471   --
472   l_old               ben_add_ler.g_add_ler_rec;
473   l_new               ben_add_ler.g_add_ler_rec;
474   --
475   -- End of Fix for WWBUG 1408379
476   --
477 Begin
478   hr_utility.set_location('Entering:'||l_proc, 5);
479   --
480   -- Start of API User Hook for post_insert.
481   begin
482     per_add_rki.after_insert
483       (p_address_id                   => p_rec.address_id
484       ,p_business_group_id            => p_rec.business_group_id
485       ,p_person_id                    => p_rec.person_id
486       ,p_date_from                    => p_rec.date_from
487       ,p_primary_flag                 => p_rec.primary_flag
488       ,p_style                        => p_rec.style
489       ,p_address_line1                => p_rec.address_line1
490       ,p_address_line2                => p_rec.address_line2
491       ,p_address_line3                => p_rec.address_line3
492       ,p_address_type                 => p_rec.address_type
493       ,p_comments                     => p_rec.comments
494       ,p_country                      => p_rec.country
495       ,p_date_to                      => p_rec.date_to
496       ,p_postal_code                  => p_rec.postal_code
497       ,p_region_1                     => p_rec.region_1
498       ,p_region_2                     => p_rec.region_2
499       ,p_region_3                     => p_rec.region_3
500       ,p_telephone_number_1           => p_rec.telephone_number_1
501       ,p_telephone_number_2           => p_rec.telephone_number_2
502       ,p_telephone_number_3           => p_rec.telephone_number_3
503       ,p_town_or_city                 => p_rec.town_or_city
504       ,p_request_id                   => p_rec.request_id
505       ,p_program_application_id       => p_rec.program_application_id
506       ,p_program_id                   => p_rec.program_id
507       ,p_program_update_date          => p_rec.program_update_date
508       ,p_addr_attribute_category      => p_rec.addr_attribute_category
509       ,p_addr_attribute1              => p_rec.addr_attribute1
510       ,p_addr_attribute2              => p_rec.addr_attribute2
511       ,p_addr_attribute3              => p_rec.addr_attribute3
512       ,p_addr_attribute4              => p_rec.addr_attribute4
513       ,p_addr_attribute5              => p_rec.addr_attribute5
514       ,p_addr_attribute6              => p_rec.addr_attribute6
515       ,p_addr_attribute7              => p_rec.addr_attribute7
516       ,p_addr_attribute8              => p_rec.addr_attribute8
517       ,p_addr_attribute9              => p_rec.addr_attribute9
518       ,p_addr_attribute10             => p_rec.addr_attribute10
519       ,p_addr_attribute11             => p_rec.addr_attribute11
520       ,p_addr_attribute12             => p_rec.addr_attribute12
521       ,p_addr_attribute13             => p_rec.addr_attribute13
522       ,p_addr_attribute14             => p_rec.addr_attribute14
523       ,p_addr_attribute15             => p_rec.addr_attribute15
524       ,p_addr_attribute16             => p_rec.addr_attribute16
525       ,p_addr_attribute17             => p_rec.addr_attribute17
526       ,p_addr_attribute18             => p_rec.addr_attribute18
527       ,p_addr_attribute19             => p_rec.addr_attribute19
528       ,p_addr_attribute20             => p_rec.addr_attribute20
529       ,p_add_information13            => p_rec.add_information13
530       ,p_add_information14            => p_rec.add_information14
531       ,p_add_information15            => p_rec.add_information15
532       ,p_add_information16            => p_rec.add_information16
533       ,p_add_information17            => p_rec.add_information17
534       ,p_add_information18            => p_rec.add_information18
535       ,p_add_information19            => p_rec.add_information19
536       ,p_add_information20            => p_rec.add_information20
537       ,p_object_version_number        => p_rec.object_version_number
538       ,p_effective_date	              => p_effective_date
539       ,p_validate_county              => p_validate_county
540       ,p_party_id                     => p_rec.party_id   -- HR/TCA merge
541       );
542   exception
543     when hr_api.cannot_find_prog_unit then
544       hr_api.cannot_find_prog_unit_error
545         (p_module_name => 'PER_ADDRESSES'
546         ,p_hook_type   => 'AI'
547         );
548   end;
549   --
550   -- Fix for WWBUG 1408379
551   --
552   l_new.person_id := p_rec.person_id;
553   l_new.business_group_id := p_rec.business_group_id;
554   l_new.date_from := p_rec.date_from;
555   l_new.date_to := p_rec.date_to;
556   l_new.primary_flag := p_rec.primary_flag;
557   l_new.postal_code := p_rec.postal_code;
558   l_new.region_2 := p_rec.region_2;
559   l_new.address_type := p_rec.address_type;
560   l_new.address_id := p_rec.address_id;
561   --
562   ben_add_ler.ler_chk(p_old            => l_old,
563                       p_new            => l_new,
564                       p_effective_date => l_new.date_from);
565   --
566   -- End of Fix for WWBUG 1408379
567   --
568   -- End of API User Hook for post_insert.
569   --
570   hr_utility.set_location(' Leaving:'||l_proc, 10);
571 End post_insert;
572 --
573 -- ----------------------------------------------------------------------------
574 -- |---------------------------------< ins >----------------------------------|
575 -- ----------------------------------------------------------------------------
576 Procedure ins
577   (p_rec               in out nocopy per_add_shd.g_rec_type
578   ,p_validate          in     boolean default false
579   ,p_effective_date    in     date
580   ,p_validate_county   in     boolean          default true
581   ) is
582 --
583   l_proc  varchar2(72) := g_package||'ins';
584 --
585 Begin
586   hr_utility.set_location('Entering:'||l_proc, 5);
587   --
588   -- Determine if the business process is to be validated.
589   --
590   If p_validate then
591     --
592     -- Issue the savepoint.
593     --
594     SAVEPOINT ins_per_add;
595   End If;
596   --
597   -- Call the supporting insert validate operations
598   --
599   per_add_bus.insert_validate(p_rec
600                              ,p_effective_date
601                              ,p_validate_county
602                              );
603   -- Call to raise any errors on multi-message list
604   hr_multi_message.end_validation_set;
605   --
606   -- Call the supporting pre-insert operation
607   --
608   pre_insert(p_rec);
609   --
610   -- Insert the row
611   --
612   insert_dml(p_rec);
613   --
614   -- Call the supporting post-insert operation
615   --
616   post_insert(p_rec
617              ,p_effective_date
618              ,p_validate_county
619              );
620   --
621   -- Call to raise any errors on multi-message list
622   hr_multi_message.end_validation_set;
623   --
624   -- If we are validating then raise the Validate_Enabled exception
625   --
626   If p_validate then
627     Raise HR_Api.Validate_Enabled;
628   End If;
629   --
630   hr_utility.set_location(' Leaving:'||l_proc, 10);
631 Exception
632   When HR_Api.Validate_Enabled Then
633     --
634     -- As the Validate_Enabled exception has been raised
635     -- we must rollback to the savepoint
636     --
637     ROLLBACK TO ins_per_add;
638 end ins;
639 --
640 -- ----------------------------------------------------------------------------
641 -- |---------------------------------< ins >----------------------------------|
642 -- ----------------------------------------------------------------------------
643 Procedure ins
644   (p_address_id                   out nocopy number
645   ,p_business_group_id            in number           default null -- HR/TCA
646   ,p_person_id                    in number           default null -- HR/TCA
647   ,p_date_from                    in date
648   ,p_primary_flag                 in varchar2
649   ,p_style                        in varchar2
650   ,p_address_line1                in varchar2         default null
651   ,p_address_line2                in varchar2         default null
652   ,p_address_line3                in varchar2         default null
653   ,p_address_type                 in varchar2         default null
654   ,p_comments                     in clob         default null	-- Bug#13362792
655   ,p_country                      in varchar2         default null
656   ,p_date_to                      in date             default null
657   ,p_postal_code                  in varchar2         default null
658   ,p_region_1                     in varchar2         default null
659   ,p_region_2                     in varchar2         default null
660   ,p_region_3                     in varchar2         default null
661   ,p_telephone_number_1           in varchar2         default null
662   ,p_telephone_number_2           in varchar2         default null
663   ,p_telephone_number_3           in varchar2         default null
664   ,p_town_or_city                 in varchar2         default null
665   ,p_request_id                   in number           default null
666   ,p_program_application_id       in number           default null
667   ,p_program_id                   in number           default null
668   ,p_program_update_date          in date             default null
669   ,p_addr_attribute_category      in varchar2         default null
670   ,p_addr_attribute1              in varchar2         default null
671   ,p_addr_attribute2              in varchar2         default null
672   ,p_addr_attribute3              in varchar2         default null
673   ,p_addr_attribute4              in varchar2         default null
674   ,p_addr_attribute5              in varchar2         default null
675   ,p_addr_attribute6              in varchar2         default null
676   ,p_addr_attribute7              in varchar2         default null
677   ,p_addr_attribute8              in varchar2         default null
678   ,p_addr_attribute9              in varchar2         default null
679   ,p_addr_attribute10             in varchar2         default null
680   ,p_addr_attribute11             in varchar2         default null
681   ,p_addr_attribute12             in varchar2         default null
682   ,p_addr_attribute13             in varchar2         default null
683   ,p_addr_attribute14             in varchar2         default null
684   ,p_addr_attribute15             in varchar2         default null
685   ,p_addr_attribute16             in varchar2         default null
686   ,p_addr_attribute17             in varchar2         default null
687   ,p_addr_attribute18             in varchar2         default null
688   ,p_addr_attribute19             in varchar2         default null
689   ,p_addr_attribute20             in varchar2         default null
690   ,p_add_information13            in varchar2         default null
691   ,p_add_information14            in varchar2         default null
692   ,p_add_information15            in varchar2         default null
693   ,p_add_information16            in varchar2         default null
694   ,p_add_information17            in varchar2         default null
695   ,p_add_information18            in varchar2         default null
696   ,p_add_information19            in varchar2         default null
697   ,p_add_information20            in varchar2         default null
698   ,p_object_version_number        out nocopy number
699   ,p_party_id                     in number           default null
700   ,p_validate                     in boolean          default false
701   ,p_effective_date               in date
702   ,p_validate_county              in boolean          default true
703   ) is
704 --
705   l_rec	  per_add_shd.g_rec_type;
706   l_proc  varchar2(72) := g_package||'ins';
707 --
708 Begin
709   hr_utility.set_location('Entering:'||l_proc, 5);
710   --
711   -- Call conversion function to turn arguments into the
712   -- p_rec structure.
713   --
714   l_rec :=
715   per_add_shd.convert_args
716   (
717   null,
718   p_business_group_id,
719   p_person_id,
720   p_date_from,
721   p_primary_flag,
722   p_style,
723   p_address_line1,
724   p_address_line2,
725   p_address_line3,
726   p_address_type,
727   p_comments,
728   p_country,
729   p_date_to,
730   p_postal_code,
731   p_region_1,
732   p_region_2,
733   p_region_3,
734   p_telephone_number_1,
735   p_telephone_number_2,
736   p_telephone_number_3,
737   p_town_or_city,
738   p_request_id,
739   p_program_application_id,
740   p_program_id,
741   p_program_update_date,
742   p_addr_attribute_category,
743   p_addr_attribute1,
744   p_addr_attribute2,
745   p_addr_attribute3,
746   p_addr_attribute4,
747   p_addr_attribute5,
748   p_addr_attribute6,
749   p_addr_attribute7,
750   p_addr_attribute8,
751   p_addr_attribute9,
752   p_addr_attribute10,
753   p_addr_attribute11,
754   p_addr_attribute12,
755   p_addr_attribute13,
756   p_addr_attribute14,
757   p_addr_attribute15,
758   p_addr_attribute16,
759   p_addr_attribute17,
760   p_addr_attribute18,
761   p_addr_attribute19,
762   p_addr_attribute20,
763   p_add_information13,
764   p_add_information14,
765   p_add_information15,
766   p_add_information16,
767   p_add_information17,
768   p_add_information18,
769   p_add_information19,
770   p_add_information20,
771   null,
772   p_party_id  -- HR/TCA merge
773   );
774   --
775   -- Having converted the arguments into the per_add_rec
776   -- plsql record structure we call the corresponding record business process.
777   --
778   ins(l_rec
779      ,p_validate
780      ,p_effective_date
781      ,p_validate_county
782      );
783   --
784   -- As the primary key argument(s)
785   -- are specified as an OUT's we must set these values.
786   --
787   p_address_id := l_rec.address_id;
788   p_object_version_number := l_rec.object_version_number;
789   --
790   hr_utility.set_location(' Leaving:'||l_proc, 10);
791 End ins;
792 --
793 end per_add_ins;