1 package body FND_CONTEXT as
2 /* $Header: AFSCCTXB.pls 115.0 2003/09/24 20:10:21 rsheh noship $ */
3
4
5 --
6 -- GENERIC_ERROR (Internal)
7 --
8 -- Set error message and raise exception for unexpected sql errors
9 --
10 procedure GENERIC_ERROR(routine in varchar2,
11 errcode in number,
12 errmsg in varchar2) is
13 begin
14 fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
15 fnd_message.set_token('ROUTINE', routine);
16 fnd_message.set_token('ERRNO', errcode);
17 fnd_message.set_token('REASON', dbms_utility.format_error_stack);
18 fnd_message.raise_error;
19 end GENERIC_ERROR;
20
21 -- Init (PUBLIC)
22 -- This is generic routine to initialize attribute value inside a given
23 -- context which its namespace must be created prior than calling this
24 -- routine.
25 --
26 -- Context Areas are defined, and associated with an initialization
27 -- package/procedure, using the CREATE CONTEXT command.
28 -- For example, "CREATE CONTEXT XXX using FND_CONTEXT"
29 -- XXX will be the context name and FND_CONTEXT is the package.
30 --
31 -- It calls dbms.session.set_context to set one attribute base on its name
32 -- and value pair.
33 --
34 -- Input
35 -- context_name: the name of the context area.(VARCHAR2)
36 -- attr_name: the name of the attribute. (VARCHAR2)
37 -- attr_value: the value of the attribute (VARCHAR2)
38 --
39 -- Usage Example:
40 -- CREATE CONTEXT PO using FND_CONTEXT;
41 -- begin fnd_context.init('PO', 'my_name', 'my_value'); end;
42 --
43 procedure init(context_name in varchar2,
44 attr_name in varchar2,
45 attr_value in varchar2) is
46 begin
47
48 dbms_session.set_context(context_name, attr_name, attr_value);
49
50 exception
51 when others then
52 generic_error('FND_CONTEXT.INIT', SQLCODE, SQLERRM);
53 end init;
54
55 end FND_CONTEXT;