1 PACKAGE PV_MSG_PUB AUTHID CURRENT_USER AS
2 /* $Header: pvxpmsgs.pls 115.6 2002/12/26 06:11:24 anubhavk ship $ */
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 -- Procedure Initialize
17 --
18 -- Usage Used by API callers and developers to intialize the
19 -- global message table.
20 -- Desc Clears the G_msg_tbl and resets all its global
21 -- variables. Except for the message level threshold.
22 --
23
24 PROCEDURE Initialize;
25
26 -- FUNCTION Count_Msg
27 --
28 -- Usage Used by API callers and developers to find the count
29 -- of messages in the message list.
30 -- Desc Returns the value of G_msg_count
31 --
32 -- Parameters None
33 --
34 -- Return NUMBER
35
36 FUNCTION Count_Msg RETURN NUMBER;
37
38 -- PROCEDURE Count_And_Get
39 --
40 -- Usage Used by API developers to find the count of messages
41 -- in the message table. If there is only one message in
42 -- the table it retrieves this message.
43 --
44 -- Desc This procedure is a cover that calls the function
45 -- Count_Msg and if the count of messages is 1. It calls the
46 -- procedure Get. It serves as a shortcut for API
47 -- developers. to make one call instead of making a call
48 -- to count, a check, and then another call to get.
49 --
50 -- Parameters p_encoded IN VARCHAR2(1) := FND_API.G_TRUE Optional
51 -- If TRUE the message is returned in an encoded
52 -- format, else it is translated and returned.
53 -- p_count OUT NUMBER
54 -- Message count.
55 -- p_data OUT VARCHAR2(2000)
56 -- Message data.
57 --
58
59 PROCEDURE Count_And_Get
60 ( p_encoded IN VARCHAR2 := FND_API.G_TRUE ,
61 p_count OUT NOCOPY NUMBER ,
62 p_data OUT NOCOPY VARCHAR2
63 );
64
65 -- PROCEDURE Add
66 --
67 -- Usage Used to add messages to the global message table.
68 --
69 -- Desc Reads a message off the message dictionary stack and
70 -- writes it in an encoded format to the global PL/SQL
71 -- message table.
72 -- The message is appended at the bottom of the message
73 -- table.
74 --
75
76 PROCEDURE Add;
77
78 -- PROCEDURE Delete_Msg
79 --
80 -- Usage Used to delete a specific message from the message
81 -- list, or clear the whole message list.
82 --
83 -- Desc If instructed to delete a specific message, the
84 -- message is removed from the message table and the
85 -- table is compressed by moving the messages coming
86 -- after the deleted messages up one entry in the message
87 -- table.
88 -- If there is no entry found the Delete procedure does
89 -- nothing, and no exception is raised.
90 -- If delete is passed no parameters it deletes the whole
91 -- message table.
92 --
93 -- Prameters p_msg_index IN NUMBER := FND_API.G_MISS_NUM Optional
94 -- holds the index of the message to be deleted.
95 --
96
97 PROCEDURE Delete_Msg
98 ( p_msg_index IN NUMBER := NULL
99 );
100
101 -- PROCEDURE Get
102 --
103 -- Usage Used to get message info from the global message table.
104 --
105 -- Desc Gets the next message from the message table.
106 -- This procedure utilizes the G_msg_index to keep track
107 -- of the last message fetched from the global table and
108 -- then fetches the next.
109 --
110 -- Parameters p_msg_index IN NUMBER := G_NEXT
111 -- Index of message to be fetched. the default is to
112 -- fetch the next message starting by the first
113 -- message. Possible values are :
114 --
115 -- G_FIRST
116 -- G_NEXT
117 -- G_LAST
118 -- G_PREVIOUS
119 -- Specific message index.
120 --
121 -- p_encoded IN VARCHAR2(1) := G_TRUE Optional
122 -- When set to TRUE retieves the message in an
123 -- encoded format. If FALSE, the function calls the
124 -- message dictionary utilities to translate the
125 -- message and do the token substitution, the message
126 -- text is then returned.
127 --
128 -- p_msg_data OUT VARCHAR2(2000)
129 -- p_msg_index_out OUT NUMBER
130
131 PROCEDURE Get
132 ( p_msg_index IN NUMBER := G_NEXT ,
133 p_encoded IN VARCHAR2 := FND_API.G_TRUE ,
134 p_data OUT NOCOPY VARCHAR2 ,
135 p_msg_index_out OUT NOCOPY NUMBER
136 );
137
138 -- FUNCTION Get
139 --
140 -- Usage Used to get message info from the message table.
141 --
142 -- Desc Gets the next message from the message table.
143 -- This procedure utilizes the G_msg_index to keep track
144 -- of the last message fetched from the table and
145 -- then fetches the next or previous message depending on
146 -- the mode the function is being called in..
147 --
148 -- Parameters p_msg_index IN NUMBER := G_NEXT
149 -- Index of message to be fetched. the default is to
150 -- fetch the next message starting by the first
151 -- message. Possible values are :
152 --
153 -- G_FIRST
154 -- G_NEXT
155 -- G_LAST
156 -- G_PREVIOUS
157 -- Specific message index.
158 --
159 -- p_encoded IN VARCHAR2(1) := FND_API.G_TRUE Optional
160 -- When set to TRUE Get retrieves the message in an
161 -- encoded format. If FALSE, the function calls the
162 -- message dictionary utilities to translate the
163 -- message and do the token substitution, the message
164 -- text is then returned.
165 --
166 -- Return VARCHAR2(2000) message data.
167 -- If there are no more messages it returns NULL.
168 --
169 -- Notes The function name Get is overloaded with another
170 -- procedure Get that performs the exact same function as
171 -- the function, the only difference is that the
172 -- procedure returns the message data as well as its
173 -- index i the message list.
174
175 FUNCTION Get
176 ( p_msg_index IN NUMBER := G_NEXT ,
177 p_encoded IN VARCHAR2 := FND_API.G_TRUE
178 )
179 RETURN VARCHAR2;
180
181 -- PROCEDURE Reset
182 --
183 -- Usage Used to reset the message table index used in reading
184 -- messages to point to the top of the message table or
185 -- the botom of the message table.
186 --
187 -- Desc Sets G_msg_index to 0 or G_msg_count+1 depending on
188 -- the reset mode.
189 --
190 -- Parameters p_mode IN NUMBER := G_FIRST Optional
191 -- possible values are :
192 -- G_FIRST resets index to the begining of msg tbl
193 -- G_LAST resets index to the end of msg tbl
194 --
195 -- Exceptions FND_API.G_EXC_UNEXPECTED_ERROR if it is passed an
196 -- invalid mode.
197
198 PROCEDURE Reset
199 ( p_mode IN NUMBER := G_FIRST );
200
201 -- Pre-defined API message levels
202 --
203 -- Valid values for message levels are from 1-50.
204 -- 1 being least severe and 50 highest.
205 --
206 -- The pre-defined levels correspond to standard API
207 -- return status. Debug levels are used to control the amount of
208 -- debug information a program writes to the PL/SQL message table.
209
210 G_MSG_LVL_UNEXP_ERROR CONSTANT NUMBER := 60;
211 G_MSG_LVL_ERROR CONSTANT NUMBER := 50;
212 G_MSG_LVL_SUCCESS CONSTANT NUMBER := 40;
213 G_MSG_LVL_DEBUG_HIGH CONSTANT NUMBER := 30;
214 G_MSG_LVL_DEBUG_MEDIUM CONSTANT NUMBER := 20;
215 G_MSG_LVL_DEBUG_LOW CONSTANT NUMBER := 10;
216
217 -- FUNCTION Check_Msg_Level
218 --
219 -- Usage Used by API developers to check if the level of the
220 -- message they want to write to the message table is
221 -- higher or equal to the message level threshold or not.
222 -- If the function returns TRUE the developer should go
223 -- ahead and write the message to the message table else
224 -- he/she should skip writing this message.
225 -- Desc Accepts a message level as input fetches the value of
226 -- the message threshold profile option and compares it
227 -- to the input level.
228 -- Return TRUE if the level is equal to or higher than the
229 -- threshold. Otherwise, it returns FALSE.
230 --
231
232 FUNCTION Check_Msg_Level
233 ( p_message_level IN NUMBER := G_MSG_LVL_SUCCESS
234 )
235 RETURN BOOLEAN;
236
237 -- PROCEDURE Build_Exc_Msg()
238 --
239 -- USAGE Used by APIs to issue a standard message when
240 -- encountering an unexpected error.
241 -- Desc The IN parameters are used as tokens to a standard
242 -- message 'FND_API_UNEXP_ERROR'.
243 -- Parameters p_pkg_name IN VARCHAR2(30) Optional
244 -- p_procedure_name IN VARCHAR2(30) Optional
245 -- p_error_text IN VARCHAR2(240) Optional
246 -- If p_error_text is missing SQLERRM is used.
247
248 PROCEDURE Build_Exc_Msg
249 ( p_pkg_name IN VARCHAR2 :=FND_API.G_MISS_CHAR ,
250 p_procedure_name IN VARCHAR2 :=FND_API.G_MISS_CHAR ,
251 p_error_text IN VARCHAR2 :=FND_API.G_MISS_CHAR
252 );
253
254 -- PROCEDURE Add_Exc_Msg()
255 --
256 -- USAGE Same as Build_Exc_Msg but in addition to constructing
257 -- the messages the procedure Adds it to the global
258 -- mesage table.
259
260 PROCEDURE Add_Exc_Msg
261 ( p_pkg_name IN VARCHAR2 :=FND_API.G_MISS_CHAR ,
262 p_procedure_name IN VARCHAR2 :=FND_API.G_MISS_CHAR ,
263 p_error_text IN VARCHAR2 :=FND_API.G_MISS_CHAR
264 );
265
266 -- PROCEDURE Dump_Msg and Dump_List are used for debugging purposes.
267 --
268
269 PROCEDURE Dump_Msg
270 ( p_msg_index IN NUMBER );
271
272 PROCEDURE Dump_List
273 ( p_messages IN BOOLEAN := FALSE );
274
275 END PV_MSG_PUB ;