DBA Data[Home] [Help]

PACKAGE: APPS.HR_API

Source


4   --
1 Package Hr_Api AUTHID CURRENT_USER As
2 /* $Header: hrapiapi.pkh 120.0.12010000.1 2008/07/27 21:42:36 appldev ship $ */
3 --
5   -- Exception Handlers
6   --
7   Object_Locked			Exception;
8   Validate_Enabled		Exception;
9   Argument_Changed		Exception;
10   Check_Integrity_Violated	Exception;
11   Parent_Integrity_Violated	Exception;
12   Child_Integrity_Violated	Exception;
13   Unique_Integrity_Violated     Exception;
14   Cannot_Find_Prog_Unit         Exception;
15   --
16   -- Pragmas
17   --
18   Pragma Exception_Init(Object_Locked, -0054);
19   Pragma Exception_Init(Check_Integrity_Violated, -2290);
20   Pragma Exception_Init(Parent_Integrity_Violated, -2291);
21   Pragma Exception_Init(Child_Integrity_Violated, -2292);
22   Pragma Exception_Init(Unique_Integrity_Violated, -0001);
23   Pragma Exception_Init(Cannot_Find_Prog_Unit, -6508);
24   --
25   -- API constant system defaults
26   --
27   g_varchar2	constant varchar2(9) := '$Sys_Def$';
28   g_number	constant number      := -987123654;
29   g_date	constant date	     := to_date('01-01--4712', 'DD-MM-SYYYY');
30   --
31   -- API constant boolean values
32   g_true_num    constant number      := 1;
33   g_false_num   constant number      := 0;
34   --
35   g_insert                constant varchar2(30) := 'INSERT';
36   g_correction            constant varchar2(30) := 'CORRECTION';
37   g_update                constant varchar2(30) := 'UPDATE';
38   g_update_override       constant varchar2(30) := 'UPDATE_OVERRIDE';
39   g_update_change_insert  constant varchar2(30) := 'UPDATE_CHANGE_INSERT';
40   g_zap                   constant varchar2(30) := 'ZAP';
41   g_delete                constant varchar2(30) := 'DELETE';
42   g_future_change         constant varchar2(30) := 'FUTURE_CHANGE';
43   g_delete_next_change    constant varchar2(30) := 'DELETE_NEXT_CHANGE';
44   --
45   -- Generic constant global date defaults
46   --
47   -- NOTE: If any of these defaults should have to be changed then
48   --       please change the forms4 library keeping the default values in
49   --       sync:
50   --       Forms 4 Lib: HR_GEN
51   --        F4 Package: HR_API
52   --
53   g_eot constant date := to_date('31-12-4712', 'DD-MM-YYYY'); -- End Of Time
54   g_sot	constant date := to_date('01-01-0001', 'DD-MM-YYYY'); -- Start Of Time
55   g_sys	constant date := trunc(sysdate);                      -- System Date.
56   --
57   -- Internal hr_api globals
58   --
59   g_package constant varchar2(33) := '  hr_api.';
60   --
61   --
62 --
63   Procedure mandatory_arg_error
64             (p_api_name         in      varchar2,
65              p_argument         in      varchar2,
66              p_argument_value   in      varchar2);
67 --
68   Procedure mandatory_arg_error
69             (p_api_name         in      varchar2,
70              p_argument         in      varchar2,
71              p_argument_value   in      date);
72 --
73   Procedure mandatory_arg_error
74             (p_api_name         in      varchar2,
75              p_argument         in      varchar2,
76              p_argument_value   in      number);
77 --
78   Procedure argument_changed_error
79             (p_api_name         in      varchar2,
80              p_argument         in      varchar2,
81              p_base_table       in      varchar2 default null);
82 --
83   Function hr_installed Return Boolean;
84 --
85   Function return_business_group_id
86          (p_name in      per_organization_units.name%TYPE)
87           Return per_organization_units.business_group_id%TYPE;
88 --
89   Function return_lookup_code
90          (p_meaning     in      fnd_common_lookups.meaning%TYPE default null,
91           p_lookup_type in      fnd_common_lookups.lookup_type%TYPE)
92          Return fnd_common_lookups.lookup_code%TYPE;
93 --
94 -- ----------------------------------------------------------------------------
95 -- |------------------------< set_security_group_id >-------------------------|
96 -- ----------------------------------------------------------------------------
97 -- {Start Of Comments}
98 --
99 -- Description:
100 --   Sets the given security_group_id in CLIENT_INFO. This procedure must
104 --   referencing a view which joins to HR_LOOKUPS.
101 --   be called when hr_api.validate_bus_grp_id has not been called and
102 --   where the security_group value affects data validation. For example,
103 --   this procedure must be called before using the HR_LOOKUPS view or
105 --
106 -- Prerequisites:
107 --   Security_group_id is known to exist and corresponds to the current
108 --   business group context. This procedure will not validate the
109 --   security_group_id exists.
110 --
111 -- In Parameters:
112 --   Name                           Reqd Type     Description
113 --   p_security_group_id            Yes  Number   Current security group id.
114 --                                                Ususally derived from the
115 --                                                current business group
116 --                                                context.
117 --
118 -- Post Success:
119 --   The security_group_id will be set in client_info.
120 --
121 -- Post Failure:
122 --   An error is raised if the value is not suitable for client_info.
123 --
124 -- Access Status:
125 --   Internal Development Use Only.
126 --
127 -- {End Of Comments}
128 --
129 procedure set_security_group_id
130 (p_security_group_id             in     number
131 );
132 --
133 -- ----------------------------------------------------------------------------
134 -- |-------------------------< validate_bus_grp_id >--------------------------|
135 -- ----------------------------------------------------------------------------
136 -- {Start Of Comments}
137 --
138 -- Description:
139 --   Validates the given business_group_id exists. When the ID is valid
140 --   CLIENT_INFO will also be set with the given security_group_id.
141 --
142 --   If this procedure is called before performing any lookup validation
143 --   or referencing a view which joins to HR_LOOKUPS then it is not
144 --   necessary to call hr_api.set_security_group_id as well.
145 --
146 -- Prerequisites:
147 --   None.
148 --
149 -- In Parameters:
150 --   Name                           Reqd Type     Description
151 --   p_business_group_id            Yes  Number   Business group id to
152 --                                                validate and use for
153 --                                                setting CLIENT_INFO.
154 --
155 -- Post Success:
156 --   The business_group_id is validate and CLIENT_INFO has been set
157 --   with the corresponding security_group_id.
158 --
159 -- Post Failure:
160 --   An applicantion error is raised if the business_group_id is
161 --   invalid or CLIENT_INFO cannot be set.
162 --
163 -- Access Status:
164 --   Internal Development Use Only.
165 --
166 -- {End Of Comments}
167 --
168 Procedure validate_bus_grp_id
169           (p_business_group_id in per_business_groups.business_group_id%TYPE
170           ,p_associated_column1 in varchar2 default null);
171 --
172 Function strip_constraint_name(p_errmsg in varchar2)
173          Return varchar2;
174 --
175 --
176 -- ----------------------------------------------------------------------------
177 -- |---------------------< return_concat_kf_segments >------------------------|
178 -- ----------------------------------------------------------------------------
179 -- {Start Of Comments}
180 --
181 -- Description:
182 --   Returns the display concatenated string for the segments1..30.
183 --   The function works by selecting all defined segments from the aol fnd
184 --   tables and determining if they have a value or if they are null. if null
185 --   then the concatenated segment delimiter is used.
186 --
187 -- Pre-conditions:
188 --   The id_flex_num and segments have been fully validated.
189 --
190 -- In Arguments:
191 --   p_rec
192 --
193 -- Post Success:
194 --
195 -- Post Failure:
196 --
197 -- Access Status:
198 --   Internal Development Use Only.
199 --
200 -- {End Of Comments}
201 -- ----------------------------------------------------------------------------
202 function return_concat_kf_segments
203            (p_id_flex_num    in number,
204             p_application_id in number,
205             p_id_flex_code   in varchar2,
206             p_segment1       in varchar2 default null,
207             p_segment2       in varchar2 default null,
208             p_segment3       in varchar2 default null,
209             p_segment4       in varchar2 default null,
210             p_segment5       in varchar2 default null,
211             p_segment6       in varchar2 default null,
212             p_segment7       in varchar2 default null,
213             p_segment8       in varchar2 default null,
214             p_segment9       in varchar2 default null,
215             p_segment10      in varchar2 default null,
216             p_segment11      in varchar2 default null,
217             p_segment12      in varchar2 default null,
218             p_segment13      in varchar2 default null,
219             p_segment14      in varchar2 default null,
220             p_segment15      in varchar2 default null,
221             p_segment16      in varchar2 default null,
222             p_segment17      in varchar2 default null,
223             p_segment18      in varchar2 default null,
224             p_segment19      in varchar2 default null,
225             p_segment20      in varchar2 default null,
226             p_segment21      in varchar2 default null,
227             p_segment22      in varchar2 default null,
228             p_segment23      in varchar2 default null,
229             p_segment24      in varchar2 default null,
230             p_segment25      in varchar2 default null,
231             p_segment26      in varchar2 default null,
232             p_segment27      in varchar2 default null,
233             p_segment28      in varchar2 default null,
237 --
234             p_segment29      in varchar2 default null,
235             p_segment30      in varchar2 default null)
236          return varchar2;
238 -- ----------------------------------------------------------------------------
239 -- |----------------------< not_exists_in_hr_lookups >------------------------|
240 -- ----------------------------------------------------------------------------
241 -- {Start Of Comments}
242 --
243 -- Description:
244 --   A supporting function for row handler lookup validation. Used to validate
245 --   that a non-DateTracked entity lookup code exists in hr_lookups. This
246 --   function must be used where data is within a business group context.
247 --   Returns TRUE if the lookup code does not exist at all, or it is not
248 --   enabled or it does not exist as the effective date.
249 --
250 -- Prerequisites:
251 --   client_info must be set with the security_group_id context.
252 --   lookup_type (p_lookup_type) is valid.
253 --
254 -- In Arguments:
255 --   p_effective_date
256 --   p_lookup_type
257 --   p_lookup_code
258 --
259 -- Post Success:
260 --   Returns FALSE when the lookup_code is valid.
261 --   Returns TRUE when the lookup_code is invalid. i.e. The row handler needs
262 --   to raise a specific error message.
263 --
264 -- Post Failure:
265 --   An unexpected error has occurred.
266 --
267 -- Access Status:
268 --   Internal Development Use Only.
269 --
270 -- {End Of Comments}
271 --
272 function not_exists_in_hr_lookups
273   (p_effective_date        in     date
274   ,p_lookup_type           in     varchar2
275   ,p_lookup_code           in     varchar2
276   ) return boolean;
277 --
278 -- ----------------------------------------------------------------------------
279 -- |----------------------< not_exists_in_leg_lookups >-----------------------|
280 -- ----------------------------------------------------------------------------
281 -- {Start Of Comments}
282 --
283 -- Description:
284 --   A supporting function for row handler lookup validation. Used to validate
285 --   that a non-DateTracked entity lookup code exists in hr_leg_lookups. This
286 --   function must be used where data is within a business group context and the
287 --   lookup_type has core plus or core minus lookup_values defined (i.e. has
288 --   legislation specific lookup values).
289 --   Returns TRUE if the lookup code does not exist at all, or it is not
290 --   enabled or it does not exist as the effective date.
291 --
292 -- Prerequisites:
293 --   client_info must be set with the security_group_id context.
294 --   legislation code should be set in the hr_session_data application context
295 --   for the session (by calling hr_api.set_application_context).
296 --   lookup_type (p_lookup_type) is valid.
297 --
298 -- In Arguments:
299 --   p_effective_date
300 --   p_lookup_type
301 --   p_lookup_code
302 --
303 -- Post Success:
304 --   Returns FALSE when the lookup_code is valid.
305 --   Returns TRUE when the lookup_code is invalid. i.e. The row handler needs
306 --   to raise a specific error message.
307 --
308 -- Post Failure:
309 --   An unexpected error has occurred.
310 --
311 -- Access Status:
312 --   Internal Development Use Only.
313 --
314 -- {End Of Comments}
315 --
316 function not_exists_in_leg_lookups
317   (p_effective_date        in     date
318   ,p_lookup_type           in     varchar2
319   ,p_lookup_code           in     varchar2
320   ) return boolean;
321 --
322 -- ----------------------------------------------------------------------------
323 -- |---------------------< not_exists_in_hrstanlookups >----------------------|
324 -- ----------------------------------------------------------------------------
325 -- {Start Of Comments}
326 --
327 -- Description:
328 --   A supporting function for row handler lookup validation. Used to validate
329 --   that a non-DateTracked entity lookup code exists in hr_standard_lookups.
330 --   This function must be used where data is outside of a business group
331 --   context. Returns TRUE if the lookup code does not exist at all, or it is
332 --   not enabled or it does not exist as the effective date.
333 --
334 -- Prerequisites:
335 --   lookup_type (p_lookup_type) is valid.
336 --
337 -- In Arguments:
338 --   p_effective_date
339 --   p_lookup_type
340 --   p_lookup_code
341 --
342 -- Post Success:
343 --   Returns FALSE when the lookup_code is valid.
344 --   Returns TRUE when the lookup_code is invalid. i.e. The row handler needs
345 --   to raise a specific error message.
346 --
347 -- Post Failure:
348 --   An unexpected error has occurred.
349 --
350 -- Access Status:
351 --   Internal Development Use Only.
352 --
353 -- {End Of Comments}
354 --
355 function not_exists_in_hrstanlookups
356   (p_effective_date        in     date
357   ,p_lookup_type           in     varchar2
358   ,p_lookup_code           in     varchar2
359   ) return boolean;
360 --
361 -- ----------------------------------------------------------------------------
362 -- |---------------------< not_exists_in_fnd_lookups >------------------------|
363 -- ----------------------------------------------------------------------------
364 -- {Start Of Comments}
365 --
366 -- Description:
367 --   A supporting function for row handler lookup validation. Used to validate
368 --   that a non-DateTracked entity lookup code exists in fnd_lookups. Returns
369 --   TRUE if the lookup code does not exist at all, or it is not enabled or it
370 --   does not exist as the effective date.
371 --
372 -- Prerequisites:
373 --   lookup_type (p_lookup_type) is valid.
374 --
378 --   p_lookup_code
375 -- In Arguments:
376 --   p_effective_date
377 --   p_lookup_type
379 --
380 -- Post Success:
381 --   Returns FALSE when the lookup_code is valid.
382 --   Returns TRUE when the lookup_code is invalid. i.e. The row handler needs
383 --   to raise a specific error message.
384 --
385 -- Post Failure:
386 --   An unexpected error has occurred.
387 --
388 -- Access Status:
389 --   Internal Development Use Only.
390 --
391 -- {End Of Comments}
392 --
393 function not_exists_in_fnd_lookups
394   (p_effective_date        in     date
395   ,p_lookup_type           in     varchar2
396   ,p_lookup_code           in     varchar2
397   ) return boolean;
398 --
399 -- ----------------------------------------------------------------------------
400 -- |--------------------< not_exists_in_dt_hr_lookups >-----------------------|
401 -- ----------------------------------------------------------------------------
402 -- {Start Of Comments}
403 --
404 -- Description:
405 --   A supporting function for row handler lookup validation. Used to validate
406 --   that a DateTracked entity lookup code exists in hr_lookups. This function
407 --   must be used where data is within a business group context. Returns
408 --   TRUE if the lookup code does not exist at all, or it is not enabled or it
409 --   does not exist as the effective date.
410 --
411 -- Prerequisites:
412 --   client_info must be set with the security_group_id context.
413 --   lookup_type (p_lookup_type) is valid.
414 --
415 -- In Arguments:
416 --   p_effective_date
417 --   p_validation_start_date
418 --   p_validation_end_date
419 --   p_lookup_type
420 --   p_lookup_code
421 --
422 -- Post Success:
423 --   Returns FALSE when the lookup_code is valid.
424 --   Returns TRUE when the lookup_code is invalid. i.e. The row handler needs
425 --   to raise a specific error message.
426 --
427 -- Post Failure:
428 --   An unexpected error has occurred.
429 --
430 -- Access Status:
431 --   Internal Development Use Only.
432 --
433 -- {End Of Comments}
434 --
435 function not_exists_in_dt_hr_lookups
436   (p_effective_date        in     date
437   ,p_validation_start_date in     date
438   ,p_validation_end_date   in     date
439   ,p_lookup_type           in     varchar2
440   ,p_lookup_code           in     varchar2
441   ) return boolean;
442 --
443 -- ----------------------------------------------------------------------------
444 -- |--------------------- not_exists_in_dt_leg_lookups >----------------------|
445 -- ----------------------------------------------------------------------------
446 -- {Start Of Comments}
447 --
448 -- Description:
449 --   A supporting function for row handler lookup validation. Used to validate
450 --   that a DateTracked entity lookup code exists in hr_leg_lookups. This
451 --   function must be used where data is within a business group context and the
452 --   lookup_type has core plus or core minus lookup_values defined (i.e. has
453 --   legislation specific lookup values).
454 --   Returns TRUE if the lookup code does not exist at all, or it is not enabled or it
455 --   does not exist as the effective date.
456 --
457 -- Prerequisites:
458 --   client_info must be set with the security_group_id context.
459 --   legislation code should be set in the hr_session_data application context
460 --   for the session (by calling hr_api.set_application_context).
461 --   lookup_type (p_lookup_type) is valid.
462 --
463 -- In Arguments:
464 --   p_effective_date
465 --   p_validation_start_date
466 --   p_validation_end_date
467 --   p_lookup_type
468 --   p_lookup_code
469 --
470 -- Post Success:
471 --   Returns FALSE when the lookup_code is valid.
472 --   Returns TRUE when the lookup_code is invalid. i.e. The row handler needs
473 --   to raise a specific error message.
474 --
475 -- Post Failure:
476 --   An unexpected error has occurred.
477 --
478 -- Access Status:
479 --   Internal Development Use Only.
480 --
481 -- {End Of Comments}
482 --
483 function not_exists_in_dt_leg_lookups
484   (p_effective_date        in     date
485   ,p_validation_start_date in     date
486   ,p_validation_end_date   in     date
487   ,p_lookup_type           in     varchar2
488   ,p_lookup_code           in     varchar2
489   ) return boolean;
490 --
491 -- ----------------------------------------------------------------------------
492 -- |-------------------< not_exists_in_dt_hrstanlookups >---------------------|
493 -- ----------------------------------------------------------------------------
494 -- {Start Of Comments}
495 --
496 -- Description:
497 --   A supporting function for row handler lookup validation. Used to validate
498 --   that a DateTracked entity lookup code exists in hr_standard_lookups.
499 --   This function must be used where data is outside a business group
500 --   context. Returns TRUE if the lookup code does not exist at all, or it is
501 --   not enabled or it does not exist as the effective date.
502 --
503 -- Prerequisites:
504 --   lookup_type (p_lookup_type) is valid.
505 --
506 -- In Arguments:
507 --   p_effective_date
508 --   p_validation_start_date
509 --   p_validation_end_date
510 --   p_lookup_type
511 --   p_lookup_code
512 --
513 -- Post Success:
514 --   Returns FALSE when the lookup_code is valid.
515 --   Returns TRUE when the lookup_code is invalid. i.e. The row handler needs
516 --   to raise a specific error message.
517 --
518 -- Post Failure:
519 --   An unexpected error has occurred.
523 --
520 --
521 -- Access Status:
522 --   Internal Development Use Only.
524 -- {End Of Comments}
525 --
526 function not_exists_in_dt_hrstanlookups
527   (p_effective_date        in     date
528   ,p_validation_start_date in     date
529   ,p_validation_end_date   in     date
530   ,p_lookup_type           in     varchar2
531   ,p_lookup_code           in     varchar2
532   ) return boolean;
533 --
534 -- ----------------------------------------------------------------------------
535 -- |--------------------< not_exists_in_dt_fnd_lookups >----------------------|
536 -- ----------------------------------------------------------------------------
537 -- {Start Of Comments}
538 --
539 -- Description:
540 --   A supporting function for row handler lookup validation. Used to validate
541 --   that a DateTracked entity lookup code exists in fnd_lookups. Returns
542 --   TRUE if the lookup code does not exist at all, or it is not enabled or it
543 --   does not exist as the effective date.
544 --
545 -- Prerequisites:
546 --   lookup_type (p_lookup_type) is valid.
547 --
548 -- In Arguments:
549 --   p_effective_date
550 --   p_validation_start_date
551 --   p_validation_end_date
552 --   p_lookup_type
553 --   p_lookup_code
554 --
555 -- Post Success:
556 --   Returns FALSE when the lookup_code is valid.
557 --   Returns TRUE when the lookup_code is invalid. i.e. The row handler needs
558 --   to raise a specific error message.
559 --
560 -- Post Failure:
561 --   An unexpected error has occurred.
562 --
563 -- Access Status:
564 --   Internal Development Use Only.
565 --
566 -- {End Of Comments}
567 --
568 function not_exists_in_dt_fnd_lookups
569   (p_effective_date        in     date
570   ,p_validation_start_date in     date
571   ,p_validation_end_date   in     date
572   ,p_lookup_type           in     varchar2
573   ,p_lookup_code           in     varchar2
574   ) return boolean;
575 --
576 -- ----------------------------------------------------------------------------
577 -- |-----------------------< cannot_find_prog_unit_error >--------------------|
578 -- ----------------------------------------------------------------------------
579 -- {Start Of Comments}
580 --
581 -- Description:
582 --   This procedure should be called when the "hr_api.Cannot_Find_Prog_Unit"
583 --   exception has been raised by a call to an API user hook package
584 --   procedure. This procedure will raise a more specific application error
585 --   message.
586 --
587 -- Prerequisites:
588 --   The "hr_api.Cannot_Find_Prog_Unit" exception has been raised.
589 --   The p_module_name parameter should be set to the same module_name value
590 --   as the corresponding row in the HR_API_MODULES table.
591 --   The p_hook_type parameter should be set to the same api_hook_type value
592 --   as the corresponding row in the HR_API_HOOKS table.
593 --
594 -- In Parameters:
595 --   Name                           Reqd Type     Description
596 --   p_module_name                  Yes  varchar2 Name of the API module to be
597 --                                                included in the error text.
598 --   p_hook_type                    Yes  varchar2 Internal code for the type
599 --                                                of API hook.
600 --
601 -- Post Success:
602 --   Raises a PL/SQL exception with an application specific error message.
603 --
604 -- Post Failure:
605 --   Raises a PL/SQL exception with an application specific error message.
606 --
607 -- Access Status:
608 --   Internal Development Use Only.
609 --
610 -- {End Of Comments}
611 --
612 procedure cannot_find_prog_unit_error
613   (p_module_name                   in     varchar2
614   ,p_hook_type                     in     varchar2
615   );
616 --
617 -- ----------------------------------------------------------------------------
618 -- |---------------------------< return_commit_unit >-------------------------|
619 -- ----------------------------------------------------------------------------
620 -- {Start Of Comments}
621 --
622 -- Description:
623 --   Assigns and returns a number which is used to used to represent the
624 --   current commit unit. This function is used in conjunction with the
625 --   validate_commit_unit procedure to detect when a commit or full rollback
626 --   has been issued as part of legislation / vertical market or customer
627 --   specific API user hook logic.
628 --
629 -- Prerequisites:
630 --   None
631 --
632 -- In Parameters:
633 --   None
634 --
635 -- Post Success:
636 --   Assigns and returns a number which represents the current commit unit.
637 --
638 -- Post Failure:
639 --   A PL/SQL exception is raised. The function will abort without returning
640 --   a number value.
641 --
642 -- Access Status:
643 --   Internal Development Use Only.
644 --
645 -- {End Of Comments}
646 --
647 function return_commit_unit return number;
648 --
649 -- ----------------------------------------------------------------------------
650 -- |--------------------------< validate_commit_unit >------------------------|
651 -- ----------------------------------------------------------------------------
652 -- {Start Of Comments}
653 --
654 -- Description:
655 --   This procedure is used in conjunction with the return_commit_unit
656 --   function to detect when a commit or full rollback has been issued as
657 --   part of legislation / vertical market or customer specific API user hook
658 --   logic.
659 --
660 -- Prerequisites:
664 --   as the corresponding row in the HR_API_MODULES table.
661 --   The return_commit_unit function should have been called at least once for
662 --   the current database session.
663 --   The p_module_name parameter should be set to the same module_name value
665 --   The p_hook_type parameter should be set to the same api_hook_type value
666 --   as the corresponding row in the HR_API_HOOKS table.
667 --
668 -- In Parameters:
669 --   Name                           Reqd Type     Description
670 --   p_commit_unit_number           Yes  number   The value which was returned
671 --                                                by the last call to the
672 --                                                return_commit_unit function.
673 --                                                i.e. What the hook package
674 --                                                thinks is the current commit
675 --                                                unit number.
676 --   p_module_name                  Yes  varchar2 Name of the API module to be
677 --                                                included in the error text.
678 --   p_hook_type                    Yes  varchar2 Internal code for the type
679 --                                                of API hook.
680 --
681 -- Post Success:
682 --   When the current commit unit number matches p_commit_unit_number this
683 --   procedure ends normally.
684 --
685 -- Post Failure:
686 --   When the current commit unit number does not match p_commit_unit_number
687 --   a commit or full rollback must have been issued since the
688 --   return_commit_unit function was called. An PL/SQL exception is raised
689 --   with an application error message.
690 --
691 -- Access Status:
692 --   Internal Development Use Only.
693 --
694 -- {End Of Comments}
695 --
696 procedure validate_commit_unit
697   (p_commit_unit_number            in     number
698   ,p_module_name                   in     varchar2
699   ,p_hook_type                     in     varchar2
700   );
701 --
702 -- ----------------------------------------------------------------------------
703 -- |-----------------------------< customer_hooks >---------------------------|
704 -- ----------------------------------------------------------------------------
705 -- {Start Of Comments}
706 --
707 -- Description:
708 --   Allows Oracle applications support and the HR Development group to switch
709 --   off all customer specific API user hook logic for the current database
710 --   session. Customers must not call this procedure without authorisation
711 --   from Oracle.
712 --
713 -- Prerequisites:
714 --   The p_mode parameter must be set to 'DISABLE' or 'ENABLE'.
715 --
716 -- In Parameters:
717 --   Name                           Reqd Type     Description
718 --   p_mode                         Yes  varchar2 Indicates if customer
719 --                                                specific API user hook logic
720 --                                                should be called.
721 --
722 -- Post Success:
723 --   Customer specific API user hook logic is either disabled or enabled.
724 --
725 -- Post Failure:
726 --   A PL/SQL exception with an application error message is raised if p_mode
727 --   is not set to a valid value.
728 --
729 -- Access Status:
730 --   Internal Development Use Only.
731 --
732 -- {End Of Comments}
733 --
734 procedure customer_hooks
735   (p_mode                          in     varchar2
736   );
737 --
738 -- ----------------------------------------------------------------------------
739 -- |---------------------------< legislation_hooks >--------------------------|
740 -- ----------------------------------------------------------------------------
741 -- {Start Of Comments}
742 --
743 -- Description:
744 --   Allows Oracle applications support and the HR Development group to switch
745 --   off all legislation and vertical market specific API user hook logic.
746 --   Only the current database session is affected. Customers must not call
747 --   this procedure without authorisation from Oracle.
748 --
749 -- Prerequisites:
750 --   The p_mode parameter must be set to 'DISABLE' or 'ENABLE'.
751 --
752 -- In Parameters:
753 --   Name                           Reqd Type     Description
754 --   p_mode                         Yes  varchar2 Indicates if legislation and
755 --                                                vertical market specific API
756 --                                                user hook logic should be
757 --                                                called.
758 --
759 -- Post Success:
760 --   Legislation and vertical market specific API user hook logic is either
761 --   disabled or enabled.
762 --
763 -- Post Failure:
764 --   A PL/SQL exception with an application error message is raised if p_mode
765 --   is not set to a valid value.
766 --
767 -- Access Status:
768 --   Internal Development Use Only.
769 --
770 -- {End Of Comments}
771 --
772 procedure legislation_hooks
773   (p_mode                          in     varchar2
774   );
775 --
776 -- ----------------------------------------------------------------------------
777 -- |--------------------------< application_hooks >---------------------------|
778 -- ----------------------------------------------------------------------------
779 -- {Start Of Comments}
780 --
781 -- Description:
782 --   Allows Oracle applications support and the HR Development group to switch
783 --   off all Application specific API user hook logic.
784 --   Only the current database session is affected. Customers must not call
785 --   this procedure without authorisation from Oracle.
786 --
790 -- In Parameters:
787 -- Prerequisites:
788 --   The p_mode parameter must be set to 'DISABLE' or 'ENABLE'.
789 --
791 --   Name                           Reqd Type     Description
792 --   p_mode                         Yes  varchar2 Indicates if application
793 --                                                specific API user hook logic
794 --                                                should be called.
795 --
796 -- Post Success:
797 --   Application specific user hook logic is either disabled or enabled.
798 --
799 -- Post Failure:
800 --   A PL/SQL exception with an application error message is raised if p_mode
801 --   is not set to a valid value.
802 --
803 -- Access Status:
804 --   Internal Development Use Only.
805 --
806 -- {End Of Comments}
807 --
808 procedure application_hooks
809   (p_mode                          in     varchar2
810   );
811 --
812 -- ----------------------------------------------------------------------------
813 -- |------------------------------< call_cus_hooks >--------------------------|
814 -- ----------------------------------------------------------------------------
815 -- {Start Of Comments}
816 --
817 -- Description:
818 --   Indicates if customer specific API user hook logic will be executed.
819 --
820 -- Prerequisites:
821 --   None
822 --
823 -- In Parameters:
824 --   None
825 --
826 -- Post Success:
827 --   Returns TRUE when custom specific API user hook logic will be executed.
828 --   Otherwise FALSE is returned.
829 --
830 -- Post Failure:
831 --
832 --
833 -- Access Status:
834 --   Internal Development Use Only.
835 --
836 -- {End Of Comments}
837 --
838 function call_cus_hooks return boolean;
839 --
840 -- ----------------------------------------------------------------------------
841 -- |----------------------------< call_leg_hooks >----------------------------|
842 -- ----------------------------------------------------------------------------
843 -- {Start Of Comments}
844 --
845 -- Description:
846 --   Indicates if legislation and vertical market specific API user hook logic
847 --   will be executed.
848 --
849 -- Prerequisites:
850 --   None
851 --
852 -- In Parameters:
853 --   None
854 --
855 -- Post Success:
856 --   Returns TRUE when legislation and vertical market specific API user hook
857 --   logic will be executed. Otherwise FALSE is returned.
858 --
859 -- Post Failure:
860 --
861 --
862 -- Access Status:
863 --   Internal Development Use Only.
864 --
865 -- {End Of Comments}
866 --
867 function call_leg_hooks return boolean;
868 --
869 -- ----------------------------------------------------------------------------
870 -- |----------------------------< call_app_hooks >----------------------------|
871 -- ----------------------------------------------------------------------------
872 -- {Start Of Comments}
873 --
874 -- Description:
875 --   Indicates if Application specific API user hook logic will be executed.
876 --
877 -- Prerequisites:
878 --   None
879 --
880 -- In Parameters:
881 --   None
882 --
883 -- Post Success:
884 --   Returns TRUE when Application specific API user hook
885 --   logic will be executed. Otherwise FALSE is returned.
886 --
887 -- Post Failure:
888 --
889 -- Access Status:
890 --   Internal Development Use Only.
891 --
892 -- {End Of Comments}
893 --
894 function call_app_hooks return boolean;
895 --
896 -- ----------------------------------------------------------------------------
897 -- |-------------------------< return_legislation_code >----------------------|
898 -- ----------------------------------------------------------------------------
899 -- {Start Of Comments}
900 --
901 -- Description:
902 --   Returns the legislation_code for a specific business group. If the
903 --   business_group_id is the same as the last call to this function the
904 --   legislation_code is returned without selecting a value from the database.
905 --
906 -- Prerequisites:
907 --   p_business_group_id should represent a business group which is known to
908 --   exist in the system.
909 --
910 -- In Parameters:
911 --   Name                           Reqd Type     Description
912 --   p_business_group_id            Yes  Number   Identifies a specific
913 --                                                business group.
914 --
915 -- Post Success:
916 --   When p_business_group_id is not null returns the legislation_code which
917 --   corresponds to the business_group_id.
918 --   When p_business_group_id is null returns null.
919 --
920 -- Post Failure:
921 --   An application error message is raised if the business_group_id does not
922 --   exist.
923 --
924 -- Access Status:
925 --   Internal Development Use Only.
926 --
927 -- {End Of Comments}
928 --
929 function return_legislation_code
930   (p_business_group_id             in     number
931   ) return varchar2;
932 --
933 --pragma restrict_references(return_legislation_code, WNDS);
934 --
935 -- ----------------------------------------------------------------------------
936 -- |---------------------------< userenv_lang >-------------------------------|
937 -- ----------------------------------------------------------------------------
938 -- {Start Of Comments}
939 --
940 -- Description:
941 --   Returns the value obtained by select userenv('LANG') from dual;
942 --
943 -- Prerequisites:
944 --   None.
945 --
946 -- In Parameters:
947 --   None.
948 --
949 -- Post Success:
950 --   The value from userenv('LANG') is returned.
954 --
951 --
952 -- Post Failure:
953 --   An application error is raised when the select statement fails.
955 -- Access Status:
956 --   Public.
957 --
958 -- {End Of Comments}
959 --
960 function userenv_lang return varchar2;
961 --
962 -- ----------------------------------------------------------------------------
963 -- |------------------------< validate_language_code >------------------------|
964 -- ----------------------------------------------------------------------------
965 -- {Start Of Comments}
966 --
967 -- Description:
968 --   Validates the specified language_code is the application base language or
969 --   an installed language. A null or hr_api.g_varchar2 value will be
970 --   ignored and userenv('LANG') will be used instead.
971 --
972 -- Prerequisites:
973 --   None.
974 --
975 -- In Parameters:
976 --   Name                           Reqd Type     Description
977 --   p_language_code                No   Varchar2 Current language for
978 --                                                translated data.
979 --
980 -- Post Success:
981 --   The language is the application base language or an installed
982 --   language. If p_language_code parameter IN value was null or
983 --   hr_api.g_varchar2 the OUT value will be set to userenv('LANG').
984 --
985 -- Post Failure:
986 --   An application error is raised when the language is not valid.
987 --
988 -- Access Status:
989 --   Internal Development Use Only.
990 --
991 -- {End Of Comments}
992 --
993 procedure validate_language_code
994 (p_language_code                 in out nocopy varchar2
995 );
996 --
997 --
998 -- ----------------------------------------------------------------------------
999 -- |-----------------------< set_legislation_context >------------------------|
1000 -- ----------------------------------------------------------------------------
1001 -- {Start Of Comments}
1002 --
1003 -- Description:
1004 --   Accepts legislation code and writes it into the LEG_CODE namespace of the
1005 --   SESSION_DATA application context. This is used to enable legislation sensitive
1006 --   switching of the lookup vales within the HR_LOOKUPS view for the current forms
1007 --   and/or API session. No validation of the legislation_code supplied is
1008 --   performed here.
1009 --
1010 -- Prerequisites:
1011 --   None.
1012 --
1013 -- In Parameters:
1014 --   Name                           Reqd Type     Description
1015 --   p_legislation_code             Yes  Varchar2 Current session's
1016 --                                                legislation code.
1017 --
1018 -- Post Success:
1019 --   The current session's legislation code is stored in the application
1020 --   context 'SESSION_DATA', within the namespace 'LEG_CODE'.
1021 --
1022 -- Post Failure:
1023 --   An application error is raised.
1024 --
1025 -- Access Status:
1026 --   Internal Development Use Only.
1027 --
1028 -- {End Of Comments}
1029 --
1030 procedure set_legislation_context
1031 (p_legislation_code        in varchar2
1032 );
1033 --
1034 -- ----------------------------------------------------------------------------
1035 -- |-----------------------< get_legislation_context >------------------------|
1036 -- ----------------------------------------------------------------------------
1037 -- {Start Of Comments}
1038 --
1039 -- Description:
1040 --   Returns the legislation code for the current API/forms session as stored
1041 --   in SESSION_DATA application context within the LEG_CODE namespace.
1042 --   (This context is used by HR_LOOKUPS view to provide legsilation sensitive
1043 --   switching of lookup values.)
1044 --
1045 -- Prerequisites:
1046 --   None.
1047 --
1048 -- In Parameters:
1049 --   Name                           Reqd Type     Description
1050 --   p_legislation_code             Yes  Varchar2 Current session's
1051 --                                                legislation code.
1052 --
1053 -- Post Success:
1054 --   The current session's legislation code is returned. (This may be null).
1055 --
1056 -- Access Status:
1057 --   Internal Development Use Only.
1058 --
1059 -- {End Of Comments}
1060 --
1061 function get_legislation_context return varchar2;
1062 --
1063 -- ----------------------------------------------------------------------------
1064 -- |-----------------------< boolean_to_constant >----------------------------|
1065 -- ----------------------------------------------------------------------------
1066 --
1067 -- Description:
1068 --  Used in the Self Service API wrappers to convert constant values to the
1069 --  appropriate boolean ones.
1070 --
1071 -- Prerequisites:
1072 --   None.
1073 --
1074 -- In Parameters:
1075 --   Name                           Reqd Type     Description
1076 --   p_constant_value               yes  boolean  Boolean value to be converted
1077 --
1078 -- Post Success:
1079 --   Function returns boolean value represented as a number.
1080 --
1081 -- Access Status:
1082 --   Internal Development Use Only.
1083 --
1084 -- {End Of Comments}
1085 --
1086 -- ----------------------------------------------------------------------------
1087 FUNCTION boolean_to_constant(p_boolean_value IN boolean) RETURN number;
1088 --
1089 -- ----------------------------------------------------------------------------
1090 -- |-----------------------< constant_to_boolean >----------------------------|
1091 -- ----------------------------------------------------------------------------
1092 --
1093 -- Description:
1094 --  Used in the Self Service API wrappers to convert constant values to the
1095 --  appropriate boolean ones.
1096 --
1097 -- Prerequisites:
1098 --   None.
1099 --
1100 -- In Parameters:
1104 -- Post Success:
1101 --   Name                           Reqd Type     Description
1102 --   p_constant_value               yes  number   Number value to be converted
1103 --
1105 --   Function returns number value represented as a boolean.
1106 --
1107 -- Access Status:
1108 --   Internal Development Use Only.
1109 --
1110 -- {End Of Comments}
1111 --
1112 -- ----------------------------------------------------------------------------
1113 FUNCTION constant_to_boolean(p_constant_value IN number) RETURN boolean;
1114 --
1115 End Hr_Api;