1 PACKAGE PO_MOAC_UTILS_PVT AS
2 /*$Header: POXVMOUS.pls 120.3 2006/08/23 08:17:41 arudas noship $*/
3
4 -----------------------------------------------------------------------------
5 -- Public variables
6 -----------------------------------------------------------------------------
7
8 -- Document types
9
10 g_doc_type_REQUISITION CONSTANT
11 PO_DOCUMENT_TYPES.document_type_code%TYPE
12 := 'REQUISITION'
13 ;
14 g_doc_type_PO CONSTANT
15 PO_DOCUMENT_TYPES.document_type_code%TYPE
16 := 'PO'
17 ;
18 g_doc_type_PA CONSTANT
19 PO_DOCUMENT_TYPES.document_type_code%TYPE
20 := 'PA'
21 ;
22 g_doc_type_RELEASE CONSTANT
23 PO_DOCUMENT_TYPES.document_type_code%TYPE
24 := 'RELEASE'
25 ;
26
27
28 -- Document levels
29
30 g_doc_level_HEADER CONSTANT
31 VARCHAR2(30)
32 := 'HEADER'
33 ;
34 g_doc_level_LINE CONSTANT
35 VARCHAR2(30)
36 := 'LINE'
37 ;
38 g_doc_level_SHIPMENT CONSTANT
39 VARCHAR2(30)
40 := 'SHIPMENT'
41 ;
42 g_doc_level_DISTRIBUTION CONSTANT
43 VARCHAR2(30)
44 := 'DISTRIBUTION'
45 ;
46
47
48 /* ===========================================================================
49 PROCEDURE NAME: set_org_context ( p_org_id NUMBER DEFAULT NULL )
50
51 DESCRIPTION : This procedure would be used to set the Org Context.
52 This procedure replaces setting of ORG Context using FND CLIENT INFO
53 or DBMS APPLICATION INFO calls. This procedure first checks if the
54 global temp table is already populated or not, if it is not populated
55 it would invoke initialize routine and then set the org context to
56 single and set current ou to the p_org_id.
57
58
59 CLIENT/SERVER : SERVER
60
61 LIBRARY NAME :
62
63 OWNER : Kirti Pal Singh
64
65 PARAMETERS : p_org_id NUMBER
66
67 ALGORITHM : Check for the current orgid. If p_org_id does not match with the
68 current org_id call the initialize routine.
69 Then set the policy context to the p_org_id.
70
71 NOTES :
72
73 =========================================================================== */
74
75 PROCEDURE set_org_context
76 (
77 p_org_id IN NUMBER DEFAULT NULL
78 );
79
80 /* ============================================================================
81 Procedure Name: PROCEDURE mo_init
82
83 DESCRIPTION : New procedure added for MOAC. This procedure would be invoked by Public APIs
84 to initialize proper multi-org context.
85
86 CLIENT/SERVER : SERVER
87
88 LIBRARY NAME :
89
90 OWNER : Kirti Pal Singh
91
92 PARAMETERS : p_org_id NUMBER
93
94 ALGORITHM : This procedure would be invoked by Public APIs to initialize
95 proper multi-org context. This procedure checks if the P_ORG_ID
96 passed is valid or not using get_valid_org function. If it is not
97 valid then error is thrown, else OU context is set to Single and
98 current OU is set to P_ORG_ID. If p_org_id is NULL, then the
99 get_valid_org routine would derive either current OU or default
100 OU and return this value. Again context is set to single and
101 current OU is set to the value returned from get_valid_org if
102 there is no existing context(in case of default OU).
103
104 NOTES :
105 =========================================================================== */
106 PROCEDURE MO_INIT
107 (
108 p_org_id IN NUMBER DEFAULT NULL
109 );
110
111 FUNCTION GET_CURRENT_ORG_ID
112 RETURN NUMBER;
113 --
114 -- This function would return the ORG ID set for the current session
115 -- if the context is set to Single, for Multi-context this function
116 -- would return NULL. This function is a wrapper that makes call to
117 -- MO_GLOBAL.GET_CURRENT_ORG_ID
118 --
119
120 FUNCTION GET_OU_NAME
121 (
122 p_org_id IN NUMBER
123 )
124 RETURN VARCHAR2;
125 --
126 -- This function would return OU Name for the ORG_ID passed.
127 -- If the ORG_ID is NULL or invalid, it would return NULL
128 -- This function is a wrapper that makes call to MO_GLOBAL.GET_OU_NAME
129 --
130
131 FUNCTION GET_OU_COUNT
132 RETURN NUMBER;
133 --
134 -- This function would return count of Operating Units a user has access to.
135 -- It would return 0 in case there is no access or context is not set. This
136 -- function is a wrapper that makes call to MO_GLOBAL.GET_OU_COUNT
137 --
138
139 PROCEDURE GET_DEFAULT_OU
140 (
141 x_default_org_id OUT NOCOPY NUMBER,
142 x_default_ou_name OUT NOCOPY VARCHAR2,
143 x_ou_count OUT NOCOPY NUMBER
144 );
145 --
146 -- This procedure should be used to get the default operating unit for a user
147 -- This is a wrapper procedure that invokes call to MO_UTILS.GET_DEFAULT_OU
148 --
149
150 FUNCTION GET_VALID_ORG
151 (
152 p_org_id IN NUMBER
153 )
154 RETURN NUMBER;
155 --
156 -- This function should be used to determine and get valid operating unit. This function
157 -- checks if the p_org_id that is passed exists in the global temporary table or not. If it
158 -- does not exist, then it would throw up error. Before calling this function, global temp
159 -- table should be populated using MO initialization routine.
160 -- If the passed org_id exists in the global temporary table, then same is returned. If the
161 -- p_org_Id is NULL, this function tries to retrieve current org id or gets the default
162 -- operating unit
163 --
164
165 PROCEDURE INITIALIZE;
166 --
167 -- This procedure invokes MO Global initialization routine by passing PO as
168 -- product short code. This procedure would populate the global temporary table with the
169 -- operating units that a user has access to.
170 --
171
172 PROCEDURE SET_POLICY_CONTEXT
173 (
174 p_access_mode IN VARCHAR2,
175 p_org_id IN NUMBER
176 );
177 --
178 -- This procedure is used to initialize org context. If the access mode is S, the context
179 -- is set to Single and p_Org_id is set as current org_id, if the access mode is M, the context
180 -- is set to Multiple and then current org_id would be set to NULL.
181 --
182
183 FUNCTION CHECK_ACCESS
184 (
185 p_org_id IN NUMBER
186 )
187 RETURN VARCHAR2;
188 --
189 -- This function is used to know if the ORG_ID that is passed has been set in
190 -- the context and if it is valid or not. This function checks if the org_id exists in the
191 -- global temorary table or not, if it is present function returns 'Y', else returns 'N'. Global
192 -- temporary table gets populated when proper org context is initialized.
193 --
194
195 FUNCTION GET_OU_SHORTCODE
196 (
197 p_org_id IN NUMBER
198 )
199 RETURN VARCHAR2;
200 --
201 -- This function would return OU Short Code for the ORG_ID passed.
202 -- If the ORG_ID is NULL or invalid, it would return NULL
203 --
204
205 PROCEDURE SET_REQUEST_CONTEXT
206 (
207 p_org_id IN NUMBER
208 );
209 --
210 -- This procedure is a wrapper for fnd_request.set_org_id
211 --
212
213 -- Bug 5124686: moved get_entity_org_id to this package from PO_CORE_S
214 -- Also added support for additional document types
215 FUNCTION GET_ENTITY_ORG_ID
216 (
217 p_doc_type IN VARCHAR2
218 , p_doc_level IN VARCHAR2
219 , p_doc_level_id IN NUMBER
220 ) RETURN NUMBER;
221 --
222 -- Returns the org_id of the passed-in entity
223 --
224
225 PROCEDURE validate_orgid_pub_api(x_org_id IN OUT NOCOPY NUMBER);-- <Bug#4581621>
226
227 END PO_MOAC_UTILS_PVT;