[Home] [Help]
PACKAGE BODY: APPS.HR_ORGANIZATION_API
Source
1 PACKAGE BODY hr_organization_api AS
2 /* $Header: hrorgapi.pkb 120.18 2009/11/05 10:25:16 skura noship $ */
3 --
4 -- Package Variables
5 --
6 g_package VARCHAR2(33) := ' hr_organization_api.';
7 --
8 --------------------------------------------------------------------------------
9 g_dummy number(1); -- Dummy for cursor returns which are not needed
10 g_business_group_id number(15); -- For validating translation;
11 g_legislation_code varchar2(150); -- For validating translation;
12 --------------------------------------------------------------------------------
13 --
14 -- ----------------------------------------------------------------------------
15 -- |-----------------------< update_cost_concat_segs >-------------------------|
16 -- ----------------------------------------------------------------------------
17 -- {Start Of Comments}
18 --
19 -- Description:
20 -- This procedure updates the pay_cost_allocation_keyflex table after the
21 -- flexfield segments have been inserted to keep the concatenated segment
22 -- field up to date.
23 --
24 -- Prerequisites:
25 -- A row must exist in the pay_cost_allocation_keyflex table for
26 -- p_cost_allocation_keyflex_id
27 --
28 -- In Parameters:
29 -- Name Reqd Type Description
30 -- p_cost_allocation_keyflex_id Yes number The primary key
31 -- p_cost_name Yes varchar2 The concatenated segments
32 --
33 -- Post Success:
34 -- The row is updated
35 --
36 -- Post Failure:
37 -- The procedure will raise an error.
38 --
39 -- Access Status:
40 -- Internal use only.
41 --
42 -- {End Of Comments}
43 --
44 --
45 -- Start of fix 3309164
46 procedure update_cost_concat_segs
47 (p_cost_allocation_keyflex_id in number
48 ,p_cost_name in varchar2
49 ) is
50 --
51 CURSOR csr_chk_cost is
52 SELECT null
53 FROM pay_cost_allocation_keyflex
54 where cost_allocation_keyflex_id = p_cost_allocation_keyflex_id
55 and (concatenated_segments <> p_cost_name
56 or concatenated_segments is null);
57 --
58 l_exists varchar2(30);
59 l_proc varchar2(72) := g_package||'update_cost_concat_segs';
60 --
61 procedure update_cost_concat_segs_auto
62 (p_cost_allocation_keyflex_id in number
63 ,p_cost_name in varchar2
64 ) is
65 PRAGMA AUTONOMOUS_TRANSACTION;
66 --
67 CURSOR csr_cost_lock is
68 SELECT null
69 FROM pay_cost_allocation_keyflex
70 where cost_allocation_keyflex_id = p_cost_allocation_keyflex_id
71 for update nowait;
72 --
73 l_exists varchar2(30);
74 l_proc varchar2(72) := g_package||'update_cost_concat_segs_auto';
75 --
76 begin
77 hr_utility.set_location('Entering:'|| l_proc, 10);
78 --
79 -- The outer procedure has already establish that an update is
80 -- required. This sub-procedure uses an autonomous transaction
81 -- to ensure that any commits do not impact the main transaction.
82 -- If the row is successfully locked then continue and update the
83 -- row. If the row cannot be locked then another transaction must
84 -- be performing the update. So it is acceptable for this
85 -- transaction to silently trap the error and continue.
86 --
87 -- Note: It is necessary to perform the lock test because in
88 -- a batch data upload scenario multiple sessions could be
89 -- attempting to insert or update the same Key Flexfield
90 -- combination at the same time. Just directly updating the row,
91 -- without first locking, can cause sessions to hang and reduce
92 -- batch throughput.
93 --
94 open csr_cost_lock;
95 fetch csr_cost_lock into l_exists;
96 if csr_cost_lock%found then
97 close csr_cost_lock;
98 hr_utility.set_location(l_proc, 20);
99 --
100 -- Lock obtained by this transaction, updating the concatenated
101 -- segment string should be performed.
102 --
103 update pay_cost_allocation_keyflex
104 set concatenated_segments = p_cost_name
105 where cost_allocation_keyflex_id = p_cost_allocation_keyflex_id
106 and (concatenated_segments <> p_cost_name
107 or concatenated_segments is null);
108 --
109 -- Commit this change so the change is immediately visible to
110 -- other transactions. Also ensuring that it is not undone if
111 -- the main transaction is rolled back. This commit is only
112 -- acceptable inside an API because it is being performed inside
113 -- an autonomous transaction and AOL code has previously
114 -- inserted the Key Flexfield combination row in another
115 -- autonomous transaction.
116 commit;
117 else
118 close csr_cost_lock;
119 rollback; -- Added for bug 3578845.
120 end if;
121 --
122 hr_utility.set_location('Leaving:'|| l_proc, 30);
123 --
124 Exception
125 When HR_Api.Object_Locked then
126 --
127 -- This autonomous transaction was unable to lock the row.
128 -- It can be assumed that another transaction has locked the
129 -- row and is performing the update. Hence the error can
130 -- be suppressed without raising it to the end user.
131 --
132 rollback; -- Added for bug 3578845.
133 hr_utility.set_location('Leaving:'|| l_proc, 40);
134 --
135 end update_cost_concat_segs_auto;
136 begin
137 --
138 hr_utility.set_location('Entering:'|| l_proc, 10);
139 --
140 -- First find out if it is necessary to update the concatenated
141 -- segment string column. This select is being done to avoid the
142 -- performance unnecessary overhead of set-up an autonomous
143 -- transaction when an update is not required. Updates are only
144 -- expected immediately after the combination row was first inserted.
145 --
146 open csr_chk_cost;
147 fetch csr_chk_cost into l_exists;
148 if csr_chk_cost%found then
149 close csr_chk_cost;
150 update_cost_concat_segs_auto
151 (p_cost_allocation_keyflex_id => p_cost_allocation_keyflex_id
152 ,p_cost_name => p_cost_name
153 );
154 else
155 close csr_chk_cost;
156 end if;
157 --
158 hr_utility.set_location('Leaving:'|| l_proc, 40);
159 --
160 end update_cost_concat_segs;
161 -- End of fix 3309164
162 --
163 -- ----------------------------------------------------------------------------
164 -- |---------------------< create_organization_internal >---------------------|
165 -- ----------------------------------------------------------------------------
166 -- {Start Of Comments}
167 --
168 -- Description:
169 -- This procedure is a Business Support Process, and this will be called
170 -- internally by the published API (create_organization and
171 -- create_hr_organization)
172 --
173 -- This procedure creates a new organization within a scope of existing
174 -- business group.
175 --
176 -- Organizations are stored on the HR_ALL_ORGANIZATION_UNITS table.
177 -- The translated columns are stored on the
178 -- HR_ALL_ORGANIZATION_UNITS_TL table.
179 --
180 -- Prerequisites:
181 -- None
182 --
183 -- In Parameters:
184 -- Name Reqd Type Description
185 --
186 -- p_effective_date Yes Date Used for date_track
187 -- validation and in hr_lookups.
188 -- p_language_code No Varchar2 The language used for the
189 -- initial translation values
190 -- p_business_group_id Yes Number Business group ID.
191 --
192 -- p_date_from Yes Date The date the organization is
193 -- in effect.
194 -- p_name Yes Varchar2 Organization name (Translated)
195 -- p_cost_allocation_keyflex_id No Number Cost Allocation Keyflex id
196 -- p_location_id No Number Organization's Location id.
197 -- p_date_to No Date The date on which the effect of
198 -- the organization ends.
199 -- p_internal_external_flag No Varchar2 Internal or External Organization Flag.
200 -- p_internal_address_line No Varchar2 Internal Address Line.
201 -- p_type No Varcahr2 Organization Type.
202
203 -- p_attribute_category No Varchar2 Flexfield Category
204 -- p_attribute1 No Varchar2 Flexfield
205 -- ..
206 -- p_attribute30 No Varchar2 Flexfield
207 --
208 -- Post Success:
209 -- When the Organization has been successfully inserted, the following OUT
210 -- parameters are set:
211 --
212 -- Name Type Description
213 --
214 -- p_organization_id Number This contains the ID assigned to
215 -- the organization.
216 -- p_object_version_number Number This contains the Object Version
217 -- Number of the newly created row.
218 -- p_duplicate_org_warning Boolean If an organization already
219 -- exists with the same name
220 -- in a different business
221 -- group this will be true
222 -- (if the duplicate is in the
223 -- same business group, an error
224 -- will be raised)
225 -- Post Failure:
226 -- The procedure does not create the organization, and raises an error
227 -- through the main API
228 --
229 -- Access Status:
230 -- Internal Developement Use Only.
231 --
232 -- {End Of Comments}
233 --
234 --
235 PROCEDURE create_organization_internal
236 ( p_effective_date in date
237 ,p_language_code in varchar2 default hr_api.userenv_lang
238 ,p_business_group_id in number
239 ,p_date_from in date
240 ,p_name in varchar2
241 ,p_cost_allocation_keyflex_id in number default null
242 ,p_location_id in number default null
243 ,p_date_to in date default null
244 ,p_internal_external_flag in varchar2 default null
245 ,p_internal_address_line in varchar2 default null
246 ,p_type in varchar2 default null
247 ,p_comments in varchar2 default null
248 ,p_attribute_category in varchar2 default null
249 ,p_attribute1 in varchar2 default null
250 ,p_attribute2 in varchar2 default null
251 ,p_attribute3 in varchar2 default null
252 ,p_attribute4 in varchar2 default null
253 ,p_attribute5 in varchar2 default null
254 ,p_attribute6 in varchar2 default null
255 ,p_attribute7 in varchar2 default null
256 ,p_attribute8 in varchar2 default null
257 ,p_attribute9 in varchar2 default null
258 ,p_attribute10 in varchar2 default null
259 ,p_attribute11 in varchar2 default null
260 ,p_attribute12 in varchar2 default null
261 ,p_attribute13 in varchar2 default null
262 ,p_attribute14 in varchar2 default null
263 ,p_attribute15 in varchar2 default null
264 ,p_attribute16 in varchar2 default null
265 ,p_attribute17 in varchar2 default null
266 ,p_attribute18 in varchar2 default null
267 ,p_attribute19 in varchar2 default null
268 ,p_attribute20 in varchar2 default null
269 --Enhancement 4040086
270 --Begin of Add 10 additional segments
271 ,p_attribute21 in varchar2 default null
272 ,p_attribute22 in varchar2 default null
273 ,p_attribute23 in varchar2 default null
274 ,p_attribute24 in varchar2 default null
275 ,p_attribute25 in varchar2 default null
276 ,p_attribute26 in varchar2 default null
277 ,p_attribute27 in varchar2 default null
278 ,p_attribute28 in varchar2 default null
279 ,p_attribute29 in varchar2 default null
280 ,p_attribute30 in varchar2 default null
281 --End of Add 10 additional segments
282 ,p_organization_id out nocopy number
283 ,p_object_version_number out nocopy number
284 ,p_duplicate_org_warning out nocopy boolean
285 ) IS
286 --
287 -- Declare cursors and local variables
288 --
289 -- Added cursor csr_sec_profile
290 cursor csr_sec_profile(p_security_profile_id in number) is
291 select view_all_organizations_flag
292 from per_security_profiles
293 where security_profile_id = p_security_profile_id;
294 --
295 l_proc varchar2(72) := g_package||'create_organization_internal';
296 l_organization_id hr_all_organization_units.organization_id%type;
297 l_object_version_number hr_all_organization_units.object_version_number%type;
298 l_language_code hr_all_organization_units_tl.language%type;
299 l_security_profile_id per_security_profiles.security_profile_id%type;
300 l_view_all_orgs per_security_profiles.view_all_organizations_flag%type;
301 --
302 BEGIN
303 --
304 hr_utility.set_location('Entering:'|| l_proc, 10);
305 --
306 -- Validate the language parameter. l_language_code should be passed to functions
307 -- instead of p_language_code from now on, to allow an IN OUT parameter to
308 -- be passed through.
309 --
310 l_language_code := p_language_code;
311 hr_api.validate_language_code(p_language_code => l_language_code);
312 --
313 hr_utility.set_location(l_proc, 20);
314 --
315 -- Process Logic
316 --
317 -- Insert non-translatable rows into HR_ALL_ORGANIZATION_UNITS first
318 hr_oru_ins.ins
319 ( p_effective_date => p_effective_date
320 ,p_business_group_id => p_business_group_id
321 ,p_date_from => p_date_from
322 ,p_name => p_name
323 ,p_cost_allocation_keyflex_id => p_cost_allocation_keyflex_id
324 ,p_location_id => p_location_id
325 ,p_date_to => p_date_to
326 ,p_internal_external_flag => p_internal_external_flag
327 ,p_internal_address_line => p_internal_address_line
328 ,p_type => p_type
329 ,p_comments => p_comments
330 ,p_attribute_category => p_attribute_category
331 ,p_attribute1 => p_attribute1
332 ,p_attribute2 => p_attribute2
333 ,p_attribute3 => p_attribute3
334 ,p_attribute4 => p_attribute4
335 ,p_attribute5 => p_attribute5
336 ,p_attribute6 => p_attribute6
337 ,p_attribute7 => p_attribute7
338 ,p_attribute8 => p_attribute8
339 ,p_attribute9 => p_attribute9
340 ,p_attribute10 => p_attribute10
341 ,p_attribute11 => p_attribute11
342 ,p_attribute12 => p_attribute12
343 ,p_attribute13 => p_attribute13
344 ,p_attribute14 => p_attribute14
345 ,p_attribute15 => p_attribute15
346 ,p_attribute16 => p_attribute16
347 ,p_attribute17 => p_attribute17
348 ,p_attribute18 => p_attribute18
349 ,p_attribute19 => p_attribute19
350 ,p_attribute20 => p_attribute20
351 -- Enhancement 4040086
352 ,p_attribute21 => p_attribute21
353 ,p_attribute22 => p_attribute22
354 ,p_attribute23 => p_attribute23
355 ,p_attribute24 => p_attribute24
356 ,p_attribute25 => p_attribute25
357 ,p_attribute26 => p_attribute26
358 ,p_attribute27 => p_attribute27
359 ,p_attribute28 => p_attribute28
360 ,p_attribute29 => p_attribute29
361 ,p_attribute30 => p_attribute30
362 -- End Enhancement 4040086
363 ,p_organization_id => l_organization_id
364 ,p_object_version_number => l_object_version_number
365 ,p_duplicate_org_warning => p_duplicate_org_warning);
366 --
367 -- Now insert translatable rows in HR_ALL_ORGANIZATION_UNITS_TL table
368 --
369 hr_ort_ins.ins_tl
370 ( p_language_code => l_language_code,
371 p_organization_id => l_organization_id,
372 p_name => p_name
373 );
374 --
375 hr_utility.set_location(l_proc, 30);
376 --
377 l_security_profile_id := fnd_profile.value('PER_SECURITY_PROFILE_ID');
378 -- Bug fix 4329807
379 /* open csr_sec_profile( l_security_profile_id );
380 fetch csr_sec_profile into l_view_all_orgs;
381 close csr_sec_profile;
382 if l_view_all_orgs <> 'N' then
383 per_org_structure_elements_pkg.maintain_org_lists(
384 p_Business_Group_Id
385 ,l_security_profile_id
386 ,l_organization_id
387 );
388 end if;
389 */
390 --
391 hr_utility.set_location(l_proc, 40);
392 --
393 -- Set all output arguments
394 --
395 p_organization_id := l_organization_id;
396 p_object_version_number := l_object_version_number;
397 --
398 hr_utility.set_location(' Leaving:'||l_proc, 50);
399 --
400 END create_organization_internal;
401 --
402 -- --------------------------------------------------------------------------
403 -- |-----------------------<<create_hr_organization>>-----------------------|
404 -- --------------------------------------------------------------------------
405 --
406 procedure create_hr_organization
407 (p_validate in boolean default false
408 ,p_effective_date in date
409 ,p_business_group_id in number
410 ,p_name in varchar2
411 ,p_date_from in date
412 ,p_language_code in varchar2 default hr_api.userenv_Lang
413 ,p_location_id in number default null
414 ,p_date_to in date default null
415 ,p_internal_external_flag in varchar2 default null
416 ,p_internal_address_line in varchar2 default null
417 ,p_type in varchar2 default null
418 ,p_enabled_flag in varchar2 default 'N'
419 ,p_segment1 in varchar2 default null
420 ,p_segment2 in varchar2 default null
421 ,p_segment3 in varchar2 default null
422 ,p_segment4 in varchar2 default null
423 ,p_segment5 in varchar2 default null
424 ,p_segment6 in varchar2 default null
425 ,p_segment7 in varchar2 default null
426 ,p_segment8 in varchar2 default null
427 ,p_segment9 in varchar2 default null
428 ,p_segment10 in varchar2 default null
429 ,p_segment11 in varchar2 default null
430 ,p_segment12 in varchar2 default null
431 ,p_segment13 in varchar2 default null
432 ,p_segment14 in varchar2 default null
433 ,p_segment15 in varchar2 default null
434 ,p_segment16 in varchar2 default null
435 ,p_segment17 in varchar2 default null
436 ,p_segment18 in varchar2 default null
437 ,p_segment19 in varchar2 default null
438 ,p_segment20 in varchar2 default null
439 ,p_segment21 in varchar2 default null
440 ,p_segment22 in varchar2 default null
441 ,p_segment23 in varchar2 default null
442 ,p_segment24 in varchar2 default null
443 ,p_segment25 in varchar2 default null
444 ,p_segment26 in varchar2 default null
445 ,p_segment27 in varchar2 default null
446 ,p_segment28 in varchar2 default null
447 ,p_segment29 in varchar2 default null
448 ,p_segment30 in varchar2 default null
449 ,p_concat_segments in varchar2 default null
450 ,p_object_version_number_inf out nocopy number
451 ,p_object_version_number_org out nocopy number
452 ,p_organization_id out nocopy number
453 ,p_org_information_id out nocopy number
454 ,p_duplicate_org_warning out nocopy boolean
455 ) is
456 --
457 -- Declare local variables
458 --
459 l_flex_num fnd_id_flex_segments.id_flex_num%Type;
460 l_cost_name pay_cost_allocation_keyflex.concatenated_segments%Type;
461 l_cost_alloc_key_id hr_all_organization_units.cost_allocation_keyflex_id%Type;
462 l_date_from date;
463 l_effective_date date;
464 --
465 l_proc varchar2(72) := g_package||'CREATE_HR_ORGANIZATION';
466 --
467 -- Declare cursors
468 --
469 -- Cursor to retrive the Cost Allocation structure id
470 -- for the current business group
471 --
472 cursor csr_cost_idsel is
473 select bus.cost_allocation_structure
474 from per_business_groups_perf bus
475 where bus.business_group_id = p_business_group_id;
476 --
477 begin
478 --
479 hr_utility.set_location('Entering:'|| l_proc, 10);
480 --
481 -- Issue a savepoint
482 --
483 savepoint create_hr_organization;
484 --
485 -- All date input parameters must be truncated to remove time elements
486 -- before passing into user hooks
487 --
488 l_date_from := trunc (p_date_from);
489 l_effective_date := trunc (p_effective_date);
490 --
491 begin
492 hr_organization_bk9.create_hr_organization_b
493 (p_effective_date => l_effective_date
494 ,p_business_group_id => p_business_group_id
495 ,p_name => p_name
496 ,p_date_from => l_date_from
497 ,p_language_code => p_language_code
498 ,p_location_id => p_location_id
499 ,p_date_to => p_date_to
500 ,p_internal_external_flag => p_internal_external_flag
501 ,p_internal_address_line => p_internal_address_line
502 ,p_type => p_type
503 ,p_enabled_flag => p_enabled_flag
504 ,p_segment1 => p_segment1
505 ,p_segment2 => p_segment2
506 ,p_segment3 => p_segment3
507 ,p_segment4 => p_segment4
508 ,p_segment5 => p_segment5
509 ,p_segment6 => p_segment6
510 ,p_segment7 => p_segment7
511 ,p_segment8 => p_segment8
512 ,p_segment9 => p_segment9
513 ,p_segment10 => p_segment10
514 ,p_segment11 => p_segment11
515 ,p_segment12 => p_segment12
516 ,p_segment13 => p_segment13
517 ,p_segment14 => p_segment14
518 ,p_segment15 => p_segment15
519 ,p_segment16 => p_segment16
520 ,p_segment17 => p_segment17
521 ,p_segment18 => p_segment18
522 ,p_segment19 => p_segment19
523 ,p_segment20 => p_segment20
524 ,p_segment21 => p_segment21
525 ,p_segment22 => p_segment22
526 ,p_segment23 => p_segment23
527 ,p_segment24 => p_segment24
528 ,p_segment25 => p_segment25
529 ,p_segment26 => p_segment26
530 ,p_segment27 => p_segment27
531 ,p_segment28 => p_segment28
532 ,p_segment29 => p_segment29
533 ,p_segment30 => p_segment30
534 ,p_concat_segments => p_concat_segments
535 );
536 exception
537 when hr_api.cannot_find_prog_unit then
538 hr_api.cannot_find_prog_unit_error
539 (p_module_name => 'create_hr_organization'
540 ,p_hook_type => 'BP'
541 );
542 end;
543 --
544 hr_utility.set_location(l_proc, 20);
545 --
546 -- Getting the structure number for Cost Allocation Flexfield
547 --
548 open csr_cost_idsel;
549 fetch csr_cost_idsel into l_flex_num;
550 --
551 if csr_cost_idsel%notfound then
552 --
553 close csr_cost_idsel;
554 --
555 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
556 hr_utility.set_message_token('PROCEDURE', l_proc);
557 hr_utility.set_message_token('STEP','5');
558 hr_utility.raise_error;
559 --
560 end if;
561 --
562 close csr_cost_idsel;
563 --
564 hr_utility.set_location(l_proc, 30);
565 --
566 -- Dterminine the Cost Allocation definition by calling ins_or_sel
567 --
568 hr_kflex_utility.ins_or_sel_keyflex_comb
569 (p_appl_short_name => 'PAY'
570 ,p_flex_code => 'COST'
571 ,p_flex_num => l_flex_num
572 ,p_segment1 => p_segment1
573 ,p_segment2 => p_segment2
574 ,p_segment3 => p_segment3
575 ,p_segment4 => p_segment4
576 ,p_segment5 => p_segment5
577 ,p_segment6 => p_segment6
578 ,p_segment7 => p_segment7
579 ,p_segment8 => p_segment8
580 ,p_segment9 => p_segment9
581 ,p_segment10 => p_segment10
582 ,p_segment11 => p_segment11
583 ,p_segment12 => p_segment12
584 ,p_segment13 => p_segment13
585 ,p_segment14 => p_segment14
586 ,p_segment15 => p_segment15
587 ,p_segment16 => p_segment16
588 ,p_segment17 => p_segment17
589 ,p_segment18 => p_segment18
590 ,p_segment19 => p_segment19
591 ,p_segment20 => p_segment20
592 ,p_segment21 => p_segment21
593 ,p_segment22 => p_segment22
594 ,p_segment23 => p_segment23
595 ,p_segment24 => p_segment24
596 ,p_segment25 => p_segment25
597 ,p_segment26 => p_segment26
598 ,p_segment27 => p_segment27
599 ,p_segment28 => p_segment28
600 ,p_segment29 => p_segment29
601 ,p_segment30 => p_segment30
602 ,p_concat_segments_in => p_concat_segments
603 ,p_ccid => l_cost_alloc_key_id
604 ,p_concat_segments_out => l_cost_name);
605 --
606 hr_utility.set_location(l_proc, 40);
607 hr_utility.set_location(l_proc ||'l_cost_alloc_key_id '||l_cost_alloc_key_id, 61);
608 hr_utility.set_location(l_proc ||'l_cost_name '||l_cost_name, 62);
609 --
610 update_cost_concat_segs (p_cost_allocation_keyflex_id => l_cost_alloc_key_id
611 ,p_cost_name => l_cost_name);
612 --
613 hr_utility.set_location(l_proc, 50);
614 --
615 create_organization_internal
616 (p_effective_date => p_effective_date
617 ,p_language_code => p_language_code
618 ,p_business_group_id => p_business_group_id
619 ,p_date_from => p_date_from
620 ,p_name => p_name
621 ,p_cost_allocation_keyflex_id => l_cost_alloc_key_id
622 ,p_location_id => p_location_id
623 ,p_date_to => p_date_to
624 ,p_internal_external_flag => p_internal_external_flag
625 ,p_internal_address_line => p_internal_address_line
626 ,p_type => p_type
627 ,p_attribute_category => null
628 ,p_attribute1 => null
629 ,p_attribute2 => null
630 ,p_attribute3 => null
631 ,p_attribute4 => null
632 ,p_attribute5 => null
633 ,p_attribute6 => null
634 ,p_attribute7 => null
635 ,p_attribute8 => null
636 ,p_attribute9 => null
637 ,p_attribute10 => null
638 ,p_attribute11 => null
639 ,p_attribute12 => null
640 ,p_attribute13 => null
641 ,p_attribute14 => null
642 ,p_attribute15 => null
643 ,p_attribute16 => null
644 ,p_attribute17 => null
645 ,p_attribute18 => null
646 ,p_attribute19 => null
647 ,p_attribute20 => null
648 --Enhancement 4040086
649 ,p_attribute21 => null
650 ,p_attribute22 => null
651 ,p_attribute23 => null
652 ,p_attribute24 => null
653 ,p_attribute25 => null
654 ,p_attribute26 => null
655 ,p_attribute27 => null
656 ,p_attribute28 => null
657 ,p_attribute29 => null
658 ,p_attribute30 => null
659 --End Enhancement 4040086
660 ,p_organization_id => p_organization_id
661 ,p_object_version_number => p_object_version_number_org
662 ,p_duplicate_org_warning => p_duplicate_org_warning);
663 --
664 hr_utility.set_location(l_proc, 60);
665 --
666 hr_organization_api.create_org_information
667 ( p_effective_date => p_effective_date
668 ,p_organization_id => p_organization_id
669 ,p_org_info_type_code => 'CLASS'
670 ,p_org_information1 => 'HR_ORG'
671 ,p_org_information2 => p_enabled_flag
672 ,p_org_information3 => null
673 ,p_org_information4 => null
674 ,p_org_information5 => null
675 ,p_org_information6 => null
676 ,p_org_information7 => null
677 ,p_org_information8 => null
678 ,p_org_information9 => null
679 ,p_org_information10 => null
680 ,p_org_information11 => null
681 ,p_org_information12 => null
682 ,p_org_information13 => null
683 ,p_org_information14 => null
684 ,p_org_information15 => null
685 ,p_org_information16 => null
686 ,p_org_information17 => null
687 ,p_org_information18 => null
688 ,p_org_information19 => null
689 ,p_org_information20 => null
690 ,p_attribute_category => null
691 ,p_attribute1 => null
692 ,p_attribute2 => null
693 ,p_attribute3 => null
694 ,p_attribute4 => null
695 ,p_attribute5 => null
696 ,p_attribute6 => null
697 ,p_attribute7 => null
698 ,p_attribute8 => null
699 ,p_attribute9 => null
700 ,p_attribute10 => null
701 ,p_attribute11 => null
702 ,p_attribute12 => null
703 ,p_attribute13 => null
704 ,p_attribute14 => null
705 ,p_attribute15 => null
706 ,p_attribute16 => null
707 ,p_attribute17 => null
708 ,p_attribute18 => null
709 ,p_attribute19 => null
710 ,p_attribute20 => null
711 ,p_org_information_id => p_org_information_id
712 ,p_object_version_number => p_object_version_number_inf
713 );
714 --
715 hr_utility.set_location(l_proc, 70);
716 --
717 begin
718 hr_organization_bk9.create_hr_organization_a
719 (p_effective_date => l_effective_date
720 ,p_business_group_id => p_business_group_id
721 ,p_name => p_name
722 ,p_date_from => l_date_from
723 ,p_language_code => p_language_code
724 ,p_location_id => p_location_id
725 ,p_date_to => p_date_to
726 ,p_internal_external_flag => p_internal_external_flag
727 ,p_internal_address_line => p_internal_address_line
728 ,p_type => p_type
729 ,p_enabled_flag => p_enabled_flag
730 ,p_segment1 => p_segment1
731 ,p_segment2 => p_segment2
732 ,p_segment3 => p_segment3
733 ,p_segment4 => p_segment4
734 ,p_segment5 => p_segment5
735 ,p_segment6 => p_segment6
736 ,p_segment7 => p_segment7
737 ,p_segment8 => p_segment8
738 ,p_segment9 => p_segment9
739 ,p_segment10 => p_segment10
740 ,p_segment11 => p_segment11
741 ,p_segment12 => p_segment12
742 ,p_segment13 => p_segment13
743 ,p_segment14 => p_segment14
744 ,p_segment15 => p_segment15
745 ,p_segment16 => p_segment16
746 ,p_segment17 => p_segment17
747 ,p_segment18 => p_segment18
748 ,p_segment19 => p_segment19
749 ,p_segment20 => p_segment20
750 ,p_segment21 => p_segment21
751 ,p_segment22 => p_segment22
752 ,p_segment23 => p_segment23
753 ,p_segment24 => p_segment24
754 ,p_segment25 => p_segment25
755 ,p_segment26 => p_segment26
756 ,p_segment27 => p_segment27
757 ,p_segment28 => p_segment28
758 ,p_segment29 => p_segment29
759 ,p_segment30 => p_segment30
760 ,p_concat_segments => p_concat_segments
761 ,p_object_version_number_inf => p_object_version_number_inf
762 ,p_object_version_number_org => p_object_version_number_org
763 ,p_organization_id => p_organization_id
764 ,p_org_information_id => p_org_information_id
765 ,p_duplicate_org_warning => p_duplicate_org_warning
766 );
767 exception
768 when hr_api.cannot_find_prog_unit then
769 hr_api.cannot_find_prog_unit_error
770 (p_module_name => 'create_hr_organization'
771 ,p_hook_type => 'AP'
772 );
773 end;
774 --
775 hr_utility.set_location(l_proc, 80);
776 --
777 -- When in validation only mode raise the Validate_Enabled exception
778 --
779 if p_validate then
780 raise hr_api.validate_enabled;
781 end if;
782 --
783 hr_utility.set_location(' Leaving:'||l_proc, 99);
784 --
785 EXCEPTION
786
787 WHEN hr_api.validate_enabled THEN
788 --
789 -- As the Validate_Enabled exception has been raised
790 -- we must rollback to the savepoint
791 --
792 hr_utility.set_location(' Leaving:'||l_proc, 99);
793
794 ROLLBACK TO create_hr_organization;
795 --
796 -- Only set output warning arguments
797 -- (Any key or derived arguments must be set to null
798 -- when validation only mode is being used.)
799 --
800 p_object_version_number_inf := NULL;
801 p_object_version_number_org := NULL;
802 p_organization_id := NULL;
803 p_org_information_id := NULL;
804 hr_utility.set_location(' Leaving:'||l_proc, 99);
805
806 WHEN OTHERS THEN
807 --
808 -- A validation or unexpected error has occurred
809 ROLLBACK TO create_hr_organization;
810 -- Set OUT parameters.
811 p_object_version_number_inf := NULL;
812 p_object_version_number_org := NULL;
813 p_organization_id := NULL;
814 p_org_information_id := NULL;
815 p_duplicate_org_warning := NULL;
816 hr_utility.set_location(' Leaving:'||l_proc, 99);
817 RAISE;
818
819 hr_utility.set_location(' Leaving:'||l_proc, 99);
820
821 end create_hr_organization;
822 --
823 -- ----------------------------------------------------------------------------
824 -- |-----------------------------< create_organization >----------------------|
825 -- ----------------------------------------------------------------------------
826 --
827 -- This procedure is to allow backwards compatibility with calls that do not
828 -- include the p_duplicate_organization_warning parameter
829 --
830 PROCEDURE create_organization
831 ( p_validate IN BOOLEAN DEFAULT false
832 ,p_effective_date IN DATE
833 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
834 ,p_business_group_id IN NUMBER
835 ,p_date_from IN DATE
836 ,p_name IN VARCHAR2
837 ,p_location_id in number default null
838 ,p_date_to in date default null
839 ,p_internal_external_flag in varchar2 default null
840 ,p_internal_address_line in varchar2 default null
841 ,p_type in varchar2 default null
842 ,p_comments in varchar2 default null
843 ,p_attribute_category in varchar2 default null
844 ,p_attribute1 in varchar2 default null
845 ,p_attribute2 in varchar2 default null
846 ,p_attribute3 in varchar2 default null
847 ,p_attribute4 in varchar2 default null
848 ,p_attribute5 in varchar2 default null
849 ,p_attribute6 in varchar2 default null
850 ,p_attribute7 in varchar2 default null
851 ,p_attribute8 in varchar2 default null
852 ,p_attribute9 in varchar2 default null
853 ,p_attribute10 in varchar2 default null
854 ,p_attribute11 in varchar2 default null
855 ,p_attribute12 in varchar2 default null
856 ,p_attribute13 in varchar2 default null
857 ,p_attribute14 in varchar2 default null
858 ,p_attribute15 in varchar2 default null
859 ,p_attribute16 in varchar2 default null
860 ,p_attribute17 in varchar2 default null
861 ,p_attribute18 in varchar2 default null
862 ,p_attribute19 in varchar2 default null
863 ,p_attribute20 in varchar2 default null
864 --Enhancement 4040086
865 --Begin of Add 10 additional segments
866 ,p_attribute21 in varchar2 default null
867 ,p_attribute22 in varchar2 default null
868 ,p_attribute23 in varchar2 default null
869 ,p_attribute24 in varchar2 default null
870 ,p_attribute25 in varchar2 default null
871 ,p_attribute26 in varchar2 default null
872 ,p_attribute27 in varchar2 default null
873 ,p_attribute28 in varchar2 default null
874 ,p_attribute29 in varchar2 default null
875 ,p_attribute30 in varchar2 default null
876 --End of Add 10 additional segments
877 ,p_organization_id OUT NOCOPY NUMBER
878 ,p_object_version_number OUT NOCOPY NUMBER
879 )
880 IS
881 l_duplicate_org_warning boolean;
882 begin
883 create_organization
884 ( p_validate => p_validate
885 ,p_effective_date => p_effective_date
886 ,p_language_code => p_language_code
887 ,p_business_group_id => p_business_group_id
888 ,p_date_from => p_date_from
889 ,p_name => p_name
890 ,p_location_id => p_location_id
891 ,p_date_to => p_date_to
892 ,p_internal_external_flag => p_internal_external_flag
893 ,p_internal_address_line => p_internal_address_line
894 ,p_type => p_type
895 ,p_comments => p_comments
896 ,p_attribute_category => p_attribute_category
897 ,p_attribute1 => p_attribute1
898 ,p_attribute2 => p_attribute2
899 ,p_attribute3 => p_attribute3
900 ,p_attribute4 => p_attribute4
901 ,p_attribute5 => p_attribute5
902 ,p_attribute6 => p_attribute6
903 ,p_attribute7 => p_attribute7
904 ,p_attribute8 => p_attribute8
905 ,p_attribute9 => p_attribute9
906 ,p_attribute10 => p_attribute10
907 ,p_attribute11 => p_attribute11
908 ,p_attribute12 => p_attribute12
909 ,p_attribute13 => p_attribute13
910 ,p_attribute14 => p_attribute14
911 ,p_attribute15 => p_attribute15
912 ,p_attribute16 => p_attribute16
913 ,p_attribute17 => p_attribute17
914 ,p_attribute18 => p_attribute18
915 ,p_attribute19 => p_attribute19
916 ,p_attribute20 => p_attribute20
917 --Enhancement 4040086
918 ,p_attribute21 => p_attribute21
919 ,p_attribute22 => p_attribute22
920 ,p_attribute23 => p_attribute23
921 ,p_attribute24 => p_attribute24
922 ,p_attribute25 => p_attribute25
923 ,p_attribute26 => p_attribute26
924 ,p_attribute27 => p_attribute27
925 ,p_attribute28 => p_attribute28
926 ,p_attribute29 => p_attribute29
927 ,p_attribute30 => p_attribute30
928 --End Enhancement 4040086
929 ,p_organization_id => p_organization_id
930 ,p_object_version_number => p_object_version_number
931 ,p_duplicate_org_warning => l_duplicate_org_warning);
932
933 end;
934 --
935 -- ----------------------------------------------------------------------------
936 -- |-----------------------------< create_organization >-----------------------|
937 -- ----------------------------------------------------------------------------
938 --
939 PROCEDURE create_organization
940 ( p_validate IN BOOLEAN DEFAULT false
941 ,p_effective_date IN DATE
942 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
943 ,p_business_group_id IN NUMBER
944 ,p_date_from IN DATE
945 ,p_name IN VARCHAR2
946 ,p_location_id in number default null
947 ,p_date_to in date default null
948 ,p_internal_external_flag in varchar2 default null
949 ,p_internal_address_line in varchar2 default null
950 ,p_type in varchar2 default null
951 ,p_comments in varchar2 default null
952 ,p_attribute_category in varchar2 default null
953 ,p_attribute1 in varchar2 default null
954 ,p_attribute2 in varchar2 default null
955 ,p_attribute3 in varchar2 default null
956 ,p_attribute4 in varchar2 default null
957 ,p_attribute5 in varchar2 default null
958 ,p_attribute6 in varchar2 default null
959 ,p_attribute7 in varchar2 default null
960 ,p_attribute8 in varchar2 default null
961 ,p_attribute9 in varchar2 default null
962 ,p_attribute10 in varchar2 default null
963 ,p_attribute11 in varchar2 default null
964 ,p_attribute12 in varchar2 default null
965 ,p_attribute13 in varchar2 default null
966 ,p_attribute14 in varchar2 default null
967 ,p_attribute15 in varchar2 default null
968 ,p_attribute16 in varchar2 default null
969 ,p_attribute17 in varchar2 default null
970 ,p_attribute18 in varchar2 default null
971 ,p_attribute19 in varchar2 default null
972 ,p_attribute20 in varchar2 default null
973 --Enhancement 4040086
974 --Begin of Add 10 additional segments
975 ,p_attribute21 in varchar2 default null
976 ,p_attribute22 in varchar2 default null
977 ,p_attribute23 in varchar2 default null
978 ,p_attribute24 in varchar2 default null
979 ,p_attribute25 in varchar2 default null
980 ,p_attribute26 in varchar2 default null
981 ,p_attribute27 in varchar2 default null
982 ,p_attribute28 in varchar2 default null
983 ,p_attribute29 in varchar2 default null
984 ,p_attribute30 in varchar2 default null
985 --End of Add 10 additional segments
986 ,p_organization_id OUT NOCOPY NUMBER
987 ,p_object_version_number OUT NOCOPY NUMBER
988 ,p_duplicate_org_warning OUT NOCOPY BOOLEAN
989 ) IS
990 --
991 l_duplicate_org_warning boolean;
992 l_date_from date;
993 l_effective_date date;
994 l_proc varchar2(72) := g_package||'create_organization';
995 --
996 BEGIN
997 --
998 hr_utility.set_location('Entering:'|| l_proc, 10);
999 --
1000 -- Issue a savepoint
1001 --
1002 savepoint create_organization;
1003 --
1004 -- All date input parameters must be truncated to remove time elements
1005 -- before passing into user hooks
1006 --
1007 l_date_from := trunc (p_date_from);
1008 l_effective_date := trunc (p_effective_date);
1009 --
1010 begin
1011 hr_organization_bk3.create_organization_b
1012 (p_effective_date => l_effective_date
1013 ,p_language_code => p_language_code
1014 ,p_business_group_id => p_business_group_id
1015 ,p_date_from => l_date_from
1016 ,p_name => p_name
1017 ,p_location_id => p_location_id
1018 ,p_date_to => p_date_to
1019 ,p_internal_external_flag => p_internal_external_flag
1020 ,p_internal_address_line => p_internal_address_line
1021 ,p_type => p_type
1022 ,p_attribute_category => p_attribute_category
1023 ,p_attribute1 => p_attribute1
1024 ,p_attribute2 => p_attribute2
1025 ,p_attribute3 => p_attribute3
1026 ,p_attribute4 => p_attribute4
1027 ,p_attribute5 => p_attribute5
1028 ,p_attribute6 => p_attribute6
1029 ,p_attribute7 => p_attribute7
1030 ,p_attribute8 => p_attribute8
1031 ,p_attribute9 => p_attribute9
1032 ,p_attribute10 => p_attribute10
1033 ,p_attribute11 => p_attribute11
1034 ,p_attribute12 => p_attribute12
1035 ,p_attribute13 => p_attribute13
1036 ,p_attribute14 => p_attribute14
1037 ,p_attribute15 => p_attribute15
1038 ,p_attribute16 => p_attribute16
1039 ,p_attribute17 => p_attribute17
1040 ,p_attribute18 => p_attribute18
1041 ,p_attribute19 => p_attribute19
1042 ,p_attribute20 => p_attribute20
1043 --Enhancement 4040086
1044 ,p_attribute21 => p_attribute21
1045 ,p_attribute22 => p_attribute22
1046 ,p_attribute23 => p_attribute23
1047 ,p_attribute24 => p_attribute24
1048 ,p_attribute25 => p_attribute25
1049 ,p_attribute26 => p_attribute26
1050 ,p_attribute27 => p_attribute27
1051 ,p_attribute28 => p_attribute28
1052 ,p_attribute29 => p_attribute29
1053 ,p_attribute30 => p_attribute30
1054 --End Enhancement 4040086
1055 );
1056 exception
1057 when hr_api.cannot_find_prog_unit then
1058 hr_api.cannot_find_prog_unit_error
1059 (p_module_name => 'create_organization'
1060 ,p_hook_type => 'BP'
1061 );
1062 end;
1063
1064 --
1065 hr_utility.set_location(l_proc, 15);
1066 --
1067 create_organization_internal
1068 ( p_effective_date => p_effective_date
1069 ,p_language_code => p_language_code
1070 ,p_business_group_id => p_business_group_id
1071 ,p_date_from => p_date_from
1072 ,p_name => p_name
1073 ,p_cost_allocation_keyflex_id => null
1074 ,p_location_id => p_location_id
1075 ,p_date_to => p_date_to
1076 ,p_internal_external_flag => p_internal_external_flag
1077 ,p_internal_address_line => p_internal_address_line
1078 ,p_type => p_type
1079 ,p_attribute_category => p_attribute_category
1080 ,p_attribute1 => p_attribute1
1081 ,p_attribute2 => p_attribute2
1082 ,p_attribute3 => p_attribute3
1083 ,p_attribute4 => p_attribute4
1084 ,p_attribute5 => p_attribute5
1085 ,p_attribute6 => p_attribute6
1086 ,p_attribute7 => p_attribute7
1087 ,p_attribute8 => p_attribute8
1088 ,p_attribute9 => p_attribute9
1089 ,p_attribute10 => p_attribute10
1090 ,p_attribute11 => p_attribute11
1091 ,p_attribute12 => p_attribute12
1092 ,p_attribute13 => p_attribute13
1093 ,p_attribute14 => p_attribute14
1094 ,p_attribute15 => p_attribute15
1095 ,p_attribute16 => p_attribute16
1096 ,p_attribute17 => p_attribute17
1097 ,p_attribute18 => p_attribute18
1098 ,p_attribute19 => p_attribute19
1099 ,p_attribute20 => p_attribute20
1100 --Enhancement 4040086
1101 ,p_attribute21 => p_attribute21
1102 ,p_attribute22 => p_attribute22
1103 ,p_attribute23 => p_attribute23
1104 ,p_attribute24 => p_attribute24
1105 ,p_attribute25 => p_attribute25
1106 ,p_attribute26 => p_attribute26
1107 ,p_attribute27 => p_attribute27
1108 ,p_attribute28 => p_attribute28
1109 ,p_attribute29 => p_attribute29
1110 ,p_attribute30 => p_attribute30
1111 --End Enhancement 4040086
1112 ,p_organization_id => p_organization_id
1113 ,p_object_version_number => p_object_version_number
1114 ,p_duplicate_org_warning => p_duplicate_org_warning);
1115 --
1116 hr_utility.set_location(l_proc, 20);
1117 --
1118
1119 begin
1120 hr_organization_bk3.create_organization_a
1121 (p_effective_date => l_effective_date
1122 ,p_language_code => p_language_code
1123 ,p_business_group_id => p_business_group_id
1124 ,p_date_from => l_date_from
1125 ,p_name => p_name
1126 ,p_location_id => p_location_id
1127 ,p_date_to => p_date_to
1128 ,p_internal_external_flag => p_internal_external_flag
1129 ,p_internal_address_line => p_internal_address_line
1130 ,p_type => p_type
1131 ,p_attribute_category => p_attribute_category
1132 ,p_attribute1 => p_attribute1
1133 ,p_attribute2 => p_attribute2
1134 ,p_attribute3 => p_attribute3
1135 ,p_attribute4 => p_attribute4
1136 ,p_attribute5 => p_attribute5
1137 ,p_attribute6 => p_attribute6
1138 ,p_attribute7 => p_attribute7
1139 ,p_attribute8 => p_attribute8
1140 ,p_attribute9 => p_attribute9
1141 ,p_attribute10 => p_attribute10
1142 ,p_attribute11 => p_attribute11
1143 ,p_attribute12 => p_attribute12
1144 ,p_attribute13 => p_attribute13
1145 ,p_attribute14 => p_attribute14
1146 ,p_attribute15 => p_attribute15
1147 ,p_attribute16 => p_attribute16
1148 ,p_attribute17 => p_attribute17
1149 ,p_attribute18 => p_attribute18
1150 ,p_attribute19 => p_attribute19
1151 ,p_attribute20 => p_attribute20
1152 --Enhancement 4040086
1153 ,p_attribute21 => p_attribute21
1154 ,p_attribute22 => p_attribute22
1155 ,p_attribute23 => p_attribute23
1156 ,p_attribute24 => p_attribute24
1157 ,p_attribute25 => p_attribute25
1158 ,p_attribute26 => p_attribute26
1159 ,p_attribute27 => p_attribute27
1160 ,p_attribute28 => p_attribute28
1161 ,p_attribute29 => p_attribute29
1162 ,p_attribute30 => p_attribute30
1163 --End Enhancement 4040086
1164 ,p_organization_id => p_organization_id
1165 ,p_object_version_number => p_object_version_number
1166 ,p_duplicate_org_warning => p_duplicate_org_warning
1167 );
1168
1169 exception
1170 when hr_api.cannot_find_prog_unit then
1171 hr_api.cannot_find_prog_unit_error
1172 (p_module_name => 'create_organization'
1173 ,p_hook_type => 'AP'
1174 );
1175 end;
1176 --
1177 -- When in validation only mode raise the Validate_Enabled exception
1178 --
1179 if p_validate then
1180 raise hr_api.validate_enabled;
1181 end if;
1182 --
1183 hr_utility.set_location(' Leaving:'||l_proc, 30);
1184 --
1185
1186 EXCEPTION
1187 --
1188 WHEN hr_api.validate_enabled THEN
1189 --
1190 -- As the Validate_Enabled exception has been raised
1191 -- we must rollback to the savepoint
1192 --
1193 ROLLBACK TO create_organization;
1194 --
1195 -- Only set output warning arguments
1196 -- (Any key or derived arguments must be set to null
1197 -- when validation only mode is being used.)
1198 --
1199 p_organization_id := NULL;
1200 p_object_version_number := NULL;
1201 p_duplicate_org_warning := l_duplicate_org_warning;
1202 hr_utility.set_location(' Leaving:'||l_proc, 80);
1203 WHEN OTHERS THEN
1204 --
1205 -- A validation or unexpected error has occurred
1206 ROLLBACK TO create_organization;
1207 -- Set OUT parameters.
1208 p_organization_id := NULL;
1209 p_object_version_number := NULL;
1210 p_duplicate_org_warning := NULL;
1211 hr_utility.set_location(' Leaving:'||l_proc, 90);
1212 RAISE;
1213 --
1214 END create_organization;
1215 --
1216 -- ----------------------------------------------------------------------------
1217 -- |-----------------------------< update_organization >----------------------|
1218 -- ----------------------------------------------------------------------------
1219 --
1220 -- This procedure is to allow backwards compatibility with calls that do not
1221 -- include the p_duplicate_organization_warning parameter
1222 --
1223 PROCEDURE update_organization
1224 ( p_validate IN BOOLEAN DEFAULT false
1225 ,p_effective_date IN DATE
1226 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
1227 --
1228 ,p_organization_id IN NUMBER
1229 ,p_cost_allocation_keyflex_id IN NUMBER DEFAULT hr_api.g_number
1230 ,p_location_id IN NUMBER DEFAULT hr_api.g_number
1231 --Bug 3040119
1232 --,p_soft_coding_keyflex_id IN NUMBER DEFAULT hr_api.g_number
1233 ,p_date_from IN DATE DEFAULT hr_api.g_date
1234 ,p_date_to IN DATE DEFAULT hr_api.g_date
1235 ,p_internal_external_flag IN VARCHAR2 DEFAULT hr_api.g_varchar2
1236 ,p_internal_address_line IN VARCHAR2 DEFAULT hr_api.g_varchar2
1237 ,p_type IN VARCHAR2 DEFAULT hr_api.g_varchar2
1238 ,p_comments IN VARCHAR2 DEFAULT hr_api.g_varchar2
1239 ,p_attribute_category IN VARCHAR2 DEFAULT hr_api.g_varchar2
1240 ,p_attribute1 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1241 ,p_attribute2 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1242 ,p_attribute3 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1243 ,p_attribute4 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1244 ,p_attribute5 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1245 ,p_attribute6 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1246 ,p_attribute7 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1247 ,p_attribute8 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1248 ,p_attribute9 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1249 ,p_attribute10 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1250 ,p_attribute11 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1251 ,p_attribute12 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1252 ,p_attribute13 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1253 ,p_attribute14 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1254 ,p_attribute15 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1255 ,p_attribute16 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1256 ,p_attribute17 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1257 ,p_attribute18 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1258 ,p_attribute19 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1259 ,p_attribute20 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1260 --Enhancement 4040086
1261 --Begin of Add 10 additional segments
1262 ,p_attribute21 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1263 ,p_attribute22 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1264 ,p_attribute23 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1265 ,p_attribute24 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1266 ,p_attribute25 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1267 ,p_attribute26 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1268 ,p_attribute27 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1269 ,p_attribute28 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1270 ,p_attribute29 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1271 ,p_attribute30 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1272 --End of Enhancement 4040086
1273 -- Bug 3039046
1274 ,p_segment1 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1275 ,p_segment2 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1276 ,p_segment3 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1277 ,p_segment4 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1278 ,p_segment5 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1279 ,p_segment6 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1280 ,p_segment7 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1281 ,p_segment8 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1282 ,p_segment9 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1283 ,p_segment10 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1284 ,p_segment11 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1285 ,p_segment12 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1286 ,p_segment13 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1287 ,p_segment14 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1288 ,p_segment15 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1289 ,p_segment16 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1290 ,p_segment17 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1291 ,p_segment18 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1292 ,p_segment19 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1293 ,p_segment20 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1294 ,p_segment21 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1295 ,p_segment22 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1296 ,p_segment23 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1297 ,p_segment24 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1298 ,p_segment25 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1299 ,p_segment26 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1300 ,p_segment27 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1301 ,p_segment28 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1302 ,p_segment29 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1303 ,p_segment30 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1304 ,p_concat_segments IN VARCHAR2 DEFAULT hr_api.g_varchar2
1305 --
1306 ,p_object_version_number IN OUT NOCOPY NUMBER
1307 )
1308 IS
1309 l_duplicate_org_warning boolean;
1310
1311 -- Bug fix 3224918.
1312 -- l_name is assgned the default value hr_api.g_varchar2.
1313 -- This will ensure that the old database value for name
1314 -- will be assigned to l_name while updating.
1315 l_name varchar2(500) := hr_api.g_varchar2;
1316
1317 begin
1318 update_organization
1319 ( p_effective_date => p_effective_date
1320 ,p_language_code => p_language_code
1321 ,p_name => l_name
1322 ,p_organization_id => p_organization_id
1323 ,p_cost_allocation_keyflex_id => p_cost_allocation_keyflex_id
1324 ,p_location_id => p_location_id
1325 -- Bug 3040119
1326 --,p_soft_coding_keyflex_id => p_soft_coding_keyflex_id
1327 ,p_date_from => p_date_from
1328 ,p_date_to => p_date_to
1329 ,p_internal_external_flag => p_internal_external_flag
1330 ,p_internal_address_line => p_internal_address_line
1331 ,p_type => p_type
1332 ,p_comments => p_comments
1333 ,p_attribute_category => p_attribute_category
1334 ,p_attribute1 => p_attribute1
1335 ,p_attribute2 => p_attribute2
1336 ,p_attribute3 => p_attribute3
1337 ,p_attribute4 => p_attribute4
1338 ,p_attribute5 => p_attribute5
1339 ,p_attribute6 => p_attribute6
1340 ,p_attribute7 => p_attribute7
1341 ,p_attribute8 => p_attribute8
1342 ,p_attribute9 => p_attribute9
1343 ,p_attribute10 => p_attribute10
1344 ,p_attribute11 => p_attribute11
1345 ,p_attribute12 => p_attribute12
1346 ,p_attribute13 => p_attribute13
1347 ,p_attribute14 => p_attribute14
1348 ,p_attribute15 => p_attribute15
1349 ,p_attribute16 => p_attribute16
1350 ,p_attribute17 => p_attribute17
1351 ,p_attribute18 => p_attribute18
1352 ,p_attribute19 => p_attribute19
1353 ,p_attribute20 => p_attribute20
1354 --Enhancement 4040086
1355 ,p_attribute21 => p_attribute21
1356 ,p_attribute22 => p_attribute22
1357 ,p_attribute23 => p_attribute23
1358 ,p_attribute24 => p_attribute24
1359 ,p_attribute25 => p_attribute25
1360 ,p_attribute26 => p_attribute26
1361 ,p_attribute27 => p_attribute27
1362 ,p_attribute28 => p_attribute28
1363 ,p_attribute29 => p_attribute29
1364 ,p_attribute30 => p_attribute30
1365 --End Enhancement 4040086
1366 -- Bug 3039046
1367 ,p_segment1 => p_segment1
1368 ,p_segment2 => p_segment2
1369 ,p_segment3 => p_segment3
1370 ,p_segment4 => p_segment4
1371 ,p_segment5 => p_segment5
1372 ,p_segment6 => p_segment6
1373 ,p_segment7 => p_segment7
1374 ,p_segment8 => p_segment8
1375 ,p_segment9 => p_segment9
1376 ,p_segment10 => p_segment10
1377 ,p_segment11 => p_segment11
1378 ,p_segment12 => p_segment12
1379 ,p_segment13 => p_segment13
1380 ,p_segment14 => p_segment14
1381 ,p_segment15 => p_segment15
1382 ,p_segment16 => p_segment16
1383 ,p_segment17 => p_segment17
1384 ,p_segment18 => p_segment18
1385 ,p_segment19 => p_segment19
1386 ,p_segment20 => p_segment20
1387 ,p_segment21 => p_segment21
1388 ,p_segment22 => p_segment22
1389 ,p_segment23 => p_segment23
1390 ,p_segment24 => p_segment24
1391 ,p_segment25 => p_segment25
1392 ,p_segment26 => p_segment26
1393 ,p_segment27 => p_segment27
1394 ,p_segment28 => p_segment28
1395 ,p_segment29 => p_segment29
1396 ,p_segment30 => p_segment30
1397 ,p_concat_segments => p_concat_segments
1398 --
1399 ,p_object_version_number => p_object_version_number
1400 ,p_duplicate_org_warning => l_duplicate_org_warning);
1401 end;
1402
1403 -- ----------------------------------------------------------------------------
1404 -- |--------------------------< update_organization >-------------------------|
1405 -- ----------------------------------------------------------------------------
1406 --
1407 PROCEDURE update_organization
1408 ( p_validate IN BOOLEAN DEFAULT false
1409 ,p_effective_date IN DATE
1410 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
1411 --
1412 ,p_name IN VARCHAR2 DEFAULT hr_api.g_varchar2
1413 ,p_organization_id IN NUMBER
1414 ,p_cost_allocation_keyflex_id IN NUMBER DEFAULT hr_api.g_number
1415 ,p_location_id IN NUMBER DEFAULT hr_api.g_number
1416 -- Bug 3040119
1417 --,p_soft_coding_keyflex_id IN NUMBER DEFAULT hr_api.g_number
1418 ,p_date_from IN DATE DEFAULT hr_api.g_date
1419 ,p_date_to IN DATE DEFAULT hr_api.g_date
1420 ,p_internal_external_flag IN VARCHAR2 DEFAULT hr_api.g_varchar2
1421 ,p_internal_address_line IN VARCHAR2 DEFAULT hr_api.g_varchar2
1422 ,p_type IN VARCHAR2 DEFAULT hr_api.g_varchar2
1423 ,p_comments IN VARCHAR2 DEFAULT hr_api.g_varchar2
1424 ,p_attribute_category IN VARCHAR2 DEFAULT hr_api.g_varchar2
1425 ,p_attribute1 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1426 ,p_attribute2 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1427 ,p_attribute3 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1428 ,p_attribute4 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1429 ,p_attribute5 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1430 ,p_attribute6 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1431 ,p_attribute7 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1432 ,p_attribute8 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1433 ,p_attribute9 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1434 ,p_attribute10 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1435 ,p_attribute11 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1436 ,p_attribute12 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1437 ,p_attribute13 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1438 ,p_attribute14 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1439 ,p_attribute15 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1440 ,p_attribute16 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1441 ,p_attribute17 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1442 ,p_attribute18 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1443 ,p_attribute19 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1444 ,p_attribute20 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1445 --Enhancement 4040086
1446 --Begin of Add 10 additional segments
1447 ,p_attribute21 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1448 ,p_attribute22 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1449 ,p_attribute23 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1450 ,p_attribute24 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1451 ,p_attribute25 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1452 ,p_attribute26 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1453 ,p_attribute27 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1454 ,p_attribute28 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1455 ,p_attribute29 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1456 ,p_attribute30 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1457 --End of Add 10 additional segments
1458 -- Bug 3039046
1459 ,p_segment1 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1460 ,p_segment2 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1461 ,p_segment3 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1462 ,p_segment4 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1463 ,p_segment5 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1464 ,p_segment6 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1465 ,p_segment7 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1466 ,p_segment8 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1467 ,p_segment9 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1468 ,p_segment10 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1469 ,p_segment11 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1470 ,p_segment12 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1471 ,p_segment13 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1472 ,p_segment14 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1473 ,p_segment15 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1474 ,p_segment16 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1475 ,p_segment17 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1476 ,p_segment18 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1477 ,p_segment19 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1478 ,p_segment20 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1479 ,p_segment21 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1480 ,p_segment22 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1481 ,p_segment23 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1482 ,p_segment24 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1483 ,p_segment25 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1484 ,p_segment26 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1485 ,p_segment27 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1486 ,p_segment28 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1487 ,p_segment29 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1488 ,p_segment30 IN VARCHAR2 DEFAULT hr_api.g_varchar2
1489 ,p_concat_segments IN VARCHAR2 DEFAULT hr_api.g_varchar2
1490 --
1491 ,p_object_version_number IN OUT NOCOPY NUMBER
1492 ,p_duplicate_org_warning out nocopy boolean
1493 ) IS
1494 --
1495 -- Declare cursors and local variables
1496 --
1497 l_proc VARCHAR2(72) := g_package||'update_organization';
1498 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
1499 l_language_code hr_all_organization_units_tl.language%TYPE;
1500 l_date_from DATE;
1501 l_date_to DATE;
1502 l_duplicate_org_warning boolean;
1503 l_temp_ovn number := p_object_version_number;
1504 --
1505 -- Bug 3039046 new variable to indicate whether cost allocation key flex
1506 -- entered with a value.
1507 --
1508 l_cost_null_ind number(1) := 0;
1509 l_api_updating boolean;
1510 l_flex_num fnd_id_flex_segments.id_flex_num%Type;
1511 l_cost_alloc_key_id hr_all_organization_units.cost_allocation_keyflex_id%Type
1512 := p_cost_allocation_keyflex_id;
1513 l_cost_name pay_cost_allocation_keyflex.concatenated_segments%Type;
1514 l_old_cost_name pay_cost_allocation_keyflex.concatenated_segments%Type;
1515 l_business_group_id per_all_assignments_f.business_group_id%Type;
1516 --
1517 -- bug 3039046 new variables for derived values where key flex id is known.
1518 --
1519 l_cost_segment1 varchar2(60) := p_segment1;
1520 l_cost_segment2 varchar2(60) := p_segment2;
1521 l_cost_segment3 varchar2(60) := p_segment3;
1522 l_cost_segment4 varchar2(60) := p_segment4;
1523 l_cost_segment5 varchar2(60) := p_segment5;
1524 l_cost_segment6 varchar2(60) := p_segment6;
1525 l_cost_segment7 varchar2(60) := p_segment7;
1526 l_cost_segment8 varchar2(60) := p_segment8;
1527 l_cost_segment9 varchar2(60) := p_segment9;
1528 l_cost_segment10 varchar2(60) := p_segment10;
1529 l_cost_segment11 varchar2(60) := p_segment11;
1530 l_cost_segment12 varchar2(60) := p_segment12;
1531 l_cost_segment13 varchar2(60) := p_segment13;
1532 l_cost_segment14 varchar2(60) := p_segment14;
1533 l_cost_segment15 varchar2(60) := p_segment15;
1534 l_cost_segment16 varchar2(60) := p_segment16;
1535 l_cost_segment17 varchar2(60) := p_segment17;
1536 l_cost_segment18 varchar2(60) := p_segment18;
1537 l_cost_segment19 varchar2(60) := p_segment19;
1538 l_cost_segment20 varchar2(60) := p_segment20;
1539 l_cost_segment21 varchar2(60) := p_segment21;
1540 l_cost_segment22 varchar2(60) := p_segment22;
1541 l_cost_segment23 varchar2(60) := p_segment23;
1542 l_cost_segment24 varchar2(60) := p_segment24;
1543 l_cost_segment25 varchar2(60) := p_segment25;
1544 l_cost_segment26 varchar2(60) := p_segment26;
1545 l_cost_segment27 varchar2(60) := p_segment27;
1546 l_cost_segment28 varchar2(60) := p_segment28;
1547 l_cost_segment29 varchar2(60) := p_segment29;
1548 l_cost_segment30 varchar2(60) := p_segment30;
1549 --
1550 cursor c_cost_segments is
1551 select concatenated_segments, -- Bug 3187772
1552 segment1,
1553 segment2,
1554 segment3,
1555 segment4,
1556 segment5,
1557 segment6,
1558 segment7,
1559 segment8,
1560 segment9,
1561 segment10,
1562 segment11,
1563 segment12,
1564 segment13,
1565 segment14,
1566 segment15,
1567 segment16,
1568 segment17,
1569 segment18,
1570 segment19,
1571 segment20,
1572 segment21,
1573 segment22,
1574 segment23,
1575 segment24,
1576 segment25,
1577 segment26,
1578 segment27,
1579 segment28,
1580 segment29,
1581 segment30
1582 from pay_cost_allocation_keyflex
1583 where cost_allocation_keyflex_id = l_cost_alloc_key_id;
1584 --
1585 --
1586 cursor csr_cost_idsel is
1587 select bus.cost_allocation_structure
1588 from per_business_groups_perf bus
1589 where bus.business_group_id = l_business_group_id;
1590 --
1591 -- Start of 3187772
1592 l_old_cost_segments c_cost_segments%rowtype;
1593 l_old_conc_segs pay_cost_allocation_keyflex.concatenated_segments%Type;
1594 -- End of 3187772
1595 --
1596 BEGIN
1597
1598 -- Bug 3039046 - if p_cost_allocation_keyflex_id enters with
1599 -- a value then get segment values from pay_cost_allocation_keyflex.
1600 --
1601 hr_utility.set_location(l_proc, 1);
1602
1603 l_old_cost_name := p_concat_segments;
1604 --
1605 if nvl(l_cost_alloc_key_id, hr_api.g_number) = hr_api.g_number then -- Bug 3187772
1606 l_cost_null_ind := 0;
1607 else
1608 -- get segment values
1609 open c_cost_segments;
1610 fetch c_cost_segments into l_old_conc_segs, -- Bug 3187772
1611 l_cost_segment1,
1612 l_cost_segment2,
1613 l_cost_segment3,
1614 l_cost_segment4,
1615 l_cost_segment5,
1616 l_cost_segment6,
1617 l_cost_segment7,
1618 l_cost_segment8,
1619 l_cost_segment9,
1620 l_cost_segment10,
1621 l_cost_segment11,
1622 l_cost_segment12,
1623 l_cost_segment13,
1624 l_cost_segment14,
1625 l_cost_segment15,
1626 l_cost_segment16,
1627 l_cost_segment17,
1628 l_cost_segment18,
1629 l_cost_segment19,
1630 l_cost_segment20,
1631 l_cost_segment21,
1632 l_cost_segment22,
1633 l_cost_segment23,
1634 l_cost_segment24,
1635 l_cost_segment25,
1636 l_cost_segment26,
1637 l_cost_segment27,
1638 l_cost_segment28,
1639 l_cost_segment29,
1640 l_cost_segment30;
1641 close c_cost_segments;
1642 l_cost_null_ind := 1;
1643 end if;
1644
1645 --
1646 -- Issue a savepoint.
1647 --
1648 savepoint update_organization;
1649 --
1650 l_date_from := trunc (p_date_from);
1651 l_date_to := trunc (p_date_to);
1652 --
1653 begin
1654 hr_organization_bk4.update_organization_b
1655 ( p_effective_date => p_effective_date
1656 ,p_language_code => p_language_code
1657 ,p_name => p_name
1658 ,p_organization_id => p_organization_id
1659 ,p_cost_allocation_keyflex_id => p_cost_allocation_keyflex_id
1660 ,p_location_id => p_location_id
1661 -- Bug 3040119
1662 --,p_soft_coding_keyflex_id => p_soft_coding_keyflex_id
1663 ,p_date_from => l_date_from
1664 ,p_date_to => l_date_to
1665 ,p_internal_external_flag => p_internal_external_flag
1666 ,p_internal_address_line => p_internal_address_line
1667 ,p_type => p_type
1668 ,p_attribute_category => p_attribute_category
1669 ,p_attribute1 => p_attribute1
1670 ,p_attribute2 => p_attribute2
1671 ,p_attribute3 => p_attribute3
1672 ,p_attribute4 => p_attribute4
1673 ,p_attribute5 => p_attribute5
1674 ,p_attribute6 => p_attribute6
1675 ,p_attribute7 => p_attribute7
1676 ,p_attribute8 => p_attribute8
1677 ,p_attribute9 => p_attribute9
1678 ,p_attribute10 => p_attribute10
1679 ,p_attribute11 => p_attribute11
1680 ,p_attribute12 => p_attribute12
1681 ,p_attribute13 => p_attribute13
1682 ,p_attribute14 => p_attribute14
1683 ,p_attribute15 => p_attribute15
1684 ,p_attribute16 => p_attribute16
1685 ,p_attribute17 => p_attribute17
1686 ,p_attribute18 => p_attribute18
1687 ,p_attribute19 => p_attribute19
1688 ,p_attribute20 => p_attribute20
1689 --Enhancement 4040086
1690 ,p_attribute21 => p_attribute21
1691 ,p_attribute22 => p_attribute22
1692 ,p_attribute23 => p_attribute23
1693 ,p_attribute24 => p_attribute24
1694 ,p_attribute25 => p_attribute25
1695 ,p_attribute26 => p_attribute26
1696 ,p_attribute27 => p_attribute27
1697 ,p_attribute28 => p_attribute28
1698 ,p_attribute29 => p_attribute29
1699 ,p_attribute30 => p_attribute30
1700 --End Enhancement 4040086
1701 -- Bug 3039046
1702 ,p_segment1 => l_cost_segment1
1703 ,p_segment2 => l_cost_segment2
1704 ,p_segment3 => l_cost_segment3
1705 ,p_segment4 => l_cost_segment4
1706 ,p_segment5 => l_cost_segment5
1707 ,p_segment6 => l_cost_segment6
1708 ,p_segment7 => l_cost_segment7
1709 ,p_segment8 => l_cost_segment8
1710 ,p_segment9 => l_cost_segment9
1711 ,p_segment10 => l_cost_segment10
1712 ,p_segment11 => l_cost_segment11
1713 ,p_segment12 => l_cost_segment12
1714 ,p_segment13 => l_cost_segment13
1715 ,p_segment14 => l_cost_segment14
1716 ,p_segment15 => l_cost_segment15
1717 ,p_segment16 => l_cost_segment16
1718 ,p_segment17 => l_cost_segment17
1719 ,p_segment18 => l_cost_segment18
1720 ,p_segment19 => l_cost_segment19
1721 ,p_segment20 => l_cost_segment20
1722 ,p_segment21 => l_cost_segment21
1723 ,p_segment22 => l_cost_segment22
1724 ,p_segment23 => l_cost_segment23
1725 ,p_segment24 => l_cost_segment24
1726 ,p_segment25 => l_cost_segment25
1727 ,p_segment26 => l_cost_segment26
1728 ,p_segment27 => l_cost_segment27
1729 ,p_segment28 => l_cost_segment28
1730 ,p_segment29 => l_cost_segment29
1731 ,p_segment30 => l_cost_segment30
1732 ,p_concat_segments => l_old_cost_name
1733 --
1734 ,p_object_version_number => l_object_version_number
1735 );
1736
1737 exception
1738 when hr_api.cannot_find_prog_unit then
1739 hr_api.cannot_find_prog_unit_error
1740 (p_module_name => 'update_organization'
1741 ,p_hook_type => 'BP'
1742 );
1743 end;
1744 --
1745 hr_utility.set_location('Entering:'|| l_proc, 10);
1746 --
1747 -- All date input parameters must be truncated to remove time elements
1748 --
1749 --
1750 -- Validate the language parameter. l_language_code should be passed to functions
1751 -- instead of p_language_code from now on, to allow an IN OUT parameter to be
1752 -- passed through.
1753 --
1754 l_language_code := p_language_code;
1755 hr_api.validate_language_code(p_language_code => l_language_code);
1756 hr_utility.set_location(l_proc, 20);
1757 --
1758 --
1759 -- Process Logic
1760 --
1761 l_object_version_number := p_object_version_number;
1762 --
1763 -- Bug 3039046
1764 -- Retrieve current organization details from database.
1765 hr_utility.set_location(l_proc, 21);
1766 l_api_updating := hr_oru_shd.api_updating
1767 (p_organization_id => p_organization_id
1768 ,p_object_version_number => l_object_version_number);
1769
1770 -- Maintain the people cost allocation key flexfields.
1771 --
1772 -- Only call the flex code if a non-default value(includng null) is passed
1773 -- to the procedure.
1774 --
1775 --
1776 hr_utility.set_location(l_proc, 22);
1777
1778 if not l_api_updating then
1779 hr_utility.set_location(l_proc, 23);
1780 --
1781 -- As this is an updating API, the organization should already exist.
1782 --
1783 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
1784 hr_utility.raise_error;
1785 end if;
1786
1787 -- Populate l_business_group_id from g_old_rec for cursor csr_cost_idsel
1788 l_business_group_id := hr_oru_shd.g_old_rec.business_group_id;
1789 open csr_cost_idsel;
1790 fetch csr_cost_idsel into l_flex_num;
1791 if csr_cost_idsel%NOTFOUND then
1792 close csr_cost_idsel;
1793 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1794 hr_utility.set_message_token('PROCEDURE', l_proc);
1795 hr_utility.set_message_token('STEP','5');
1796 hr_utility.raise_error;
1797 end if;
1798 close csr_cost_idsel;
1799
1800 hr_utility.set_location(l_proc, 24);
1801
1802 if l_cost_null_ind = 0 then
1803 --
1804 l_cost_alloc_key_id := hr_oru_shd.g_old_rec.cost_allocation_keyflex_id;
1805 --
1806 --
1807 -- Start of 4176977
1808 if l_cost_alloc_key_id is not null then
1809 open c_cost_segments;
1810 fetch c_cost_segments into l_old_cost_segments;
1811 close c_cost_segments;
1812 end if;
1813 --
1814 if nvl(l_cost_segment1, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment1, hr_api.g_varchar2)
1815 or nvl(l_cost_segment2, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment2, hr_api.g_varchar2)
1816 or nvl(l_cost_segment3, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment3, hr_api.g_varchar2)
1817 or nvl(l_cost_segment4, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment4, hr_api.g_varchar2)
1818 or nvl(l_cost_segment5, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment5, hr_api.g_varchar2)
1819 or nvl(l_cost_segment6, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment6, hr_api.g_varchar2)
1820 or nvl(l_cost_segment7, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment7, hr_api.g_varchar2)
1821 or nvl(l_cost_segment8, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment8, hr_api.g_varchar2)
1822 or nvl(l_cost_segment9, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment9, hr_api.g_varchar2)
1823 or nvl(l_cost_segment10, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment10, hr_api.g_varchar2)
1824 or nvl(l_cost_segment11, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment11, hr_api.g_varchar2)
1825 or nvl(l_cost_segment12, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment12, hr_api.g_varchar2)
1826 or nvl(l_cost_segment13, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment13, hr_api.g_varchar2)
1827 or nvl(l_cost_segment14, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment14, hr_api.g_varchar2)
1828 or nvl(l_cost_segment15, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment15, hr_api.g_varchar2)
1829 or nvl(l_cost_segment16, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment16, hr_api.g_varchar2)
1830 or nvl(l_cost_segment17, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment17, hr_api.g_varchar2)
1831 or nvl(l_cost_segment18, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment18, hr_api.g_varchar2)
1832 or nvl(l_cost_segment19, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment19, hr_api.g_varchar2)
1833 or nvl(l_cost_segment20, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment20, hr_api.g_varchar2)
1834 or nvl(l_cost_segment21, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment21, hr_api.g_varchar2)
1835 or nvl(l_cost_segment22, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment22, hr_api.g_varchar2)
1836 or nvl(l_cost_segment23, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment23, hr_api.g_varchar2)
1837 or nvl(l_cost_segment24, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment24, hr_api.g_varchar2)
1838 or nvl(l_cost_segment25, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment25, hr_api.g_varchar2)
1839 or nvl(l_cost_segment26, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment26, hr_api.g_varchar2)
1840 or nvl(l_cost_segment27, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment27, hr_api.g_varchar2)
1841 or nvl(l_cost_segment28, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment28, hr_api.g_varchar2)
1842 or nvl(l_cost_segment29, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment29, hr_api.g_varchar2)
1843 or nvl(l_cost_segment30, hr_api.g_varchar2) <> nvl(l_old_cost_segments.segment30, hr_api.g_varchar2)
1844 or nvl(l_old_cost_name, hr_api.g_varchar2) <> nvl(l_old_cost_segments.concatenated_segments, hr_api.g_varchar2) then
1845 -- End of 3187772
1846 hr_kflex_utility.upd_or_sel_keyflex_comb
1847 (p_appl_short_name => 'PAY'
1848 ,p_flex_code => 'COST'
1849 ,p_flex_num => l_flex_num
1850 ,p_segment1 => l_cost_segment1
1851 ,p_segment2 => l_cost_segment2
1852 ,p_segment3 => l_cost_segment3
1853 ,p_segment4 => l_cost_segment4
1854 ,p_segment5 => l_cost_segment5
1855 ,p_segment6 => l_cost_segment6
1856 ,p_segment7 => l_cost_segment7
1857 ,p_segment8 => l_cost_segment8
1858 ,p_segment9 => l_cost_segment9
1859 ,p_segment10 => l_cost_segment10
1860 ,p_segment11 => l_cost_segment11
1861 ,p_segment12 => l_cost_segment12
1862 ,p_segment13 => l_cost_segment13
1863 ,p_segment14 => l_cost_segment14
1864 ,p_segment15 => l_cost_segment15
1865 ,p_segment16 => l_cost_segment16
1866 ,p_segment17 => l_cost_segment17
1867 ,p_segment18 => l_cost_segment18
1868 ,p_segment19 => l_cost_segment19
1869 ,p_segment20 => l_cost_segment20
1870 ,p_segment21 => l_cost_segment21
1871 ,p_segment22 => l_cost_segment22
1872 ,p_segment23 => l_cost_segment23
1873 ,p_segment24 => l_cost_segment24
1874 ,p_segment25 => l_cost_segment25
1875 ,p_segment26 => l_cost_segment26
1876 ,p_segment27 => l_cost_segment27
1877 ,p_segment28 => l_cost_segment28
1878 ,p_segment29 => l_cost_segment29
1879 ,p_segment30 => l_cost_segment30
1880 ,p_concat_segments_in => l_old_cost_name
1881 ,p_ccid => l_cost_alloc_key_id
1882 ,p_concat_segments_out => l_cost_name
1883 );
1884 --
1885 hr_utility.set_location(l_proc, 25);
1886 --
1887 -- update the combinations column
1888 -- Start of 3187772
1889 update_cost_concat_segs (p_cost_allocation_keyflex_id => l_cost_alloc_key_id
1890 ,p_cost_name => l_cost_name);
1891 -- End of 3187772
1892 end if;
1893 --
1894 hr_utility.set_location(l_proc, 26);
1895 --
1896 end if;
1897 --
1898
1899 --
1900 -- Update non-translatable rows in HR_ALL_ORGANIZATION_UNITS Table
1901 --
1902 hr_oru_upd.upd
1903 ( p_effective_date => p_effective_date
1904 ,p_name => p_name
1905 ,p_organization_id => p_organization_id
1906 ,p_cost_allocation_keyflex_id => l_cost_alloc_key_id -- Bug 3187772
1907 ,p_location_id => p_location_id
1908 -- Bug 3040119
1909 --,p_soft_coding_keyflex_id => p_soft_coding_keyflex_id
1910 ,p_date_from => l_date_from
1911 ,p_date_to => l_date_to
1912 ,p_internal_external_flag => p_internal_external_flag
1913 ,p_internal_address_line => p_internal_address_line
1914 ,p_type => p_type
1915 ,p_comments => p_comments
1916 ,p_attribute_category => p_attribute_category
1917 ,p_attribute1 => p_attribute1
1918 ,p_attribute2 => p_attribute2
1919 ,p_attribute3 => p_attribute3
1920 ,p_attribute4 => p_attribute4
1921 ,p_attribute5 => p_attribute5
1922 ,p_attribute6 => p_attribute6
1923 ,p_attribute7 => p_attribute7
1924 ,p_attribute8 => p_attribute8
1925 ,p_attribute9 => p_attribute9
1926 ,p_attribute10 => p_attribute10
1927 ,p_attribute11 => p_attribute11
1928 ,p_attribute12 => p_attribute12
1929 ,p_attribute13 => p_attribute13
1930 ,p_attribute14 => p_attribute14
1931 ,p_attribute15 => p_attribute15
1932 ,p_attribute16 => p_attribute16
1933 ,p_attribute17 => p_attribute17
1934 ,p_attribute18 => p_attribute18
1935 ,p_attribute19 => p_attribute19
1936 ,p_attribute20 => p_attribute20
1937 --Enhancement 4040086
1938 ,p_attribute21 => p_attribute21
1939 ,p_attribute22 => p_attribute22
1940 ,p_attribute23 => p_attribute23
1941 ,p_attribute24 => p_attribute24
1942 ,p_attribute25 => p_attribute25
1943 ,p_attribute26 => p_attribute26
1944 ,p_attribute27 => p_attribute27
1945 ,p_attribute28 => p_attribute28
1946 ,p_attribute29 => p_attribute29
1947 ,p_attribute30 => p_attribute30
1948 --End Enhancement 4040086
1949 ,p_object_version_number => l_object_version_number
1950 ,p_duplicate_org_warning => p_duplicate_org_warning
1951 );
1952 --
1953 hr_utility.set_location(l_proc, 55);
1954 --
1955 -- update the TL table
1956 hr_ort_upd.upd_tl(
1957 p_language_code => p_language_code,
1958 p_organization_id => p_organization_id,
1959 p_name => p_name);
1960 --
1961 --
1962 hr_utility.set_location(l_proc, 60);
1963 --
1964 -- When in validation only mode raise the Validate_Enabled exception
1965 --
1966 IF p_validate THEN
1967 RAISE hr_api.validate_enabled;
1968 END IF;
1969 --
1970 -- Set all output arguments. If p_validate was TRUE, this bit is
1971 -- never reached, so p_object_version_number is passed back unchanged.
1972 --
1973 p_object_version_number := l_object_version_number;
1974 --
1975 hr_utility.set_location(' Leaving:'||l_proc, 70);
1976 --
1977
1978 begin
1979 hr_organization_bk4.update_organization_a
1980 ( p_effective_date => p_effective_date
1981 ,p_language_code => p_language_code
1982 ,p_name => p_name
1983 ,p_organization_id => p_organization_id
1984 ,p_cost_allocation_keyflex_id => p_cost_allocation_keyflex_id
1985 ,p_location_id => p_location_id
1986 -- Bug 3040119
1987 --,p_soft_coding_keyflex_id => p_soft_coding_keyflex_id
1988 ,p_date_from => l_date_from
1989 ,p_date_to => l_date_to
1990 ,p_internal_external_flag => p_internal_external_flag
1991 ,p_internal_address_line => p_internal_address_line
1992 ,p_type => p_type
1993 ,p_attribute_category => p_attribute_category
1994 ,p_attribute1 => p_attribute1
1995 ,p_attribute2 => p_attribute2
1996 ,p_attribute3 => p_attribute3
1997 ,p_attribute4 => p_attribute4
1998 ,p_attribute5 => p_attribute5
1999 ,p_attribute6 => p_attribute6
2000 ,p_attribute7 => p_attribute7
2001 ,p_attribute8 => p_attribute8
2002 ,p_attribute9 => p_attribute9
2003 ,p_attribute10 => p_attribute10
2004 ,p_attribute11 => p_attribute11
2005 ,p_attribute12 => p_attribute12
2006 ,p_attribute13 => p_attribute13
2007 ,p_attribute14 => p_attribute14
2008 ,p_attribute15 => p_attribute15
2009 ,p_attribute16 => p_attribute16
2010 ,p_attribute17 => p_attribute17
2011 ,p_attribute18 => p_attribute18
2012 ,p_attribute19 => p_attribute19
2013 ,p_attribute20 => p_attribute20
2014 --Enhancement 4040086
2015 ,p_attribute21 => p_attribute21
2016 ,p_attribute22 => p_attribute22
2017 ,p_attribute23 => p_attribute23
2018 ,p_attribute24 => p_attribute24
2019 ,p_attribute25 => p_attribute25
2020 ,p_attribute26 => p_attribute26
2021 ,p_attribute27 => p_attribute27
2022 ,p_attribute28 => p_attribute28
2023 ,p_attribute29 => p_attribute29
2024 ,p_attribute30 => p_attribute30
2025 --End Enhancement 4040086
2026 -- Bug 3039046
2027 ,p_segment1 => l_cost_segment1
2028 ,p_segment2 => l_cost_segment2
2029 ,p_segment3 => l_cost_segment3
2030 ,p_segment4 => l_cost_segment4
2031 ,p_segment5 => l_cost_segment5
2032 ,p_segment6 => l_cost_segment6
2033 ,p_segment7 => l_cost_segment7
2034 ,p_segment8 => l_cost_segment8
2035 ,p_segment9 => l_cost_segment9
2036 ,p_segment10 => l_cost_segment10
2037 ,p_segment11 => l_cost_segment11
2038 ,p_segment12 => l_cost_segment12
2039 ,p_segment13 => l_cost_segment13
2040 ,p_segment14 => l_cost_segment14
2041 ,p_segment15 => l_cost_segment15
2042 ,p_segment16 => l_cost_segment16
2043 ,p_segment17 => l_cost_segment17
2044 ,p_segment18 => l_cost_segment18
2045 ,p_segment19 => l_cost_segment19
2046 ,p_segment20 => l_cost_segment20
2047 ,p_segment21 => l_cost_segment21
2048 ,p_segment22 => l_cost_segment22
2049 ,p_segment23 => l_cost_segment23
2050 ,p_segment24 => l_cost_segment24
2051 ,p_segment25 => l_cost_segment25
2052 ,p_segment26 => l_cost_segment26
2053 ,p_segment27 => l_cost_segment27
2054 ,p_segment28 => l_cost_segment28
2055 ,p_segment29 => l_cost_segment29
2056 ,p_segment30 => l_cost_segment30
2057 ,p_concat_segments => l_old_cost_name
2058 ,p_cost_name => l_cost_name
2059 --
2060 ,p_object_version_number => l_object_version_number
2061 ,p_duplicate_org_warning => p_duplicate_org_warning
2062 );
2063
2064 exception
2065 when hr_api.cannot_find_prog_unit then
2066 hr_api.cannot_find_prog_unit_error
2067 (p_module_name => 'update_organization'
2068 ,p_hook_type => 'AP'
2069 );
2070 end;
2071
2072 EXCEPTION
2073 --
2074 WHEN hr_api.validate_enabled THEN
2075 --
2076 -- As the Validate_Enabled exception has been raised
2077 -- we must rollback to the savepoint
2078 --
2079 ROLLBACK TO update_organization;
2080 --
2081 -- Only set output warning arguments
2082 -- (Any key or derived arguments must be set to null
2083 -- when validation only mode is being used.)
2084 -- Set IN OUT and OUT parameters.
2085 p_object_version_number := l_temp_ovn;
2086 p_duplicate_org_warning := l_duplicate_org_warning;
2087 hr_utility.set_location(' Leaving:'||l_proc, 80);
2088 WHEN OTHERS THEN
2089 --
2090 -- A validation or unexpected error has occurred
2091 ROLLBACK TO update_organization;
2092 -- Set IN OUT and OUT parameters.
2093 p_object_version_number := l_temp_ovn;
2094 p_duplicate_org_warning := null;
2095 hr_utility.set_location(' Leaving:'||l_proc, 90);
2096 RAISE;
2097 --
2098 --
2099 END update_organization;
2100 -- ----------------------------------------------------------------------------
2101 -- |-------------------------< delete_organization >--------------------------|
2102 -- ----------------------------------------------------------------------------
2103 --
2104 PROCEDURE delete_organization
2105 ( p_validate IN BOOLEAN
2106 ,p_organization_id IN hr_all_organization_units.organization_id%TYPE
2107 ,p_object_version_number IN hr_all_organization_units.object_version_number%TYPE )
2108
2109 IS
2110 --
2111 --
2112 -- Declare cursors and local variables
2113 --
2114 l_proc VARCHAR2(72) := g_package||'delete_organization';
2115 --
2116 BEGIN
2117
2118 --
2119 -- Issue a savepoint
2120 --
2121 savepoint delete_organization;
2122 --
2123 begin
2124 hr_organization_bk5.delete_organization_b
2125 (p_organization_id => p_organization_id
2126 ,p_object_version_number => p_object_version_number
2127 );
2128
2129 exception
2130 when hr_api.cannot_find_prog_unit then
2131 hr_api.cannot_find_prog_unit_error
2132 (p_module_name => 'delete_organization'
2133 ,p_hook_type => 'BP'
2134 );
2135 end;
2136
2137 --
2138 -- Process Logic
2139 -- =============
2140 --
2141 -- Need to lock main table to maintain the locking ladder order
2142 --
2143 hr_utility.set_location( l_proc, 30);
2144 hr_oru_shd.lck ( p_organization_id => p_organization_id,
2145 p_object_version_number => p_object_version_number );
2146 --
2147 -- Remove all matching translation rows
2148 --
2149 hr_utility.set_location( l_proc, 35);
2150 hr_ort_del.del_tl ( p_organization_id => p_organization_id );
2151 --
2152 -- Remove non-translated data row
2153 --
2154 hr_utility.set_location( l_proc, 40);
2155
2156 -- bug fix 3571140.Record for the organization deleted from PER_ORGANIZATION_LIST
2157 -- table.
2158
2159 delete from per_organization_list
2160 where organization_id = p_organization_id;
2161
2162 hr_utility.set_location( l_proc, 45);
2163
2164 -- bug fix 3571140 ends here.
2165
2166 hr_oru_del.del ( p_organization_id => p_organization_id,
2167 p_object_version_number => p_object_version_number );
2168 --
2169 --
2170 hr_utility.set_location(' Leaving:'||l_proc, 60);
2171 --
2172 -- When in validation only mode raise the Validate_Enabled exception
2173 --
2174 IF p_validate THEN
2175 RAISE hr_api.validate_enabled;
2176 END IF;
2177 --
2178 --
2179 begin
2180 hr_organization_bk5.delete_organization_a
2181 (p_organization_id => p_organization_id
2182 ,p_object_version_number => p_object_version_number
2183 );
2184
2185 exception
2186 when hr_api.cannot_find_prog_unit then
2187 hr_api.cannot_find_prog_unit_error
2188 (p_module_name => 'delete_organization'
2189 ,p_hook_type => 'AP'
2190 );
2191 end;
2192
2193
2194 EXCEPTION
2195 --
2196 WHEN hr_api.validate_enabled THEN
2197 --
2198 -- As the Validate_Enabled exception has been raised
2199 -- we must rollback to the savepoint
2200 --
2201 ROLLBACK TO delete_organization;
2202 --
2203 -- Only set output warning arguments
2204 -- (Any key or derived arguments must be set to null
2205 -- when validation only mode is being used.)
2206 --
2207 hr_utility.set_location(' Leaving:'||l_proc, 80);
2208 WHEN OTHERS THEN
2209 --
2210 -- A validation or unexpected error has occurred
2211 ROLLBACK TO delete_organization;
2212 hr_utility.set_location(' Leaving:'||l_proc, 90);
2213 RAISE;
2214 --
2215 END delete_organization;
2216 --
2217 -- ----------------------------------------------------------------------------
2218 -- |-------------------------< chk_cls_mand >---------------------------------|
2219 -- ----------------------------------------------------------------------------
2220 --
2221 -- Description:
2222 -- Validates that classification does not have mandatory info types in
2223 -- HR_ORG_INFO_TYPES_BY_CLASS table.
2224 --
2225 -- Pre-conditions:
2226 -- None.
2227 --
2228 -- In Arguments:
2229 -- p_org_classif_code
2230 -- p_parent_call
2231 -- p_legislation_code
2232 --
2233 -- Post Success:
2234 -- If classification does not have mandatory info types then
2235 -- normal processing continues depending on p_parent_call value.
2236 --
2237 -- Post Failure:
2238 -- If classification has mandatory info types which are either
2239 -- global or for the current legislation then an application
2240 -- error will be raised and processing is terminated
2241 -- depending on p_parent_call value.
2242 --
2243 -- Developer/Implementation Notes:
2244 -- Duplicate validation exists on form, so any changes made here
2245 -- or on form must be dual-maintained.
2246 --
2247 -- Access Status:
2248 -- From Business Processes
2249 --
2250 -- {End Of Comments}
2251 --
2252 PROCEDURE chk_cls_mand
2253 (p_org_classif_code IN hr_organization_information.org_information1%TYPE,
2254 p_parent_call IN VARCHAR2,
2255 p_organization_id IN NUMBER)
2256 IS
2257 --
2258 cursor csr_get_leg_code is
2259 select legislation_code
2260 from per_business_groups pbg,
2261 hr_all_organization_units hou
2262 where hou.organization_id = p_organization_id
2263 and pbg.business_group_id = hou.business_group_id;
2264
2265 l_proc VARCHAR2(72) := g_package||'chk_cls_mand';
2266 l_exists VARCHAR2(1) := 'N';
2267 l_legislation_code VARCHAR2(5);
2268 --
2269 BEGIN
2270 --
2271 hr_utility.set_location('Entering:'|| l_proc, 10);
2272 --
2273 open csr_get_leg_code;
2274 fetch csr_get_leg_code into l_legislation_code;
2275 close csr_get_leg_code;
2276 --
2277 -- Check classification with mandatory info types presence
2278 --
2279 BEGIN
2280 SELECT 'Y'
2281 INTO l_exists
2282 FROM sys.dual
2283 WHERE EXISTS
2284 (SELECT null
2285 FROM hr_org_info_types_by_class class,
2286 hr_org_information_types type
2287 WHERE class.org_classification = p_org_classif_code
2288 AND class.org_information_type = type.org_information_type
2289 AND ( type.legislation_code is null
2290 OR type.legislation_code = l_legislation_code)
2291 AND class.mandatory_flag = 'Y'
2292 );
2293 EXCEPTION
2294 WHEN NO_DATA_FOUND THEN null;
2295 END;
2296 --
2297 hr_utility.set_location(l_proc, 20);
2298 --
2299 IF l_exists = 'Y'
2300 AND p_parent_call = 'REGULAR' THEN
2301 hr_utility.set_message(800, 'HR_289000_CLSF_MAND_INFO_TYPE');
2302 hr_utility.raise_error;
2303 END IF;
2304 /*
2305 What does this do, it makes no sense.
2306 WWBUG 2557238
2307 IF l_exists = 'N'
2308 AND p_parent_call = 'INTERNAL' THEN
2309 hr_utility.set_message(800, 'HR_289001_CLSF_NO_MAND_INFO');
2310 hr_utility.raise_error;
2311 END IF;
2312 */
2313 --
2314 --
2315 hr_utility.set_location('Leaving:'||l_proc, 30);
2316 --
2317 END chk_cls_mand;
2318 --
2319 --
2320 -- ----------------------------------------------------------------------------
2321 -- |-----------------------------< create_org_classification >----------------|
2322 -- ----------------------------------------------------------------------------
2323 --
2324 PROCEDURE create_org_classification
2325 ( p_validate IN BOOLEAN DEFAULT false
2326 ,p_effective_date IN DATE
2327 --
2328 ,p_organization_id IN NUMBER
2329 ,p_org_classif_code IN VARCHAR2
2330 ,p_org_information_id OUT NOCOPY NUMBER
2331 ,p_object_version_number OUT NOCOPY NUMBER
2332
2333 ) IS
2334 --
2335 -- Declare cursors and local variables
2336 --
2337
2338 --
2339 l_proc VARCHAR2(72) := g_package||'create_org_classification';
2340 l_org_information_id hr_organization_information.org_information_id%TYPE;
2341 l_object_version_number hr_organization_information.object_version_number%TYPE;
2342 --
2343 BEGIN
2344 hr_utility.set_location('Entering:'|| l_proc, 10);
2345 --
2346 -- Issue a savepoint
2347 --
2348 savepoint create_org_classification;
2349 --
2350 hr_utility.set_location(l_proc, 15);
2351 begin
2352 hr_organization_bk6.create_org_classification_b
2353 (p_effective_date => p_effective_date
2354 ,p_organization_id => p_organization_id
2355 ,p_org_classif_code =>p_org_classif_code);
2356
2357 exception
2358 when hr_api.cannot_find_prog_unit then
2359 hr_api.cannot_find_prog_unit_error
2360 (p_module_name => 'create_org_classification'
2361 ,p_hook_type => 'BP'
2362 );
2363 end;
2364
2365 hr_api.mandatory_arg_error
2366 (p_api_name => l_proc
2367 ,p_argument => 'ORGANIZATION_ID'
2368 ,p_argument_value => p_organization_id );
2369
2370 --
2371 hr_utility.set_location(l_proc, 20);
2372 --
2373 -- Process Logic
2374 --
2375 -- Check if it is proper classification first
2376 -- by calling Business Support process
2377 --
2378 chk_cls_mand(
2379 p_org_classif_code => p_org_classif_code,
2380 p_parent_call => 'REGULAR',
2381 p_organization_id => p_organization_id);
2382 --
2383 hr_utility.set_location(l_proc, 30);
2384 --
2385 hr_ori_ins.ins(
2386 p_effective_date => p_effective_date,
2387 p_org_information_context => 'CLASS',
2388 p_organization_id => p_organization_id,
2389 p_org_information1 => p_org_classif_code,
2390 p_org_information2 => 'Y',
2391 p_org_information_id => l_org_information_id,
2392 p_object_version_number => l_object_version_number
2393 );
2394 --
2395 hr_utility.set_location(l_proc, 60);
2396 --
2397 -- When in validation only mode raise the Validate_Enabled exception
2398 --
2399 IF p_validate THEN
2400 RAISE hr_api.validate_enabled;
2401 END IF;
2402 --
2403 -- Set all output arguments
2404 --
2405 p_org_information_id := l_org_information_id;
2406 p_object_version_number := l_object_version_number;
2407 --
2408 hr_utility.set_location(' Leaving:'||l_proc, 70);
2409 --
2410 begin
2411
2412 hr_organization_bk6.create_org_classification_a
2413 (p_effective_date => p_effective_date
2414 ,p_organization_id => p_organization_id
2415 ,p_org_classif_code => p_org_classif_code
2416 );
2417
2418 exception
2419 when hr_api.cannot_find_prog_unit then
2420 hr_api.cannot_find_prog_unit_error
2421 (p_module_name => 'create_org_classification'
2422 ,p_hook_type => 'AP'
2423 );
2424 end;
2425 EXCEPTION
2426 --
2427 WHEN hr_api.validate_enabled THEN
2428 --
2429 -- As the Validate_Enabled exception has been raised
2430 -- we must rollback to the savepoint
2431 --
2432 ROLLBACK TO create_org_classification;
2433 --
2434 -- Only set output warning arguments
2435 -- (Any key or derived arguments must be set to null
2436 -- when validation only mode is being used.)
2437 --
2438 p_org_information_id := NULL;
2439 p_object_version_number := NULL;
2440 hr_utility.set_location(' Leaving:'||l_proc, 80);
2441 WHEN OTHERS THEN
2442 --
2443 -- A validation or unexpected error has occurred
2444 ROLLBACK TO create_org_classification;
2445 -- Set OUT parameters.
2446 p_org_information_id := NULL;
2447 p_object_version_number := NULL;
2448 hr_utility.set_location(' Leaving:'||l_proc, 90);
2449 RAISE;
2450 --
2451 END create_org_classification;
2452 --
2453 --
2454 -- ----------------------------------------------------------------------------
2455 -- |-------------------------< chk_cls_row >----------------------------------|
2456 -- ----------------------------------------------------------------------------
2457 --
2458 -- Description:
2459 -- Validates that classification does not have mandatory info types in
2460 -- HR_ORG_INFO_TYPES_BY_CLASS table.
2461 --
2462 -- Pre-conditions:
2463 -- None.
2464 --
2465 -- In Arguments:
2466 -- p_org_information_id
2467 --
2468 -- Post Success:
2469 -- If the row of p_org_information_id has org_information_context
2470 -- value 'CLASS' then normal processing continues.
2471 --
2472 -- Post Failure:
2473 -- If the row of p_org_information_id does not have a value 'CLASS'
2474 -- then an application error will be raised and processing is terminated.
2475 --
2476 -- Developer/Implementation Notes:
2477 -- Duplicate validation exists on form, so any changes made here
2478 -- or on form must be dual-maintained.
2479 --
2480 -- Access Status:
2481 -- From Business Processes
2482 --
2483 -- {End Of Comments}
2484 --
2485 PROCEDURE chk_cls_row
2486 (p_org_information_id IN hr_organization_information.org_information_id%TYPE)
2487 IS
2488 l_proc VARCHAR2(72) := g_package||'chk_cls_row';
2489 l_context VARCHAR2(40);
2490 --
2491 BEGIN
2492 --
2493 hr_utility.set_location('Entering:'|| l_proc, 10);
2494 --
2495 --
2496 -- Check classification with mandatory info types presence
2497 --
2498 BEGIN
2499 SELECT org_information_context
2500 INTO l_context
2501 FROM hr_organization_information
2502 WHERE org_information_id = p_org_information_id;
2503 EXCEPTION
2504 WHEN NO_DATA_FOUND THEN null;
2505 END;
2506 --
2507 hr_utility.set_location(l_proc, 20);
2508 --
2509 IF l_context IS NULL OR
2510 (l_context IS NOT NULL AND l_context <> 'CLASS') THEN
2511 hr_utility.set_message(800, 'HR_52762_NOT_CLSF_ROW');
2512 hr_utility.raise_error;
2513 END IF;
2514 --
2515 --
2516 hr_utility.set_location('Leaving:'||l_proc, 30);
2517 --
2518 END chk_cls_row;
2519 --
2520 -- ----------------------------------------------------------------------------
2521 -- |--------------------------< enable_org_classification >-------------------|
2522 -- ----------------------------------------------------------------------------
2523 --
2524 PROCEDURE enable_org_classification
2525 ( p_validate IN BOOLEAN DEFAULT false
2526 ,p_effective_date IN DATE
2527 --
2528 ,p_org_information_id IN NUMBER
2529 ,p_org_info_type_code IN VARCHAR2
2530 ,p_object_version_number IN OUT NOCOPY NUMBER
2531 ) IS
2532 --
2533 -- Declare cursors and local variables
2534 --
2535 l_proc VARCHAR2(72) := g_package||'enable_org_classification';
2536 l_object_version_number hr_organization_information.object_version_number%TYPE;
2537 l_temp_ovn number := p_object_version_number;
2538 --
2539 BEGIN
2540 --
2541 hr_utility.set_location('Entering:'|| l_proc, 10);
2542 --
2543 -- Issue a savepoint.
2544 --
2545 savepoint enable_org_classification;
2546 --
2547 hr_utility.set_location(l_proc, 20);
2548 --
2549 -- Check that row has org_information_context as 'CLASS'
2550 --
2551 chk_cls_row(p_org_information_id => p_org_information_id);
2552 --
2553 --
2554 -- Process Logic
2555 --
2556 l_object_version_number := p_object_version_number;
2557 --
2558 --
2559 -- Update row in HR_ORGANIZATION_INFORMATION Table
2560 --
2561 hr_ori_upd.upd
2562 ( p_effective_date => p_effective_date
2563 ,p_org_information_id => p_org_information_id
2564 ,p_org_information_context => p_org_info_type_code
2565 ,p_org_information2 => 'Y'
2566 ,p_object_version_number => l_object_version_number
2567 );
2568 --
2569 --
2570 --
2571 --
2572 hr_utility.set_location(l_proc, 60);
2573 --
2574 -- When in validation only mode raise the Validate_Enabled exception
2575 --
2576 IF p_validate THEN
2577 RAISE hr_api.validate_enabled;
2578 END IF;
2579 --
2580 -- Set all output arguments. If p_validate was TRUE, this bit is
2581 -- never reached, so p_object_version_number is passed back unchanged.
2582 --
2583 p_object_version_number := l_object_version_number;
2584 --
2585 hr_utility.set_location(' Leaving:'||l_proc, 70);
2586 --
2587 EXCEPTION
2588 --
2589 WHEN hr_api.validate_enabled THEN
2590 --
2591 -- As the Validate_Enabled exception has been raised
2592 -- we must rollback to the savepoint
2593 --
2594 ROLLBACK TO enable_org_classification;
2595 --
2596 -- Only set output warning arguments
2597 -- (Any key or derived arguments must be set to null
2598 -- when validation only mode is being used.)
2599 p_object_version_number := l_temp_ovn;
2600 hr_utility.set_location(' Leaving:'||l_proc, 80);
2601 WHEN OTHERS THEN
2602 --
2603 -- A validation or unexpected error has occurred
2604 ROLLBACK TO enable_org_classification;
2605 -- Reset IN OUT parameters.
2606 p_object_version_number := l_temp_ovn;
2607 hr_utility.set_location(' Leaving:'||l_proc, 90);
2608 RAISE;
2609 --
2610 --
2611 END enable_org_classification;
2612 -- ----------------------------------------------------------------------------
2613 --
2614 -- ----------------------------------------------------------------------------
2615 -- |--------------------------< disable_org_classification >------------------|
2616 -- ----------------------------------------------------------------------------
2617 --
2618 PROCEDURE disable_org_classification
2619 ( p_validate IN BOOLEAN DEFAULT false
2620 ,p_effective_date IN DATE
2621 --
2622 ,p_org_information_id IN NUMBER
2623 ,p_org_info_type_code IN VARCHAR2
2624 ,p_object_version_number IN OUT NOCOPY NUMBER
2625 ) IS
2626 --
2627 -- Declare cursors and local variables
2628 --
2629 l_proc VARCHAR2(72) := g_package||'disable_org_classification';
2630 l_object_version_number hr_organization_information.object_version_number%TYPE;
2631 l_temp_ovn number := p_object_version_number;
2632 --
2633 BEGIN
2634 --
2635 hr_utility.set_location('Entering:'|| l_proc, 10);
2636 --
2637 -- Issue a savepoint.
2638 --
2639 savepoint disable_org_classification;
2640 --
2641 hr_utility.set_location(l_proc, 20);
2642 --
2643 -- Check that row has org_information_context as 'CLASS'
2644 --
2645 chk_cls_row(p_org_information_id => p_org_information_id);
2646 --
2647 --
2648 -- Process Logic
2649 --
2650 l_object_version_number := p_object_version_number;
2651 --
2652 --
2653 -- Update row in HR_ORGANIZATION_INFORMATION Table
2654 --
2655 hr_ori_upd.upd
2656 ( p_effective_date => p_effective_date
2657 ,p_org_information_id => p_org_information_id
2658 ,p_org_information_context => p_org_info_type_code
2659 ,p_org_information2 => 'N'
2660 ,p_object_version_number => l_object_version_number
2661 );
2662 --
2663 --
2664 --
2665 --
2666 hr_utility.set_location(l_proc, 60);
2667 --
2668 -- When in validation only mode raise the Validate_Enabled exception
2669 --
2670 IF p_validate THEN
2671 RAISE hr_api.validate_enabled;
2672 END IF;
2673 --
2674 -- Set all output arguments. If p_validate was TRUE, this bit is
2675 -- never reached, so p_object_version_number is passed back unchanged.
2676 --
2677 p_object_version_number := l_object_version_number;
2678 --
2679 hr_utility.set_location(' Leaving:'||l_proc, 70);
2680 --
2681 EXCEPTION
2682 --
2683 WHEN hr_api.validate_enabled THEN
2684 --
2685 -- As the Validate_Enabled exception has been raised
2686 -- we must rollback to the savepoint
2687 --
2688 ROLLBACK TO disable_org_classification;
2689 --
2690 -- Only set output warning arguments
2691 -- (Any key or derived arguments must be set to null
2692 -- when validation only mode is being used.)
2693 -- Reset IN OUT parameters.
2694 p_object_version_number := l_temp_ovn;
2695 hr_utility.set_location(' Leaving:'||l_proc, 80);
2696 WHEN OTHERS THEN
2697 --
2698 -- A validation or unexpected error has occurred
2699 ROLLBACK TO disable_org_classification;
2700 -- Reset IN OUT parameters.
2701 p_object_version_number := l_temp_ovn;
2702 hr_utility.set_location(' Leaving:'||l_proc, 90);
2703 RAISE;
2704 --
2705 --
2706 END disable_org_classification;
2707 --
2708 --
2709 -- ----------------------------------------------------------------------------
2710 -- |-----------------------------< create_org_information >-------------------|
2711 -- ----------------------------------------------------------------------------
2712 --
2713 PROCEDURE create_org_information
2714 (p_validate IN BOOLEAN DEFAULT false
2715 ,p_effective_date IN DATE
2716 ,p_organization_id IN NUMBER
2717 ,p_org_info_type_code IN VARCHAR2
2718 ,p_org_information1 IN VARCHAR2 DEFAULT null
2719 ,p_org_information2 IN VARCHAR2 DEFAULT null
2720 ,p_org_information3 IN VARCHAR2 DEFAULT null
2721 ,p_org_information4 IN VARCHAR2 DEFAULT null
2722 ,p_org_information5 IN VARCHAR2 DEFAULT null
2723 ,p_org_information6 IN VARCHAR2 DEFAULT null
2724 ,p_org_information7 IN VARCHAR2 DEFAULT null
2725 ,p_org_information8 IN VARCHAR2 DEFAULT null
2726 ,p_org_information9 IN VARCHAR2 DEFAULT null
2727 ,p_org_information10 IN VARCHAR2 DEFAULT null
2728 ,p_org_information11 IN VARCHAR2 DEFAULT null
2729 ,p_org_information12 IN VARCHAR2 DEFAULT null
2730 ,p_org_information13 IN VARCHAR2 DEFAULT null
2731 ,p_org_information14 IN VARCHAR2 DEFAULT null
2732 ,p_org_information15 IN VARCHAR2 DEFAULT null
2733 ,p_org_information16 IN VARCHAR2 DEFAULT null
2734 ,p_org_information17 IN VARCHAR2 DEFAULT null
2735 ,p_org_information18 IN VARCHAR2 DEFAULT null
2736 ,p_org_information19 IN VARCHAR2 DEFAULT null
2737 ,p_org_information20 IN VARCHAR2 DEFAULT null
2738 ,p_attribute_category IN VARCHAR2 DEFAULT null
2739 ,p_attribute1 IN VARCHAR2 DEFAULT null
2740 ,p_attribute2 IN VARCHAR2 DEFAULT null
2741 ,p_attribute3 IN VARCHAR2 DEFAULT null
2742 ,p_attribute4 IN VARCHAR2 DEFAULT null
2743 ,p_attribute5 IN VARCHAR2 DEFAULT null
2744 ,p_attribute6 IN VARCHAR2 DEFAULT null
2745 ,p_attribute7 IN VARCHAR2 DEFAULT null
2746 ,p_attribute8 IN VARCHAR2 DEFAULT null
2747 ,p_attribute9 IN VARCHAR2 DEFAULT null
2748 ,p_attribute10 IN VARCHAR2 DEFAULT null
2749 ,p_attribute11 IN VARCHAR2 DEFAULT null
2750 ,p_attribute12 IN VARCHAR2 DEFAULT null
2751 ,p_attribute13 IN VARCHAR2 DEFAULT null
2752 ,p_attribute14 IN VARCHAR2 DEFAULT null
2753 ,p_attribute15 IN VARCHAR2 DEFAULT null
2754 ,p_attribute16 IN VARCHAR2 DEFAULT null
2755 ,p_attribute17 IN VARCHAR2 DEFAULT null
2756 ,p_attribute18 IN VARCHAR2 DEFAULT null
2757 ,p_attribute19 IN VARCHAR2 DEFAULT null
2758 ,p_attribute20 IN VARCHAR2 DEFAULT null
2759 ,p_org_information_id OUT NOCOPY NUMBER
2760 ,p_object_version_number OUT NOCOPY NUMBER
2761 ) IS
2762 --
2763 -- Declare cursors and local variables
2764 --
2765 l_proc VARCHAR2(72) := g_package||'create_org_information';
2766 l_org_information_id hr_organization_information.org_information_id%TYPE;
2767 l_object_version_number hr_organization_information.object_version_number%TYPE;
2768 l_session_id number;
2769 l_effective_date date;
2770 --
2771 BEGIN
2772 --
2773 hr_utility.set_location('Entering:'|| l_proc, 10);
2774 --
2775 -- Issue a savepoint
2776 --
2777 savepoint create_org_information;
2778 --
2779 hr_utility.set_location(l_proc, 20);
2780
2781 l_effective_date := trunc(p_effective_date);
2782
2783 --
2784 -- Call Before Process User Hook
2785 --
2786 begin
2787 hr_organization_bk1.create_org_information_b
2788 (p_effective_date => trunc(p_effective_date)
2789 ,p_org_info_type_code => p_org_info_type_code
2790 ,p_organization_id => p_organization_id
2791 ,p_org_information1 => p_org_information1
2792 ,p_org_information2 => p_org_information2
2793 ,p_org_information3 => p_org_information3
2794 ,p_org_information4 => p_org_information4
2795 ,p_org_information5 => p_org_information5
2796 ,p_org_information6 => p_org_information6
2797 ,p_org_information7 => p_org_information7
2798 ,p_org_information8 => p_org_information8
2799 ,p_org_information9 => p_org_information9
2800 ,p_org_information10 => p_org_information10
2801 ,p_org_information11 => p_org_information11
2802 ,p_org_information12 => p_org_information12
2803 ,p_org_information13 => p_org_information13
2804 ,p_org_information14 => p_org_information14
2805 ,p_org_information15 => p_org_information15
2806 ,p_org_information16 => p_org_information16
2807 ,p_org_information17 => p_org_information17
2808 ,p_org_information18 => p_org_information18
2809 ,p_org_information19 => p_org_information19
2810 ,p_org_information20 => p_org_information20
2811 ,p_attribute_category => p_attribute_category
2812 ,p_attribute1 => p_attribute1
2813 ,p_attribute2 => p_attribute2
2814 ,p_attribute3 => p_attribute3
2815 ,p_attribute4 => p_attribute4
2816 ,p_attribute5 => p_attribute5
2817 ,p_attribute6 => p_attribute6
2818 ,p_attribute7 => p_attribute7
2819 ,p_attribute8 => p_attribute8
2820 ,p_attribute9 => p_attribute9
2821 ,p_attribute10 => p_attribute10
2822 ,p_attribute11 => p_attribute11
2823 ,p_attribute12 => p_attribute12
2824 ,p_attribute13 => p_attribute13
2825 ,p_attribute14 => p_attribute14
2826 ,p_attribute15 => p_attribute15
2827 ,p_attribute16 => p_attribute16
2828 ,p_attribute17 => p_attribute17
2829 ,p_attribute18 => p_attribute18
2830 ,p_attribute19 => p_attribute19
2831 ,p_attribute20 => p_attribute20
2832 );
2833 exception
2834 when hr_api.cannot_find_prog_unit then
2835 hr_api.cannot_find_prog_unit_error
2836 (p_module_name => 'create_org_information'
2837 ,p_hook_type => 'BP'
2838 );
2839 end;
2840 --
2841 hr_utility.set_location(l_proc, 30);
2842
2843 -- Insert the effective date into fnd_sessions for the flexfield
2844 -- validation to work (Bug#3286325)
2845
2846 hr_kflex_utility.set_session_date
2847 (p_effective_date => l_effective_date
2848 ,p_session_id => l_session_id);
2849 --
2850 -- Process Logic
2851 --
2852 hr_ori_ins.ins(
2853 p_effective_date => p_effective_date,
2854 p_org_information_context => p_org_info_type_code,
2855 p_organization_id => p_organization_id,
2856 p_org_information1 => p_org_information1,
2857 p_org_information2 => p_org_information2,
2858 p_org_information3 => p_org_information3,
2859 p_org_information4 => p_org_information4,
2860 p_org_information5 => p_org_information5,
2861 p_org_information6 => p_org_information6,
2862 p_org_information7 => p_org_information7,
2863 p_org_information8 => p_org_information8,
2864 p_org_information9 => p_org_information9,
2865 p_org_information10 => p_org_information10,
2866 p_org_information11 => p_org_information11,
2867 p_org_information12 => p_org_information12,
2868 p_org_information13 => p_org_information13,
2869 p_org_information14 => p_org_information14,
2870 p_org_information15 => p_org_information15,
2871 p_org_information16 => p_org_information16,
2872 p_org_information17 => p_org_information17,
2873 p_org_information18 => p_org_information18,
2874 p_org_information19 => p_org_information19,
2875 p_org_information20 => p_org_information20,
2876 p_attribute_category => p_attribute_category,
2877 p_attribute1 => p_attribute1,
2878 p_attribute2 => p_attribute2,
2879 p_attribute3 => p_attribute3,
2880 p_attribute4 => p_attribute4,
2881 p_attribute5 => p_attribute5,
2882 p_attribute6 => p_attribute6,
2883 p_attribute7 => p_attribute7,
2884 p_attribute8 => p_attribute8,
2885 p_attribute9 => p_attribute9,
2886 p_attribute10 => p_attribute10,
2887 p_attribute11 => p_attribute11,
2888 p_attribute12 => p_attribute12,
2889 p_attribute13 => p_attribute13,
2890 p_attribute14 => p_attribute14,
2891 p_attribute15 => p_attribute15,
2892 p_attribute16 => p_attribute16,
2893 p_attribute17 => p_attribute17,
2894 p_attribute18 => p_attribute18,
2895 p_attribute19 => p_attribute19,
2896 p_attribute20 => p_attribute20,
2897 p_org_information_id => l_org_information_id,
2898 p_object_version_number => l_object_version_number
2899 );
2900 --
2901 hr_utility.set_location(l_proc, 40);
2902 --
2903 -- Call After Process User Hook
2904 --
2905 begin
2906 hr_organization_bk1.create_org_information_a
2907 (p_effective_date => trunc(p_effective_date)
2908 ,p_org_info_type_code => p_org_info_type_code
2909 ,p_organization_id => p_organization_id
2910 ,p_org_information1 => p_org_information1
2911 ,p_org_information2 => p_org_information2
2912 ,p_org_information3 => p_org_information3
2913 ,p_org_information4 => p_org_information4
2914 ,p_org_information5 => p_org_information5
2915 ,p_org_information6 => p_org_information6
2916 ,p_org_information7 => p_org_information7
2917 ,p_org_information8 => p_org_information8
2918 ,p_org_information9 => p_org_information9
2919 ,p_org_information10 => p_org_information10
2920 ,p_org_information11 => p_org_information11
2921 ,p_org_information12 => p_org_information12
2922 ,p_org_information13 => p_org_information13
2923 ,p_org_information14 => p_org_information14
2924 ,p_org_information15 => p_org_information15
2925 ,p_org_information16 => p_org_information16
2926 ,p_org_information17 => p_org_information17
2927 ,p_org_information18 => p_org_information18
2928 ,p_org_information19 => p_org_information19
2929 ,p_org_information20 => p_org_information20
2930 ,p_attribute_category => p_attribute_category
2931 ,p_attribute1 => p_attribute1
2932 ,p_attribute2 => p_attribute2
2933 ,p_attribute3 => p_attribute3
2934 ,p_attribute4 => p_attribute4
2935 ,p_attribute5 => p_attribute5
2936 ,p_attribute6 => p_attribute6
2937 ,p_attribute7 => p_attribute7
2938 ,p_attribute8 => p_attribute8
2939 ,p_attribute9 => p_attribute9
2940 ,p_attribute10 => p_attribute10
2941 ,p_attribute11 => p_attribute11
2942 ,p_attribute12 => p_attribute12
2943 ,p_attribute13 => p_attribute13
2944 ,p_attribute14 => p_attribute14
2945 ,p_attribute15 => p_attribute15
2946 ,p_attribute16 => p_attribute16
2947 ,p_attribute17 => p_attribute17
2948 ,p_attribute18 => p_attribute18
2949 ,p_attribute19 => p_attribute19
2950 ,p_attribute20 => p_attribute20
2951 ,p_org_information_id => l_org_information_id
2952 ,p_object_version_number => l_object_version_number);
2953 exception
2954 when hr_api.cannot_find_prog_unit then
2955 hr_api.cannot_find_prog_unit_error
2956 (p_module_name => 'create_org_information'
2957 ,p_hook_type => 'AP'
2958 );
2959 end;
2960 --
2961 hr_utility.set_location(l_proc, 50);
2962 --
2963 -- When in validation only mode raise the Validate_Enabled exception
2964 --
2965 IF p_validate THEN
2966 RAISE hr_api.validate_enabled;
2967 END IF;
2968 --
2969 hr_utility.set_location(l_proc, 60);
2970 --
2971 -- Set all output arguments
2972 --
2973 p_org_information_id := l_org_information_id;
2974 p_object_version_number := l_object_version_number;
2975 --
2976 --
2977 -- remove data from the session table (Bug# 3286325)
2978 --
2979 hr_kflex_utility.unset_session_date
2980 (p_session_id => l_session_id);
2981 --
2982 hr_utility.set_location(' Leaving:'||l_proc, 70);
2983 --
2984 EXCEPTION
2985 --
2986 WHEN hr_api.validate_enabled THEN
2987 --
2988 -- As the Validate_Enabled exception has been raised
2989 -- we must rollback to the savepoint
2990 --
2991 ROLLBACK TO create_org_information;
2992 --
2993 -- Only set output warning arguments
2994 -- (Any key or derived arguments must be set to null
2995 -- when validation only mode is being used.)
2996 --
2997 p_org_information_id := NULL;
2998 p_object_version_number := NULL;
2999 hr_utility.set_location(' Leaving:'||l_proc, 80);
3000 WHEN OTHERS THEN
3001 --
3002 -- A validation or unexpected error has occurred
3003 ROLLBACK TO create_org_information;
3004 -- Set OUT parameters
3005 p_org_information_id := NULL;
3006 p_object_version_number := NULL;
3007 hr_utility.set_location(' Leaving:'||l_proc, 90);
3008 RAISE;
3009 --
3010 END create_org_information;
3011 --
3012 -- ----------------------------------------------------------------------------
3013 -- |-----------------------------< create_org_manager >-----------------------|
3014 -- ----------------------------------------------------------------------------
3015 --
3016 PROCEDURE create_org_manager
3017 (p_validate IN BOOLEAN DEFAULT false
3018 ,p_effective_date IN DATE
3019 ,p_organization_id IN NUMBER
3020 ,p_org_info_type_code IN VARCHAR2
3021 ,p_org_information1 IN VARCHAR2 DEFAULT null
3022 ,p_org_information2 IN VARCHAR2 DEFAULT null
3023 ,p_org_information3 IN VARCHAR2 DEFAULT null
3024 ,p_org_information4 IN VARCHAR2 DEFAULT null
3025 ,p_org_information5 IN VARCHAR2 DEFAULT null
3026 ,p_org_information6 IN VARCHAR2 DEFAULT null
3027 ,p_org_information7 IN VARCHAR2 DEFAULT null
3028 ,p_org_information8 IN VARCHAR2 DEFAULT null
3029 ,p_org_information9 IN VARCHAR2 DEFAULT null
3030 ,p_org_information10 IN VARCHAR2 DEFAULT null
3031 ,p_org_information11 IN VARCHAR2 DEFAULT null
3032 ,p_org_information12 IN VARCHAR2 DEFAULT null
3033 ,p_org_information13 IN VARCHAR2 DEFAULT null
3034 ,p_org_information14 IN VARCHAR2 DEFAULT null
3035 ,p_org_information15 IN VARCHAR2 DEFAULT null
3036 ,p_org_information16 IN VARCHAR2 DEFAULT null
3037 ,p_org_information17 IN VARCHAR2 DEFAULT null
3038 ,p_org_information18 IN VARCHAR2 DEFAULT null
3039 ,p_org_information19 IN VARCHAR2 DEFAULT null
3040 ,p_org_information20 IN VARCHAR2 DEFAULT null
3041 ,p_attribute_category IN VARCHAR2 DEFAULT null
3042 ,p_attribute1 IN VARCHAR2 DEFAULT null
3043 ,p_attribute2 IN VARCHAR2 DEFAULT null
3044 ,p_attribute3 IN VARCHAR2 DEFAULT null
3045 ,p_attribute4 IN VARCHAR2 DEFAULT null
3046 ,p_attribute5 IN VARCHAR2 DEFAULT null
3047 ,p_attribute6 IN VARCHAR2 DEFAULT null
3048 ,p_attribute7 IN VARCHAR2 DEFAULT null
3049 ,p_attribute8 IN VARCHAR2 DEFAULT null
3050 ,p_attribute9 IN VARCHAR2 DEFAULT null
3051 ,p_attribute10 IN VARCHAR2 DEFAULT null
3052 ,p_attribute11 IN VARCHAR2 DEFAULT null
3053 ,p_attribute12 IN VARCHAR2 DEFAULT null
3054 ,p_attribute13 IN VARCHAR2 DEFAULT null
3055 ,p_attribute14 IN VARCHAR2 DEFAULT null
3056 ,p_attribute15 IN VARCHAR2 DEFAULT null
3057 ,p_attribute16 IN VARCHAR2 DEFAULT null
3058 ,p_attribute17 IN VARCHAR2 DEFAULT null
3059 ,p_attribute18 IN VARCHAR2 DEFAULT null
3060 ,p_attribute19 IN VARCHAR2 DEFAULT null
3061 ,p_attribute20 IN VARCHAR2 DEFAULT null
3062 ,p_org_information_id OUT NOCOPY NUMBER
3063 ,p_object_version_number OUT NOCOPY NUMBER
3064 ,p_warning OUT NOCOPY BOOLEAN
3065 ) IS
3066 --
3067 -- Declare cursors and local variables
3068 --
3069 l_proc varchar2(72) := g_package||'create_org_manager';
3070 l_org_information_id hr_organization_information.org_information_id%TYPE;
3071 l_object_version_number hr_organization_information.object_version_number%TYPE;
3072 l_warning boolean;
3073 --
3074 cursor c1 is
3075 select business_group_id
3076 from hr_all_organization_units
3077 where organization_id = p_organization_id;
3078 --
3079 l_business_group_id number;
3080 --
3081 BEGIN
3082 --
3083 hr_utility.set_location('Entering:'|| l_proc, 10);
3084 --
3085 open c1;
3086 --
3087 fetch c1 into l_business_group_id;
3088 if c1%found then
3089 --
3090 fnd_profile.put('PER_BUSINESS_GROUP_ID',l_business_group_id);
3091 --
3092 end if;
3093 --
3094 close c1;
3095 --
3096 -- Issue a savepoint
3097 --
3098 savepoint create_org_information;
3099 --
3100 hr_utility.set_location(l_proc, 20);
3101 --
3102 -- Call Before Process User Hook
3103 --
3104 if p_org_info_type_code <> 'Business Group Information' then
3105 begin
3106 --
3107 hr_organization_bk1.create_org_information_b
3108 (p_effective_date => trunc(p_effective_date)
3109 ,p_org_info_type_code => p_org_info_type_code
3110 ,p_organization_id => p_organization_id
3111 ,p_org_information1 => p_org_information1
3112 ,p_org_information2 => p_org_information2
3113 ,p_org_information3 => p_org_information3
3114 ,p_org_information4 => p_org_information4
3115 ,p_org_information5 => p_org_information5
3116 ,p_org_information6 => p_org_information6
3117 ,p_org_information7 => p_org_information7
3118 ,p_org_information8 => p_org_information8
3119 ,p_org_information9 => p_org_information9
3120 ,p_org_information10 => p_org_information10
3121 ,p_org_information11 => p_org_information11
3122 ,p_org_information12 => p_org_information12
3123 ,p_org_information13 => p_org_information13
3124 ,p_org_information14 => p_org_information14
3125 ,p_org_information15 => p_org_information15
3126 ,p_org_information16 => p_org_information16
3127 ,p_org_information17 => p_org_information17
3128 ,p_org_information18 => p_org_information18
3129 ,p_org_information19 => p_org_information19
3130 ,p_org_information20 => p_org_information20
3131 ,p_attribute_category => p_attribute_category
3132 ,p_attribute1 => p_attribute1
3133 ,p_attribute2 => p_attribute2
3134 ,p_attribute3 => p_attribute3
3135 ,p_attribute4 => p_attribute4
3136 ,p_attribute5 => p_attribute5
3137 ,p_attribute6 => p_attribute6
3138 ,p_attribute7 => p_attribute7
3139 ,p_attribute8 => p_attribute8
3140 ,p_attribute9 => p_attribute9
3141 ,p_attribute10 => p_attribute10
3142 ,p_attribute11 => p_attribute11
3143 ,p_attribute12 => p_attribute12
3144 ,p_attribute13 => p_attribute13
3145 ,p_attribute14 => p_attribute14
3146 ,p_attribute15 => p_attribute15
3147 ,p_attribute16 => p_attribute16
3148 ,p_attribute17 => p_attribute17
3149 ,p_attribute18 => p_attribute18
3150 ,p_attribute19 => p_attribute19
3151 ,p_attribute20 => p_attribute20
3152 );
3153 --
3154 exception
3155 --
3156 when hr_api.cannot_find_prog_unit then
3157 hr_api.cannot_find_prog_unit_error
3158 (p_module_name => 'create_org_information'
3159 ,p_hook_type => 'BP');
3160 --
3161 end;
3162 end if;
3163 --
3164 hr_utility.set_location(l_proc, 30);
3165 --
3166 -- Process Logic
3167 --
3168 hr_ori_ins.ins
3169 (p_effective_date => p_effective_date
3170 ,p_org_information_context => p_org_info_type_code
3171 ,p_organization_id => p_organization_id
3172 ,p_org_information1 => p_org_information1
3173 ,p_org_information2 => p_org_information2
3174 ,p_org_information3 => p_org_information3
3175 ,p_org_information4 => p_org_information4
3176 ,p_org_information5 => p_org_information5
3177 ,p_org_information6 => p_org_information6
3178 ,p_org_information7 => p_org_information7
3179 ,p_org_information8 => p_org_information8
3180 ,p_org_information9 => p_org_information9
3181 ,p_org_information10 => p_org_information10
3182 ,p_org_information11 => p_org_information11
3183 ,p_org_information12 => p_org_information12
3184 ,p_org_information13 => p_org_information13
3185 ,p_org_information14 => p_org_information14
3186 ,p_org_information15 => p_org_information15
3187 ,p_org_information16 => p_org_information16
3188 ,p_org_information17 => p_org_information17
3189 ,p_org_information18 => p_org_information18
3190 ,p_org_information19 => p_org_information19
3191 ,p_org_information20 => p_org_information20
3192 ,p_attribute_category => p_attribute_category
3193 ,p_attribute1 => p_attribute1
3194 ,p_attribute2 => p_attribute2
3195 ,p_attribute3 => p_attribute3
3196 ,p_attribute4 => p_attribute4
3197 ,p_attribute5 => p_attribute5
3198 ,p_attribute6 => p_attribute6
3199 ,p_attribute7 => p_attribute7
3200 ,p_attribute8 => p_attribute8
3201 ,p_attribute9 => p_attribute9
3202 ,p_attribute10 => p_attribute10
3203 ,p_attribute11 => p_attribute11
3204 ,p_attribute12 => p_attribute12
3205 ,p_attribute13 => p_attribute13
3206 ,p_attribute14 => p_attribute14
3207 ,p_attribute15 => p_attribute15
3208 ,p_attribute16 => p_attribute16
3209 ,p_attribute17 => p_attribute17
3210 ,p_attribute18 => p_attribute18
3211 ,p_attribute19 => p_attribute19
3212 ,p_attribute20 => p_attribute20
3213 ,p_org_information_id => l_org_information_id
3214 ,p_object_version_number => l_object_version_number);
3215 --
3216 -- Set the warning parameter if a gap occurred
3217 --
3218 l_warning := false;
3219 --
3220 if p_org_info_type_code = 'Organization Name Alias' then
3221 --
3222 if hr_ori_bus.chk_cost_center_gap
3223 (p_organization_id => p_organization_id,
3224 p_org_information_id => l_org_information_id,
3225 p_org_information_context => p_org_info_type_code,
3226 p_start_date => fnd_date.canonical_to_date(p_org_information3),
3227 p_end_date => fnd_date.canonical_to_date(p_org_information4)) then
3228 --
3229 l_warning := true;
3230 --
3231 else
3232 --
3233 l_warning := false;
3234 --
3235 end if;
3236 --
3237 end if;
3238 --
3239 hr_utility.set_location(l_proc, 40);
3240 --
3241 -- Bug 3617238 START
3242 --
3243 IF p_org_info_type_code = 'Business Group Information' THEN
3244 --
3245 pay_generic_upgrade.new_business_group( p_bus_grp_id => p_organization_id
3246 ,p_leg_code => p_org_information9
3247 );
3248 --
3249 END IF;
3250 --
3251 hr_utility.set_location(l_proc, 45);
3252 --
3253 -- Bug 3617238 END
3254 --
3255 --
3256 -- Call After Process User Hook
3257 --
3258 begin
3259 --
3260 hr_organization_bk1.create_org_information_a
3261 (p_effective_date => trunc(p_effective_date)
3262 ,p_org_info_type_code => p_org_info_type_code
3263 ,p_organization_id => p_organization_id
3264 ,p_org_information1 => p_org_information1
3265 ,p_org_information2 => p_org_information2
3266 ,p_org_information3 => p_org_information3
3267 ,p_org_information4 => p_org_information4
3268 ,p_org_information5 => p_org_information5
3269 ,p_org_information6 => p_org_information6
3270 ,p_org_information7 => p_org_information7
3271 ,p_org_information8 => p_org_information8
3272 ,p_org_information9 => p_org_information9
3273 ,p_org_information10 => p_org_information10
3274 ,p_org_information11 => p_org_information11
3275 ,p_org_information12 => p_org_information12
3276 ,p_org_information13 => p_org_information13
3277 ,p_org_information14 => p_org_information14
3278 ,p_org_information15 => p_org_information15
3279 ,p_org_information16 => p_org_information16
3280 ,p_org_information17 => p_org_information17
3281 ,p_org_information18 => p_org_information18
3282 ,p_org_information19 => p_org_information19
3283 ,p_org_information20 => p_org_information20
3284 ,p_attribute_category => p_attribute_category
3285 ,p_attribute1 => p_attribute1
3286 ,p_attribute2 => p_attribute2
3287 ,p_attribute3 => p_attribute3
3288 ,p_attribute4 => p_attribute4
3289 ,p_attribute5 => p_attribute5
3290 ,p_attribute6 => p_attribute6
3291 ,p_attribute7 => p_attribute7
3292 ,p_attribute8 => p_attribute8
3293 ,p_attribute9 => p_attribute9
3294 ,p_attribute10 => p_attribute10
3295 ,p_attribute11 => p_attribute11
3296 ,p_attribute12 => p_attribute12
3297 ,p_attribute13 => p_attribute13
3298 ,p_attribute14 => p_attribute14
3299 ,p_attribute15 => p_attribute15
3300 ,p_attribute16 => p_attribute16
3301 ,p_attribute17 => p_attribute17
3302 ,p_attribute18 => p_attribute18
3303 ,p_attribute19 => p_attribute19
3304 ,p_attribute20 => p_attribute20
3305 ,p_org_information_id => l_org_information_id
3306 ,p_object_version_number => l_object_version_number);
3307 --
3308 exception
3309 --
3310 when hr_api.cannot_find_prog_unit then
3311 hr_api.cannot_find_prog_unit_error
3312 (p_module_name => 'create_org_information'
3313 ,p_hook_type => 'AP');
3314 --
3315 end;
3316 --
3317 hr_utility.set_location(l_proc, 50);
3318 --
3319 -- When in validation only mode raise the Validate_Enabled exception
3320 --
3321 IF p_validate THEN
3322 RAISE hr_api.validate_enabled;
3323 END IF;
3324 --
3325 hr_utility.set_location(l_proc, 60);
3326 --
3327 -- Set all output arguments
3328 --
3329 p_org_information_id := l_org_information_id;
3330 p_object_version_number := l_object_version_number;
3331 p_warning := l_warning;
3332 --
3333 hr_utility.set_location(' Leaving:'||l_proc, 70);
3334 --
3335 EXCEPTION
3336 --
3337 WHEN hr_api.validate_enabled THEN
3338 --
3339 -- As the Validate_Enabled exception has been raised
3340 -- we must rollback to the savepoint
3341 --
3342 ROLLBACK TO create_org_information;
3343 --
3344 -- Only set output warning arguments
3345 -- (Any key or derived arguments must be set to null
3346 -- when validation only mode is being used.)
3347 --
3348 p_org_information_id := NULL;
3349 p_object_version_number := NULL;
3350 p_warning := NULL;
3351 hr_utility.set_location(' Leaving:'||l_proc, 80);
3352 --
3353 WHEN OTHERS THEN
3354 --
3355 -- A validation or unexpected error has occurred
3356 ROLLBACK TO create_org_information;
3357 --
3358 p_org_information_id := NULL;
3359 p_object_version_number := NULL;
3360 p_warning := NULL;
3361 hr_utility.set_location(' Leaving:'||l_proc, 90);
3362 RAISE;
3363 --
3364 end create_org_manager;
3365 --
3366 -- ----------------------------------------------------------------------------
3367 -- |--------------------------< update_org_information >----------------------|
3368 -- ----------------------------------------------------------------------------
3369 --
3370 PROCEDURE update_org_information
3371 (p_validate IN BOOLEAN DEFAULT false
3372 ,p_effective_date IN DATE
3373 ,p_org_information_id IN NUMBER
3374 ,p_org_info_type_code IN VARCHAR2
3375 ,p_org_information1 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3376 ,p_org_information2 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3377 ,p_org_information3 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3378 ,p_org_information4 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3379 ,p_org_information5 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3380 ,p_org_information6 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3381 ,p_org_information7 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3382 ,p_org_information8 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3383 ,p_org_information9 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3384 ,p_org_information10 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3385 ,p_org_information11 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3386 ,p_org_information12 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3387 ,p_org_information13 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3388 ,p_org_information14 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3389 ,p_org_information15 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3390 ,p_org_information16 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3391 ,p_org_information17 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3392 ,p_org_information18 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3393 ,p_org_information19 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3394 ,p_org_information20 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3395 ,p_attribute_category IN VARCHAR2 DEFAULT hr_api.g_varchar2
3396 ,p_attribute1 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3397 ,p_attribute2 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3398 ,p_attribute3 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3399 ,p_attribute4 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3400 ,p_attribute5 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3401 ,p_attribute6 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3402 ,p_attribute7 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3403 ,p_attribute8 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3404 ,p_attribute9 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3405 ,p_attribute10 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3406 ,p_attribute11 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3407 ,p_attribute12 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3408 ,p_attribute13 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3409 ,p_attribute14 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3410 ,p_attribute15 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3411 ,p_attribute16 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3412 ,p_attribute17 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3413 ,p_attribute18 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3414 ,p_attribute19 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3415 ,p_attribute20 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3416 ,p_object_version_number IN OUT NOCOPY NUMBER
3417 ) IS
3418 --
3419 -- Declare cursors and local variables
3420 --
3421 l_proc VARCHAR2(72) := g_package||'update_org_information';
3422 l_object_version_number hr_organization_information.object_version_number%TYPE := p_object_version_number;
3423 l_temp_ovn number := p_object_version_number;
3424 l_session_id number; --Fix for bug9064403
3425 l_effective_date date; --Fix for bug9064403
3426
3427 --
3428
3429 cursor csr_check_ou
3430 is
3431 select 1 from hr_organization_information hoi
3432 where hoi.org_information_id = p_org_information_id
3433 and hoi.org_information_context = p_org_info_type_code;
3434 BEGIN
3435 --
3436 hr_utility.set_location('Entering:'|| l_proc, 10);
3437 --
3438 -- Issue a savepoint.
3439 --
3440 savepoint update_org_information;
3441 --
3442 hr_utility.set_location(l_proc, 20);
3443
3444 --Fix for bug9064403
3445 l_effective_date := trunc(p_effective_date);
3446 hr_kflex_utility.set_session_date
3447 (p_effective_date => l_effective_date
3448 ,p_session_id => l_session_id);
3449 --Changed end for bug9064403
3450
3451 --
3452 -- Check that mandatory info types cannot be updated after
3453 -- they were created
3454 --
3455 IF p_org_info_type_code = 'Business Group Information'
3456 -- OR p_org_info_type_code = 'Operating Unit Information'
3457 OR p_org_info_type_code = 'Canada Employer Identification'
3458 OR p_org_info_type_code = 'FPT_BRANCH_INFO'
3459 OR p_org_info_type_code = 'FPT_BANK_INFO' THEN
3460 hr_utility.set_message(800, 'HR_289005_INFO_TYPE_NONUPD');
3461 hr_utility.raise_error;
3462 END IF;
3463 --
3464 open csr_check_ou;
3465 IF csr_check_ou%notfound then
3466 hr_utility.set_message(800, 'HR_289005_INFO_TYPE_NONUPD');
3467 hr_utility.raise_error;
3468 END IF;
3469
3470 hr_utility.set_location(l_proc, 30);
3471 --
3472 -- Call Before Process User Hook
3473 --
3474 begin
3475 hr_organization_bk2.update_org_information_b
3476 (p_effective_date => trunc(p_effective_date)
3477 ,p_org_info_type_code => p_org_info_type_code
3478 ,p_org_information1 => p_org_information1
3479 ,p_org_information2 => p_org_information2
3480 ,p_org_information3 => p_org_information3
3481 ,p_org_information4 => p_org_information4
3482 ,p_org_information5 => p_org_information5
3483 ,p_org_information6 => p_org_information6
3484 ,p_org_information7 => p_org_information7
3485 ,p_org_information8 => p_org_information8
3486 ,p_org_information9 => p_org_information9
3487 ,p_org_information10 => p_org_information10
3488 ,p_org_information11 => p_org_information11
3489 ,p_org_information12 => p_org_information12
3490 ,p_org_information13 => p_org_information13
3491 ,p_org_information14 => p_org_information14
3492 ,p_org_information15 => p_org_information15
3493 ,p_org_information16 => p_org_information16
3494 ,p_org_information17 => p_org_information17
3495 ,p_org_information18 => p_org_information18
3496 ,p_org_information19 => p_org_information19
3497 ,p_org_information20 => p_org_information20
3498 ,p_org_information_id => p_org_information_id
3499 ,p_attribute_category => p_attribute_category
3500 ,p_attribute1 => p_attribute1
3501 ,p_attribute2 => p_attribute2
3502 ,p_attribute3 => p_attribute3
3503 ,p_attribute4 => p_attribute4
3504 ,p_attribute5 => p_attribute5
3505 ,p_attribute6 => p_attribute6
3506 ,p_attribute7 => p_attribute7
3507 ,p_attribute8 => p_attribute8
3508 ,p_attribute9 => p_attribute9
3509 ,p_attribute10 => p_attribute10
3510 ,p_attribute11 => p_attribute11
3511 ,p_attribute12 => p_attribute12
3512 ,p_attribute13 => p_attribute13
3513 ,p_attribute14 => p_attribute14
3514 ,p_attribute15 => p_attribute15
3515 ,p_attribute16 => p_attribute16
3516 ,p_attribute17 => p_attribute17
3517 ,p_attribute18 => p_attribute18
3518 ,p_attribute19 => p_attribute19
3519 ,p_attribute20 => p_attribute20
3520 ,p_object_version_number => l_object_version_number);
3521 exception
3522 when hr_api.cannot_find_prog_unit then
3523 hr_api.cannot_find_prog_unit_error
3524 (p_module_name => 'update_org_information'
3525 ,p_hook_type => 'BP'
3526 );
3527 end;
3528 --
3529 hr_utility.set_location(l_proc, 40);
3530 --
3531 -- Update row in HR_ORGANIZATION_INFORMATION Table
3532 --
3533 hr_ori_upd.upd(
3534 p_effective_date => p_effective_date,
3535 p_org_information_id => p_org_information_id,
3536 p_org_information_context => p_org_info_type_code,
3537 p_org_information1 => p_org_information1,
3538 p_org_information2 => p_org_information2,
3539 p_org_information3 => p_org_information3,
3540 p_org_information4 => p_org_information4,
3541 p_org_information5 => p_org_information5,
3542 p_org_information6 => p_org_information6,
3543 p_org_information7 => p_org_information7,
3544 p_org_information8 => p_org_information8,
3545 p_org_information9 => p_org_information9,
3546 p_org_information10 => p_org_information10,
3547 p_org_information11 => p_org_information11,
3548 p_org_information12 => p_org_information12,
3549 p_org_information13 => p_org_information13,
3550 p_org_information14 => p_org_information14,
3551 p_org_information15 => p_org_information15,
3552 p_org_information16 => p_org_information16,
3553 p_org_information17 => p_org_information17,
3554 p_org_information18 => p_org_information18,
3555 p_org_information19 => p_org_information19,
3556 p_org_information20 => p_org_information20,
3557 p_attribute_category => p_attribute_category,
3558 p_attribute1 => p_attribute1,
3559 p_attribute2 => p_attribute2,
3560 p_attribute3 => p_attribute3,
3561 p_attribute4 => p_attribute4,
3562 p_attribute5 => p_attribute5,
3563 p_attribute6 => p_attribute6,
3564 p_attribute7 => p_attribute7,
3565 p_attribute8 => p_attribute8,
3566 p_attribute9 => p_attribute9,
3567 p_attribute10 => p_attribute10,
3568 p_attribute11 => p_attribute11,
3569 p_attribute12 => p_attribute12,
3570 p_attribute13 => p_attribute13,
3571 p_attribute14 => p_attribute14,
3572 p_attribute15 => p_attribute15,
3573 p_attribute16 => p_attribute16,
3574 p_attribute17 => p_attribute17,
3575 p_attribute18 => p_attribute18,
3576 p_attribute19 => p_attribute19,
3577 p_attribute20 => p_attribute20,
3578 p_object_version_number => l_object_version_number
3579 );
3580 --
3581 hr_utility.set_location(l_proc, 50);
3582 --
3583 -- Call After Process User Hook
3584 --
3585 begin
3586 hr_organization_bk2.update_org_information_a
3587 (p_effective_date => trunc(p_effective_date)
3588 ,p_org_info_type_code => p_org_info_type_code
3589 ,p_org_information1 => p_org_information1
3590 ,p_org_information2 => p_org_information2
3591 ,p_org_information3 => p_org_information3
3592 ,p_org_information4 => p_org_information4
3593 ,p_org_information5 => p_org_information5
3594 ,p_org_information6 => p_org_information6
3595 ,p_org_information7 => p_org_information7
3596 ,p_org_information8 => p_org_information8
3597 ,p_org_information9 => p_org_information9
3598 ,p_org_information10 => p_org_information10
3599 ,p_org_information11 => p_org_information11
3600 ,p_org_information12 => p_org_information12
3601 ,p_org_information13 => p_org_information13
3602 ,p_org_information14 => p_org_information14
3603 ,p_org_information15 => p_org_information15
3604 ,p_org_information16 => p_org_information16
3605 ,p_org_information17 => p_org_information17
3606 ,p_org_information18 => p_org_information18
3607 ,p_org_information19 => p_org_information19
3608 ,p_org_information20 => p_org_information20
3609 ,p_org_information_id => p_org_information_id
3610 ,p_attribute_category => p_attribute_category
3611 ,p_attribute1 => p_attribute1
3612 ,p_attribute2 => p_attribute2
3613 ,p_attribute3 => p_attribute3
3614 ,p_attribute4 => p_attribute4
3615 ,p_attribute5 => p_attribute5
3616 ,p_attribute6 => p_attribute6
3617 ,p_attribute7 => p_attribute7
3618 ,p_attribute8 => p_attribute8
3619 ,p_attribute9 => p_attribute9
3620 ,p_attribute10 => p_attribute10
3621 ,p_attribute11 => p_attribute11
3622 ,p_attribute12 => p_attribute12
3623 ,p_attribute13 => p_attribute13
3624 ,p_attribute14 => p_attribute14
3625 ,p_attribute15 => p_attribute15
3626 ,p_attribute16 => p_attribute16
3627 ,p_attribute17 => p_attribute17
3628 ,p_attribute18 => p_attribute18
3629 ,p_attribute19 => p_attribute19
3630 ,p_attribute20 => p_attribute20
3631 ,p_object_version_number => l_object_version_number);
3632 exception
3633 when hr_api.cannot_find_prog_unit then
3634 hr_api.cannot_find_prog_unit_error
3635 (p_module_name => 'update_org_information'
3636 ,p_hook_type => 'AP'
3637 );
3638 end;
3639 --
3640 hr_utility.set_location(l_proc, 60);
3641 --
3642 -- When in validation only mode raise the Validate_Enabled exception
3643 --
3644 IF p_validate THEN
3645 RAISE hr_api.validate_enabled;
3646 END IF;
3647 --
3648 hr_utility.set_location(l_proc, 70);
3649 --
3650 -- Set all output arguments. If p_validate was TRUE, this bit is
3651 -- never reached, so p_object_version_number is passed back unchanged.
3652 --
3653 p_object_version_number := l_object_version_number;
3654 --Fixed for bug9064403
3655 hr_kflex_utility.unset_session_date
3656 (p_session_id => l_session_id);
3657 --
3658
3659 --
3660 hr_utility.set_location(' Leaving:'||l_proc, 80);
3661 --
3662 EXCEPTION
3663 --
3664 WHEN hr_api.validate_enabled THEN
3665 --
3666 -- As the Validate_Enabled exception has been raised
3667 -- we must rollback to the savepoint
3668 --
3669 ROLLBACK TO update_org_information;
3670 --
3671 -- Only set output warning arguments
3672 -- (Any key or derived arguments must be set to null
3673 -- when validation only mode is being used.)
3674 -- Reset IN OUT parameters.
3675 p_object_version_number := l_temp_ovn;
3676 hr_utility.set_location(' Leaving:'||l_proc, 80);
3677 WHEN OTHERS THEN
3678 --
3679 -- A validation or unexpected error has occurred
3680 ROLLBACK TO update_org_information;
3681 -- Reset IN OUT parameters.
3682 p_object_version_number := l_temp_ovn;
3683 hr_utility.set_location(' Leaving:'||l_proc, 90);
3684 RAISE;
3685 --
3686 --
3687 END update_org_information;
3688 --
3689 -- ----------------------------------------------------------------------------
3690 -- |--------------------------< update_org_manager >--------------------------|
3691 -- ----------------------------------------------------------------------------
3692 --
3693 PROCEDURE update_org_manager
3694 (p_validate IN BOOLEAN DEFAULT false
3695 ,p_effective_date IN DATE
3696 ,p_organization_id IN NUMBER
3697 ,p_org_information_id IN NUMBER
3698 ,p_org_info_type_code IN VARCHAR2
3699 ,p_org_information1 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3700 ,p_org_information2 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3701 ,p_org_information3 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3702 ,p_org_information4 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3703 ,p_org_information5 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3704 ,p_org_information6 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3705 ,p_org_information7 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3706 ,p_org_information8 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3707 ,p_org_information9 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3708 ,p_org_information10 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3709 ,p_org_information11 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3710 ,p_org_information12 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3711 ,p_org_information13 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3712 ,p_org_information14 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3713 ,p_org_information15 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3714 ,p_org_information16 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3715 ,p_org_information17 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3716 ,p_org_information18 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3717 ,p_org_information19 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3718 ,p_org_information20 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3719 ,p_attribute_category IN VARCHAR2 DEFAULT hr_api.g_varchar2
3720 ,p_attribute1 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3721 ,p_attribute2 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3722 ,p_attribute3 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3723 ,p_attribute4 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3724 ,p_attribute5 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3725 ,p_attribute6 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3726 ,p_attribute7 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3727 ,p_attribute8 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3728 ,p_attribute9 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3729 ,p_attribute10 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3730 ,p_attribute11 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3731 ,p_attribute12 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3732 ,p_attribute13 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3733 ,p_attribute14 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3734 ,p_attribute15 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3735 ,p_attribute16 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3736 ,p_attribute17 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3737 ,p_attribute18 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3738 ,p_attribute19 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3739 ,p_attribute20 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3740 ,p_object_version_number IN OUT NOCOPY NUMBER
3741 ,p_warning OUT NOCOPY BOOLEAN
3742 ) IS
3743 --
3744 -- Declare cursors and local variables
3745 --
3746 l_proc VARCHAR2(72) := g_package||'update_org_manager';
3747 l_object_version_number hr_organization_information.object_version_number%TYPE := p_object_version_number;
3748 l_warning boolean;
3749 l_temp_ovn number := p_object_version_number;
3750 --
3751 cursor c1 is
3752 select business_group_id
3753 from hr_all_organization_units
3754 where organization_id = p_organization_id;
3755 --
3756 l_business_group_id number;
3757 --
3758 BEGIN
3759 --
3760 hr_utility.set_location('Entering:'|| l_proc, 10);
3761 --
3762 -- Issue a savepoint.
3763 --
3764 open c1;
3765 --
3766 fetch c1 into l_business_group_id;
3767 if c1%found then
3768 --
3769 fnd_profile.put('PER_BUSINESS_GROUP_ID',l_business_group_id);
3770 --
3771 end if;
3772 --
3773 close c1;
3774 --
3775 savepoint update_org_information;
3776 --
3777 hr_utility.set_location(l_proc, 20);
3778 --
3779 -- Call Before Process User Hook
3780 --
3781 begin
3782 --
3783 hr_organization_bk2.update_org_information_b
3784 (p_effective_date => trunc(p_effective_date)
3785 ,p_org_info_type_code => p_org_info_type_code
3786 ,p_org_information1 => p_org_information1
3787 ,p_org_information2 => p_org_information2
3788 ,p_org_information3 => p_org_information3
3789 ,p_org_information4 => p_org_information4
3790 ,p_org_information5 => p_org_information5
3791 ,p_org_information6 => p_org_information6
3792 ,p_org_information7 => p_org_information7
3793 ,p_org_information8 => p_org_information8
3794 ,p_org_information9 => p_org_information9
3795 ,p_org_information10 => p_org_information10
3796 ,p_org_information11 => p_org_information11
3797 ,p_org_information12 => p_org_information12
3798 ,p_org_information13 => p_org_information13
3799 ,p_org_information14 => p_org_information14
3800 ,p_org_information15 => p_org_information15
3801 ,p_org_information16 => p_org_information16
3802 ,p_org_information17 => p_org_information17
3803 ,p_org_information18 => p_org_information18
3804 ,p_org_information19 => p_org_information19
3805 ,p_org_information20 => p_org_information20
3806 ,p_org_information_id => p_org_information_id
3807 ,p_attribute_category => p_attribute_category
3808 ,p_attribute1 => p_attribute1
3809 ,p_attribute2 => p_attribute2
3810 ,p_attribute3 => p_attribute3
3811 ,p_attribute4 => p_attribute4
3812 ,p_attribute5 => p_attribute5
3813 ,p_attribute6 => p_attribute6
3814 ,p_attribute7 => p_attribute7
3815 ,p_attribute8 => p_attribute8
3816 ,p_attribute9 => p_attribute9
3817 ,p_attribute10 => p_attribute10
3818 ,p_attribute11 => p_attribute11
3819 ,p_attribute12 => p_attribute12
3820 ,p_attribute13 => p_attribute13
3821 ,p_attribute14 => p_attribute14
3822 ,p_attribute15 => p_attribute15
3823 ,p_attribute16 => p_attribute16
3824 ,p_attribute17 => p_attribute17
3825 ,p_attribute18 => p_attribute18
3826 ,p_attribute19 => p_attribute19
3827 ,p_attribute20 => p_attribute20
3828 ,p_object_version_number => l_object_version_number);
3829 --
3830 exception
3831 --
3832 when hr_api.cannot_find_prog_unit then
3833 --
3834 hr_api.cannot_find_prog_unit_error
3835 (p_module_name => 'update_org_information'
3836 ,p_hook_type => 'BP'
3837 );
3838 end;
3839 --
3840 hr_utility.set_location(l_proc, 40);
3841 --
3842 -- Update row in HR_ORGANIZATION_INFORMATION Table
3843 --
3844 hr_ori_upd.upd
3845 (p_effective_date => p_effective_date
3846 ,p_org_information_id => p_org_information_id
3847 ,p_org_information_context => p_org_info_type_code
3848 ,p_org_information1 => p_org_information1
3849 ,p_org_information2 => p_org_information2
3850 ,p_org_information3 => p_org_information3
3851 ,p_org_information4 => p_org_information4
3852 ,p_org_information5 => p_org_information5
3853 ,p_org_information6 => p_org_information6
3854 ,p_org_information7 => p_org_information7
3855 ,p_org_information8 => p_org_information8
3856 ,p_org_information9 => p_org_information9
3857 ,p_org_information10 => p_org_information10
3858 ,p_org_information11 => p_org_information11
3859 ,p_org_information12 => p_org_information12
3860 ,p_org_information13 => p_org_information13
3861 ,p_org_information14 => p_org_information14
3862 ,p_org_information15 => p_org_information15
3863 ,p_org_information16 => p_org_information16
3864 ,p_org_information17 => p_org_information17
3865 ,p_org_information18 => p_org_information18
3866 ,p_org_information19 => p_org_information19
3867 ,p_org_information20 => p_org_information20
3868 ,p_attribute_category => p_attribute_category
3869 ,p_attribute1 => p_attribute1
3870 ,p_attribute2 => p_attribute2
3871 ,p_attribute3 => p_attribute3
3872 ,p_attribute4 => p_attribute4
3873 ,p_attribute5 => p_attribute5
3874 ,p_attribute6 => p_attribute6
3875 ,p_attribute7 => p_attribute7
3876 ,p_attribute8 => p_attribute8
3877 ,p_attribute9 => p_attribute9
3878 ,p_attribute10 => p_attribute10
3879 ,p_attribute11 => p_attribute11
3880 ,p_attribute12 => p_attribute12
3881 ,p_attribute13 => p_attribute13
3882 ,p_attribute14 => p_attribute14
3883 ,p_attribute15 => p_attribute15
3884 ,p_attribute16 => p_attribute16
3885 ,p_attribute17 => p_attribute17
3886 ,p_attribute18 => p_attribute18
3887 ,p_attribute19 => p_attribute19
3888 ,p_attribute20 => p_attribute20
3889 ,p_object_version_number => l_object_version_number);
3890 --
3891 hr_utility.set_location(l_proc, 50);
3892 --
3893 -- Set the warning parameter if a gap occurred
3894 --
3895 l_warning := false;
3896 --
3897 if p_org_info_type_code = 'Organization Name Alias' then
3898 --
3899 if hr_ori_bus.chk_cost_center_gap
3900 (p_organization_id => p_organization_id,
3901 p_org_information_id => p_org_information_id,
3902 p_org_information_context => p_org_info_type_code,
3903 p_start_date => fnd_date.canonical_to_date(p_org_information3),
3904 p_end_date => fnd_date.canonical_to_date(p_org_information4)) then
3905 --
3906 l_warning := true;
3907 --
3908 else
3909 --
3910 l_warning := false;
3911 --
3912 end if;
3913 --
3914 end if;
3915 --
3916 -- Call After Process User Hook
3917 --
3918 begin
3919 --
3920 hr_organization_bk2.update_org_information_a
3921 (p_effective_date => trunc(p_effective_date)
3922 ,p_org_info_type_code => p_org_info_type_code
3923 ,p_org_information1 => p_org_information1
3924 ,p_org_information2 => p_org_information2
3925 ,p_org_information3 => p_org_information3
3926 ,p_org_information4 => p_org_information4
3927 ,p_org_information5 => p_org_information5
3928 ,p_org_information6 => p_org_information6
3929 ,p_org_information7 => p_org_information7
3930 ,p_org_information8 => p_org_information8
3931 ,p_org_information9 => p_org_information9
3932 ,p_org_information10 => p_org_information10
3933 ,p_org_information11 => p_org_information11
3934 ,p_org_information12 => p_org_information12
3935 ,p_org_information13 => p_org_information13
3936 ,p_org_information14 => p_org_information14
3937 ,p_org_information15 => p_org_information15
3938 ,p_org_information16 => p_org_information16
3939 ,p_org_information17 => p_org_information17
3940 ,p_org_information18 => p_org_information18
3941 ,p_org_information19 => p_org_information19
3942 ,p_org_information20 => p_org_information20
3943 ,p_org_information_id => p_org_information_id
3944 ,p_attribute_category => p_attribute_category
3945 ,p_attribute1 => p_attribute1
3946 ,p_attribute2 => p_attribute2
3947 ,p_attribute3 => p_attribute3
3948 ,p_attribute4 => p_attribute4
3949 ,p_attribute5 => p_attribute5
3950 ,p_attribute6 => p_attribute6
3951 ,p_attribute7 => p_attribute7
3952 ,p_attribute8 => p_attribute8
3953 ,p_attribute9 => p_attribute9
3954 ,p_attribute10 => p_attribute10
3955 ,p_attribute11 => p_attribute11
3956 ,p_attribute12 => p_attribute12
3957 ,p_attribute13 => p_attribute13
3958 ,p_attribute14 => p_attribute14
3959 ,p_attribute15 => p_attribute15
3960 ,p_attribute16 => p_attribute16
3961 ,p_attribute17 => p_attribute17
3962 ,p_attribute18 => p_attribute18
3963 ,p_attribute19 => p_attribute19
3964 ,p_attribute20 => p_attribute20
3965 ,p_object_version_number => l_object_version_number);
3966 --
3967 exception
3968 --
3969 when hr_api.cannot_find_prog_unit then
3970 --
3971 hr_api.cannot_find_prog_unit_error
3972 (p_module_name => 'update_org_information'
3973 ,p_hook_type => 'AP');
3974 --
3975 end;
3976 --
3977 hr_utility.set_location(l_proc, 60);
3978 --
3979 -- When in validation only mode raise the Validate_Enabled exception
3980 --
3981 IF p_validate THEN
3982 RAISE hr_api.validate_enabled;
3983 END IF;
3984 --
3985 hr_utility.set_location(l_proc, 70);
3986 --
3987 -- Set all output arguments. If p_validate was TRUE, this bit is
3988 -- never reached, so p_object_version_number is passed back unchanged.
3989 --
3990 p_object_version_number := l_object_version_number;
3991 p_warning := l_warning;
3992 --
3993 hr_utility.set_location(' Leaving:'||l_proc, 80);
3994 --
3995 EXCEPTION
3996 --
3997 WHEN hr_api.validate_enabled THEN
3998 --
3999 -- As the Validate_Enabled exception has been raised
4000 -- we must rollback to the savepoint
4001 --
4002 ROLLBACK TO update_org_information;
4003 --
4004 -- Only set output warning arguments
4005 -- (Any key or derived arguments must be set to null
4006 -- when validation only mode is being used.)
4007 p_object_version_number := l_temp_ovn;
4008 p_warning := l_warning;
4009 hr_utility.set_location(' Leaving:'||l_proc, 80);
4010 WHEN OTHERS THEN
4011 --
4012 -- A validation or unexpected error has occurred
4013 ROLLBACK TO update_org_information;
4014 p_object_version_number := l_temp_ovn;
4015 p_warning := null;
4016 hr_utility.set_location(' Leaving:'||l_proc, 90);
4017 RAISE;
4018 --
4019 END update_org_manager;
4020 --
4021 -- ----------------------------------------------------------------------------
4022 -- |------------------------< delete_org_manager >----------------------------|
4023 -- ----------------------------------------------------------------------------
4024 --
4025 procedure delete_org_manager
4026 (p_validate in boolean default false
4027 ,p_org_information_id in number
4028 ,p_object_version_number in out nocopy number) is
4029 --
4030 -- Declare cursors and local variables
4031 --
4032 l_proc varchar2(72) := g_package||'delete_org_manager';
4033 l_object_version_number hr_organization_information.object_version_number%TYPE;
4034 l_temp_ovn number := p_object_version_number;
4035 --
4036 begin
4037 --
4038 hr_utility.set_location('Entering:'|| l_proc, 10);
4039 --
4040 -- Issue a savepoint if operating in validation only mode
4041 --
4042 savepoint delete_org_manager;
4043 --
4044 hr_utility.set_location(l_proc, 20);
4045 --
4046 -- Process Logic
4047 --
4048 l_object_version_number := p_object_version_number;
4049 --
4050 --
4051 begin
4052 --
4053 -- Start of API User Hook for the before hook of delete_org_manager
4054 --
4055 hr_organization_bk8.delete_org_manager_b
4056 (p_org_information_id => p_org_information_id
4057 ,p_object_version_number => p_object_version_number);
4058 --
4059 exception
4060 --
4061 when hr_api.cannot_find_prog_unit then
4062 --
4063 hr_api.cannot_find_prog_unit_error
4064 (p_module_name => 'delete_org_manager'
4065 ,p_hook_type => 'BP');
4066 --
4067 -- End of API User Hook for the before hook of delete_org_manager
4068 --
4069 end;
4070 --
4071 hr_ori_del.del
4072 (p_org_information_id => p_org_information_id
4073 ,p_object_version_number => l_object_version_number);
4074 --
4075 begin
4076 --
4077 -- Start of API User Hook for the after hook of delete_org_manager
4078 --
4079 hr_organization_bk8.delete_org_manager_a
4080 (p_org_information_id => p_org_information_id
4081 ,p_object_version_number => l_object_version_number);
4082 --
4083 exception
4084 --
4085 when hr_api.cannot_find_prog_unit then
4086 --
4087 hr_api.cannot_find_prog_unit_error
4088 (p_module_name => 'delete_org_manager'
4089 ,p_hook_type => 'AP');
4090 --
4091 -- End of API User Hook for the after hook of delete_org_manager
4092 --
4093 end;
4094 --
4095 hr_utility.set_location(l_proc, 60);
4096 --
4097 -- When in validation only mode raise the Validate_Enabled exception
4098 --
4099 if p_validate then
4100 raise hr_api.validate_enabled;
4101 end if;
4102 --
4103 hr_utility.set_location(' Leaving:'||l_proc, 70);
4104 --
4105 exception
4106 --
4107 when hr_api.validate_enabled then
4108 --
4109 -- As the Validate_Enabled exception has been raised
4110 -- we must rollback to the savepoint
4111 --
4112 rollback to delete_org_manager;
4113 --
4114 -- Only set output warning arguments
4115 -- (Any key or derived arguments must be set to null
4116 -- when validation only mode is being used.)
4117 --
4118 p_object_version_number := l_temp_ovn;
4119 --
4120 when others then
4121 --
4122 -- A validation or unexpected error has occured
4123 --
4124 rollback to delete_org_manager;
4125 p_object_version_number := l_temp_ovn;
4126 raise;
4127 --
4128 end delete_org_manager;
4129 --
4130 -- ----------------------------------------------------------------------------
4131 -- |-----------------------------< create_org_class_internal >----------------|
4132 -- ----------------------------------------------------------------------------
4133 --
4134 PROCEDURE create_org_class_internal
4135 ( p_validate IN BOOLEAN DEFAULT false
4136 ,p_effective_date IN DATE
4137 --
4138 ,p_organization_id IN NUMBER
4139 ,p_org_classif_code IN VARCHAR2
4140 ,p_classification_enabled IN VARCHAR2 DEFAULT 'Y' -- Bug 3456540
4141 ,p_org_information_id OUT nocopy NUMBER
4142 ,p_object_version_number OUT nocopy NUMBER
4143 ) IS
4144 --
4145 -- Declare cursors and local variables
4146 --
4147 l_proc VARCHAR2(72) := g_package||'create_org_class_internal';
4148 l_org_information_id hr_organization_information.org_information_id%TYPE;
4149 l_object_version_number hr_organization_information.object_version_number%TYPE;
4150 --
4151 BEGIN
4152 --
4153 hr_utility.set_location('Entering:'|| l_proc, 10);
4154 --
4155 -- Issue a savepoint
4156 --
4157 savepoint create_org_class_internal;
4158 --
4159 hr_utility.set_location(l_proc, 15);
4160 --
4161 -- added the hook for create_org_class_internal
4162 begin
4163 hr_organization_bk10.create_org_class_internal_b
4164 ( p_effective_date => trunc(p_effective_date)
4165 ,p_organization_id => p_organization_id
4166 ,p_org_classif_code => p_org_classif_code
4167 ,p_classification_enabled => p_classification_enabled
4168 ,p_org_information_id => p_org_information_id
4169 ,p_object_version_number => p_object_version_number);
4170
4171 exception
4172 when hr_api.cannot_find_prog_unit then
4173 hr_api.cannot_find_prog_unit_error
4174 (p_module_name => 'create_org_class_internal'
4175 ,p_hook_type => 'BP'
4176 );
4177 end;
4178 --
4179 hr_utility.set_location(l_proc, 20);
4180 --
4181 -- Process Logic
4182 --
4183 -- Check if it is proper classification first
4184 -- by calling Business Support process
4185 --
4186 chk_cls_mand(
4187 p_org_classif_code => p_org_classif_code,
4188 p_parent_call => 'INTERNAL',
4189 p_organization_id => p_organization_id);
4190 --
4191 hr_utility.set_location(l_proc, 30);
4192 --
4193 hr_ori_ins.ins(
4194 p_effective_date => p_effective_date,
4195 p_org_information_context => 'CLASS',
4196 p_organization_id => p_organization_id,
4197 p_org_information1 => p_org_classif_code,
4198 p_org_information2 => p_classification_enabled, -- Bug 3456540
4199 p_org_information_id => l_org_information_id,
4200 p_object_version_number => l_object_version_number
4201 );
4202 --
4203 hr_utility.set_location(l_proc, 60);
4204 --
4205 -- When in validation only mode raise the Validate_Enabled exception
4206 --
4207 IF p_validate THEN
4208 RAISE hr_api.validate_enabled;
4209 END IF;
4210 --
4211 -- Set all output arguments
4212 --
4213 p_org_information_id := l_org_information_id;
4214 p_object_version_number := l_object_version_number;
4215 --
4216 hr_utility.set_location(l_proc, 70);
4217
4218 begin
4219
4220 hr_organization_bk10.create_org_class_internal_a
4221 ( p_effective_date => trunc(p_effective_date)
4222 ,p_organization_id => p_organization_id
4223 ,p_org_classif_code => p_org_classif_code
4224 ,p_classification_enabled => p_classification_enabled
4225 ,p_org_information_id => l_org_information_id
4226 ,p_object_version_number => l_object_version_number);
4227
4228 exception
4229 when hr_api.cannot_find_prog_unit then
4230 hr_api.cannot_find_prog_unit_error
4231 (p_module_name => 'create_org_class_internal'
4232 ,p_hook_type => 'AP'
4233 );
4234 end;
4235
4236 --
4237 hr_utility.set_location(' Leaving:'||l_proc, 80);
4238 --
4239 EXCEPTION
4240 --
4241 WHEN hr_api.validate_enabled THEN
4242 --
4243 -- As the Validate_Enabled exception has been raised
4244 -- we must rollback to the savepoint
4245 --
4246 ROLLBACK TO create_org_class_internal;
4247 --
4248 -- Only set output warning arguments
4249 -- (Any key or derived arguments must be set to null
4250 -- when validation only mode is being used.)
4251 --
4252 p_org_information_id := NULL;
4253 p_object_version_number := NULL;
4254 hr_utility.set_location(' Leaving:'||l_proc, 80);
4255 WHEN OTHERS THEN
4256 --
4257 -- A validation or unexpected error has occurred
4258 ROLLBACK TO create_org_class_internal;
4259 hr_utility.set_location(' Leaving:'||l_proc, 90);
4260 RAISE;
4261 --
4262 END create_org_class_internal;
4263 --
4264 -- ----------------------------------------------------------------------------
4265 -- |-----------------------------< create_business_group >--------------------|
4266 -- ----------------------------------------------------------------------------
4267 --
4268 PROCEDURE create_business_group
4269 ( p_validate IN BOOLEAN DEFAULT false
4270 ,p_effective_date IN DATE
4271 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
4272 --
4273 ,p_date_from IN DATE
4274 ,p_name IN VARCHAR2
4275 ,p_type IN VARCHAR2
4276 ,p_internal_external_flag IN VARCHAR2
4277 ,p_location_id IN NUMBER
4278 ,p_short_name IN VARCHAR2
4279 ,p_emp_gen_method IN VARCHAR2
4280 ,p_app_gen_method IN VARCHAR2
4281 ,p_cwk_gen_method IN VARCHAR2
4282 ,p_grade_flex_id IN VARCHAR2
4283 ,p_group_flex_id IN VARCHAR2
4284 ,p_job_flex_id IN VARCHAR2
4285 ,p_cost_flex_id IN VARCHAR2
4286 ,p_position_flex_id IN VARCHAR2
4287 ,p_legislation_code IN VARCHAR2
4288 ,p_currency_code IN VARCHAR2
4289 ,p_fiscal_year_start IN VARCHAR2
4290 ,p_min_work_age IN VARCHAR2
4291 ,p_max_work_age IN VARCHAR2
4292 ,p_sec_group_id IN VARCHAR2
4293 ,p_competence_flex_id IN VARCHAR2
4294 ,p_organization_id OUT NOCOPY NUMBER
4295 ,p_object_version_number OUT NOCOPY NUMBER
4296
4297 ) IS
4298 --
4299 -- Declare cursors and local variables
4300 --
4301 l_proc VARCHAR2(72) := g_package||'create_business_group';
4302 l_organization_id hr_all_organization_units.organization_id%TYPE;
4303 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
4304 l_language_code hr_all_organization_units_tl.language%TYPE;
4305 l_org_information_id hr_organization_information.org_information_id%TYPE;
4306 l_date_from DATE;
4307 l_ovn_bg hr_all_organization_units.object_version_number%TYPE;
4308 --
4309 BEGIN
4310 --
4311 hr_utility.set_location('Entering:'|| l_proc, 10);
4312 --
4313 -- Issue a savepoint
4314 --
4315 savepoint create_business_group;
4316 --
4317 hr_utility.set_location(l_proc, 15);
4318 --
4319 -- All date input parameters must be truncated to remove time elements
4320 --
4321 l_date_from := trunc (p_date_from);
4322 --
4323 --
4324 -- Validate the language parameter. l_language_code should be passed to functions
4325 -- instead of p_language_code from now on, to allow an IN OUT parameter to
4326 -- be passed through.
4327 --
4328 l_language_code := p_language_code;
4329 hr_api.validate_language_code(p_language_code => l_language_code);
4330 --
4331 hr_utility.set_location(l_proc, 20);
4332 --
4333 -- Process Logic
4334 --
4335 --
4336 hr_organization_api.create_organization(
4337 p_validate => p_validate
4338 ,p_effective_date => p_effective_date
4339 ,p_language_code => p_language_code
4340 ,p_business_group_id => 0
4341 ,p_date_from => l_date_from
4342 ,p_name => p_name
4343 ,p_organization_id => l_organization_id
4344 ,p_object_version_number => l_object_version_number);
4345 --
4346 hr_organization_api.update_organization(
4347 p_validate => p_validate
4348 ,p_effective_date => p_effective_date
4349 ,p_language_code => p_language_code
4350 ,p_organization_id => l_organization_id
4351 ,p_internal_external_flag => p_internal_external_flag
4352 ,p_type => p_type
4353 ,p_location_id => p_location_id
4354 ,p_object_version_number => l_object_version_number);
4355 --
4356 l_ovn_bg := l_object_version_number;
4357 --
4358 create_org_class_internal(
4359 p_validate => p_validate
4360 ,p_effective_date => p_effective_date
4361 ,p_organization_id => l_organization_id
4362 ,p_org_classif_code => 'HR_BG'
4363 ,p_org_information_id => l_org_information_id
4364 ,p_object_version_number => l_object_version_number
4365 );
4366 --
4367 hr_organization_api.create_org_information(
4368 p_validate => p_validate
4369 ,p_effective_date => p_effective_date
4370 ,p_organization_id => l_organization_id
4371 ,p_org_info_type_code => 'Business Group Information'
4372 ,p_org_information1 => p_short_name
4373 ,p_org_information2 => p_emp_gen_method
4374 ,p_org_information3 => p_app_gen_method
4375 ,p_org_information4 => p_grade_flex_id
4376 ,p_org_information5 => p_group_flex_id
4377 ,p_org_information6 => p_job_flex_id
4378 ,p_org_information7 => p_cost_flex_id
4379 ,p_org_information8 => p_position_flex_id
4380 ,p_org_information9 => p_legislation_code
4381 ,p_org_information10 => p_currency_code
4382 ,p_org_information11 => p_fiscal_year_start
4383 ,p_org_information12 => p_min_work_age
4384 ,p_org_information13 => p_max_work_age
4385 ,p_org_information14 => p_sec_group_id
4386 ,p_org_information15 => p_competence_flex_id
4387 ,p_org_information16 => p_cwk_gen_method
4388 ,p_org_information_id => l_org_information_id
4389 ,p_object_version_number => l_object_version_number);
4390 --
4391 hr_utility.set_location(l_proc, 60);
4392 --
4393 update hr_all_organization_units
4394 set business_group_id = l_organization_id
4395 where organization_id = l_organization_id;
4396 --
4397 hr_utility.set_location(l_proc, 70);
4398 --
4399 -- When in validation only mode raise the Validate_Enabled exception
4400 --
4401 IF p_validate THEN
4402 RAISE hr_api.validate_enabled;
4403 END IF;
4404 --
4405 -- Set all output arguments
4406 --
4407 p_organization_id := l_organization_id;
4408 p_object_version_number := l_ovn_bg + 1;
4409 --
4410 hr_utility.set_location(' Leaving:'||l_proc, 80);
4411 --
4412 EXCEPTION
4413 --
4414 WHEN hr_api.validate_enabled THEN
4415 --
4416 -- As the Validate_Enabled exception has been raised
4417 -- we must rollback to the savepoint
4418 --
4419 ROLLBACK TO create_business_group;
4420 --
4421 -- Only set output warning arguments
4422 -- (Any key or derived arguments must be set to null
4423 -- when validation only mode is being used.)
4424 --
4425 p_organization_id := NULL;
4426 p_object_version_number := NULL;
4427 hr_utility.set_location(' Leaving:'||l_proc, 80);
4428 WHEN OTHERS THEN
4429 --
4430 -- A validation or unexpected error has occurred
4431 ROLLBACK TO create_business_group;
4432 -- Set OUT parameters
4433 p_organization_id := NULL;
4434 p_object_version_number := NULL;
4435 hr_utility.set_location(' Leaving:'||l_proc, 90);
4436 RAISE;
4437 --
4438 END create_business_group;
4439 --
4440 --
4441 -- ----------------------------------------------------------------------------
4442 -- |-----------------------------< get_operating_unit >--------------------|
4443 -- ----------------------------------------------------------------------------
4444 --
4445 function get_operating_unit
4446 (
4447 p_effective_date IN DATE
4448 ,p_person_id IN NUMBER DEFAULT NULL
4449 ,p_assignment_id IN NUMBER DEFAULT NULL
4450 ,p_organization_id IN NUMBER DEFAULT NULL
4451 ) return number
4452
4453 IS
4454 --
4455 -- Declare cursors and local variables
4456 --
4457 l_proc VARCHAR2(72) := g_package||'get_operating_unit';
4458 l_operating_unit_id number;
4459
4460 cursor ou_person is
4461 select nvl(org_information1,fnd_profile.value('ORG_ID'))
4462 from hr_organization_information HOI
4463 , per_all_assignments_f PAAF
4464 where HOI.organization_id = PAAF.organization_id
4465 and PAAF.person_id = p_person_id
4466 and p_effective_date between
4467 PAAF.effective_start_date and PAAF.effective_end_date
4468 and PAAF.primary_flag = 'Y'
4469 and HOI.org_information_context='Exp Organization Defaults';
4470 --
4471 cursor ou_assignment is
4472 select nvl(org_information1,fnd_profile.value('ORG_ID'))
4473 from hr_organization_information HOI
4474 , per_all_assignments_f PAAF
4475 where HOI.organization_id = PAAF.organization_id
4476 and PAAF.assignment_id = p_assignment_id
4477 and p_effective_date between
4478 PAAF.effective_start_date and PAAF.effective_end_date
4479 and HOI.org_information_context='Exp Organization Defaults';
4480 --
4481 cursor ou_organization is
4482 select nvl(org_information1,fnd_profile.value('ORG_ID'))
4483 from hr_organization_information HOI
4484 where HOI.organization_id = p_organization_id
4485 and HOI.org_information_context='Exp Organization Defaults';
4486 --
4487
4488 BEGIN
4489
4490 hr_utility.set_location(' Entering:'||l_proc, 10);
4491
4492 --TO CHECK IF NONE OF THE IN PARAMETERS ARE ENTERED
4493
4494 if (p_person_id is null
4495 and p_assignment_id is null
4496 and p_organization_id is null) then
4497
4498 hr_utility.set_message(800,'PER_449733_MUST_ENTR_ONE_PAR');
4499 hr_utility.raise_error;
4500
4501 end if;
4502
4503 hr_utility.set_location(l_proc, 20);
4504
4505 --TO CHECK IF MORE THAN ONE PARAMETER HAS BEEN ENTERED
4506
4507 if (p_person_id is not null
4508 and p_assignment_id is not null
4509 or p_person_id is not null
4510 and p_organization_id is not null
4511 or p_assignment_id is not null
4512 and p_organization_id is not null) then
4513 hr_utility.set_message(800,'PER_449734_ENTR_ONLY_ONE_PAR');
4514 hr_utility.raise_error;
4515 end if;
4516
4517 hr_utility.set_location(l_proc, 30);
4518
4519 if p_person_id is not null then
4520
4521 hr_utility.set_location(l_proc, 40);
4522
4523 open ou_person;
4524 fetch ou_person into l_operating_unit_id;
4525 if ou_person%notfound then
4526
4527 hr_utility.set_location(l_proc, 50);
4528
4529 l_operating_unit_id := nvl(fnd_profile.value('ORG_ID'),-99);
4530
4531 end if;
4532 close ou_person;
4533
4534 hr_utility.set_location(l_proc, 60);
4535
4536 elsif p_assignment_id is not null then
4537
4538 hr_utility.set_location(l_proc, 70);
4539
4540 open ou_assignment;
4541 fetch ou_assignment into l_operating_unit_id;
4542 if ou_assignment%notfound then
4543
4544 hr_utility.set_location(l_proc, 80);
4545
4546 l_operating_unit_id := nvl(fnd_profile.value('ORG_ID'),-99);
4547
4548 end if;
4549 close ou_assignment;
4550
4551 hr_utility.set_location(l_proc, 90);
4552 else
4553
4554 open ou_organization;
4555 fetch ou_organization into l_operating_unit_id;
4556 if ou_organization%notfound then
4557
4558 hr_utility.set_location(l_proc, 100);
4559
4560 l_operating_unit_id := nvl(fnd_profile.value('ORG_ID'),-99);
4561
4562 end if;
4563 close ou_organization;
4564
4565 hr_utility.set_location(l_proc, 110);
4566 end if;
4567
4568 hr_utility.set_location(l_proc, 120);
4569
4570 if nvl(l_operating_unit_id,-99) <> -99 then
4571
4572 hr_utility.set_location(l_proc, 130);
4573
4574 return l_operating_unit_id;
4575
4576 else
4577
4578 hr_utility.set_message(800,'PER_449732_UNABLE_TO_DERI_OU');
4579 hr_utility.raise_error;
4580
4581 end if;
4582
4583 hr_utility.set_location(' Leaving:'||l_proc, 140);
4584
4585 return l_operating_unit_id;
4586
4587 END get_operating_unit;
4588 -- ----------------------------------------------------------------------------
4589 -- |-----------------------------< create_operating_unit >--------------------|
4590 -- ----------------------------------------------------------------------------
4591 --
4592 PROCEDURE create_operating_unit
4593 ( p_validate IN BOOLEAN DEFAULT false
4594 ,p_effective_date IN DATE
4595 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
4596 --
4597 ,p_business_group_id IN NUMBER
4598 ,p_date_from IN DATE
4599 ,p_name IN VARCHAR2
4600 ,p_type IN VARCHAR2
4601 ,p_internal_external_flag IN VARCHAR2
4602 ,p_location_id IN NUMBER
4603 ,p_set_of_books_id IN VARCHAR2
4604 -- Added p_legal_entity_id for bug 41281871
4605 ,p_legal_entity_id IN VARCHAR2 DEFAULT null
4606 -- Added p_short_code for bug 4526439
4607 ,p_short_code IN VARCHAR2 DEFAULT null
4608 ,p_organization_id OUT NOCOPY NUMBER
4609 ,p_object_version_number OUT NOCOPY NUMBER
4610
4611 ) IS
4612 --
4613 -- Declare cursors and local variables
4614 --
4615 l_proc VARCHAR2(72) := g_package||'create_operating_unit';
4616 l_organization_id hr_all_organization_units.organization_id%TYPE;
4617 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
4618 l_language_code hr_all_organization_units_tl.language%TYPE;
4619 l_org_information_id hr_organization_information.org_information_id%TYPE;
4620 l_date_from DATE;
4621 --
4622 BEGIN
4623 --
4624 hr_utility.set_location('Entering:'|| l_proc, 10);
4625 --
4626 -- Issue a savepoint
4627 --
4628 savepoint create_operating_unit;
4629 --
4630 hr_utility.set_location(l_proc, 15);
4631 --
4632 -- All date input parameters must be truncated to remove time elements
4633 --
4634 l_date_from := trunc (p_date_from);
4635 --
4636 --
4637 -- Validate the language parameter. l_language_code should be passed to functions
4638 -- instead of p_language_code from now on, to allow an IN OUT parameter to
4639 -- be passed through.
4640 --
4641 l_language_code := p_language_code;
4642 hr_api.validate_language_code(p_language_code => l_language_code);
4643 --
4644 hr_utility.set_location(l_proc, 20);
4645 --
4646 -- Process Logic
4647 --
4648 --
4649 hr_organization_api.create_organization(
4650 p_validate => p_validate
4651 ,p_effective_date => p_effective_date
4652 ,p_language_code => p_language_code
4653 ,p_business_group_id => p_business_group_id
4654 ,p_date_from => l_date_from
4655 ,p_name => p_name
4656 ,p_internal_external_flag => p_internal_external_flag
4657 ,p_type => p_type
4658 ,p_location_id => p_location_id
4659 ,p_organization_id => l_organization_id
4660 ,p_object_version_number => l_object_version_number);
4661 --
4662 -- Changed for the bug 5446483 - Start
4663 p_object_version_number := l_object_version_number;
4664 -- Changed for the bug 5446483 - end
4665
4666
4667 /* hr_organization_api.update_organization(
4668 p_validate => p_validate
4669 ,p_effective_date => p_effective_date
4670 ,p_language_code => p_language_code
4671 ,p_organization_id => l_organization_id
4672 ,p_internal_external_flag => p_internal_external_flag
4673 ,p_type => p_type
4674 ,p_location_id => p_location_id
4675 ,p_object_version_number => l_object_version_number);
4676 --
4677 create_org_class_internal(
4678 p_validate => p_validate
4679 ,p_effective_date => p_effective_date
4680 ,p_organization_id => l_organization_id
4681 ,p_org_classif_code => 'HR_LEGAL'
4682 ,p_org_information_id => l_org_information_id
4683 ,p_object_version_number => l_object_version_number
4684 );
4685 --
4686 hr_organization_api.create_org_information(
4687 p_validate => p_validate
4688 ,p_effective_date => p_effective_date
4689 ,p_organization_id => l_organization_id
4690 ,p_org_info_type_code => 'Legal Entity Accounting'
4691 ,p_org_information1 => p_set_of_books_id
4692 ,p_org_information_id => l_org_information_id
4693 ,p_object_version_number => l_object_version_number); */
4694 --
4695 create_org_class_internal(
4696 p_validate => p_validate
4697 ,p_effective_date => p_effective_date
4698 ,p_organization_id => l_organization_id
4699 ,p_org_classif_code => 'OPERATING_UNIT'
4700 ,p_org_information_id => l_org_information_id
4701 ,p_object_version_number => l_object_version_number
4702 );
4703 --
4704 hr_organization_api.create_org_information(
4705 p_validate => p_validate
4706 ,p_effective_date => p_effective_date
4707 ,p_organization_id => l_organization_id
4708 ,p_org_info_type_code => 'Operating Unit Information'
4709 -- ,p_org_information2 => rtrim(ltrim(to_char(l_organization_id,'999999999999')))
4710 ,p_org_information2 => p_legal_entity_id
4711 ,p_org_information3 => p_set_of_books_id
4712 ,p_org_information5 => p_short_code
4713 ,p_org_information_id => l_org_information_id
4714 ,p_object_version_number => l_object_version_number);
4715 --
4716 --
4717 hr_utility.set_location(l_proc, 70);
4718 --
4719 -- When in validation only mode raise the Validate_Enabled exception
4720 --
4721 IF p_validate THEN
4722 RAISE hr_api.validate_enabled;
4723 END IF;
4724 --
4725 -- Set all output arguments
4726 --
4727 p_organization_id := l_organization_id;
4728 -- Changed for the bug 5446483 - Start
4729 --p_object_version_number := l_object_version_number;
4730 -- Changed for the bug 5446483 - end
4731 --
4732 hr_utility.set_location(' Leaving:'||l_proc, 80);
4733 --
4734 EXCEPTION
4735 --
4736 WHEN hr_api.validate_enabled THEN
4737 --
4738 -- As the Validate_Enabled exception has been raised
4739 -- we must rollback to the savepoint
4740 --
4741 ROLLBACK TO create_operating_unit;
4742 --
4743 -- Only set output warning arguments
4744 -- (Any key or derived arguments must be set to null
4745 -- when validation only mode is being used.)
4746 --
4747 p_organization_id := NULL;
4748 p_object_version_number := NULL;
4749 hr_utility.set_location(' Leaving:'||l_proc, 80);
4750 WHEN OTHERS THEN
4751 --
4752 -- A validation or unexpected error has occurred
4753 ROLLBACK TO create_operating_unit;
4754 -- Set OUT parameters
4755 p_organization_id := NULL;
4756 p_object_version_number := NULL;
4757 hr_utility.set_location(' Leaving:'||l_proc, 90);
4758 RAISE;
4759 --
4760 END create_operating_unit;
4761 --
4762 --
4763 -- ----------------------------------------------------------------------------
4764 -- |-----------------------------< update_operating_unit >----------------------|
4765 -- ----------------------------------------------------------------------------
4766 --
4767 PROCEDURE update_operating_unit
4768 (
4769 p_validate IN BOOLEAN DEFAULT false
4770 ,p_organization_id IN NUMBER
4771 ,p_effective_date IN DATE
4772 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
4773 ,p_date_from IN DATE DEFAULT hr_api.g_date
4774 ,p_name IN VARCHAR2 DEFAULT hr_api.g_varchar2
4775 ,p_type IN VARCHAR2 DEFAULT hr_api.g_varchar2
4776 ,p_internal_external_flag IN VARCHAR2 DEFAULT hr_api.g_varchar2
4777 ,p_location_id IN NUMBER DEFAULT hr_api.g_number
4778 ,p_set_of_books_id IN VARCHAR2 DEFAULT hr_api.g_varchar2
4779 ,p_usable_flag IN VARCHAR2 DEFAULT hr_api.g_varchar2
4780 -- Added p_short_code for bug 4526439
4781 ,p_short_code IN VARCHAR2 DEFAULT hr_api.g_varchar2
4782 ,p_legal_entity_id IN VARCHAR2 DEFAULT hr_api.g_varchar2
4783 ,p_object_version_number IN OUT NOCOPY NUMBER
4784 ,p_update_prim_ledger_warning OUT NOCOPY BOOLEAN
4785 ,p_duplicate_org_warning OUT NOCOPY BOOLEAN
4786 ) IS
4787
4788 --
4789 -- Declare cursors and local variables
4790 --
4791 l_proc varchar2(72) := g_package||'update_operating_unit';
4792 l_legal_entity_id hr_organization_information.ORG_INFORMATION2%type;
4793 l_set_of_books_id hr_organization_information.ORG_INFORMATION3%type;
4794 l_object_version_number hr_organization_information.object_version_number%type;
4795 l_update_prim_ledger_warning boolean;
4796 l_org_information_id hr_organization_information.org_information_id%TYPE;
4797 l_new_org_information_id hr_organization_information.org_information_id%TYPE;
4798 l_new_ovn hr_organization_information.object_version_number%type;
4799 l_organization_id hr_all_organization_units.organization_id%TYPE;
4800 l_duplicate_org_warning boolean;
4801
4802
4803 cursor csr_check_update (p_organization_id number)
4804 is
4805 select ORG_INFORMATION_ID,ORG_INFORMATION2,ORG_INFORMATION3,OBJECT_VERSION_NUMBER
4806 from hr_organization_information
4807 where ORG_INFORMATION_CONTEXT = 'Operating Unit Information'
4808 and organization_id = p_organization_id;
4809
4810 BEGIN
4811 --
4812 hr_utility.set_location('Entering:'|| l_proc, 10);
4813 --
4814 -- Issue a savepoint
4815 --
4816 savepoint update_operating_unit;
4817
4818 --
4819 -- Call to Update Organization
4820 --
4821 hr_organization_api.update_organization(
4822 p_validate => p_validate
4823 ,p_effective_date => p_effective_date
4824 ,p_name=>p_name
4825 ,p_language_code => p_language_code
4826 ,p_organization_id => p_organization_id
4827 ,p_internal_external_flag => p_internal_external_flag
4828 ,p_type => p_type
4829 ,p_location_id => p_location_id
4830 ,p_object_version_number => p_object_version_number
4831 ,p_duplicate_org_warning =>l_duplicate_org_warning);
4832 --
4833 -- Open Cursor
4834 --
4835
4836 open csr_check_update(p_organization_id => p_organization_id);
4837
4838 if csr_check_update%notfound then
4839 if(p_set_of_books_id is not null and p_legal_entity_id is not null) then
4840 l_update_prim_ledger_warning := TRUE;
4841 end if;
4842
4843 hr_organization_api.create_org_information(
4844 p_validate => p_validate
4845 ,p_effective_date => p_effective_date
4846 ,p_organization_id => p_organization_id
4847 ,p_org_info_type_code => 'Operating Unit Information'
4848 ,p_org_information2 => p_legal_entity_id
4849 ,p_org_information3 => p_set_of_books_id
4850 ,p_org_information5 => p_short_code
4851 ,p_org_information6 => p_usable_flag
4852 ,p_org_information_id => l_org_information_id
4853 ,p_object_version_number => l_object_version_number);
4854 else
4855
4856 fetch csr_check_update into l_new_org_information_id,l_legal_entity_id,
4857 l_set_of_books_id,l_new_ovn;
4858
4859 if ((l_legal_entity_id <> p_legal_entity_id) or (l_set_of_books_id <> p_set_of_books_id))
4860 then
4861 l_update_prim_ledger_warning := TRUE;
4862 end if;
4863
4864 hr_organization_api.update_org_information(
4865 p_validate => p_validate
4866 ,p_effective_date => p_effective_date
4867 ,p_org_information_id => l_new_org_information_id
4868 ,p_org_info_type_code => 'Operating Unit Information'
4869 ,p_org_information2 => p_legal_entity_id
4870 ,p_org_information3 => p_set_of_books_id
4871 ,p_org_information5 => p_short_code
4872 ,p_org_information6 => p_usable_flag
4873 ,p_object_version_number => l_new_ovn);
4874
4875
4876
4877 end if;
4878
4879 close csr_check_update;
4880
4881 hr_utility.set_location(l_proc, 20);
4882 --
4883 -- When in validation only mode raise the Validate_Enabled exception
4884 --
4885 IF p_validate THEN
4886 RAISE hr_api.validate_enabled;
4887 END IF;
4888 --
4889 -- Set all output arguments
4890 --
4891
4892 -- Changed for the bug 5446483 - Start
4893 --p_object_version_number := l_object_version_number; This is set with the out parameter of update_organization call.
4894 -- Changed for the bug 5446483 - end
4895
4896
4897 p_update_prim_ledger_warning := l_update_prim_ledger_warning;
4898 --
4899 hr_utility.set_location(' Leaving:'||l_proc, 30);
4900 --
4901 EXCEPTION
4902 --
4903 WHEN hr_api.validate_enabled THEN
4904 --
4905 -- As the Validate_Enabled exception has been raised
4906 -- we must rollback to the savepoint
4907 --
4908 ROLLBACK TO update_operating_unit;
4909 --
4910 -- Only set output warning arguments
4911 -- (Any key or derived arguments must be set to null
4912 -- when validation only mode is being used.)
4913 -- Reset IN OUT parameters.
4914 p_object_version_number := l_object_version_number;
4915 p_update_prim_ledger_warning :=false;
4916 hr_utility.set_location(' Leaving:'||l_proc, 40);
4917 WHEN OTHERS THEN
4918 --
4919 -- A validation or unexpected error has occurred
4920 ROLLBACK TO update_operating_unit;
4921 -- Set OUT parameters
4922 -- Reset IN OUT parameters.
4923 p_object_version_number := l_object_version_number;
4924 p_update_prim_ledger_warning :=false;
4925 hr_utility.set_location(' Leaving:'||l_proc, 50);
4926 RAISE;
4927 --
4928
4929 END update_operating_unit;
4930
4931
4932 --
4933 -- ----------------------------------------------------------------------------
4934 -- |-----------------------------< create_legal_entity >----------------------|
4935 -- ----------------------------------------------------------------------------
4936 --
4937 PROCEDURE create_legal_entity
4938 ( p_validate IN BOOLEAN DEFAULT false
4939 ,p_effective_date IN DATE
4940 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
4941 --
4942 ,p_business_group_id IN NUMBER
4943 ,p_date_from IN DATE
4944 ,p_name IN VARCHAR2
4945 ,p_type IN VARCHAR2
4946 ,p_internal_external_flag IN VARCHAR2
4947 ,p_location_id IN NUMBER
4948 ,p_set_of_books_id IN VARCHAR2
4949 ,p_organization_id OUT NOCOPY NUMBER
4950 ,p_object_version_number OUT NOCOPY NUMBER
4951
4952 ) IS
4953 --
4954 -- Declare cursors and local variables
4955 --
4956 l_proc VARCHAR2(72) := g_package||'create_legal_entity';
4957 l_organization_id hr_all_organization_units.organization_id%TYPE;
4958 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
4959 l_language_code hr_all_organization_units_tl.language%TYPE;
4960 l_org_information_id hr_organization_information.org_information_id%TYPE;
4961 l_date_from DATE;
4962 --
4963 BEGIN
4964 --
4965 hr_utility.set_location('Entering:'|| l_proc, 10);
4966
4967 hr_utility.set_message(800, 'HR_449740_LEG_ENT_API_OBSOLETE');
4968 hr_utility.raise_error;
4969 /*
4970 --
4971 -- Issue a savepoint
4972 --
4973 savepoint create_legal_entity;
4974 --
4975 hr_utility.set_location(l_proc, 15);
4976 --
4977 -- All date input parameters must be truncated to remove time elements
4978 --
4979 l_date_from := trunc (p_date_from);
4980 --
4981 --
4982 -- Validate the language parameter. l_language_code should be passed to functions
4983 -- instead of p_language_code from now on, to allow an IN OUT parameter to
4984 -- be passed through.
4985 --
4986 l_language_code := p_language_code;
4987 hr_api.validate_language_code(p_language_code => l_language_code);
4988 --
4989 hr_utility.set_location(l_proc, 20);
4990 --
4991 -- Process Logic
4992 --
4993 --
4994 hr_organization_api.create_organization(
4995 p_validate => p_validate
4996 ,p_effective_date => p_effective_date
4997 ,p_language_code => p_language_code
4998 ,p_business_group_id => p_business_group_id
4999 ,p_date_from => l_date_from
5000 ,p_name => p_name
5001 ,p_organization_id => l_organization_id
5002 ,p_object_version_number => l_object_version_number);
5003 --
5004 hr_organization_api.update_organization(
5005 p_validate => p_validate
5006 ,p_effective_date => p_effective_date
5007 ,p_language_code => p_language_code
5008 ,p_organization_id => l_organization_id
5009 ,p_internal_external_flag => p_internal_external_flag
5010 ,p_type => p_type
5011 ,p_location_id => p_location_id
5012 ,p_object_version_number => l_object_version_number);
5013 --
5014 create_org_class_internal(
5015 p_validate => p_validate
5016 ,p_effective_date => p_effective_date
5017 ,p_organization_id => l_organization_id
5018 ,p_org_classif_code => 'HR_LEGAL'
5019 ,p_org_information_id => l_org_information_id
5020 ,p_object_version_number => l_object_version_number
5021 );
5022 --
5023 hr_organization_api.create_org_information(
5024 p_validate => p_validate
5025 ,p_effective_date => p_effective_date
5026 ,p_organization_id => l_organization_id
5027 ,p_org_info_type_code => 'Legal Entity Accounting'
5028 ,p_org_information1 => p_set_of_books_id
5029 ,p_org_information_id => l_org_information_id
5030 ,p_object_version_number => l_object_version_number);
5031 --
5032 --
5033 hr_utility.set_location(l_proc, 70);
5034 --
5035 -- When in validation only mode raise the Validate_Enabled exception
5036 --
5037 IF p_validate THEN
5038 RAISE hr_api.validate_enabled;
5039 END IF;
5040 --
5041 -- Set all output arguments
5042 --
5043 p_organization_id := l_organization_id;
5044 p_object_version_number := l_object_version_number;
5045 --
5046 hr_utility.set_location(' Leaving:'||l_proc, 80);
5047 --
5048 EXCEPTION
5049 --
5050 WHEN hr_api.validate_enabled THEN
5051 --
5052 -- As the Validate_Enabled exception has been raised
5053 -- we must rollback to the savepoint
5054 --
5055 ROLLBACK TO create_legal_entity;
5056 --
5057 -- Only set output warning arguments
5058 -- (Any key or derived arguments must be set to null
5059 -- when validation only mode is being used.)
5060 --
5061 p_organization_id := NULL;
5062 p_object_version_number := NULL;
5063 hr_utility.set_location(' Leaving:'||l_proc, 80);
5064 WHEN OTHERS THEN
5065 --
5066 -- A validation or unexpected error has occurred
5067 ROLLBACK TO create_legal_entity;
5068 -- Set OUT parameters
5069 p_organization_id := NULL;
5070 p_object_version_number := NULL;
5071 hr_utility.set_location(' Leaving:'||l_proc, 90);
5072 RAISE;
5073 --
5074 */
5075 END create_legal_entity;
5076 --
5077 --
5078 -- ----------------------------------------------------------------------------
5079 -- |-------------------------< chk_bgr_id >-----------------------------------|
5080 -- ----------------------------------------------------------------------------
5081 --
5082 -- Description:
5083 -- Validates that business_group is present in PER_BUSINESS_GROUPS
5084 --
5085 -- Pre-conditions:
5086 -- None.
5087 --
5088 -- In Arguments:
5089 -- p_bgr_id
5090 --
5091 -- Post Success:
5092 -- If the business_group_id attribute is valid then
5093 -- normal processing continues
5094 --
5095 -- Post Failure:
5096 -- If the business_group_id attribute is invalid then an application
5097 -- error will be raised and processing is terminated.
5098 --
5099 -- Developer/Implementation Notes:
5100 -- Duplicate validation exists on form, so any changes made here
5101 -- or on form must be dual-maintained.
5102 --
5103 -- Access Status:
5104 -- Internal Row Table Handler Use Only.
5105 --
5106 -- {End Of Comments}
5107 --
5108 PROCEDURE chk_bgr_id
5109 ( p_bgr_id IN hr_all_organization_units.business_group_id%TYPE)
5110 IS
5111 l_proc VARCHAR2(72) := g_package||'chk_bgr_id';
5112 l_exists VARCHAR2(1) := 'N';
5113 --
5114 BEGIN
5115 --
5116 hr_utility.set_location('Entering:'|| l_proc, 10);
5117 --
5118 --
5119 -- Check business_group_id presence
5120 --
5121 BEGIN
5122 SELECT 'Y'
5123 INTO l_exists
5124 FROM sys.dual
5125 WHERE EXISTS
5126 (SELECT null
5127 FROM PER_BUSINESS_GROUPS
5128 WHERE business_group_id = p_bgr_id);
5129 EXCEPTION
5130 WHEN NO_DATA_FOUND THEN NULL;
5131 END;
5132 --
5133 hr_utility.set_location(l_proc, 20);
5134 --
5135 IF l_exists = 'N' THEN
5136 hr_utility.set_message(800, 'HR_7208_API_BUS_GRP_INVALID');
5137 hr_utility.raise_error;
5138 END IF;
5139 --
5140 --
5141 hr_utility.set_location('Leaving:'||l_proc, 30);
5142 --
5143 END chk_bgr_id;
5144 --
5145 --
5146 -- ----------------------------------------------------------------------------
5147 -- |-----------------------------< create_bgr_classif >-----------------------|
5148 -- ----------------------------------------------------------------------------
5149 --
5150 PROCEDURE create_bgr_classif
5151 ( p_validate IN BOOLEAN DEFAULT false
5152 ,p_effective_date IN DATE
5153 --
5154 ,p_business_group_id IN NUMBER
5155 ,p_set_of_books_id IN VARCHAR2
5156 ) IS
5157 --
5158 -- Declare cursors and local variables
5159 --
5160 l_proc VARCHAR2(72) := g_package||'create_bgr_classif';
5161 l_organization_id hr_all_organization_units.organization_id%TYPE;
5162 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
5163 l_org_information_id hr_organization_information.org_information_id%TYPE;
5164 --
5165 BEGIN
5166 --
5167 hr_utility.set_location('Entering:'|| l_proc, 10);
5168 --
5169 -- Issue a savepoint
5170 --
5171 savepoint create_bgr_classif;
5172 --
5173 -- Check if it is a Business Group
5174 --
5175 chk_bgr_id(p_business_group_id);
5176 --
5177 --
5178 hr_utility.set_location(l_proc, 20);
5179 --
5180 -- Process Logic
5181 --
5182 create_org_class_internal(
5183 p_validate => p_validate
5184 ,p_effective_date => p_effective_date
5185 ,p_organization_id => p_business_group_id
5186 ,p_org_classif_code => 'HR_LEGAL'
5187 ,p_org_information_id => l_org_information_id
5188 ,p_object_version_number => l_object_version_number
5189 );
5190 --
5191 hr_organization_api.create_org_information(
5192 p_validate => p_validate
5193 ,p_effective_date => p_effective_date
5194 ,p_organization_id => p_business_group_id
5195 ,p_org_info_type_code => 'Legal Entity Accounting'
5196 ,p_org_information1 => p_set_of_books_id
5197 ,p_org_information_id => l_org_information_id
5198 ,p_object_version_number => l_object_version_number);
5199 --
5200 create_org_class_internal(
5201 p_validate => p_validate
5202 ,p_effective_date => p_effective_date
5203 ,p_organization_id => p_business_group_id
5204 ,p_org_classif_code => 'OPERATING_UNIT'
5205 ,p_org_information_id => l_org_information_id
5206 ,p_object_version_number => l_object_version_number
5207 );
5208 --
5209 hr_organization_api.create_org_information(
5210 p_validate => p_validate
5211 ,p_effective_date => p_effective_date
5212 ,p_organization_id => p_business_group_id
5213 ,p_org_info_type_code => 'Operating Unit Information'
5214 ,p_org_information2 => rtrim(ltrim(to_char(p_business_group_id,'999999999999')))
5215 ,p_org_information3 => p_set_of_books_id
5216 ,p_org_information_id => l_org_information_id
5217 ,p_object_version_number => l_object_version_number);
5218 --
5219 --
5220 hr_utility.set_location(l_proc, 70);
5221 --
5222 -- When in validation only mode raise the Validate_Enabled exception
5223 --
5224 IF p_validate THEN
5225 RAISE hr_api.validate_enabled;
5226 END IF;
5227 --
5228 --
5229 hr_utility.set_location(' Leaving:'||l_proc, 80);
5230 --
5231 EXCEPTION
5232 --
5233 WHEN hr_api.validate_enabled THEN
5234 --
5235 -- As the Validate_Enabled exception has been raised
5236 -- we must rollback to the savepoint
5237 --
5238 ROLLBACK TO create_bgr_classif;
5239 --
5240 -- Only set output warning arguments
5241 -- (Any key or derived arguments must be set to null
5242 -- when validation only mode is being used.)
5243 --
5244 hr_utility.set_location(' Leaving:'||l_proc, 80);
5245 WHEN OTHERS THEN
5246 --
5247 -- A validation or unexpected error has occurred
5248 ROLLBACK TO create_bgr_classif;
5249 hr_utility.set_location(' Leaving:'||l_proc, 90);
5250 RAISE;
5251 --
5252 END create_bgr_classif;
5253 --
5254 -- ----------------------------------------------------------------------------
5255 -- |-------------------------< chk_organization_id >--------------------------|
5256 -- ----------------------------------------------------------------------------
5257 --
5258 -- Description:
5259 -- Validates that organization_id of organization unit is present in
5260 -- HR_ALL_ORGANIZATION_UNITS table and valid.
5261 --
5262 -- Pre-conditions:
5263 -- None.
5264 --
5265 -- In Arguments:
5266 -- p_organization_id
5267 --
5268 -- Post Success:
5269 -- If the organization_id attribute is valid then
5270 -- normal processing continues
5271 --
5272 -- Post Failure:
5273 -- If the organization_id attribute is invalid then an application
5274 -- error will be raised and processing is terminated.
5275 --
5276 -- Developer/Implementation Notes:
5277 -- Duplicate validation exists on form, so any changes made here
5278 -- or on form must be dual-maintained.
5279 --
5280 -- Access Status:
5281 -- Internal Row Table Handler Use Only.
5282 --
5283 -- {End Of Comments}
5284 --
5285 PROCEDURE chk_organization_id
5286 ( p_organization_id IN hr_organization_information.organization_id%TYPE)
5287 IS
5288 l_proc VARCHAR2(72) := g_package||'chk_organization_id';
5289 l_exists VARCHAR2(1) := 'N';
5290 --
5291 BEGIN
5292 --
5293 hr_utility.set_location('Entering:'|| l_proc, 10);
5294 --
5295 --
5296 -- Check organization_id presence
5297 --
5298 BEGIN
5299 SELECT 'Y'
5300 INTO l_exists
5301 FROM sys.dual
5302 WHERE EXISTS
5303 (SELECT null
5304 FROM hr_all_organization_units
5305 WHERE organization_id = p_organization_id);
5306 EXCEPTION
5307 WHEN NO_DATA_FOUND THEN NULL;
5308 END;
5309 --
5310 hr_utility.set_location(l_proc, 20);
5311 --
5312 IF l_exists = 'N' THEN
5313 hr_utility.set_message(800, 'HR_289002_INV_ORG_ID');
5314 hr_utility.raise_error;
5315 END IF;
5316 --
5317 --
5318 hr_utility.set_location('Leaving:'||l_proc, 30);
5319 --
5320 END chk_organization_id;
5321 --
5322 --
5323 -- ----------------------------------------------------------------------------
5324 -- |-----------------------------< create_legal_entity_classif >--------------|
5325 -- ----------------------------------------------------------------------------
5326 --
5327 PROCEDURE create_legal_entity_classif
5328 ( p_validate IN BOOLEAN DEFAULT false
5329 ,p_effective_date IN DATE
5330 --
5331 ,p_organization_id IN NUMBER
5332 ,p_set_of_books_id IN VARCHAR2
5333 ) IS
5334 --
5335 -- Declare cursors and local variables
5336 --
5337 l_proc VARCHAR2(72) := g_package||'create_legal_entity_classif';
5338 l_organization_id hr_all_organization_units.organization_id%TYPE;
5339 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
5340 l_org_information_id hr_organization_information.org_information_id%TYPE;
5341 --
5342 BEGIN
5343 --
5344 hr_utility.set_location('Entering:'|| l_proc, 10);
5345 --
5346 -- Issue a savepoint
5347 --
5348 savepoint create_legal_entity_classif;
5349 --
5350 -- Check if it is a valid Organization
5351 --
5352 chk_organization_id(p_organization_id);
5353 --
5354 --
5355 hr_utility.set_location(l_proc, 20);
5356 --
5357 -- Process Logic
5358 --
5359 create_org_class_internal(
5360 p_validate => p_validate
5361 ,p_effective_date => p_effective_date
5362 ,p_organization_id => p_organization_id
5363 ,p_org_classif_code => 'HR_LEGAL'
5364 ,p_org_information_id => l_org_information_id
5365 ,p_object_version_number => l_object_version_number
5366 );
5367 --
5368 hr_organization_api.create_org_information(
5369 p_validate => p_validate
5370 ,p_effective_date => p_effective_date
5371 ,p_organization_id => p_organization_id
5372 ,p_org_info_type_code => 'Legal Entity Accounting'
5373 ,p_org_information1 => p_set_of_books_id
5374 ,p_org_information_id => l_org_information_id
5375 ,p_object_version_number => l_object_version_number);
5376 --
5377 hr_utility.set_location(l_proc, 70);
5378 --
5379 -- When in validation only mode raise the Validate_Enabled exception
5380 --
5381 IF p_validate THEN
5382 RAISE hr_api.validate_enabled;
5383 END IF;
5384 --
5385 --
5386 hr_utility.set_location(' Leaving:'||l_proc, 80);
5387 --
5388 EXCEPTION
5389 --
5390 WHEN hr_api.validate_enabled THEN
5391 --
5392 -- As the Validate_Enabled exception has been raised
5393 -- we must rollback to the savepoint
5394 --
5395 ROLLBACK TO create_legal_entity_classif;
5396 --
5397 -- Only set output warning arguments
5398 -- (Any key or derived arguments must be set to null
5399 -- when validation only mode is being used.)
5400 --
5401 hr_utility.set_location(' Leaving:'||l_proc, 80);
5402 WHEN OTHERS THEN
5403 --
5404 -- A validation or unexpected error has occurred
5405 ROLLBACK TO create_legal_entity_classif;
5406 hr_utility.set_location(' Leaving:'||l_proc, 90);
5407 RAISE;
5408 --
5409 END create_legal_entity_classif;
5410 --
5411 --
5412 -- ----------------------------------------------------------------------------
5413 -- |-----------------------------< create_oper_unit_classif >-----------------|
5414 -- ----------------------------------------------------------------------------
5415 --
5416 PROCEDURE create_oper_unit_classif
5417 ( p_validate IN BOOLEAN DEFAULT false
5418 ,p_effective_date IN DATE
5419 --
5420 ,p_organization_id IN NUMBER
5421 ,p_legal_entity_id IN VARCHAR2
5422 ,p_set_of_books_id IN VARCHAR2
5423 ,p_oper_unit_short_code IN VARCHAR2 DEFAULT null --- Fix For Bug # 7439707
5424 ) IS
5425 --
5426 -- Declare cursors and local variables
5427 --
5428 l_proc VARCHAR2(72) := g_package||'create_oper_unit_classif';
5429 l_organization_id hr_all_organization_units.organization_id%TYPE;
5430 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
5431 l_org_information_id hr_organization_information.org_information_id%TYPE;
5432 --
5433 BEGIN
5434 --
5435 hr_utility.set_location('Entering:'|| l_proc, 10);
5436 --
5437 -- Issue a savepoint
5438 --
5439 savepoint create_oper_unit_classif;
5440 --
5441 -- Check if it is a valid Organization
5442 --
5443 chk_organization_id(p_organization_id);
5444 --
5445 --
5446 hr_utility.set_location(l_proc, 20);
5447 --
5448 -- Process Logic
5449 --
5450 create_org_class_internal(
5451 p_validate => p_validate
5452 ,p_effective_date => p_effective_date
5453 ,p_organization_id => p_organization_id
5454 ,p_org_classif_code => 'OPERATING_UNIT'
5455 ,p_org_information_id => l_org_information_id
5456 ,p_object_version_number => l_object_version_number
5457 );
5458 --
5459 hr_organization_api.create_org_information(
5460 p_validate => p_validate
5461 ,p_effective_date => p_effective_date
5462 ,p_organization_id => p_organization_id
5463 ,p_org_info_type_code => 'Operating Unit Information'
5464 ,p_org_information2 => p_legal_entity_id
5465 ,p_org_information3 => p_set_of_books_id
5466 ,p_org_information5 => p_oper_unit_short_code --- Fix For Bug # 7439707
5467 ,p_org_information_id => l_org_information_id
5468 ,p_object_version_number => l_object_version_number);
5469 --
5470 --
5471 hr_utility.set_location(l_proc, 70);
5472 --
5473 -- When in validation only mode raise the Validate_Enabled exception
5474 --
5475 IF p_validate THEN
5476 RAISE hr_api.validate_enabled;
5477 END IF;
5478 --
5479 --
5480 hr_utility.set_location(' Leaving:'||l_proc, 80);
5481 --
5482 EXCEPTION
5483 --
5484 WHEN hr_api.validate_enabled THEN
5485 --
5486 -- As the Validate_Enabled exception has been raised
5487 -- we must rollback to the savepoint
5488 --
5489 ROLLBACK TO create_oper_unit_classif;
5490 --
5491 -- Only set output warning arguments
5492 -- (Any key or derived arguments must be set to null
5493 -- when validation only mode is being used.)
5494 --
5495 hr_utility.set_location(' Leaving:'||l_proc, 80);
5496 WHEN OTHERS THEN
5497 --
5498 -- A validation or unexpected error has occurred
5499 ROLLBACK TO create_oper_unit_classif;
5500 hr_utility.set_location(' Leaving:'||l_proc, 90);
5501 RAISE;
5502 --
5503 END create_oper_unit_classif;
5504 --
5505 -- ----------------------------------------------------------------------------
5506 --
5507 -- ----------------------------------------------------------------------------
5508 -- |-----------------------------< trans_org_name >---------------------------|
5509 -- ----------------------------------------------------------------------------
5510 --
5511 PROCEDURE trans_org_name
5512 ( p_validate IN BOOLEAN DEFAULT false
5513 ,p_effective_date IN DATE
5514 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
5515 --
5516 ,p_organization_id IN NUMBER
5517 ,p_name IN VARCHAR2
5518 ) IS
5519 --
5520 -- Declare cursors and local variables
5521 --
5522 l_proc VARCHAR2(72) := g_package||'trans_org_name';
5523 l_organization_id hr_all_organization_units.organization_id%TYPE;
5524 l_language_code hr_all_organization_units_tl.language%TYPE;
5525 --
5526 BEGIN
5527 --
5528 hr_utility.set_location('Entering:'|| l_proc, 10);
5529 --
5530 -- Issue a savepoint
5531 --
5532 savepoint trans_org_name;
5533 --
5534 hr_utility.set_location(l_proc, 15);
5535 --
5536 --
5537 -- Validate the language parameter. l_language_code should be passed to functions
5538 -- instead of p_language_code from now on, to allow an IN OUT parameter to
5539 -- be passed through.
5540 --
5541 l_language_code := p_language_code;
5542 hr_api.validate_language_code(p_language_code => l_language_code);
5543 --
5544 hr_utility.set_location(l_proc, 20);
5545 --
5546 --
5547 --
5548 hr_api.mandatory_arg_error
5549 (p_api_name => l_proc
5550 ,p_argument => 'LANGUAGE'
5551 ,p_argument_value => p_language_code
5552 );
5553 --
5554 --
5555 hr_api.mandatory_arg_error
5556 (p_api_name => l_proc
5557 ,p_argument => 'ORGANIZATION_ID'
5558 ,p_argument_value => p_organization_id
5559 );
5560 --
5561 --
5562 hr_api.mandatory_arg_error
5563 (p_api_name => l_proc
5564 ,p_argument => 'NAME'
5565 ,p_argument_value => p_name
5566 );
5567 --
5568 chk_organization_id(
5569 p_organization_id => p_organization_id);
5570 --
5571 -- Process Logic
5572 --
5573 --
5574 hr_ort_upd.upd_tl(
5575 p_language_code => p_language_code,
5576 p_organization_id => p_organization_id,
5577 p_name => p_name);
5578 --
5579 hr_utility.set_location(l_proc, 60);
5580 --
5581 -- When in validation only mode raise the Validate_Enabled exception
5582 --
5583 IF p_validate THEN
5584 RAISE hr_api.validate_enabled;
5585 END IF;
5586 --
5587 -- Set all output arguments
5588 --
5589 --
5590 hr_utility.set_location(' Leaving:'||l_proc, 70);
5591 --
5592 EXCEPTION
5593 --
5594 WHEN hr_api.validate_enabled THEN
5595 --
5596 -- As the Validate_Enabled exception has been raised
5597 -- we must rollback to the savepoint
5598 --
5599 ROLLBACK TO trans_org_name;
5600 --
5601 -- Only set output warning arguments
5602 -- (Any key or derived arguments must be set to null
5603 -- when validation only mode is being used.)
5604 --
5605 hr_utility.set_location(' Leaving:'||l_proc, 80);
5606 WHEN OTHERS THEN
5607 --
5608 -- A validation or unexpected error has occurred
5609 ROLLBACK TO trans_org_name;
5610 hr_utility.set_location(' Leaving:'||l_proc, 90);
5611 RAISE;
5612 --
5613 END trans_org_name;
5614 -- ----------------------------------------------------------------------------
5615 --
5616 --
5617 -- ----------------------------------------------------------------------------
5618 -- |---------------------------< create_company_cost_center >----------------|
5619 -- ----------------------------------------------------------------------------
5620 --
5621 PROCEDURE create_company_cost_center
5622 ( p_validate IN BOOLEAN DEFAULT false
5623 ,p_effective_date IN DATE
5624 ,p_organization_id IN NUMBER
5625 ,p_company_valueset_id IN NUMBER DEFAULT null
5626 ,p_company IN VARCHAR2 DEFAULT null
5627 ,p_costcenter_valueset_id IN NUMBER DEFAULT null
5628 ,p_costcenter IN VARCHAR2 DEFAULT null
5629 ,p_ori_org_information_id OUT NOCOPY NUMBER
5630 ,p_ori_object_version_number OUT NOCOPY NUMBER
5631 ,p_org_information_id OUT NOCOPY NUMBER
5632 ,p_object_version_number OUT NOCOPY NUMBER
5633 ) IS
5634
5635 l_org_information1 varchar2(150);
5636 l_proc VARCHAR2(72) := g_package||'create_company_cost_center';
5637
5638 BEGIN
5639
5640 --
5641 hr_utility.set_location('Entering:'|| l_proc, 10);
5642 --
5643 -- Issue a savepoint
5644 --
5645 savepoint create_company_cost_center;
5646 --
5647
5648 l_org_information1 := substr(p_company_valueset_id||'|'||p_company||'|'||p_costcenter_valueset_id||'|'||p_costcenter,0,150);
5649
5650 hr_utility.set_location(l_proc, 20);
5651 --
5652 -- Call Before Process User Hook
5653 --
5654 begin
5655
5656 hr_organization_bk7.create_company_cost_center_b
5657 ( p_effective_date => p_effective_date
5658 ,p_organization_id => p_organization_id
5659 ,p_company_valueset_id => p_company_valueset_id
5660 ,p_company => p_company
5661 ,p_costcenter_valueset_id => p_costcenter_valueset_id
5662 ,p_costcenter => p_costcenter
5663 );
5664
5665 exception
5666 when hr_api.cannot_find_prog_unit then
5667 hr_api.cannot_find_prog_unit_error
5668 (p_module_name => 'create_company_cost_center'
5669 ,p_hook_type => 'BP'
5670 );
5671 end;
5672 --
5673 hr_utility.set_location(l_proc, 30);
5674 --
5675 create_org_classification
5676 ( p_effective_date => p_effective_date
5677 ,p_organization_id => p_organization_id
5678 ,p_org_classif_code => 'CC'
5679 ,p_org_information_id => p_ori_org_information_id
5680 ,p_object_version_number => p_ori_object_version_number
5681 );
5682 --
5683 hr_utility.set_location(l_proc, 40);
5684 --
5685
5686 IF ( p_company_valueset_id is NOT NULL ) OR
5687 ( p_company is NOT NULL ) OR
5688 ( p_costcenter_valueset_id is NOT NULL ) OR
5689 ( p_costcenter is NOT NULL ) THEN
5690
5691 create_org_information
5692 ( p_effective_date => p_effective_date
5693 ,p_organization_id => p_organization_id
5694 ,p_org_info_type_code => 'Company Cost Center'
5695 ,p_org_information1 => l_org_information1
5696 ,p_org_information2 => to_char(p_company_valueset_id)
5697 ,p_org_information3 => p_company
5698 ,p_org_information4 => to_char(p_costcenter_valueset_id)
5699 ,p_org_information5 => p_costcenter
5700 ,p_org_information_id => p_org_information_id
5701 ,p_object_version_number => p_object_version_number
5702 );
5703
5704 END IF;
5705 --
5706 hr_utility.set_location(l_proc, 50);
5707 --
5708 -- Call After Process User Hook
5709 --
5710 begin
5711
5712 hr_organization_bk7.create_company_cost_center_a
5713 ( p_effective_date => p_effective_date
5714 ,p_organization_id => p_organization_id
5715 ,p_company_valueset_id => p_company_valueset_id
5716 ,p_company => p_company
5717 ,p_costcenter_valueset_id => p_costcenter_valueset_id
5718 ,p_costcenter => p_costcenter
5719 ,p_ori_org_information_id => p_ori_org_information_id
5720 ,p_ori_object_version_number => p_ori_object_version_number
5721 ,p_org_information_id => p_org_information_id
5722 ,p_object_version_number => p_object_version_number
5723 );
5724
5725 exception
5726 when hr_api.cannot_find_prog_unit then
5727 hr_api.cannot_find_prog_unit_error
5728 (p_module_name => 'create_company_cost_center'
5729 ,p_hook_type => 'AP'
5730 );
5731 end;
5732 --
5733 hr_utility.set_location(l_proc, 60);
5734 --
5735 --
5736 -- When in validation only mode raise the Validate_Enabled exception
5737 --
5738 IF p_validate THEN
5739 RAISE hr_api.validate_enabled;
5740 END IF;
5741 --
5742 --
5743 hr_utility.set_location(' Leaving:'||l_proc, 70);
5744 --
5745 EXCEPTION
5746 --
5747 WHEN hr_api.validate_enabled THEN
5748 --
5749 -- As the Validate_Enabled exception has been raised
5750 -- we must rollback to the savepoint
5751 --
5752 ROLLBACK TO create_company_cost_center;
5753 --
5754 -- Only set output warning arguments
5755 -- (Any key or derived arguments must be set to null
5756 -- when validation only mode is being used.)
5757 --
5758 -- Set OUT parameters.
5759 p_ori_org_information_id := null;
5760 p_ori_object_version_number := null;
5761 p_org_information_id := null;
5762 p_object_version_number := null;
5763 hr_utility.set_location(' Leaving:'||l_proc, 80);
5764 WHEN OTHERS THEN
5765 --
5766 -- A validation or unexpected error has occurred
5767 ROLLBACK TO create_company_cost_center;
5768 -- Set OUT parameters.
5769 p_ori_org_information_id := null;
5770 p_ori_object_version_number := null;
5771 p_org_information_id := null;
5772 p_object_version_number := null;
5773 hr_utility.set_location(' Leaving:'||l_proc, 90);
5774 RAISE;
5775 --
5776 END create_company_cost_center;
5777 --
5778 --------------------------------------------------------------------------------
5779 PROCEDURE set_translation_globals(p_business_group_id IN NUMBER,
5780 p_legislation_code IN VARCHAR2) IS
5781 BEGIN
5782 g_business_group_id := p_business_group_id;
5783 g_legislation_code := p_legislation_code;
5784 END;
5785 --
5786 --------------------------------------------------------------------------------
5787 --
5788 -- ----------------------------------------------------------------------------
5789 -- |----------------------< create_not_usable_ou_internal >-------------------|
5790 -- ----------------------------------------------------------------------------
5791 --
5792 PROCEDURE create_not_usable_ou_internal
5793 (p_validate IN BOOLEAN DEFAULT FALSE
5794 ,p_effective_date IN DATE
5795 ,p_language_code IN VARCHAR2 DEFAULT HR_API.userenv_lang
5796 ,p_business_group_id IN NUMBER
5797 ,p_date_from IN DATE
5798 ,p_name IN VARCHAR2
5799 ,p_type IN VARCHAR2
5800 ,p_internal_external_flag IN VARCHAR2
5801 ,p_location_id IN NUMBER
5802 ,p_ledger_id IN VARCHAR2 DEFAULT NULL
5803 ,p_default_legal_context IN VARCHAR2 DEFAULT NULL
5804 ,p_short_code IN VARCHAR2 DEFAULT NULL
5805 ,p_organization_id OUT NOCOPY NUMBER
5806 ,p_object_version_number OUT NOCOPY NUMBER ) IS
5807 --
5808 -- Declare cursors and local variables
5809 --
5810 l_proc VARCHAR2(72) := g_package||'create_not_usable_ou_internal';
5811 l_organization_id hr_all_organization_units.organization_id%TYPE;
5812 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
5813 l_language_code hr_all_organization_units_tl.language%TYPE;
5814 l_org_information_id hr_organization_information.org_information_id%TYPE;
5815 l_date_from DATE;
5816 --
5817 BEGIN
5818 --
5819 hr_utility.set_location('Entering:'|| l_proc, 10);
5820 --
5821 -- Issue a savepoint
5822 --
5823 savepoint create_not_usable_ou_internal;
5824 --
5825 hr_utility.set_location(l_proc, 15);
5826 --
5827 -- All date input parameters must be truncated to remove time elements
5828 --
5829 l_date_from := trunc (p_date_from);
5830 --
5831 -- Validate language parameter. l_language_code should be passed to functions
5832 -- instead of p_language_code from now on to allow IN OUT param to be passed.
5833 --
5834 l_language_code := p_language_code;
5835 hr_api.validate_language_code(p_language_code => l_language_code);
5836 --
5837 hr_utility.set_location(l_proc, 20);
5838 --
5839 -- Process Logic
5840 --
5841 hr_organization_api.create_organization(
5842 p_validate => p_validate
5843 ,p_effective_date => p_effective_date
5844 ,p_language_code => p_language_code
5845 ,p_business_group_id => p_business_group_id
5846 ,p_date_from => l_date_from
5847 ,p_name => p_name
5848 ,p_internal_external_flag => p_internal_external_flag
5849 ,p_type => p_type
5850 ,p_location_id => p_location_id
5851 ,p_organization_id => l_organization_id
5852 ,p_object_version_number => l_object_version_number);
5853 --
5854 create_org_class_internal(
5855 p_validate => p_validate
5856 ,p_effective_date => p_effective_date
5857 ,p_organization_id => l_organization_id
5858 ,p_org_classif_code => 'OPERATING_UNIT'
5859 ,p_org_information_id => l_org_information_id
5860 ,p_object_version_number => l_object_version_number);
5861 --
5862 hr_organization_api.create_org_information(
5863 p_validate => p_validate
5864 ,p_effective_date => p_effective_date
5865 ,p_organization_id => l_organization_id
5866 ,p_org_info_type_code => 'Operating Unit Information'
5867 ,p_org_information2 => p_default_legal_context --p_legal_entity_id
5868 ,p_org_information3 => p_ledger_id --p_set_of_books_id
5869 ,p_org_information5 => p_short_code
5870 ,p_org_information6 => 'N' --Usable N=Not Usable
5871 ,p_org_information_id => l_org_information_id
5872 ,p_object_version_number => l_object_version_number);
5873 --
5874 hr_utility.set_location(l_proc, 70);
5875 --
5876 -- When in validation only mode raise the Validate_Enabled exception
5877 --
5878 IF p_validate THEN
5879 RAISE hr_api.validate_enabled;
5880 END IF;
5881 --
5882 -- Set all output arguments
5883 --
5884 p_organization_id := l_organization_id;
5885 p_object_version_number := l_object_version_number;
5886 --
5887 hr_utility.set_location(' Leaving:'||l_proc, 80);
5888 --
5889 EXCEPTION
5890 --
5891 WHEN hr_api.validate_enabled THEN
5892 --
5893 -- As the Validate_Enabled exception has been raised
5894 -- we must rollback to the savepoint
5895 --
5896 ROLLBACK TO create_not_usable_ou_internal;
5897 --
5898 -- Only set output warning arguments
5899 -- (Any key or derived arguments must be set to null
5900 -- when validation only mode is being used.)
5901 --
5902 p_organization_id := NULL;
5903 p_object_version_number := NULL;
5904 hr_utility.set_location(' Leaving:'||l_proc, 80);
5905 WHEN OTHERS THEN
5906 --
5907 -- A validation or unexpected error has occurred
5908 ROLLBACK TO create_not_usable_ou_internal;
5909 -- Set OUT parameters
5910 p_organization_id := NULL;
5911 p_object_version_number := NULL;
5912 hr_utility.set_location(' Leaving:'||l_proc, 90);
5913 RAISE;
5914 --
5915 END create_not_usable_ou_internal;
5916 --------------------------------------------------------------------------------
5917 --
5918 END hr_organization_api;