[Home] [Help]
PACKAGE BODY: APPS.HR_ORGANIZATION_API
Source
1 PACKAGE BODY hr_organization_api AS
2 /* $Header: hrorgapi.pkb 120.10.12010000.7 2008/09/30 06:39:43 ktithy ship $ */
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 --
3425
3426 cursor csr_check_ou
3427 is
3428 select 1 from hr_organization_information hoi
3429 where hoi.org_information_id = p_org_information_id
3430 and hoi.org_information_context = p_org_info_type_code;
3431 BEGIN
3432 --
3433 hr_utility.set_location('Entering:'|| l_proc, 10);
3434 --
3435 -- Issue a savepoint.
3436 --
3437 savepoint update_org_information;
3438 --
3439 hr_utility.set_location(l_proc, 20);
3440 --
3441 -- Check that mandatory info types cannot be updated after
3442 -- they were created
3443 --
3444 IF p_org_info_type_code = 'Business Group Information'
3445 -- OR p_org_info_type_code = 'Operating Unit Information'
3446 OR p_org_info_type_code = 'Canada Employer Identification'
3447 OR p_org_info_type_code = 'FPT_BRANCH_INFO'
3448 OR p_org_info_type_code = 'FPT_BANK_INFO' THEN
3449 hr_utility.set_message(800, 'HR_289005_INFO_TYPE_NONUPD');
3450 hr_utility.raise_error;
3451 END IF;
3452 --
3453 open csr_check_ou;
3454 IF csr_check_ou%notfound then
3455 hr_utility.set_message(800, 'HR_289005_INFO_TYPE_NONUPD');
3456 hr_utility.raise_error;
3457 END IF;
3458
3459 hr_utility.set_location(l_proc, 30);
3460 --
3461 -- Call Before Process User Hook
3462 --
3463 begin
3464 hr_organization_bk2.update_org_information_b
3465 (p_effective_date => trunc(p_effective_date)
3466 ,p_org_info_type_code => p_org_info_type_code
3467 ,p_org_information1 => p_org_information1
3468 ,p_org_information2 => p_org_information2
3469 ,p_org_information3 => p_org_information3
3470 ,p_org_information4 => p_org_information4
3471 ,p_org_information5 => p_org_information5
3472 ,p_org_information6 => p_org_information6
3473 ,p_org_information7 => p_org_information7
3474 ,p_org_information8 => p_org_information8
3475 ,p_org_information9 => p_org_information9
3476 ,p_org_information10 => p_org_information10
3477 ,p_org_information11 => p_org_information11
3478 ,p_org_information12 => p_org_information12
3479 ,p_org_information13 => p_org_information13
3480 ,p_org_information14 => p_org_information14
3481 ,p_org_information15 => p_org_information15
3482 ,p_org_information16 => p_org_information16
3483 ,p_org_information17 => p_org_information17
3484 ,p_org_information18 => p_org_information18
3485 ,p_org_information19 => p_org_information19
3486 ,p_org_information20 => p_org_information20
3487 ,p_org_information_id => p_org_information_id
3488 ,p_attribute_category => p_attribute_category
3489 ,p_attribute1 => p_attribute1
3490 ,p_attribute2 => p_attribute2
3491 ,p_attribute3 => p_attribute3
3492 ,p_attribute4 => p_attribute4
3493 ,p_attribute5 => p_attribute5
3494 ,p_attribute6 => p_attribute6
3495 ,p_attribute7 => p_attribute7
3496 ,p_attribute8 => p_attribute8
3497 ,p_attribute9 => p_attribute9
3498 ,p_attribute10 => p_attribute10
3499 ,p_attribute11 => p_attribute11
3500 ,p_attribute12 => p_attribute12
3501 ,p_attribute13 => p_attribute13
3502 ,p_attribute14 => p_attribute14
3503 ,p_attribute15 => p_attribute15
3504 ,p_attribute16 => p_attribute16
3505 ,p_attribute17 => p_attribute17
3506 ,p_attribute18 => p_attribute18
3507 ,p_attribute19 => p_attribute19
3508 ,p_attribute20 => p_attribute20
3509 ,p_object_version_number => l_object_version_number);
3510 exception
3511 when hr_api.cannot_find_prog_unit then
3512 hr_api.cannot_find_prog_unit_error
3513 (p_module_name => 'update_org_information'
3514 ,p_hook_type => 'BP'
3515 );
3516 end;
3517 --
3518 hr_utility.set_location(l_proc, 40);
3519 --
3520 -- Update row in HR_ORGANIZATION_INFORMATION Table
3521 --
3522 hr_ori_upd.upd(
3523 p_effective_date => p_effective_date,
3524 p_org_information_id => p_org_information_id,
3525 p_org_information_context => p_org_info_type_code,
3526 p_org_information1 => p_org_information1,
3527 p_org_information2 => p_org_information2,
3528 p_org_information3 => p_org_information3,
3529 p_org_information4 => p_org_information4,
3530 p_org_information5 => p_org_information5,
3531 p_org_information6 => p_org_information6,
3532 p_org_information7 => p_org_information7,
3533 p_org_information8 => p_org_information8,
3534 p_org_information9 => p_org_information9,
3535 p_org_information10 => p_org_information10,
3536 p_org_information11 => p_org_information11,
3537 p_org_information12 => p_org_information12,
3538 p_org_information13 => p_org_information13,
3539 p_org_information14 => p_org_information14,
3540 p_org_information15 => p_org_information15,
3541 p_org_information16 => p_org_information16,
3542 p_org_information17 => p_org_information17,
3543 p_org_information18 => p_org_information18,
3544 p_org_information19 => p_org_information19,
3545 p_org_information20 => p_org_information20,
3546 p_attribute_category => p_attribute_category,
3547 p_attribute1 => p_attribute1,
3548 p_attribute2 => p_attribute2,
3549 p_attribute3 => p_attribute3,
3550 p_attribute4 => p_attribute4,
3551 p_attribute5 => p_attribute5,
3552 p_attribute6 => p_attribute6,
3553 p_attribute7 => p_attribute7,
3554 p_attribute8 => p_attribute8,
3555 p_attribute9 => p_attribute9,
3556 p_attribute10 => p_attribute10,
3557 p_attribute11 => p_attribute11,
3558 p_attribute12 => p_attribute12,
3559 p_attribute13 => p_attribute13,
3560 p_attribute14 => p_attribute14,
3561 p_attribute15 => p_attribute15,
3562 p_attribute16 => p_attribute16,
3563 p_attribute17 => p_attribute17,
3564 p_attribute18 => p_attribute18,
3565 p_attribute19 => p_attribute19,
3566 p_attribute20 => p_attribute20,
3567 p_object_version_number => l_object_version_number
3568 );
3569 --
3570 hr_utility.set_location(l_proc, 50);
3571 --
3572 -- Call After Process User Hook
3573 --
3574 begin
3575 hr_organization_bk2.update_org_information_a
3576 (p_effective_date => trunc(p_effective_date)
3577 ,p_org_info_type_code => p_org_info_type_code
3578 ,p_org_information1 => p_org_information1
3579 ,p_org_information2 => p_org_information2
3580 ,p_org_information3 => p_org_information3
3581 ,p_org_information4 => p_org_information4
3582 ,p_org_information5 => p_org_information5
3583 ,p_org_information6 => p_org_information6
3584 ,p_org_information7 => p_org_information7
3585 ,p_org_information8 => p_org_information8
3586 ,p_org_information9 => p_org_information9
3587 ,p_org_information10 => p_org_information10
3588 ,p_org_information11 => p_org_information11
3589 ,p_org_information12 => p_org_information12
3590 ,p_org_information13 => p_org_information13
3591 ,p_org_information14 => p_org_information14
3592 ,p_org_information15 => p_org_information15
3593 ,p_org_information16 => p_org_information16
3594 ,p_org_information17 => p_org_information17
3595 ,p_org_information18 => p_org_information18
3596 ,p_org_information19 => p_org_information19
3597 ,p_org_information20 => p_org_information20
3598 ,p_org_information_id => p_org_information_id
3599 ,p_attribute_category => p_attribute_category
3600 ,p_attribute1 => p_attribute1
3601 ,p_attribute2 => p_attribute2
3602 ,p_attribute3 => p_attribute3
3603 ,p_attribute4 => p_attribute4
3604 ,p_attribute5 => p_attribute5
3605 ,p_attribute6 => p_attribute6
3606 ,p_attribute7 => p_attribute7
3607 ,p_attribute8 => p_attribute8
3608 ,p_attribute9 => p_attribute9
3609 ,p_attribute10 => p_attribute10
3610 ,p_attribute11 => p_attribute11
3611 ,p_attribute12 => p_attribute12
3612 ,p_attribute13 => p_attribute13
3613 ,p_attribute14 => p_attribute14
3614 ,p_attribute15 => p_attribute15
3615 ,p_attribute16 => p_attribute16
3616 ,p_attribute17 => p_attribute17
3617 ,p_attribute18 => p_attribute18
3618 ,p_attribute19 => p_attribute19
3619 ,p_attribute20 => p_attribute20
3620 ,p_object_version_number => l_object_version_number);
3621 exception
3622 when hr_api.cannot_find_prog_unit then
3623 hr_api.cannot_find_prog_unit_error
3624 (p_module_name => 'update_org_information'
3625 ,p_hook_type => 'AP'
3626 );
3627 end;
3628 --
3629 hr_utility.set_location(l_proc, 60);
3630 --
3631 -- When in validation only mode raise the Validate_Enabled exception
3632 --
3633 IF p_validate THEN
3634 RAISE hr_api.validate_enabled;
3635 END IF;
3636 --
3637 hr_utility.set_location(l_proc, 70);
3638 --
3639 -- Set all output arguments. If p_validate was TRUE, this bit is
3640 -- never reached, so p_object_version_number is passed back unchanged.
3641 --
3642 p_object_version_number := l_object_version_number;
3643 --
3644 hr_utility.set_location(' Leaving:'||l_proc, 80);
3645 --
3646 EXCEPTION
3647 --
3648 WHEN hr_api.validate_enabled THEN
3649 --
3650 -- As the Validate_Enabled exception has been raised
3651 -- we must rollback to the savepoint
3652 --
3653 ROLLBACK TO update_org_information;
3654 --
3655 -- Only set output warning arguments
3656 -- (Any key or derived arguments must be set to null
3657 -- when validation only mode is being used.)
3658 -- Reset IN OUT parameters.
3659 p_object_version_number := l_temp_ovn;
3660 hr_utility.set_location(' Leaving:'||l_proc, 80);
3661 WHEN OTHERS THEN
3662 --
3663 -- A validation or unexpected error has occurred
3664 ROLLBACK TO update_org_information;
3665 -- Reset IN OUT parameters.
3666 p_object_version_number := l_temp_ovn;
3667 hr_utility.set_location(' Leaving:'||l_proc, 90);
3668 RAISE;
3669 --
3670 --
3671 END update_org_information;
3672 --
3673 -- ----------------------------------------------------------------------------
3674 -- |--------------------------< update_org_manager >--------------------------|
3675 -- ----------------------------------------------------------------------------
3676 --
3677 PROCEDURE update_org_manager
3678 (p_validate IN BOOLEAN DEFAULT false
3679 ,p_effective_date IN DATE
3680 ,p_organization_id IN NUMBER
3681 ,p_org_information_id IN NUMBER
3682 ,p_org_info_type_code IN VARCHAR2
3683 ,p_org_information1 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3684 ,p_org_information2 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3685 ,p_org_information3 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3686 ,p_org_information4 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3687 ,p_org_information5 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3688 ,p_org_information6 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3689 ,p_org_information7 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3690 ,p_org_information8 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3691 ,p_org_information9 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3692 ,p_org_information10 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3693 ,p_org_information11 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3694 ,p_org_information12 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3695 ,p_org_information13 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3696 ,p_org_information14 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3697 ,p_org_information15 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3698 ,p_org_information16 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3699 ,p_org_information17 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3700 ,p_org_information18 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3701 ,p_org_information19 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3702 ,p_org_information20 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3703 ,p_attribute_category IN VARCHAR2 DEFAULT hr_api.g_varchar2
3704 ,p_attribute1 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3705 ,p_attribute2 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3706 ,p_attribute3 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3707 ,p_attribute4 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3708 ,p_attribute5 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3709 ,p_attribute6 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3710 ,p_attribute7 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3711 ,p_attribute8 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3712 ,p_attribute9 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3713 ,p_attribute10 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3714 ,p_attribute11 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3715 ,p_attribute12 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3716 ,p_attribute13 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3717 ,p_attribute14 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3718 ,p_attribute15 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3719 ,p_attribute16 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3720 ,p_attribute17 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3721 ,p_attribute18 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3722 ,p_attribute19 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3723 ,p_attribute20 IN VARCHAR2 DEFAULT hr_api.g_varchar2
3724 ,p_object_version_number IN OUT NOCOPY NUMBER
3725 ,p_warning OUT NOCOPY BOOLEAN
3726 ) IS
3727 --
3728 -- Declare cursors and local variables
3729 --
3730 l_proc VARCHAR2(72) := g_package||'update_org_manager';
3731 l_object_version_number hr_organization_information.object_version_number%TYPE := p_object_version_number;
3732 l_warning boolean;
3733 l_temp_ovn number := p_object_version_number;
3734 --
3735 cursor c1 is
3736 select business_group_id
3737 from hr_all_organization_units
3738 where organization_id = p_organization_id;
3739 --
3740 l_business_group_id number;
3741 --
3742 BEGIN
3743 --
3744 hr_utility.set_location('Entering:'|| l_proc, 10);
3745 --
3746 -- Issue a savepoint.
3747 --
3748 open c1;
3749 --
3750 fetch c1 into l_business_group_id;
3751 if c1%found then
3752 --
3753 fnd_profile.put('PER_BUSINESS_GROUP_ID',l_business_group_id);
3754 --
3755 end if;
3756 --
3757 close c1;
3758 --
3759 savepoint update_org_information;
3760 --
3761 hr_utility.set_location(l_proc, 20);
3762 --
3763 -- Call Before Process User Hook
3764 --
3765 begin
3766 --
3767 hr_organization_bk2.update_org_information_b
3768 (p_effective_date => trunc(p_effective_date)
3769 ,p_org_info_type_code => p_org_info_type_code
3770 ,p_org_information1 => p_org_information1
3771 ,p_org_information2 => p_org_information2
3772 ,p_org_information3 => p_org_information3
3773 ,p_org_information4 => p_org_information4
3774 ,p_org_information5 => p_org_information5
3775 ,p_org_information6 => p_org_information6
3776 ,p_org_information7 => p_org_information7
3777 ,p_org_information8 => p_org_information8
3778 ,p_org_information9 => p_org_information9
3779 ,p_org_information10 => p_org_information10
3780 ,p_org_information11 => p_org_information11
3781 ,p_org_information12 => p_org_information12
3782 ,p_org_information13 => p_org_information13
3783 ,p_org_information14 => p_org_information14
3784 ,p_org_information15 => p_org_information15
3785 ,p_org_information16 => p_org_information16
3786 ,p_org_information17 => p_org_information17
3787 ,p_org_information18 => p_org_information18
3788 ,p_org_information19 => p_org_information19
3789 ,p_org_information20 => p_org_information20
3790 ,p_org_information_id => p_org_information_id
3791 ,p_attribute_category => p_attribute_category
3792 ,p_attribute1 => p_attribute1
3793 ,p_attribute2 => p_attribute2
3794 ,p_attribute3 => p_attribute3
3795 ,p_attribute4 => p_attribute4
3796 ,p_attribute5 => p_attribute5
3797 ,p_attribute6 => p_attribute6
3798 ,p_attribute7 => p_attribute7
3799 ,p_attribute8 => p_attribute8
3800 ,p_attribute9 => p_attribute9
3801 ,p_attribute10 => p_attribute10
3802 ,p_attribute11 => p_attribute11
3803 ,p_attribute12 => p_attribute12
3804 ,p_attribute13 => p_attribute13
3805 ,p_attribute14 => p_attribute14
3806 ,p_attribute15 => p_attribute15
3807 ,p_attribute16 => p_attribute16
3808 ,p_attribute17 => p_attribute17
3809 ,p_attribute18 => p_attribute18
3810 ,p_attribute19 => p_attribute19
3811 ,p_attribute20 => p_attribute20
3812 ,p_object_version_number => l_object_version_number);
3813 --
3814 exception
3815 --
3816 when hr_api.cannot_find_prog_unit then
3817 --
3818 hr_api.cannot_find_prog_unit_error
3819 (p_module_name => 'update_org_information'
3820 ,p_hook_type => 'BP'
3821 );
3822 end;
3823 --
3824 hr_utility.set_location(l_proc, 40);
3825 --
3826 -- Update row in HR_ORGANIZATION_INFORMATION Table
3827 --
3828 hr_ori_upd.upd
3829 (p_effective_date => p_effective_date
3830 ,p_org_information_id => p_org_information_id
3831 ,p_org_information_context => p_org_info_type_code
3832 ,p_org_information1 => p_org_information1
3833 ,p_org_information2 => p_org_information2
3834 ,p_org_information3 => p_org_information3
3835 ,p_org_information4 => p_org_information4
3836 ,p_org_information5 => p_org_information5
3837 ,p_org_information6 => p_org_information6
3838 ,p_org_information7 => p_org_information7
3839 ,p_org_information8 => p_org_information8
3840 ,p_org_information9 => p_org_information9
3841 ,p_org_information10 => p_org_information10
3842 ,p_org_information11 => p_org_information11
3843 ,p_org_information12 => p_org_information12
3844 ,p_org_information13 => p_org_information13
3845 ,p_org_information14 => p_org_information14
3846 ,p_org_information15 => p_org_information15
3847 ,p_org_information16 => p_org_information16
3848 ,p_org_information17 => p_org_information17
3849 ,p_org_information18 => p_org_information18
3850 ,p_org_information19 => p_org_information19
3851 ,p_org_information20 => p_org_information20
3852 ,p_attribute_category => p_attribute_category
3853 ,p_attribute1 => p_attribute1
3854 ,p_attribute2 => p_attribute2
3855 ,p_attribute3 => p_attribute3
3856 ,p_attribute4 => p_attribute4
3857 ,p_attribute5 => p_attribute5
3858 ,p_attribute6 => p_attribute6
3859 ,p_attribute7 => p_attribute7
3860 ,p_attribute8 => p_attribute8
3861 ,p_attribute9 => p_attribute9
3862 ,p_attribute10 => p_attribute10
3863 ,p_attribute11 => p_attribute11
3864 ,p_attribute12 => p_attribute12
3865 ,p_attribute13 => p_attribute13
3866 ,p_attribute14 => p_attribute14
3867 ,p_attribute15 => p_attribute15
3868 ,p_attribute16 => p_attribute16
3869 ,p_attribute17 => p_attribute17
3870 ,p_attribute18 => p_attribute18
3871 ,p_attribute19 => p_attribute19
3872 ,p_attribute20 => p_attribute20
3873 ,p_object_version_number => l_object_version_number);
3874 --
3875 hr_utility.set_location(l_proc, 50);
3876 --
3877 -- Set the warning parameter if a gap occurred
3878 --
3879 l_warning := false;
3880 --
3881 if p_org_info_type_code = 'Organization Name Alias' then
3882 --
3883 if hr_ori_bus.chk_cost_center_gap
3884 (p_organization_id => p_organization_id,
3885 p_org_information_id => p_org_information_id,
3886 p_org_information_context => p_org_info_type_code,
3887 p_start_date => fnd_date.canonical_to_date(p_org_information3),
3888 p_end_date => fnd_date.canonical_to_date(p_org_information4)) then
3889 --
3890 l_warning := true;
3891 --
3892 else
3893 --
3894 l_warning := false;
3895 --
3896 end if;
3897 --
3898 end if;
3899 --
3900 -- Call After Process User Hook
3901 --
3902 begin
3903 --
3904 hr_organization_bk2.update_org_information_a
3905 (p_effective_date => trunc(p_effective_date)
3906 ,p_org_info_type_code => p_org_info_type_code
3907 ,p_org_information1 => p_org_information1
3908 ,p_org_information2 => p_org_information2
3909 ,p_org_information3 => p_org_information3
3910 ,p_org_information4 => p_org_information4
3911 ,p_org_information5 => p_org_information5
3912 ,p_org_information6 => p_org_information6
3913 ,p_org_information7 => p_org_information7
3914 ,p_org_information8 => p_org_information8
3915 ,p_org_information9 => p_org_information9
3916 ,p_org_information10 => p_org_information10
3917 ,p_org_information11 => p_org_information11
3918 ,p_org_information12 => p_org_information12
3919 ,p_org_information13 => p_org_information13
3920 ,p_org_information14 => p_org_information14
3921 ,p_org_information15 => p_org_information15
3922 ,p_org_information16 => p_org_information16
3923 ,p_org_information17 => p_org_information17
3924 ,p_org_information18 => p_org_information18
3925 ,p_org_information19 => p_org_information19
3926 ,p_org_information20 => p_org_information20
3927 ,p_org_information_id => p_org_information_id
3928 ,p_attribute_category => p_attribute_category
3929 ,p_attribute1 => p_attribute1
3930 ,p_attribute2 => p_attribute2
3931 ,p_attribute3 => p_attribute3
3932 ,p_attribute4 => p_attribute4
3933 ,p_attribute5 => p_attribute5
3934 ,p_attribute6 => p_attribute6
3935 ,p_attribute7 => p_attribute7
3936 ,p_attribute8 => p_attribute8
3937 ,p_attribute9 => p_attribute9
3938 ,p_attribute10 => p_attribute10
3939 ,p_attribute11 => p_attribute11
3940 ,p_attribute12 => p_attribute12
3941 ,p_attribute13 => p_attribute13
3942 ,p_attribute14 => p_attribute14
3943 ,p_attribute15 => p_attribute15
3944 ,p_attribute16 => p_attribute16
3945 ,p_attribute17 => p_attribute17
3946 ,p_attribute18 => p_attribute18
3947 ,p_attribute19 => p_attribute19
3948 ,p_attribute20 => p_attribute20
3949 ,p_object_version_number => l_object_version_number);
3950 --
3951 exception
3952 --
3953 when hr_api.cannot_find_prog_unit then
3954 --
3955 hr_api.cannot_find_prog_unit_error
3956 (p_module_name => 'update_org_information'
3957 ,p_hook_type => 'AP');
3958 --
3959 end;
3960 --
3961 hr_utility.set_location(l_proc, 60);
3962 --
3963 -- When in validation only mode raise the Validate_Enabled exception
3964 --
3965 IF p_validate THEN
3966 RAISE hr_api.validate_enabled;
3967 END IF;
3968 --
3969 hr_utility.set_location(l_proc, 70);
3970 --
3971 -- Set all output arguments. If p_validate was TRUE, this bit is
3972 -- never reached, so p_object_version_number is passed back unchanged.
3973 --
3974 p_object_version_number := l_object_version_number;
3975 p_warning := l_warning;
3976 --
3977 hr_utility.set_location(' Leaving:'||l_proc, 80);
3978 --
3979 EXCEPTION
3980 --
3981 WHEN hr_api.validate_enabled THEN
3982 --
3983 -- As the Validate_Enabled exception has been raised
3984 -- we must rollback to the savepoint
3985 --
3986 ROLLBACK TO update_org_information;
3987 --
3988 -- Only set output warning arguments
3989 -- (Any key or derived arguments must be set to null
3990 -- when validation only mode is being used.)
3991 p_object_version_number := l_temp_ovn;
3992 p_warning := l_warning;
3993 hr_utility.set_location(' Leaving:'||l_proc, 80);
3994 WHEN OTHERS THEN
3995 --
3996 -- A validation or unexpected error has occurred
3997 ROLLBACK TO update_org_information;
3998 p_object_version_number := l_temp_ovn;
3999 p_warning := null;
4000 hr_utility.set_location(' Leaving:'||l_proc, 90);
4001 RAISE;
4002 --
4003 END update_org_manager;
4004 --
4005 -- ----------------------------------------------------------------------------
4006 -- |------------------------< delete_org_manager >----------------------------|
4007 -- ----------------------------------------------------------------------------
4008 --
4009 procedure delete_org_manager
4010 (p_validate in boolean default false
4011 ,p_org_information_id in number
4012 ,p_object_version_number in out nocopy number) is
4013 --
4014 -- Declare cursors and local variables
4015 --
4016 l_proc varchar2(72) := g_package||'delete_org_manager';
4017 l_object_version_number hr_organization_information.object_version_number%TYPE;
4018 l_temp_ovn number := p_object_version_number;
4019 --
4020 begin
4021 --
4022 hr_utility.set_location('Entering:'|| l_proc, 10);
4023 --
4024 -- Issue a savepoint if operating in validation only mode
4025 --
4026 savepoint delete_org_manager;
4027 --
4028 hr_utility.set_location(l_proc, 20);
4029 --
4030 -- Process Logic
4031 --
4032 l_object_version_number := p_object_version_number;
4033 --
4034 --
4035 begin
4036 --
4037 -- Start of API User Hook for the before hook of delete_org_manager
4038 --
4039 hr_organization_bk8.delete_org_manager_b
4040 (p_org_information_id => p_org_information_id
4041 ,p_object_version_number => p_object_version_number);
4042 --
4043 exception
4044 --
4045 when hr_api.cannot_find_prog_unit then
4046 --
4047 hr_api.cannot_find_prog_unit_error
4048 (p_module_name => 'delete_org_manager'
4049 ,p_hook_type => 'BP');
4050 --
4051 -- End of API User Hook for the before hook of delete_org_manager
4052 --
4053 end;
4054 --
4055 hr_ori_del.del
4056 (p_org_information_id => p_org_information_id
4057 ,p_object_version_number => l_object_version_number);
4058 --
4059 begin
4060 --
4061 -- Start of API User Hook for the after hook of delete_org_manager
4062 --
4063 hr_organization_bk8.delete_org_manager_a
4064 (p_org_information_id => p_org_information_id
4065 ,p_object_version_number => l_object_version_number);
4066 --
4067 exception
4068 --
4069 when hr_api.cannot_find_prog_unit then
4070 --
4071 hr_api.cannot_find_prog_unit_error
4072 (p_module_name => 'delete_org_manager'
4073 ,p_hook_type => 'AP');
4074 --
4075 -- End of API User Hook for the after hook of delete_org_manager
4076 --
4077 end;
4078 --
4079 hr_utility.set_location(l_proc, 60);
4080 --
4081 -- When in validation only mode raise the Validate_Enabled exception
4082 --
4083 if p_validate then
4084 raise hr_api.validate_enabled;
4085 end if;
4086 --
4087 hr_utility.set_location(' Leaving:'||l_proc, 70);
4088 --
4089 exception
4090 --
4091 when hr_api.validate_enabled then
4092 --
4093 -- As the Validate_Enabled exception has been raised
4094 -- we must rollback to the savepoint
4095 --
4096 rollback to delete_org_manager;
4097 --
4098 -- Only set output warning arguments
4099 -- (Any key or derived arguments must be set to null
4100 -- when validation only mode is being used.)
4101 --
4102 p_object_version_number := l_temp_ovn;
4103 --
4104 when others then
4105 --
4106 -- A validation or unexpected error has occured
4107 --
4108 rollback to delete_org_manager;
4109 p_object_version_number := l_temp_ovn;
4110 raise;
4111 --
4112 end delete_org_manager;
4113 --
4114 -- ----------------------------------------------------------------------------
4115 -- |-----------------------------< create_org_class_internal >----------------|
4116 -- ----------------------------------------------------------------------------
4117 --
4118 PROCEDURE create_org_class_internal
4119 ( p_validate IN BOOLEAN DEFAULT false
4120 ,p_effective_date IN DATE
4121 --
4122 ,p_organization_id IN NUMBER
4123 ,p_org_classif_code IN VARCHAR2
4124 ,p_classification_enabled IN VARCHAR2 DEFAULT 'Y' -- Bug 3456540
4125 ,p_org_information_id OUT nocopy NUMBER
4126 ,p_object_version_number OUT nocopy NUMBER
4127 ) IS
4128 --
4129 -- Declare cursors and local variables
4130 --
4131 l_proc VARCHAR2(72) := g_package||'create_org_class_internal';
4132 l_org_information_id hr_organization_information.org_information_id%TYPE;
4133 l_object_version_number hr_organization_information.object_version_number%TYPE;
4134 --
4135 BEGIN
4136 --
4137 hr_utility.set_location('Entering:'|| l_proc, 10);
4138 --
4139 -- Issue a savepoint
4140 --
4141 savepoint create_org_class_internal;
4142 --
4143 hr_utility.set_location(l_proc, 15);
4144 --
4145 --
4146 hr_utility.set_location(l_proc, 20);
4147 --
4148 -- Process Logic
4149 --
4150 -- Check if it is proper classification first
4151 -- by calling Business Support process
4152 --
4153 chk_cls_mand(
4154 p_org_classif_code => p_org_classif_code,
4155 p_parent_call => 'INTERNAL',
4156 p_organization_id => p_organization_id);
4157 --
4158 hr_utility.set_location(l_proc, 30);
4159 --
4160 hr_ori_ins.ins(
4161 p_effective_date => p_effective_date,
4162 p_org_information_context => 'CLASS',
4163 p_organization_id => p_organization_id,
4164 p_org_information1 => p_org_classif_code,
4165 p_org_information2 => p_classification_enabled, -- Bug 3456540
4166 p_org_information_id => l_org_information_id,
4167 p_object_version_number => l_object_version_number
4168 );
4169 --
4170 hr_utility.set_location(l_proc, 60);
4171 --
4172 -- When in validation only mode raise the Validate_Enabled exception
4173 --
4174 IF p_validate THEN
4175 RAISE hr_api.validate_enabled;
4176 END IF;
4177 --
4178 -- Set all output arguments
4179 --
4180 p_org_information_id := l_org_information_id;
4181 p_object_version_number := l_object_version_number;
4182 --
4183 hr_utility.set_location(' Leaving:'||l_proc, 70);
4184 --
4185 EXCEPTION
4186 --
4187 WHEN hr_api.validate_enabled THEN
4188 --
4189 -- As the Validate_Enabled exception has been raised
4190 -- we must rollback to the savepoint
4191 --
4192 ROLLBACK TO create_org_class_internal;
4193 --
4194 -- Only set output warning arguments
4195 -- (Any key or derived arguments must be set to null
4196 -- when validation only mode is being used.)
4197 --
4198 p_org_information_id := NULL;
4199 p_object_version_number := NULL;
4200 hr_utility.set_location(' Leaving:'||l_proc, 80);
4201 WHEN OTHERS THEN
4202 --
4203 -- A validation or unexpected error has occurred
4204 ROLLBACK TO create_org_class_internal;
4205 hr_utility.set_location(' Leaving:'||l_proc, 90);
4206 RAISE;
4207 --
4208 END create_org_class_internal;
4209 --
4210 -- ----------------------------------------------------------------------------
4211 -- |-----------------------------< create_business_group >--------------------|
4212 -- ----------------------------------------------------------------------------
4213 --
4214 PROCEDURE create_business_group
4215 ( p_validate IN BOOLEAN DEFAULT false
4216 ,p_effective_date IN DATE
4217 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
4218 --
4219 ,p_date_from IN DATE
4220 ,p_name IN VARCHAR2
4221 ,p_type IN VARCHAR2
4222 ,p_internal_external_flag IN VARCHAR2
4223 ,p_location_id IN NUMBER
4224 ,p_short_name IN VARCHAR2
4225 ,p_emp_gen_method IN VARCHAR2
4226 ,p_app_gen_method IN VARCHAR2
4227 ,p_cwk_gen_method IN VARCHAR2
4228 ,p_grade_flex_id IN VARCHAR2
4229 ,p_group_flex_id IN VARCHAR2
4230 ,p_job_flex_id IN VARCHAR2
4231 ,p_cost_flex_id IN VARCHAR2
4232 ,p_position_flex_id IN VARCHAR2
4233 ,p_legislation_code IN VARCHAR2
4234 ,p_currency_code IN VARCHAR2
4235 ,p_fiscal_year_start IN VARCHAR2
4236 ,p_min_work_age IN VARCHAR2
4237 ,p_max_work_age IN VARCHAR2
4238 ,p_sec_group_id IN VARCHAR2
4239 ,p_competence_flex_id IN VARCHAR2
4240 ,p_organization_id OUT NOCOPY NUMBER
4241 ,p_object_version_number OUT NOCOPY NUMBER
4242
4243 ) IS
4244 --
4245 -- Declare cursors and local variables
4246 --
4247 l_proc VARCHAR2(72) := g_package||'create_business_group';
4248 l_organization_id hr_all_organization_units.organization_id%TYPE;
4249 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
4250 l_language_code hr_all_organization_units_tl.language%TYPE;
4251 l_org_information_id hr_organization_information.org_information_id%TYPE;
4252 l_date_from DATE;
4253 l_ovn_bg hr_all_organization_units.object_version_number%TYPE;
4254 --
4255 BEGIN
4256 --
4257 hr_utility.set_location('Entering:'|| l_proc, 10);
4258 --
4259 -- Issue a savepoint
4260 --
4261 savepoint create_business_group;
4262 --
4263 hr_utility.set_location(l_proc, 15);
4264 --
4265 -- All date input parameters must be truncated to remove time elements
4266 --
4267 l_date_from := trunc (p_date_from);
4268 --
4269 --
4270 -- Validate the language parameter. l_language_code should be passed to functions
4271 -- instead of p_language_code from now on, to allow an IN OUT parameter to
4272 -- be passed through.
4273 --
4274 l_language_code := p_language_code;
4275 hr_api.validate_language_code(p_language_code => l_language_code);
4276 --
4277 hr_utility.set_location(l_proc, 20);
4278 --
4279 -- Process Logic
4280 --
4281 --
4282 hr_organization_api.create_organization(
4283 p_validate => p_validate
4284 ,p_effective_date => p_effective_date
4285 ,p_language_code => p_language_code
4286 ,p_business_group_id => 0
4287 ,p_date_from => l_date_from
4288 ,p_name => p_name
4289 ,p_organization_id => l_organization_id
4290 ,p_object_version_number => l_object_version_number);
4291 --
4292 hr_organization_api.update_organization(
4293 p_validate => p_validate
4294 ,p_effective_date => p_effective_date
4295 ,p_language_code => p_language_code
4296 ,p_organization_id => l_organization_id
4297 ,p_internal_external_flag => p_internal_external_flag
4298 ,p_type => p_type
4299 ,p_location_id => p_location_id
4300 ,p_object_version_number => l_object_version_number);
4301 --
4302 l_ovn_bg := l_object_version_number;
4303 --
4304 create_org_class_internal(
4305 p_validate => p_validate
4306 ,p_effective_date => p_effective_date
4307 ,p_organization_id => l_organization_id
4308 ,p_org_classif_code => 'HR_BG'
4309 ,p_org_information_id => l_org_information_id
4310 ,p_object_version_number => l_object_version_number
4311 );
4312 --
4313 hr_organization_api.create_org_information(
4314 p_validate => p_validate
4315 ,p_effective_date => p_effective_date
4316 ,p_organization_id => l_organization_id
4317 ,p_org_info_type_code => 'Business Group Information'
4318 ,p_org_information1 => p_short_name
4319 ,p_org_information2 => p_emp_gen_method
4320 ,p_org_information3 => p_app_gen_method
4321 ,p_org_information4 => p_grade_flex_id
4322 ,p_org_information5 => p_group_flex_id
4323 ,p_org_information6 => p_job_flex_id
4324 ,p_org_information7 => p_cost_flex_id
4325 ,p_org_information8 => p_position_flex_id
4326 ,p_org_information9 => p_legislation_code
4327 ,p_org_information10 => p_currency_code
4328 ,p_org_information11 => p_fiscal_year_start
4329 ,p_org_information12 => p_min_work_age
4330 ,p_org_information13 => p_max_work_age
4331 ,p_org_information14 => p_sec_group_id
4332 ,p_org_information15 => p_competence_flex_id
4333 ,p_org_information16 => p_cwk_gen_method
4334 ,p_org_information_id => l_org_information_id
4335 ,p_object_version_number => l_object_version_number);
4336 --
4337 hr_utility.set_location(l_proc, 60);
4338 --
4339 update hr_all_organization_units
4340 set business_group_id = l_organization_id
4341 where organization_id = l_organization_id;
4342 --
4343 hr_utility.set_location(l_proc, 70);
4344 --
4345 -- When in validation only mode raise the Validate_Enabled exception
4346 --
4347 IF p_validate THEN
4348 RAISE hr_api.validate_enabled;
4349 END IF;
4350 --
4351 -- Set all output arguments
4352 --
4353 p_organization_id := l_organization_id;
4354 p_object_version_number := l_ovn_bg + 1;
4355 --
4356 hr_utility.set_location(' Leaving:'||l_proc, 80);
4357 --
4358 EXCEPTION
4359 --
4360 WHEN hr_api.validate_enabled THEN
4361 --
4362 -- As the Validate_Enabled exception has been raised
4363 -- we must rollback to the savepoint
4364 --
4365 ROLLBACK TO create_business_group;
4366 --
4367 -- Only set output warning arguments
4368 -- (Any key or derived arguments must be set to null
4369 -- when validation only mode is being used.)
4370 --
4371 p_organization_id := NULL;
4372 p_object_version_number := NULL;
4373 hr_utility.set_location(' Leaving:'||l_proc, 80);
4374 WHEN OTHERS THEN
4375 --
4376 -- A validation or unexpected error has occurred
4377 ROLLBACK TO create_business_group;
4378 -- Set OUT parameters
4379 p_organization_id := NULL;
4380 p_object_version_number := NULL;
4381 hr_utility.set_location(' Leaving:'||l_proc, 90);
4382 RAISE;
4383 --
4384 END create_business_group;
4385 --
4386 --
4387 -- ----------------------------------------------------------------------------
4388 -- |-----------------------------< get_operating_unit >--------------------|
4389 -- ----------------------------------------------------------------------------
4390 --
4391 function get_operating_unit
4392 (
4393 p_effective_date IN DATE
4394 ,p_person_id IN NUMBER DEFAULT NULL
4395 ,p_assignment_id IN NUMBER DEFAULT NULL
4396 ,p_organization_id IN NUMBER DEFAULT NULL
4397 ) return number
4398
4399 IS
4400 --
4401 -- Declare cursors and local variables
4402 --
4403 l_proc VARCHAR2(72) := g_package||'get_operating_unit';
4404 l_operating_unit_id number;
4405
4406 cursor ou_person is
4407 select nvl(org_information1,fnd_profile.value('ORG_ID'))
4408 from hr_organization_information HOI
4409 , per_all_assignments_f PAAF
4410 where HOI.organization_id = PAAF.organization_id
4411 and PAAF.person_id = p_person_id
4412 and p_effective_date between
4413 PAAF.effective_start_date and PAAF.effective_end_date
4414 and PAAF.primary_flag = 'Y'
4415 and HOI.org_information_context='Exp Organization Defaults';
4416 --
4417 cursor ou_assignment is
4418 select nvl(org_information1,fnd_profile.value('ORG_ID'))
4419 from hr_organization_information HOI
4420 , per_all_assignments_f PAAF
4421 where HOI.organization_id = PAAF.organization_id
4422 and PAAF.assignment_id = p_assignment_id
4423 and p_effective_date between
4424 PAAF.effective_start_date and PAAF.effective_end_date
4425 and HOI.org_information_context='Exp Organization Defaults';
4426 --
4427 cursor ou_organization is
4428 select nvl(org_information1,fnd_profile.value('ORG_ID'))
4429 from hr_organization_information HOI
4430 where HOI.organization_id = p_organization_id
4431 and HOI.org_information_context='Exp Organization Defaults';
4432 --
4433
4434 BEGIN
4435
4436 hr_utility.set_location(' Entering:'||l_proc, 10);
4437
4438 --TO CHECK IF NONE OF THE IN PARAMETERS ARE ENTERED
4439
4440 if (p_person_id is null
4441 and p_assignment_id is null
4442 and p_organization_id is null) then
4443
4444 hr_utility.set_message(800,'PER_449733_MUST_ENTR_ONE_PAR');
4445 hr_utility.raise_error;
4446
4447 end if;
4448
4449 hr_utility.set_location(l_proc, 20);
4450
4451 --TO CHECK IF MORE THAN ONE PARAMETER HAS BEEN ENTERED
4452
4453 if (p_person_id is not null
4454 and p_assignment_id is not null
4455 or p_person_id is not null
4456 and p_organization_id is not null
4457 or p_assignment_id is not null
4458 and p_organization_id is not null) then
4459 hr_utility.set_message(800,'PER_449734_ENTR_ONLY_ONE_PAR');
4460 hr_utility.raise_error;
4461 end if;
4462
4463 hr_utility.set_location(l_proc, 30);
4464
4465 if p_person_id is not null then
4466
4467 hr_utility.set_location(l_proc, 40);
4468
4469 open ou_person;
4470 fetch ou_person into l_operating_unit_id;
4471 if ou_person%notfound then
4472
4473 hr_utility.set_location(l_proc, 50);
4474
4475 l_operating_unit_id := nvl(fnd_profile.value('ORG_ID'),-99);
4476
4477 end if;
4478 close ou_person;
4479
4480 hr_utility.set_location(l_proc, 60);
4481
4482 elsif p_assignment_id is not null then
4483
4484 hr_utility.set_location(l_proc, 70);
4485
4486 open ou_assignment;
4487 fetch ou_assignment into l_operating_unit_id;
4488 if ou_assignment%notfound then
4489
4490 hr_utility.set_location(l_proc, 80);
4491
4492 l_operating_unit_id := nvl(fnd_profile.value('ORG_ID'),-99);
4493
4494 end if;
4495 close ou_assignment;
4496
4497 hr_utility.set_location(l_proc, 90);
4498 else
4499
4500 open ou_organization;
4501 fetch ou_organization into l_operating_unit_id;
4502 if ou_organization%notfound then
4503
4504 hr_utility.set_location(l_proc, 100);
4505
4506 l_operating_unit_id := nvl(fnd_profile.value('ORG_ID'),-99);
4507
4508 end if;
4509 close ou_organization;
4510
4511 hr_utility.set_location(l_proc, 110);
4512 end if;
4513
4514 hr_utility.set_location(l_proc, 120);
4515
4516 if nvl(l_operating_unit_id,-99) <> -99 then
4517
4518 hr_utility.set_location(l_proc, 130);
4519
4520 return l_operating_unit_id;
4521
4522 else
4523
4524 hr_utility.set_message(800,'PER_449732_UNABLE_TO_DERI_OU');
4525 hr_utility.raise_error;
4526
4527 end if;
4528
4529 hr_utility.set_location(' Leaving:'||l_proc, 140);
4530
4531 return l_operating_unit_id;
4532
4533 END get_operating_unit;
4534 -- ----------------------------------------------------------------------------
4535 -- |-----------------------------< create_operating_unit >--------------------|
4536 -- ----------------------------------------------------------------------------
4537 --
4538 PROCEDURE create_operating_unit
4539 ( p_validate IN BOOLEAN DEFAULT false
4540 ,p_effective_date IN DATE
4541 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
4542 --
4543 ,p_business_group_id IN NUMBER
4544 ,p_date_from IN DATE
4545 ,p_name IN VARCHAR2
4546 ,p_type IN VARCHAR2
4547 ,p_internal_external_flag IN VARCHAR2
4548 ,p_location_id IN NUMBER
4549 ,p_set_of_books_id IN VARCHAR2
4550 -- Added p_legal_entity_id for bug 41281871
4551 ,p_legal_entity_id IN VARCHAR2 DEFAULT null
4552 -- Added p_short_code for bug 4526439
4553 ,p_short_code IN VARCHAR2 DEFAULT null
4554 ,p_organization_id OUT NOCOPY NUMBER
4555 ,p_object_version_number OUT NOCOPY NUMBER
4556
4557 ) IS
4558 --
4559 -- Declare cursors and local variables
4560 --
4561 l_proc VARCHAR2(72) := g_package||'create_operating_unit';
4562 l_organization_id hr_all_organization_units.organization_id%TYPE;
4563 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
4564 l_language_code hr_all_organization_units_tl.language%TYPE;
4565 l_org_information_id hr_organization_information.org_information_id%TYPE;
4566 l_date_from DATE;
4567 --
4568 BEGIN
4569 --
4570 hr_utility.set_location('Entering:'|| l_proc, 10);
4571 --
4572 -- Issue a savepoint
4573 --
4574 savepoint create_operating_unit;
4575 --
4576 hr_utility.set_location(l_proc, 15);
4577 --
4578 -- All date input parameters must be truncated to remove time elements
4579 --
4580 l_date_from := trunc (p_date_from);
4581 --
4582 --
4583 -- Validate the language parameter. l_language_code should be passed to functions
4584 -- instead of p_language_code from now on, to allow an IN OUT parameter to
4585 -- be passed through.
4586 --
4587 l_language_code := p_language_code;
4588 hr_api.validate_language_code(p_language_code => l_language_code);
4589 --
4590 hr_utility.set_location(l_proc, 20);
4591 --
4592 -- Process Logic
4593 --
4594 --
4595 hr_organization_api.create_organization(
4596 p_validate => p_validate
4597 ,p_effective_date => p_effective_date
4598 ,p_language_code => p_language_code
4599 ,p_business_group_id => p_business_group_id
4600 ,p_date_from => l_date_from
4601 ,p_name => p_name
4602 ,p_internal_external_flag => p_internal_external_flag
4603 ,p_type => p_type
4604 ,p_location_id => p_location_id
4605 ,p_organization_id => l_organization_id
4606 ,p_object_version_number => l_object_version_number);
4607 --
4608 -- Changed for the bug 5446483 - Start
4609 p_object_version_number := l_object_version_number;
4610 -- Changed for the bug 5446483 - end
4611
4612
4613 /* hr_organization_api.update_organization(
4614 p_validate => p_validate
4615 ,p_effective_date => p_effective_date
4616 ,p_language_code => p_language_code
4617 ,p_organization_id => l_organization_id
4618 ,p_internal_external_flag => p_internal_external_flag
4619 ,p_type => p_type
4620 ,p_location_id => p_location_id
4621 ,p_object_version_number => l_object_version_number);
4622 --
4623 create_org_class_internal(
4624 p_validate => p_validate
4625 ,p_effective_date => p_effective_date
4626 ,p_organization_id => l_organization_id
4627 ,p_org_classif_code => 'HR_LEGAL'
4628 ,p_org_information_id => l_org_information_id
4629 ,p_object_version_number => l_object_version_number
4630 );
4631 --
4632 hr_organization_api.create_org_information(
4633 p_validate => p_validate
4634 ,p_effective_date => p_effective_date
4635 ,p_organization_id => l_organization_id
4636 ,p_org_info_type_code => 'Legal Entity Accounting'
4637 ,p_org_information1 => p_set_of_books_id
4638 ,p_org_information_id => l_org_information_id
4639 ,p_object_version_number => l_object_version_number); */
4640 --
4641 create_org_class_internal(
4642 p_validate => p_validate
4643 ,p_effective_date => p_effective_date
4644 ,p_organization_id => l_organization_id
4645 ,p_org_classif_code => 'OPERATING_UNIT'
4646 ,p_org_information_id => l_org_information_id
4647 ,p_object_version_number => l_object_version_number
4648 );
4649 --
4650 hr_organization_api.create_org_information(
4651 p_validate => p_validate
4652 ,p_effective_date => p_effective_date
4653 ,p_organization_id => l_organization_id
4654 ,p_org_info_type_code => 'Operating Unit Information'
4655 -- ,p_org_information2 => rtrim(ltrim(to_char(l_organization_id,'999999999999')))
4656 ,p_org_information2 => p_legal_entity_id
4657 ,p_org_information3 => p_set_of_books_id
4658 ,p_org_information5 => p_short_code
4659 ,p_org_information_id => l_org_information_id
4660 ,p_object_version_number => l_object_version_number);
4661 --
4662 --
4663 hr_utility.set_location(l_proc, 70);
4664 --
4665 -- When in validation only mode raise the Validate_Enabled exception
4666 --
4667 IF p_validate THEN
4668 RAISE hr_api.validate_enabled;
4669 END IF;
4670 --
4671 -- Set all output arguments
4672 --
4673 p_organization_id := l_organization_id;
4674 -- Changed for the bug 5446483 - Start
4675 --p_object_version_number := l_object_version_number;
4676 -- Changed for the bug 5446483 - end
4677 --
4678 hr_utility.set_location(' Leaving:'||l_proc, 80);
4679 --
4680 EXCEPTION
4681 --
4682 WHEN hr_api.validate_enabled THEN
4683 --
4684 -- As the Validate_Enabled exception has been raised
4685 -- we must rollback to the savepoint
4686 --
4687 ROLLBACK TO create_operating_unit;
4688 --
4689 -- Only set output warning arguments
4690 -- (Any key or derived arguments must be set to null
4691 -- when validation only mode is being used.)
4692 --
4693 p_organization_id := NULL;
4694 p_object_version_number := NULL;
4695 hr_utility.set_location(' Leaving:'||l_proc, 80);
4696 WHEN OTHERS THEN
4697 --
4698 -- A validation or unexpected error has occurred
4699 ROLLBACK TO create_operating_unit;
4700 -- Set OUT parameters
4701 p_organization_id := NULL;
4702 p_object_version_number := NULL;
4703 hr_utility.set_location(' Leaving:'||l_proc, 90);
4704 RAISE;
4705 --
4706 END create_operating_unit;
4707 --
4708 --
4709 -- ----------------------------------------------------------------------------
4710 -- |-----------------------------< update_operating_unit >----------------------|
4711 -- ----------------------------------------------------------------------------
4712 --
4713 PROCEDURE update_operating_unit
4714 (
4715 p_validate IN BOOLEAN DEFAULT false
4716 ,p_organization_id IN NUMBER
4717 ,p_effective_date IN DATE
4718 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
4719 ,p_date_from IN DATE DEFAULT hr_api.g_date
4720 ,p_name IN VARCHAR2 DEFAULT hr_api.g_varchar2
4721 ,p_type IN VARCHAR2 DEFAULT hr_api.g_varchar2
4722 ,p_internal_external_flag IN VARCHAR2 DEFAULT hr_api.g_varchar2
4723 ,p_location_id IN NUMBER DEFAULT hr_api.g_number
4724 ,p_set_of_books_id IN VARCHAR2 DEFAULT hr_api.g_varchar2
4725 ,p_usable_flag IN VARCHAR2 DEFAULT hr_api.g_varchar2
4726 -- Added p_short_code for bug 4526439
4727 ,p_short_code IN VARCHAR2 DEFAULT hr_api.g_varchar2
4728 ,p_legal_entity_id IN VARCHAR2 DEFAULT hr_api.g_varchar2
4729 ,p_object_version_number IN OUT NOCOPY NUMBER
4730 ,p_update_prim_ledger_warning OUT NOCOPY BOOLEAN
4731 ,p_duplicate_org_warning OUT NOCOPY BOOLEAN
4732 ) IS
4733
4734 --
4735 -- Declare cursors and local variables
4736 --
4737 l_proc varchar2(72) := g_package||'update_operating_unit';
4738 l_legal_entity_id hr_organization_information.ORG_INFORMATION2%type;
4739 l_set_of_books_id hr_organization_information.ORG_INFORMATION3%type;
4740 l_object_version_number hr_organization_information.object_version_number%type;
4741 l_update_prim_ledger_warning boolean;
4742 l_org_information_id hr_organization_information.org_information_id%TYPE;
4743 l_new_org_information_id hr_organization_information.org_information_id%TYPE;
4744 l_new_ovn hr_organization_information.object_version_number%type;
4745 l_organization_id hr_all_organization_units.organization_id%TYPE;
4746 l_duplicate_org_warning boolean;
4747
4748
4749 cursor csr_check_update (p_organization_id number)
4750 is
4751 select ORG_INFORMATION_ID,ORG_INFORMATION2,ORG_INFORMATION3,OBJECT_VERSION_NUMBER
4752 from hr_organization_information
4753 where ORG_INFORMATION_CONTEXT = 'Operating Unit Information'
4754 and organization_id = p_organization_id;
4755
4756 BEGIN
4757 --
4758 hr_utility.set_location('Entering:'|| l_proc, 10);
4759 --
4760 -- Issue a savepoint
4761 --
4762 savepoint update_operating_unit;
4763
4764 --
4765 -- Call to Update Organization
4766 --
4767 hr_organization_api.update_organization(
4768 p_validate => p_validate
4769 ,p_effective_date => p_effective_date
4770 ,p_name=>p_name
4771 ,p_language_code => p_language_code
4772 ,p_organization_id => p_organization_id
4773 ,p_internal_external_flag => p_internal_external_flag
4774 ,p_type => p_type
4775 ,p_location_id => p_location_id
4776 ,p_object_version_number => p_object_version_number
4777 ,p_duplicate_org_warning =>l_duplicate_org_warning);
4778 --
4779 -- Open Cursor
4780 --
4781
4782 open csr_check_update(p_organization_id => p_organization_id);
4783
4784 if csr_check_update%notfound then
4785 if(p_set_of_books_id is not null and p_legal_entity_id is not null) then
4786 l_update_prim_ledger_warning := TRUE;
4787 end if;
4788
4789 hr_organization_api.create_org_information(
4790 p_validate => p_validate
4791 ,p_effective_date => p_effective_date
4792 ,p_organization_id => p_organization_id
4793 ,p_org_info_type_code => 'Operating Unit Information'
4794 ,p_org_information2 => p_legal_entity_id
4795 ,p_org_information3 => p_set_of_books_id
4796 ,p_org_information5 => p_short_code
4797 ,p_org_information6 => p_usable_flag
4798 ,p_org_information_id => l_org_information_id
4799 ,p_object_version_number => l_object_version_number);
4800 else
4801
4802 fetch csr_check_update into l_new_org_information_id,l_legal_entity_id,
4803 l_set_of_books_id,l_new_ovn;
4804
4805 if ((l_legal_entity_id <> p_legal_entity_id) or (l_set_of_books_id <> p_set_of_books_id))
4806 then
4807 l_update_prim_ledger_warning := TRUE;
4808 end if;
4809
4810 hr_organization_api.update_org_information(
4811 p_validate => p_validate
4812 ,p_effective_date => p_effective_date
4813 ,p_org_information_id => l_new_org_information_id
4814 ,p_org_info_type_code => 'Operating Unit Information'
4815 ,p_org_information2 => p_legal_entity_id
4816 ,p_org_information3 => p_set_of_books_id
4817 ,p_org_information5 => p_short_code
4818 ,p_org_information6 => p_usable_flag
4819 ,p_object_version_number => l_new_ovn);
4820
4821
4822
4823 end if;
4824
4825 close csr_check_update;
4826
4827 hr_utility.set_location(l_proc, 20);
4828 --
4829 -- When in validation only mode raise the Validate_Enabled exception
4830 --
4831 IF p_validate THEN
4832 RAISE hr_api.validate_enabled;
4833 END IF;
4834 --
4835 -- Set all output arguments
4836 --
4837
4838 -- Changed for the bug 5446483 - Start
4839 --p_object_version_number := l_object_version_number; This is set with the out parameter of update_organization call.
4840 -- Changed for the bug 5446483 - end
4841
4842
4843 p_update_prim_ledger_warning := l_update_prim_ledger_warning;
4844 --
4845 hr_utility.set_location(' Leaving:'||l_proc, 30);
4846 --
4847 EXCEPTION
4848 --
4849 WHEN hr_api.validate_enabled THEN
4850 --
4851 -- As the Validate_Enabled exception has been raised
4852 -- we must rollback to the savepoint
4853 --
4854 ROLLBACK TO update_operating_unit;
4855 --
4856 -- Only set output warning arguments
4857 -- (Any key or derived arguments must be set to null
4858 -- when validation only mode is being used.)
4859 -- Reset IN OUT parameters.
4860 p_object_version_number := l_object_version_number;
4861 p_update_prim_ledger_warning :=false;
4862 hr_utility.set_location(' Leaving:'||l_proc, 40);
4863 WHEN OTHERS THEN
4864 --
4865 -- A validation or unexpected error has occurred
4866 ROLLBACK TO update_operating_unit;
4867 -- Set OUT parameters
4868 -- Reset IN OUT parameters.
4869 p_object_version_number := l_object_version_number;
4870 p_update_prim_ledger_warning :=false;
4871 hr_utility.set_location(' Leaving:'||l_proc, 50);
4872 RAISE;
4873 --
4874
4875 END update_operating_unit;
4876
4877
4878 --
4879 -- ----------------------------------------------------------------------------
4880 -- |-----------------------------< create_legal_entity >----------------------|
4881 -- ----------------------------------------------------------------------------
4882 --
4883 PROCEDURE create_legal_entity
4884 ( p_validate IN BOOLEAN DEFAULT false
4885 ,p_effective_date IN DATE
4886 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
4887 --
4888 ,p_business_group_id IN NUMBER
4889 ,p_date_from IN DATE
4890 ,p_name IN VARCHAR2
4891 ,p_type IN VARCHAR2
4892 ,p_internal_external_flag IN VARCHAR2
4893 ,p_location_id IN NUMBER
4894 ,p_set_of_books_id IN VARCHAR2
4895 ,p_organization_id OUT NOCOPY NUMBER
4896 ,p_object_version_number OUT NOCOPY NUMBER
4897
4898 ) IS
4899 --
4900 -- Declare cursors and local variables
4901 --
4902 l_proc VARCHAR2(72) := g_package||'create_legal_entity';
4903 l_organization_id hr_all_organization_units.organization_id%TYPE;
4904 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
4905 l_language_code hr_all_organization_units_tl.language%TYPE;
4906 l_org_information_id hr_organization_information.org_information_id%TYPE;
4907 l_date_from DATE;
4908 --
4909 BEGIN
4910 --
4911 hr_utility.set_location('Entering:'|| l_proc, 10);
4912
4913 hr_utility.set_message(800, 'HR_449740_LEG_ENT_API_OBSOLETE');
4914 hr_utility.raise_error;
4915 /*
4916 --
4917 -- Issue a savepoint
4918 --
4919 savepoint create_legal_entity;
4920 --
4921 hr_utility.set_location(l_proc, 15);
4922 --
4923 -- All date input parameters must be truncated to remove time elements
4924 --
4925 l_date_from := trunc (p_date_from);
4926 --
4927 --
4928 -- Validate the language parameter. l_language_code should be passed to functions
4929 -- instead of p_language_code from now on, to allow an IN OUT parameter to
4930 -- be passed through.
4931 --
4932 l_language_code := p_language_code;
4933 hr_api.validate_language_code(p_language_code => l_language_code);
4934 --
4935 hr_utility.set_location(l_proc, 20);
4936 --
4937 -- Process Logic
4938 --
4939 --
4940 hr_organization_api.create_organization(
4941 p_validate => p_validate
4942 ,p_effective_date => p_effective_date
4943 ,p_language_code => p_language_code
4944 ,p_business_group_id => p_business_group_id
4945 ,p_date_from => l_date_from
4946 ,p_name => p_name
4947 ,p_organization_id => l_organization_id
4948 ,p_object_version_number => l_object_version_number);
4949 --
4950 hr_organization_api.update_organization(
4951 p_validate => p_validate
4952 ,p_effective_date => p_effective_date
4953 ,p_language_code => p_language_code
4954 ,p_organization_id => l_organization_id
4955 ,p_internal_external_flag => p_internal_external_flag
4956 ,p_type => p_type
4957 ,p_location_id => p_location_id
4958 ,p_object_version_number => l_object_version_number);
4959 --
4960 create_org_class_internal(
4961 p_validate => p_validate
4962 ,p_effective_date => p_effective_date
4963 ,p_organization_id => l_organization_id
4964 ,p_org_classif_code => 'HR_LEGAL'
4965 ,p_org_information_id => l_org_information_id
4966 ,p_object_version_number => l_object_version_number
4967 );
4968 --
4969 hr_organization_api.create_org_information(
4970 p_validate => p_validate
4971 ,p_effective_date => p_effective_date
4972 ,p_organization_id => l_organization_id
4973 ,p_org_info_type_code => 'Legal Entity Accounting'
4974 ,p_org_information1 => p_set_of_books_id
4975 ,p_org_information_id => l_org_information_id
4976 ,p_object_version_number => l_object_version_number);
4977 --
4978 --
4979 hr_utility.set_location(l_proc, 70);
4980 --
4981 -- When in validation only mode raise the Validate_Enabled exception
4982 --
4983 IF p_validate THEN
4984 RAISE hr_api.validate_enabled;
4985 END IF;
4986 --
4987 -- Set all output arguments
4988 --
4989 p_organization_id := l_organization_id;
4990 p_object_version_number := l_object_version_number;
4991 --
4992 hr_utility.set_location(' Leaving:'||l_proc, 80);
4993 --
4994 EXCEPTION
4995 --
4996 WHEN hr_api.validate_enabled THEN
4997 --
4998 -- As the Validate_Enabled exception has been raised
4999 -- we must rollback to the savepoint
5000 --
5001 ROLLBACK TO create_legal_entity;
5002 --
5003 -- Only set output warning arguments
5004 -- (Any key or derived arguments must be set to null
5005 -- when validation only mode is being used.)
5006 --
5007 p_organization_id := NULL;
5008 p_object_version_number := NULL;
5009 hr_utility.set_location(' Leaving:'||l_proc, 80);
5010 WHEN OTHERS THEN
5011 --
5012 -- A validation or unexpected error has occurred
5013 ROLLBACK TO create_legal_entity;
5014 -- Set OUT parameters
5015 p_organization_id := NULL;
5016 p_object_version_number := NULL;
5017 hr_utility.set_location(' Leaving:'||l_proc, 90);
5018 RAISE;
5019 --
5020 */
5021 END create_legal_entity;
5022 --
5023 --
5024 -- ----------------------------------------------------------------------------
5025 -- |-------------------------< chk_bgr_id >-----------------------------------|
5026 -- ----------------------------------------------------------------------------
5027 --
5028 -- Description:
5029 -- Validates that business_group is present in PER_BUSINESS_GROUPS
5030 --
5031 -- Pre-conditions:
5032 -- None.
5033 --
5034 -- In Arguments:
5035 -- p_bgr_id
5036 --
5037 -- Post Success:
5038 -- If the business_group_id attribute is valid then
5039 -- normal processing continues
5040 --
5041 -- Post Failure:
5042 -- If the business_group_id attribute is invalid then an application
5043 -- error will be raised and processing is terminated.
5044 --
5045 -- Developer/Implementation Notes:
5046 -- Duplicate validation exists on form, so any changes made here
5047 -- or on form must be dual-maintained.
5048 --
5049 -- Access Status:
5050 -- Internal Row Table Handler Use Only.
5051 --
5052 -- {End Of Comments}
5053 --
5054 PROCEDURE chk_bgr_id
5055 ( p_bgr_id IN hr_all_organization_units.business_group_id%TYPE)
5056 IS
5057 l_proc VARCHAR2(72) := g_package||'chk_bgr_id';
5058 l_exists VARCHAR2(1) := 'N';
5059 --
5060 BEGIN
5061 --
5062 hr_utility.set_location('Entering:'|| l_proc, 10);
5063 --
5064 --
5065 -- Check business_group_id presence
5066 --
5067 BEGIN
5068 SELECT 'Y'
5069 INTO l_exists
5070 FROM sys.dual
5071 WHERE EXISTS
5072 (SELECT null
5073 FROM PER_BUSINESS_GROUPS
5074 WHERE business_group_id = p_bgr_id);
5075 EXCEPTION
5076 WHEN NO_DATA_FOUND THEN NULL;
5077 END;
5078 --
5079 hr_utility.set_location(l_proc, 20);
5080 --
5081 IF l_exists = 'N' THEN
5082 hr_utility.set_message(800, 'HR_7208_API_BUS_GRP_INVALID');
5083 hr_utility.raise_error;
5084 END IF;
5085 --
5086 --
5087 hr_utility.set_location('Leaving:'||l_proc, 30);
5088 --
5089 END chk_bgr_id;
5090 --
5091 --
5092 -- ----------------------------------------------------------------------------
5093 -- |-----------------------------< create_bgr_classif >-----------------------|
5094 -- ----------------------------------------------------------------------------
5095 --
5096 PROCEDURE create_bgr_classif
5097 ( p_validate IN BOOLEAN DEFAULT false
5098 ,p_effective_date IN DATE
5099 --
5100 ,p_business_group_id IN NUMBER
5101 ,p_set_of_books_id IN VARCHAR2
5102 ) IS
5103 --
5104 -- Declare cursors and local variables
5105 --
5106 l_proc VARCHAR2(72) := g_package||'create_bgr_classif';
5107 l_organization_id hr_all_organization_units.organization_id%TYPE;
5108 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
5109 l_org_information_id hr_organization_information.org_information_id%TYPE;
5110 --
5111 BEGIN
5112 --
5113 hr_utility.set_location('Entering:'|| l_proc, 10);
5114 --
5115 -- Issue a savepoint
5116 --
5117 savepoint create_bgr_classif;
5118 --
5119 -- Check if it is a Business Group
5120 --
5121 chk_bgr_id(p_business_group_id);
5122 --
5123 --
5124 hr_utility.set_location(l_proc, 20);
5125 --
5126 -- Process Logic
5127 --
5128 create_org_class_internal(
5129 p_validate => p_validate
5130 ,p_effective_date => p_effective_date
5131 ,p_organization_id => p_business_group_id
5132 ,p_org_classif_code => 'HR_LEGAL'
5133 ,p_org_information_id => l_org_information_id
5134 ,p_object_version_number => l_object_version_number
5135 );
5136 --
5137 hr_organization_api.create_org_information(
5138 p_validate => p_validate
5139 ,p_effective_date => p_effective_date
5140 ,p_organization_id => p_business_group_id
5141 ,p_org_info_type_code => 'Legal Entity Accounting'
5142 ,p_org_information1 => p_set_of_books_id
5143 ,p_org_information_id => l_org_information_id
5144 ,p_object_version_number => l_object_version_number);
5145 --
5146 create_org_class_internal(
5147 p_validate => p_validate
5148 ,p_effective_date => p_effective_date
5149 ,p_organization_id => p_business_group_id
5150 ,p_org_classif_code => 'OPERATING_UNIT'
5151 ,p_org_information_id => l_org_information_id
5152 ,p_object_version_number => l_object_version_number
5153 );
5154 --
5155 hr_organization_api.create_org_information(
5156 p_validate => p_validate
5157 ,p_effective_date => p_effective_date
5158 ,p_organization_id => p_business_group_id
5159 ,p_org_info_type_code => 'Operating Unit Information'
5160 ,p_org_information2 => rtrim(ltrim(to_char(p_business_group_id,'999999999999')))
5161 ,p_org_information3 => p_set_of_books_id
5162 ,p_org_information_id => l_org_information_id
5163 ,p_object_version_number => l_object_version_number);
5164 --
5165 --
5166 hr_utility.set_location(l_proc, 70);
5167 --
5168 -- When in validation only mode raise the Validate_Enabled exception
5169 --
5170 IF p_validate THEN
5171 RAISE hr_api.validate_enabled;
5172 END IF;
5173 --
5174 --
5175 hr_utility.set_location(' Leaving:'||l_proc, 80);
5176 --
5177 EXCEPTION
5178 --
5179 WHEN hr_api.validate_enabled THEN
5180 --
5181 -- As the Validate_Enabled exception has been raised
5182 -- we must rollback to the savepoint
5183 --
5184 ROLLBACK TO create_bgr_classif;
5185 --
5186 -- Only set output warning arguments
5187 -- (Any key or derived arguments must be set to null
5188 -- when validation only mode is being used.)
5189 --
5190 hr_utility.set_location(' Leaving:'||l_proc, 80);
5191 WHEN OTHERS THEN
5192 --
5193 -- A validation or unexpected error has occurred
5194 ROLLBACK TO create_bgr_classif;
5195 hr_utility.set_location(' Leaving:'||l_proc, 90);
5196 RAISE;
5197 --
5198 END create_bgr_classif;
5199 --
5200 -- ----------------------------------------------------------------------------
5201 -- |-------------------------< chk_organization_id >--------------------------|
5202 -- ----------------------------------------------------------------------------
5203 --
5204 -- Description:
5205 -- Validates that organization_id of organization unit is present in
5206 -- HR_ALL_ORGANIZATION_UNITS table and valid.
5207 --
5208 -- Pre-conditions:
5209 -- None.
5210 --
5211 -- In Arguments:
5212 -- p_organization_id
5213 --
5214 -- Post Success:
5215 -- If the organization_id attribute is valid then
5216 -- normal processing continues
5217 --
5218 -- Post Failure:
5219 -- If the organization_id attribute is invalid then an application
5220 -- error will be raised and processing is terminated.
5221 --
5222 -- Developer/Implementation Notes:
5223 -- Duplicate validation exists on form, so any changes made here
5224 -- or on form must be dual-maintained.
5225 --
5226 -- Access Status:
5227 -- Internal Row Table Handler Use Only.
5228 --
5229 -- {End Of Comments}
5230 --
5231 PROCEDURE chk_organization_id
5232 ( p_organization_id IN hr_organization_information.organization_id%TYPE)
5233 IS
5234 l_proc VARCHAR2(72) := g_package||'chk_organization_id';
5235 l_exists VARCHAR2(1) := 'N';
5236 --
5237 BEGIN
5238 --
5239 hr_utility.set_location('Entering:'|| l_proc, 10);
5240 --
5241 --
5242 -- Check organization_id presence
5243 --
5244 BEGIN
5245 SELECT 'Y'
5246 INTO l_exists
5247 FROM sys.dual
5248 WHERE EXISTS
5249 (SELECT null
5250 FROM hr_all_organization_units
5251 WHERE organization_id = p_organization_id);
5252 EXCEPTION
5253 WHEN NO_DATA_FOUND THEN NULL;
5254 END;
5255 --
5256 hr_utility.set_location(l_proc, 20);
5257 --
5258 IF l_exists = 'N' THEN
5259 hr_utility.set_message(800, 'HR_289002_INV_ORG_ID');
5260 hr_utility.raise_error;
5261 END IF;
5262 --
5263 --
5264 hr_utility.set_location('Leaving:'||l_proc, 30);
5265 --
5266 END chk_organization_id;
5267 --
5268 --
5269 -- ----------------------------------------------------------------------------
5270 -- |-----------------------------< create_legal_entity_classif >--------------|
5271 -- ----------------------------------------------------------------------------
5272 --
5273 PROCEDURE create_legal_entity_classif
5274 ( p_validate IN BOOLEAN DEFAULT false
5275 ,p_effective_date IN DATE
5276 --
5277 ,p_organization_id IN NUMBER
5278 ,p_set_of_books_id IN VARCHAR2
5279 ) IS
5280 --
5281 -- Declare cursors and local variables
5282 --
5283 l_proc VARCHAR2(72) := g_package||'create_legal_entity_classif';
5284 l_organization_id hr_all_organization_units.organization_id%TYPE;
5285 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
5286 l_org_information_id hr_organization_information.org_information_id%TYPE;
5287 --
5288 BEGIN
5289 --
5290 hr_utility.set_location('Entering:'|| l_proc, 10);
5291 --
5292 -- Issue a savepoint
5293 --
5294 savepoint create_legal_entity_classif;
5295 --
5296 -- Check if it is a valid Organization
5297 --
5298 chk_organization_id(p_organization_id);
5299 --
5300 --
5301 hr_utility.set_location(l_proc, 20);
5302 --
5303 -- Process Logic
5304 --
5305 create_org_class_internal(
5306 p_validate => p_validate
5307 ,p_effective_date => p_effective_date
5308 ,p_organization_id => p_organization_id
5309 ,p_org_classif_code => 'HR_LEGAL'
5310 ,p_org_information_id => l_org_information_id
5311 ,p_object_version_number => l_object_version_number
5312 );
5313 --
5314 hr_organization_api.create_org_information(
5315 p_validate => p_validate
5316 ,p_effective_date => p_effective_date
5317 ,p_organization_id => p_organization_id
5318 ,p_org_info_type_code => 'Legal Entity Accounting'
5319 ,p_org_information1 => p_set_of_books_id
5320 ,p_org_information_id => l_org_information_id
5321 ,p_object_version_number => l_object_version_number);
5322 --
5323 hr_utility.set_location(l_proc, 70);
5324 --
5325 -- When in validation only mode raise the Validate_Enabled exception
5326 --
5327 IF p_validate THEN
5328 RAISE hr_api.validate_enabled;
5329 END IF;
5330 --
5331 --
5332 hr_utility.set_location(' Leaving:'||l_proc, 80);
5333 --
5334 EXCEPTION
5335 --
5336 WHEN hr_api.validate_enabled THEN
5337 --
5338 -- As the Validate_Enabled exception has been raised
5339 -- we must rollback to the savepoint
5340 --
5341 ROLLBACK TO create_legal_entity_classif;
5342 --
5343 -- Only set output warning arguments
5344 -- (Any key or derived arguments must be set to null
5345 -- when validation only mode is being used.)
5346 --
5347 hr_utility.set_location(' Leaving:'||l_proc, 80);
5348 WHEN OTHERS THEN
5349 --
5350 -- A validation or unexpected error has occurred
5351 ROLLBACK TO create_legal_entity_classif;
5352 hr_utility.set_location(' Leaving:'||l_proc, 90);
5353 RAISE;
5354 --
5355 END create_legal_entity_classif;
5356 --
5357 --
5358 -- ----------------------------------------------------------------------------
5359 -- |-----------------------------< create_oper_unit_classif >-----------------|
5360 -- ----------------------------------------------------------------------------
5361 --
5362 PROCEDURE create_oper_unit_classif
5363 ( p_validate IN BOOLEAN DEFAULT false
5364 ,p_effective_date IN DATE
5365 --
5366 ,p_organization_id IN NUMBER
5367 ,p_legal_entity_id IN VARCHAR2
5368 ,p_set_of_books_id IN VARCHAR2
5369 ,p_oper_unit_short_code IN VARCHAR2 DEFAULT null --- Fix For Bug # 7439707
5370 ) IS
5371 --
5372 -- Declare cursors and local variables
5373 --
5374 l_proc VARCHAR2(72) := g_package||'create_oper_unit_classif';
5375 l_organization_id hr_all_organization_units.organization_id%TYPE;
5376 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
5377 l_org_information_id hr_organization_information.org_information_id%TYPE;
5378 --
5379 BEGIN
5380 --
5381 hr_utility.set_location('Entering:'|| l_proc, 10);
5382 --
5383 -- Issue a savepoint
5384 --
5385 savepoint create_oper_unit_classif;
5386 --
5387 -- Check if it is a valid Organization
5388 --
5389 chk_organization_id(p_organization_id);
5390 --
5391 --
5392 hr_utility.set_location(l_proc, 20);
5393 --
5394 -- Process Logic
5395 --
5396 create_org_class_internal(
5397 p_validate => p_validate
5398 ,p_effective_date => p_effective_date
5399 ,p_organization_id => p_organization_id
5400 ,p_org_classif_code => 'OPERATING_UNIT'
5401 ,p_org_information_id => l_org_information_id
5402 ,p_object_version_number => l_object_version_number
5403 );
5404 --
5405 hr_organization_api.create_org_information(
5406 p_validate => p_validate
5407 ,p_effective_date => p_effective_date
5408 ,p_organization_id => p_organization_id
5409 ,p_org_info_type_code => 'Operating Unit Information'
5410 ,p_org_information2 => p_legal_entity_id
5411 ,p_org_information3 => p_set_of_books_id
5412 ,p_org_information5 => p_oper_unit_short_code --- Fix For Bug # 7439707
5413 ,p_org_information_id => l_org_information_id
5414 ,p_object_version_number => l_object_version_number);
5415 --
5416 --
5417 hr_utility.set_location(l_proc, 70);
5418 --
5419 -- When in validation only mode raise the Validate_Enabled exception
5420 --
5421 IF p_validate THEN
5422 RAISE hr_api.validate_enabled;
5423 END IF;
5424 --
5425 --
5426 hr_utility.set_location(' Leaving:'||l_proc, 80);
5427 --
5428 EXCEPTION
5429 --
5430 WHEN hr_api.validate_enabled THEN
5431 --
5432 -- As the Validate_Enabled exception has been raised
5433 -- we must rollback to the savepoint
5434 --
5435 ROLLBACK TO create_oper_unit_classif;
5436 --
5437 -- Only set output warning arguments
5438 -- (Any key or derived arguments must be set to null
5439 -- when validation only mode is being used.)
5440 --
5441 hr_utility.set_location(' Leaving:'||l_proc, 80);
5442 WHEN OTHERS THEN
5443 --
5444 -- A validation or unexpected error has occurred
5445 ROLLBACK TO create_oper_unit_classif;
5446 hr_utility.set_location(' Leaving:'||l_proc, 90);
5447 RAISE;
5448 --
5449 END create_oper_unit_classif;
5450 --
5451 -- ----------------------------------------------------------------------------
5452 --
5453 -- ----------------------------------------------------------------------------
5454 -- |-----------------------------< trans_org_name >---------------------------|
5455 -- ----------------------------------------------------------------------------
5456 --
5457 PROCEDURE trans_org_name
5458 ( p_validate IN BOOLEAN DEFAULT false
5459 ,p_effective_date IN DATE
5460 ,p_language_code IN VARCHAR2 DEFAULT hr_api.userenv_lang
5461 --
5462 ,p_organization_id IN NUMBER
5463 ,p_name IN VARCHAR2
5464 ) IS
5465 --
5466 -- Declare cursors and local variables
5467 --
5468 l_proc VARCHAR2(72) := g_package||'trans_org_name';
5469 l_organization_id hr_all_organization_units.organization_id%TYPE;
5470 l_language_code hr_all_organization_units_tl.language%TYPE;
5471 --
5472 BEGIN
5473 --
5474 hr_utility.set_location('Entering:'|| l_proc, 10);
5475 --
5476 -- Issue a savepoint
5477 --
5478 savepoint trans_org_name;
5479 --
5480 hr_utility.set_location(l_proc, 15);
5481 --
5482 --
5483 -- Validate the language parameter. l_language_code should be passed to functions
5484 -- instead of p_language_code from now on, to allow an IN OUT parameter to
5485 -- be passed through.
5486 --
5487 l_language_code := p_language_code;
5488 hr_api.validate_language_code(p_language_code => l_language_code);
5489 --
5490 hr_utility.set_location(l_proc, 20);
5491 --
5492 --
5493 --
5494 hr_api.mandatory_arg_error
5495 (p_api_name => l_proc
5496 ,p_argument => 'LANGUAGE'
5497 ,p_argument_value => p_language_code
5498 );
5499 --
5500 --
5501 hr_api.mandatory_arg_error
5502 (p_api_name => l_proc
5503 ,p_argument => 'ORGANIZATION_ID'
5504 ,p_argument_value => p_organization_id
5505 );
5506 --
5507 --
5508 hr_api.mandatory_arg_error
5509 (p_api_name => l_proc
5510 ,p_argument => 'NAME'
5511 ,p_argument_value => p_name
5512 );
5513 --
5514 chk_organization_id(
5515 p_organization_id => p_organization_id);
5516 --
5517 -- Process Logic
5518 --
5519 --
5520 hr_ort_upd.upd_tl(
5521 p_language_code => p_language_code,
5522 p_organization_id => p_organization_id,
5523 p_name => p_name);
5524 --
5525 hr_utility.set_location(l_proc, 60);
5526 --
5527 -- When in validation only mode raise the Validate_Enabled exception
5528 --
5529 IF p_validate THEN
5530 RAISE hr_api.validate_enabled;
5531 END IF;
5532 --
5533 -- Set all output arguments
5534 --
5535 --
5536 hr_utility.set_location(' Leaving:'||l_proc, 70);
5537 --
5538 EXCEPTION
5539 --
5540 WHEN hr_api.validate_enabled THEN
5541 --
5542 -- As the Validate_Enabled exception has been raised
5543 -- we must rollback to the savepoint
5544 --
5545 ROLLBACK TO trans_org_name;
5546 --
5547 -- Only set output warning arguments
5548 -- (Any key or derived arguments must be set to null
5549 -- when validation only mode is being used.)
5550 --
5551 hr_utility.set_location(' Leaving:'||l_proc, 80);
5552 WHEN OTHERS THEN
5553 --
5554 -- A validation or unexpected error has occurred
5555 ROLLBACK TO trans_org_name;
5556 hr_utility.set_location(' Leaving:'||l_proc, 90);
5557 RAISE;
5558 --
5559 END trans_org_name;
5560 -- ----------------------------------------------------------------------------
5561 --
5562 --
5563 -- ----------------------------------------------------------------------------
5564 -- |---------------------------< create_company_cost_center >----------------|
5565 -- ----------------------------------------------------------------------------
5566 --
5567 PROCEDURE create_company_cost_center
5568 ( p_validate IN BOOLEAN DEFAULT false
5569 ,p_effective_date IN DATE
5570 ,p_organization_id IN NUMBER
5571 ,p_company_valueset_id IN NUMBER DEFAULT null
5572 ,p_company IN VARCHAR2 DEFAULT null
5573 ,p_costcenter_valueset_id IN NUMBER DEFAULT null
5574 ,p_costcenter IN VARCHAR2 DEFAULT null
5575 ,p_ori_org_information_id OUT NOCOPY NUMBER
5576 ,p_ori_object_version_number OUT NOCOPY NUMBER
5577 ,p_org_information_id OUT NOCOPY NUMBER
5578 ,p_object_version_number OUT NOCOPY NUMBER
5579 ) IS
5580
5581 l_org_information1 varchar2(150);
5582 l_proc VARCHAR2(72) := g_package||'create_company_cost_center';
5583
5584 BEGIN
5585
5586 --
5587 hr_utility.set_location('Entering:'|| l_proc, 10);
5588 --
5589 -- Issue a savepoint
5590 --
5591 savepoint create_company_cost_center;
5592 --
5593
5594 l_org_information1 := substr(p_company_valueset_id||'|'||p_company||'|'||p_costcenter_valueset_id||'|'||p_costcenter,0,150);
5595
5596 hr_utility.set_location(l_proc, 20);
5597 --
5598 -- Call Before Process User Hook
5599 --
5600 begin
5601
5602 hr_organization_bk7.create_company_cost_center_b
5603 ( p_effective_date => p_effective_date
5604 ,p_organization_id => p_organization_id
5605 ,p_company_valueset_id => p_company_valueset_id
5606 ,p_company => p_company
5607 ,p_costcenter_valueset_id => p_costcenter_valueset_id
5608 ,p_costcenter => p_costcenter
5609 );
5610
5611 exception
5612 when hr_api.cannot_find_prog_unit then
5613 hr_api.cannot_find_prog_unit_error
5614 (p_module_name => 'create_company_cost_center'
5615 ,p_hook_type => 'BP'
5616 );
5617 end;
5618 --
5619 hr_utility.set_location(l_proc, 30);
5620 --
5621 create_org_classification
5622 ( p_effective_date => p_effective_date
5623 ,p_organization_id => p_organization_id
5624 ,p_org_classif_code => 'CC'
5625 ,p_org_information_id => p_ori_org_information_id
5626 ,p_object_version_number => p_ori_object_version_number
5627 );
5628 --
5629 hr_utility.set_location(l_proc, 40);
5630 --
5631
5632 IF ( p_company_valueset_id is NOT NULL ) OR
5633 ( p_company is NOT NULL ) OR
5634 ( p_costcenter_valueset_id is NOT NULL ) OR
5635 ( p_costcenter is NOT NULL ) THEN
5636
5637 create_org_information
5638 ( p_effective_date => p_effective_date
5639 ,p_organization_id => p_organization_id
5640 ,p_org_info_type_code => 'Company Cost Center'
5641 ,p_org_information1 => l_org_information1
5642 ,p_org_information2 => to_char(p_company_valueset_id)
5643 ,p_org_information3 => p_company
5644 ,p_org_information4 => to_char(p_costcenter_valueset_id)
5645 ,p_org_information5 => p_costcenter
5646 ,p_org_information_id => p_org_information_id
5647 ,p_object_version_number => p_object_version_number
5648 );
5649
5650 END IF;
5651 --
5652 hr_utility.set_location(l_proc, 50);
5653 --
5654 -- Call After Process User Hook
5655 --
5656 begin
5657
5658 hr_organization_bk7.create_company_cost_center_a
5659 ( p_effective_date => p_effective_date
5660 ,p_organization_id => p_organization_id
5661 ,p_company_valueset_id => p_company_valueset_id
5662 ,p_company => p_company
5663 ,p_costcenter_valueset_id => p_costcenter_valueset_id
5664 ,p_costcenter => p_costcenter
5665 ,p_ori_org_information_id => p_ori_org_information_id
5666 ,p_ori_object_version_number => p_ori_object_version_number
5667 ,p_org_information_id => p_org_information_id
5668 ,p_object_version_number => p_object_version_number
5669 );
5670
5671 exception
5672 when hr_api.cannot_find_prog_unit then
5673 hr_api.cannot_find_prog_unit_error
5674 (p_module_name => 'create_company_cost_center'
5675 ,p_hook_type => 'AP'
5676 );
5677 end;
5678 --
5679 hr_utility.set_location(l_proc, 60);
5680 --
5681 --
5682 -- When in validation only mode raise the Validate_Enabled exception
5683 --
5684 IF p_validate THEN
5685 RAISE hr_api.validate_enabled;
5686 END IF;
5687 --
5688 --
5689 hr_utility.set_location(' Leaving:'||l_proc, 70);
5690 --
5691 EXCEPTION
5692 --
5693 WHEN hr_api.validate_enabled THEN
5694 --
5695 -- As the Validate_Enabled exception has been raised
5696 -- we must rollback to the savepoint
5697 --
5698 ROLLBACK TO create_company_cost_center;
5699 --
5700 -- Only set output warning arguments
5701 -- (Any key or derived arguments must be set to null
5702 -- when validation only mode is being used.)
5703 --
5704 -- Set OUT parameters.
5705 p_ori_org_information_id := null;
5706 p_ori_object_version_number := null;
5707 p_org_information_id := null;
5708 p_object_version_number := null;
5709 hr_utility.set_location(' Leaving:'||l_proc, 80);
5710 WHEN OTHERS THEN
5711 --
5712 -- A validation or unexpected error has occurred
5713 ROLLBACK TO create_company_cost_center;
5714 -- Set OUT parameters.
5715 p_ori_org_information_id := null;
5716 p_ori_object_version_number := null;
5717 p_org_information_id := null;
5718 p_object_version_number := null;
5719 hr_utility.set_location(' Leaving:'||l_proc, 90);
5720 RAISE;
5721 --
5722 END create_company_cost_center;
5723 --
5724 --------------------------------------------------------------------------------
5725 PROCEDURE set_translation_globals(p_business_group_id IN NUMBER,
5726 p_legislation_code IN VARCHAR2) IS
5727 BEGIN
5728 g_business_group_id := p_business_group_id;
5729 g_legislation_code := p_legislation_code;
5730 END;
5731 --
5732 --------------------------------------------------------------------------------
5733 --
5734 -- ----------------------------------------------------------------------------
5735 -- |----------------------< create_not_usable_ou_internal >-------------------|
5736 -- ----------------------------------------------------------------------------
5737 --
5738 PROCEDURE create_not_usable_ou_internal
5739 (p_validate IN BOOLEAN DEFAULT FALSE
5740 ,p_effective_date IN DATE
5741 ,p_language_code IN VARCHAR2 DEFAULT HR_API.userenv_lang
5742 ,p_business_group_id IN NUMBER
5743 ,p_date_from IN DATE
5744 ,p_name IN VARCHAR2
5745 ,p_type IN VARCHAR2
5746 ,p_internal_external_flag IN VARCHAR2
5747 ,p_location_id IN NUMBER
5748 ,p_ledger_id IN VARCHAR2 DEFAULT NULL
5749 ,p_default_legal_context IN VARCHAR2 DEFAULT NULL
5750 ,p_short_code IN VARCHAR2 DEFAULT NULL
5751 ,p_organization_id OUT NOCOPY NUMBER
5752 ,p_object_version_number OUT NOCOPY NUMBER ) IS
5753 --
5754 -- Declare cursors and local variables
5755 --
5756 l_proc VARCHAR2(72) := g_package||'create_not_usable_ou_internal';
5757 l_organization_id hr_all_organization_units.organization_id%TYPE;
5758 l_object_version_number hr_all_organization_units.object_version_number%TYPE;
5759 l_language_code hr_all_organization_units_tl.language%TYPE;
5760 l_org_information_id hr_organization_information.org_information_id%TYPE;
5761 l_date_from DATE;
5762 --
5763 BEGIN
5764 --
5765 hr_utility.set_location('Entering:'|| l_proc, 10);
5766 --
5767 -- Issue a savepoint
5768 --
5769 savepoint create_not_usable_ou_internal;
5770 --
5771 hr_utility.set_location(l_proc, 15);
5772 --
5773 -- All date input parameters must be truncated to remove time elements
5774 --
5775 l_date_from := trunc (p_date_from);
5776 --
5777 -- Validate language parameter. l_language_code should be passed to functions
5778 -- instead of p_language_code from now on to allow IN OUT param to be passed.
5779 --
5780 l_language_code := p_language_code;
5781 hr_api.validate_language_code(p_language_code => l_language_code);
5782 --
5783 hr_utility.set_location(l_proc, 20);
5784 --
5785 -- Process Logic
5786 --
5787 hr_organization_api.create_organization(
5788 p_validate => p_validate
5789 ,p_effective_date => p_effective_date
5790 ,p_language_code => p_language_code
5791 ,p_business_group_id => p_business_group_id
5792 ,p_date_from => l_date_from
5793 ,p_name => p_name
5794 ,p_internal_external_flag => p_internal_external_flag
5795 ,p_type => p_type
5796 ,p_location_id => p_location_id
5797 ,p_organization_id => l_organization_id
5798 ,p_object_version_number => l_object_version_number);
5799 --
5800 create_org_class_internal(
5801 p_validate => p_validate
5802 ,p_effective_date => p_effective_date
5803 ,p_organization_id => l_organization_id
5804 ,p_org_classif_code => 'OPERATING_UNIT'
5805 ,p_org_information_id => l_org_information_id
5806 ,p_object_version_number => l_object_version_number);
5807 --
5808 hr_organization_api.create_org_information(
5809 p_validate => p_validate
5810 ,p_effective_date => p_effective_date
5811 ,p_organization_id => l_organization_id
5812 ,p_org_info_type_code => 'Operating Unit Information'
5813 ,p_org_information2 => p_default_legal_context --p_legal_entity_id
5814 ,p_org_information3 => p_ledger_id --p_set_of_books_id
5815 ,p_org_information5 => p_short_code
5816 ,p_org_information6 => 'N' --Usable N=Not Usable
5817 ,p_org_information_id => l_org_information_id
5818 ,p_object_version_number => l_object_version_number);
5819 --
5820 hr_utility.set_location(l_proc, 70);
5821 --
5822 -- When in validation only mode raise the Validate_Enabled exception
5823 --
5824 IF p_validate THEN
5825 RAISE hr_api.validate_enabled;
5826 END IF;
5827 --
5828 -- Set all output arguments
5829 --
5830 p_organization_id := l_organization_id;
5831 p_object_version_number := l_object_version_number;
5832 --
5833 hr_utility.set_location(' Leaving:'||l_proc, 80);
5834 --
5835 EXCEPTION
5836 --
5837 WHEN hr_api.validate_enabled THEN
5838 --
5839 -- As the Validate_Enabled exception has been raised
5840 -- we must rollback to the savepoint
5841 --
5842 ROLLBACK TO create_not_usable_ou_internal;
5843 --
5844 -- Only set output warning arguments
5845 -- (Any key or derived arguments must be set to null
5846 -- when validation only mode is being used.)
5847 --
5848 p_organization_id := NULL;
5849 p_object_version_number := NULL;
5850 hr_utility.set_location(' Leaving:'||l_proc, 80);
5851 WHEN OTHERS THEN
5852 --
5853 -- A validation or unexpected error has occurred
5854 ROLLBACK TO create_not_usable_ou_internal;
5855 -- Set OUT parameters
5856 p_organization_id := NULL;
5857 p_object_version_number := NULL;
5858 hr_utility.set_location(' Leaving:'||l_proc, 90);
5859 RAISE;
5860 --
5861 END create_not_usable_ou_internal;
5862 --------------------------------------------------------------------------------
5863 --
5864 END hr_organization_api;