DBA Data[Home] [Help]

PACKAGE: APPS.OE_BULK_MSG_PUB

Source


1 PACKAGE OE_BULK_MSG_PUB AS
2 /* $Header: OEBUMSGS.pls 120.0 2005/06/01 03:09:44 appldev noship $ */
3 
4 --  Global constants used by the Get function/procedure to
5 --  determine which message to get.
6 
7     G_FIRST	    CONSTANT	NUMBER	:=  -1	;
8     G_NEXT	    CONSTANT	NUMBER	:=  -2	;
9     G_LAST	    CONSTANT	NUMBER	:=  -3	;
10     G_PREVIOUS	    CONSTANT	NUMBER	:=  -4	;
11 
12 --  global that holds the value of the message level profile option.
13 
14     G_msg_level_threshold	NUMBER    	:= FND_API.G_MISS_NUM;
15 
16 --message context record group
17 TYPE G_MSG_CONTEXT_REC_TYPE IS RECORD
18     (ENTITY_CODE       		VARCHAR2(30)
19     ,ENTITY_REF       		VARCHAR2(50)
20     ,ENTITY_ID         		NUMBER
21     ,HEADER_ID         		NUMBER
22     ,LINE_ID           		NUMBER
23     ,ORDER_SOURCE_ID            NUMBER
24     ,ORIG_SYS_DOCUMENT_REF	VARCHAR2(50)
25     ,ORIG_SYS_DOCUMENT_LINE_REF	VARCHAR2(50)
26     ,ORIG_SYS_SHIPMENT_REF	VARCHAR2(50)
27     ,CHANGE_SEQUENCE		VARCHAR2(50)
28     ,SOURCE_DOCUMENT_TYPE_ID    NUMBER
29     ,SOURCE_DOCUMENT_ID		NUMBER
30     ,SOURCE_DOCUMENT_LINE_ID	NUMBER
31     ,ATTRIBUTE_CODE       	VARCHAR2(30)
32     ,CONSTRAINT_ID		NUMBER
33     ,PROCESS_ACTIVITY		NUMBER
34    );
35 
36 TYPE Msg_Context_Tbl_Type IS TABLE OF G_MSG_CONTEXT_REC_TYPE
37  INDEX BY BINARY_INTEGER;
38 
39 G_msg_context_tbl                   Msg_Context_Tbl_Type;
40 G_msg_context_count                 NUMBER          := 0;
41 G_msg_context_index                 NUMBER          := 0;
42 
43 TYPE T_TBL_V1   IS TABLE OF VARCHAR2(1);
44 TYPE T_TBL_V30  IS TABLE OF VARCHAR2(30);
45 TYPE T_TBL_V50  IS TABLE OF VARCHAR2(50);
46 TYPE T_TBL_V2000  IS TABLE OF VARCHAR2(2000);
47 TYPE T_TBL_NUM  IS TABLE OF NUMBER;
48 
49 -- API message record type
50    TYPE G_MSG_REC_TYPE IS RECORD
51    ( MESSAGE          		  T_TBL_V2000
52     ,ENTITY_CODE       		  T_TBL_V30
53     ,ENTITY_ID         		  T_TBL_NUM
54     ,HEADER_ID         		  T_TBL_NUM
55     ,LINE_ID           		  T_TBL_NUM
56     ,ORDER_SOURCE_ID          T_TBL_NUM
57     ,ORIG_SYS_DOCUMENT_REF	  T_TBL_V50
58     ,ORIG_SYS_DOCUMENT_LINE_REF   T_TBL_V50
59     ,SOURCE_DOCUMENT_TYPE_ID      T_TBL_NUM
60     ,SOURCE_DOCUMENT_ID		  T_TBL_NUM
61     ,SOURCE_DOCUMENT_LINE_ID  T_TBL_NUM
62     ,ATTRIBUTE_CODE       	  T_TBL_V30
63     ,CONSTRAINT_ID		      T_TBL_NUM
64     ,PROCESS_ACTIVITY		  T_TBL_NUM
65     ,NOTIFICATION_FLAG        T_TBL_V1
66     ,MESSAGE_TEXT             T_TBL_V2000
67     ,TYPE                 	  T_TBL_V30
68     ,ENTITY_REF       		  T_TBL_V50
69     ,ORIG_SYS_SHIPMENT_REF    T_TBL_V50
70     ,CHANGE_SEQUENCE   	  	  T_TBL_V50
71    );
72 
73 
74 --  API message table type
75 --
76 --  	PL/SQL table of VARCHAR2(2000)
77 --	This is the datatype of the API message list
78 
79 --    TYPE Msg_Tbl_Type IS TABLE OF G_MSG_REC_TYPE
80 --    INDEX BY BINARY_INTEGER;
81 
82 --  Global message table variable.
83 --  this variable is global to the OE_MSG_PUB package only.
84     G_msg_tbl	  G_MSG_REC_TYPE;
85 
86 --  Global variable holding the message count.
87     G_msg_count   		NUMBER      	:= 0;
88 
89 --  Index used by the Get function to keep track of the last fetched
90 --  message.
91     G_msg_index			NUMBER		:= 0;
92 
93 --  Global variable holding the process_activity values.
94     G_process_activity	        NUMBER          := NULL;
95 
96 -----------------------------------------------------------------
97 --  Procedure	Initialize
98 --
99 --  Usage	Used by API callers and developers to intialize the
100 --		global message table.
101 --  Desc	Clears the G_msg_tbl and resets all its global
102 --		variables. Except for the message level threshold.
103 --
104 
105 PROCEDURE Initialize;
106 
107 --  FUNCTION	Count_Msg
108 --
109 --  Usage	Used by API callers and developers to find the count
110 --		of messages in the  message list.
111 --  Desc	Returns the value of G_msg_count
112 --
113 --  Parameters	None
114 --
115 --  Return	NUMBER
116 
117 FUNCTION    Count_Msg  RETURN NUMBER;
118 
119 PROCEDURE Set_Process_Activity(
120      p_process_activity             IN NUMBER           DEFAULT NULL);
121 
122 
123 PROCEDURE Set_Msg_Context (
124      p_entity_code       	    IN	VARCHAR2	DEFAULT NULL
125     ,p_entity_ref         	    IN	VARCHAR2	DEFAULT NULL
126     ,p_entity_id         	    IN	NUMBER		DEFAULT NULL
127     ,p_header_id         	    IN	NUMBER		DEFAULT NULL
128     ,p_line_id           	    IN	NUMBER		DEFAULT NULL
129     ,p_order_source_id              IN  NUMBER          DEFAULT NULL
130     ,p_orig_sys_document_ref	    IN	VARCHAR2	DEFAULT NULL
131     ,p_orig_sys_document_line_ref   IN	VARCHAR2	DEFAULT NULL
132     ,p_orig_sys_shipment_ref   	    IN	VARCHAR2	DEFAULT NULL
133     ,p_change_sequence   	    IN	VARCHAR2	DEFAULT NULL
134     ,p_source_document_type_id      IN  NUMBER          DEFAULT NULL
135     ,p_source_document_id	    IN  NUMBER		DEFAULT NULL
136     ,p_source_document_line_id	    IN  NUMBER		DEFAULT NULL
137     ,p_attribute_code       	    IN  VARCHAR2	DEFAULT NULL
138     ,p_constraint_id		    IN  NUMBER		DEFAULT NULL
139 --  ,p_process_activity             IN  NUMBER		DEFAULT NULL
140  );
141 
142 PROCEDURE Reset_Msg_Context(p_entity_code IN VARCHAR2);
143 
144 PROCEDURE Update_Msg_Context (
145      p_entity_code       	  IN	VARCHAR2  DEFAULT FND_API.G_MISS_CHAR
146     ,p_entity_id         	  IN	NUMBER 	  DEFAULT FND_API.G_MISS_NUM
147     ,p_header_id         	  IN	NUMBER	  DEFAULT FND_API.G_MISS_NUM
148     ,p_line_id           	  IN	NUMBER	  DEFAULT FND_API.G_MISS_NUM
149     ,p_order_source_id            IN    NUMBER    DEFAULT FND_API.G_MISS_NUM
150     ,p_orig_sys_document_ref	  IN	VARCHAR2  DEFAULT FND_API.G_MISS_CHAR
151     ,p_orig_sys_document_line_ref IN	VARCHAR2  DEFAULT FND_API.G_MISS_CHAR
152     ,p_source_document_type_id    IN    NUMBER    DEFAULT FND_API.G_MISS_NUM
153     ,p_source_document_id	  IN	NUMBER	  DEFAULT FND_API.G_MISS_NUM
154     ,p_source_document_line_id	  IN	NUMBER	  DEFAULT FND_API.G_MISS_NUM
155     ,p_attribute_code       	  IN	VARCHAR2  DEFAULT FND_API.G_MISS_CHAR
156     ,p_constraint_id		  IN	NUMBER	  DEFAULT FND_API.G_MISS_NUM
157 --    ,p_process_activity		  IN	NUMBER	  DEFAULT FND_API.G_MISS_NUM
158   );
159 
160 --  PROCEDURE	Count_And_Get
161 --
162 --  Usage	Used by API developers to find the count of messages
163 --		in the message table. If there is only one message in
164 --		the table it retrieves this message.
165 --
166 --  Desc	This procedure is a cover that calls the function
167 --		Count_Msg and if the count of messages is 1. It calls the
168 --		procedure Get. It serves as a shortcut for API
169 --		developers. to make one call instead of making a call
170 --		to count, a check, and then another call to get.
171 --
172 --  Parameters	p_encoded   IN VARCHAR2(1) := FND_API.G_TRUE    Optional
173 --		    If TRUE the message is returned in an encoded
174 --		    format, else it is translated and returned.
175 --		p_count OUT NUMBER
176 --		    Message count.
177 --		p_data	    OUT VARCHAR2(2000)
178 --		    Message data.
179 --
180 
181 PROCEDURE    Count_And_Get
182 (   p_encoded		    IN	VARCHAR2    := FND_API.G_TRUE	    ,
183     p_count		    OUT NOCOPY /* file.sql.39 change */	NUMBER  ,
184     p_data		    OUT NOCOPY /* file.sql.39 change */ VARCHAR2
185 );
186 
187 
188 --  PROCEDURE 	Add
189 --
190 --  Usage	Used to add messages to the global message table.
191 --
192 --  Desc	Reads a message off the message dictionary stack and
193 --  	    	writes it in an encoded format to the global PL/SQL
194 --		message table.
195 --  	    	The message is appended at the bottom of the message
196 --    	    	table.
197 
198 PROCEDURE Add(p_context_flag IN VARCHAR2 DEFAULT 'Y',
199               p_msg_type IN VARCHAR2 DEFAULT NULL);
200 
201 
202 -- PROCEDURE   Add
203 --
204 --  Usage       Used by Devlopers to add messages to Global stack from FND
205 --              stack .
206 --
207 --  Desc        Accepts the  message as input and writes to global_PL/SQL
208 --              message table.
209 --              The message is appended at the bottom of the message
210 --              table.
211 --
212 PROCEDURE Add_Text(p_message_text IN VARCHAR2
213                   ,p_type IN VARCHAR2 DEFAULT 'ERROR'
214                   ,p_context_flag IN VARCHAR2 DEFAULT 'Y');
215 
216 
217 --  PROCEDURE   Delete_Msg
218 --
219 --  Usage       Used to delete a specific message from the message
220 --              list, or clear the whole message list.
221 --
222 --  Desc        If instructed to delete a specific message, the
223 --              message is removed from the message table and the
224 --              table is compressed by moving the messages coming
225 --              after the deleted messages up one entry in the message
226 --              table.
227 --              If there is no entry found the Delete procedure does
228 --              nothing, and  no exception is raised.
229 --              If delete is passed no parameters it deletes the whole
230 --              message table.
231 --
232 --  Prameters   p_msg_index     IN NUMBER := FND_API.G_MISS_NUM  Optional
233 --                  holds the index of the message to be deleted.
234 --
235 
236 PROCEDURE Delete_Msg
237 (   p_msg_index IN    NUMBER    :=      NULL
238 );
239 
240 --  PROCEDURE   Get
241 --
242 --  Usage       Used to get message info from the global message table.
243 --
244 --  Desc        Gets the next message from the message table.
245 --              This procedure utilizes the G_msg_index to keep track
246 --              of the last message fetched from the global table and
247 --              then fetches the next.
248 --
249 --  Parameters  p_msg_index     IN NUMBER := G_NEXT
250 --                  Index of message to be fetched. the default is to
251 --                  fetch the next message starting by the first
252 --                  message. Possible values are :
253 --
254 --                  G_FIRST
255 --                  G_NEXT
256 --                  G_LAST
257 --                  G_PREVIOUS
258 --                  Specific message index.
259 --
260 --              p_encoded   IN VARCHAR2(1) := G_TRUE    Optional
261 --                  When set to TRUE retieves the message in an
262 --                  encoded format. If FALSE, the function calls the
263 --                  message dictionary utilities to translate the
264 --                  message and do the token substitution, the message
265 --                  text is then returned.
266 --
267 --              p_msg_data          OUT VARCHAR2(2000)
268 --              p_msg_index_out     OUT NUMBER
269 
270 PROCEDURE    Get
271 (   p_msg_index     IN  NUMBER      := G_NEXT           ,
272     p_encoded       IN  VARCHAR2    := FND_API.G_TRUE   ,
273     p_data          OUT NOCOPY /* file.sql.39 change */ VARCHAR2 ,
274     p_msg_index_out OUT NOCOPY /* file.sql.39 change */ NUMBER
275 );
276 
277 --  FUNCTION    Get
278 --
279 --  Usage       Used to get message info from the message table.
280 --
281 --  Desc        Gets the next message from the message table.
282 --              This procedure utilizes the G_msg_index to keep track
283 --              of the last message fetched from the table and
284 --              then fetches the next or previous message depending on
285 --              the mode the function is being called in..
286 --
287 --  Parameters  p_msg_index     IN NUMBER := G_NEXT
288 --                  Index of message to be fetched. the default is to
289 --                  fetch the next message starting by the first
290 --                  message. Possible values are :
291 --
292 --                  G_FIRST
293 --                  G_NEXT
294 --                  G_LAST
295 --                  G_PREVIOUS
296 --                  Specific message index.
297 --
298 --              p_encoded   IN VARCHAR2(1) := FND_API.G_TRUE    Optional
299 --                  When set to TRUE Get retrieves the message in an
300 --                  encoded format. If FALSE, the function calls the
301 --                  message dictionary utilities to translate the
302 --                  message and do the token substitution, the message
303 --                  text is then returned.
304 --
305 --  Return      VARCHAR2(2000) message data.
306 --              If there are no more messages it returns NULL.
307 --
308 --  Notes       The function name Get is overloaded with another
309 --              procedure Get that performs the exact same function as
310 --              the function, the only difference is that the
311 --              procedure returns the message data as well as its
312 --              index i the message list.
313 
314 FUNCTION    Get
315 (   p_msg_index     IN NUMBER   := G_NEXT           ,
316     p_encoded       IN VARCHAR2 := FND_API.G_TRUE
317 )
318 RETURN VARCHAR2;
319 
320 PROCEDURE Reset
321 ( p_mode    IN NUMBER := G_FIRST );
322 
323 --  Pre-defined API message levels
324 --
325 --      Valid values for message levels are from 1-50.
326 --      1 being least severe and 50 highest.
327 --
328 --      The pre-defined levels correspond to standard API
329 --      return status. Debug levels are used to control the amount of
330 --      debug information a program writes to the PL/SQL message table.
331 
332 G_MSG_LVL_UNEXP_ERROR   CONSTANT NUMBER := 60;
333 G_MSG_LVL_ERROR         CONSTANT NUMBER := 50;
334 G_MSG_LVL_SUCCESS       CONSTANT NUMBER := 40;
335 G_MSG_LVL_DEBUG_HIGH    CONSTANT NUMBER := 30;
336 G_MSG_LVL_DEBUG_MEDIUM  CONSTANT NUMBER := 20;
337 G_MSG_LVL_DEBUG_LOW     CONSTANT NUMBER := 10;
338 
339 --  FUNCTION    Check_Msg_Level
340 --
341 --  Usage       Used by API developers to check if the level of the
342 --              message they want to write to the message table is
343 --              higher or equal to the message level threshold or not.
344 --              If the function returns TRUE the developer should go
345 --              ahead and write the message to the message table else
346 --              he/she should skip writing this message.
347 --  Desc        Accepts a message level as input fetches the value of
348 --              the message threshold profile option and compares it
349 --              to the input level.
350 --  Return      TRUE if the level is equal to or higher than the
351 --              threshold. Otherwise, it returns FALSE.
352 --
353 
354 FUNCTION Check_Msg_Level
355 (   p_message_level IN NUMBER := G_MSG_LVL_SUCCESS
356 )
357 RETURN BOOLEAN;
358 
359 
360 --  PROCEDURE   Build_Exc_Msg()
361 --
362 --  USAGE       Used by APIs to issue a standard message when
363 --              encountering an unexpected error.
364 --  Desc        The IN parameters are used as tokens to a standard
365 --              message 'FND_API_UNEXP_ERROR'.
366 --  Parameters  p_pkg_name          IN VARCHAR2     Optional
367 --              p_procedure_name    IN VARCHAR2     Optional
368 --              p_error_text        IN VARCHAR2(240)    Optional
369 --                  If p_error_text is missing SQLERRM is used.
370 
371 PROCEDURE Build_Exc_Msg
372 (   p_pkg_name          IN VARCHAR2 :=FND_API.G_MISS_CHAR    ,
373     p_procedure_name    IN VARCHAR2 :=FND_API.G_MISS_CHAR    ,
374     p_error_text        IN VARCHAR2 :=FND_API.G_MISS_CHAR
375 );
376 
377 
378 --  PROCEDURE   Add_Exc_Msg()
379 --
380 --  USAGE   	Same as Build_Exc_Msg but in addition to constructing
381 --		the messages the procedure Adds it to the global
382 --		mesage table.
383 
384 PROCEDURE Add_Exc_Msg
385 ( p_pkg_name		IN VARCHAR2 :=FND_API.G_MISS_CHAR   ,
386   p_procedure_name	IN VARCHAR2 :=FND_API.G_MISS_CHAR   ,
387   p_error_text		IN VARCHAR2 :=FND_API.G_MISS_CHAR  ,
388   p_context_flag      IN VARCHAR2 DEFAULT  'Y'
389 );
390 
391 --  PROCEDURE Dump_Msg and Dump_List are used for debugging purposes.
392 --
393 
394 PROCEDURE    Dump_Msg
395 (   p_msg_index IN NUMBER );
396 
397 PROCEDURE    Dump_List
398 (   p_messages	IN BOOLEAN  :=	FALSE );
399 
400 -- PROCEDURE Save_Messages takes all the messages from the
401 -- message stack and inserts them into the OE_PROCESSING_MSGS table.
402 
403 PROCEDURE Save_Messages(p_request_id IN NUMBER
404                         ,p_message_source_code IN VARCHAR2 DEFAULT 'C');
405 
406 PROCEDURE Transfer_Msg_Stack
407 ( p_msg_index IN  NUMBER DEFAULT  NULL);
408 
409 END OE_BULK_MSG_PUB ;