230: -- Fix for 4309248:
231: -- Background
232: -- ==========
233: -- Modification to fix bug 2661569 (changing a hardcoded
234: -- call from fnd_message.raise_error to
235: -- hr_utility.raise_error) was incorrect. As HRMS
236: -- error messages can be setup in two ways. Either
237: -- using the hr_utility or fnd_message packages. The
238: -- following solution ensures that when an error is
233: -- Modification to fix bug 2661569 (changing a hardcoded
234: -- call from fnd_message.raise_error to
235: -- hr_utility.raise_error) was incorrect. As HRMS
236: -- error messages can be setup in two ways. Either
237: -- using the hr_utility or fnd_message packages. The
238: -- following solution ensures that when an error is
239: -- raised it is done in a consistent way to how the
240: -- error was setup. i.e. If the error was setup using
241: -- hr_utility then hr_utility.raise_error will be
239: -- raised it is done in a consistent way to how the
240: -- error was setup. i.e. If the error was setup using
241: -- hr_utility then hr_utility.raise_error will be
242: -- called. Otherwise if the error was setup using
243: -- fnd_message then fnd_message.raise_error will
244: -- be called.
245: --
246: -- Solution Overview
247: -- =================
249: -- the error details are not cleared from the hr_utility
250: -- package. Hence we cannot just call
251: -- hr_utility.get_message_details and assume that when
252: -- 'NO_MESSAGE' has been called that the error has been
253: -- set-up using fnd_message. This is because if one message
254: -- is set-up using hr_utility then all following messages
255: -- set-up using fnd_message would also look as if they
256: -- have been set-up using hr_utility. The solution needs
257: -- obtain the error details currently held in both
251: -- hr_utility.get_message_details and assume that when
252: -- 'NO_MESSAGE' has been called that the error has been
253: -- set-up using fnd_message. This is because if one message
254: -- is set-up using hr_utility then all following messages
255: -- set-up using fnd_message would also look as if they
256: -- have been set-up using hr_utility. The solution needs
257: -- obtain the error details currently held in both
258: -- hr_utility and fnd_message. If error details returned
259: -- from both packages are the same then hr_utility has
254: -- is set-up using hr_utility then all following messages
255: -- set-up using fnd_message would also look as if they
256: -- have been set-up using hr_utility. The solution needs
257: -- obtain the error details currently held in both
258: -- hr_utility and fnd_message. If error details returned
259: -- from both packages are the same then hr_utility has
260: -- been used. If they are different then fnd_message must
261: -- have been used for the latest message.
262: --
256: -- have been set-up using hr_utility. The solution needs
257: -- obtain the error details currently held in both
258: -- hr_utility and fnd_message. If error details returned
259: -- from both packages are the same then hr_utility has
260: -- been used. If they are different then fnd_message must
261: -- have been used for the latest message.
262: --
263: -- Solution Details
264: -- ================
276: );
277: --
278: -- If the 'NO_MESSAGE' string is returned then the error
279: -- can't have been setup using the hr_utility package,
280: -- it must be in fnd_message.
281: --
282: if l_hr_msg_name = 'NO_MESSAGE' then
283: fnd_message.raise_error;
284: else
279: -- can't have been setup using the hr_utility package,
280: -- it must be in fnd_message.
281: --
282: if l_hr_msg_name = 'NO_MESSAGE' then
283: fnd_message.raise_error;
284: else
285: --
286: -- Obtain error details from fnd_message, without
287: -- clearing the message in the other package.
282: if l_hr_msg_name = 'NO_MESSAGE' then
283: fnd_message.raise_error;
284: else
285: --
286: -- Obtain error details from fnd_message, without
287: -- clearing the message in the other package.
288: --
289: l_fnd_msg_encoded := fnd_message.get_encoded(AUTO_LOG => 'Y');
290: if l_fnd_msg_encoded is not null then
285: --
286: -- Obtain error details from fnd_message, without
287: -- clearing the message in the other package.
288: --
289: l_fnd_msg_encoded := fnd_message.get_encoded(AUTO_LOG => 'Y');
290: if l_fnd_msg_encoded is not null then
291: fnd_message.parse_encoded
292: (encoded_message => l_fnd_msg_encoded
293: ,app_short_name => l_fnd_msg_appl
287: -- clearing the message in the other package.
288: --
289: l_fnd_msg_encoded := fnd_message.get_encoded(AUTO_LOG => 'Y');
290: if l_fnd_msg_encoded is not null then
291: fnd_message.parse_encoded
292: (encoded_message => l_fnd_msg_encoded
293: ,app_short_name => l_fnd_msg_appl
294: ,message_name => l_fnd_msg_name
295: );
297: l_fnd_msg_appl := null;
298: l_fnd_msg_name := 'NO_MESSAGE';
299: end if;
300: --
301: -- If the message names returned from the fnd_message
302: -- and hr_utility packages are different then the
303: -- latest message cannot have been setup using the
304: -- hr_utility package.
305: if l_fnd_msg_name <> l_hr_msg_name then
302: -- and hr_utility packages are different then the
303: -- latest message cannot have been setup using the
304: -- hr_utility package.
305: if l_fnd_msg_name <> l_hr_msg_name then
306: fnd_message.raise_error;
307: else
308: hr_utility.raise_error;
309: end if;
310: end if;
309: end if;
310: end if;
311: else
312: -- All other message types should be ignored.
313: -- Make sure fnd_message package is cleared
314: -- so later messages can be set without being
315: -- mixed up with previously set values.
316: --
317: fnd_message.clear;
313: -- Make sure fnd_message package is cleared
314: -- so later messages can be set without being
315: -- mixed up with previously set values.
316: --
317: fnd_message.clear;
318: end if;
319: else
320: --
321: -- Provide Multiple Message Detection for all types of message
356: return true;
357: else
358: --
359: if sqlcode = -20001 then
360: l_encoded := fnd_message.get_encoded;
361: if l_encoded is not null then
362: fnd_message.set_encoded(l_encoded);
363: fnd_msg_pub.add;
364: else
358: --
359: if sqlcode = -20001 then
360: l_encoded := fnd_message.get_encoded;
361: if l_encoded is not null then
362: fnd_message.set_encoded(l_encoded);
363: fnd_msg_pub.add;
364: else
365: l_position := instr(p_procedure_name,'.');
366: if l_position <> 0 then
404: --
405: -- loop through messages to find the first message of type ERROR
406: FOR I IN 1..fnd_msg_pub.count_msg LOOP
407: l_encoded := fnd_msg_pub.get_detail(p_msg_index => I);
408: fnd_message.set_encoded(l_encoded);
409: l_message_type := fnd_message.get_token
410: (token => fnd_msg_pub.g_message_type_token_name);
411: if l_message_type = hr_multi_message.g_error_msg then
412: raise hr_multi_message.Error_Message_Exist;
405: -- loop through messages to find the first message of type ERROR
406: FOR I IN 1..fnd_msg_pub.count_msg LOOP
407: l_encoded := fnd_msg_pub.get_detail(p_msg_index => I);
408: fnd_message.set_encoded(l_encoded);
409: l_message_type := fnd_message.get_token
410: (token => fnd_msg_pub.g_message_type_token_name);
411: if l_message_type = hr_multi_message.g_error_msg then
412: raise hr_multi_message.Error_Message_Exist;
413: end if;