90: -- API body
91: --
92:
93: IF p_user_id IS NULL THEN
94: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
95: FND_MESSAGE.set_token('ID', 'User ID');
96: FND_MSG_PUB.add;
97: RAISE FND_API.G_EXC_ERROR;
98: ELSIF p_process_code IS NULL THEN
91: --
92:
93: IF p_user_id IS NULL THEN
94: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
95: FND_MESSAGE.set_token('ID', 'User ID');
96: FND_MSG_PUB.add;
97: RAISE FND_API.G_EXC_ERROR;
98: ELSIF p_process_code IS NULL THEN
99: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
95: FND_MESSAGE.set_token('ID', 'User ID');
96: FND_MSG_PUB.add;
97: RAISE FND_API.G_EXC_ERROR;
98: ELSIF p_process_code IS NULL THEN
99: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
100: FND_MESSAGE.set_token('ID', 'Process Code');
101: FND_MSG_PUB.add;
102: RAISE FND_API.G_EXC_ERROR;
103: ELSIF p_execution_detail_id IS NULL THEN
96: FND_MSG_PUB.add;
97: RAISE FND_API.G_EXC_ERROR;
98: ELSIF p_process_code IS NULL THEN
99: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
100: FND_MESSAGE.set_token('ID', 'Process Code');
101: FND_MSG_PUB.add;
102: RAISE FND_API.G_EXC_ERROR;
103: ELSIF p_execution_detail_id IS NULL THEN
104: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
100: FND_MESSAGE.set_token('ID', 'Process Code');
101: FND_MSG_PUB.add;
102: RAISE FND_API.G_EXC_ERROR;
103: ELSIF p_execution_detail_id IS NULL THEN
104: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
105: FND_MESSAGE.set_token('ID', 'Execution Detail ID');
106: FND_MSG_PUB.add;
107: RAISE FND_API.G_EXC_ERROR;
108: END IF;
101: FND_MSG_PUB.add;
102: RAISE FND_API.G_EXC_ERROR;
103: ELSIF p_execution_detail_id IS NULL THEN
104: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
105: FND_MESSAGE.set_token('ID', 'Execution Detail ID');
106: FND_MSG_PUB.add;
107: RAISE FND_API.G_EXC_ERROR;
108: END IF;
109:
163: WHERE lookup_code = UPPER(p_notif_language)
164: AND lookup_type = 'DPP_LANG_DFLT_TERRITORY';
165: EXCEPTION
166: WHEN NO_DATA_FOUND THEN
167: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
168: FND_MESSAGE.set_token('ID', 'Language Code');
169: FND_MSG_PUB.add;
170: RAISE FND_API.G_EXC_ERROR;
171: WHEN OTHERS THEN
164: AND lookup_type = 'DPP_LANG_DFLT_TERRITORY';
165: EXCEPTION
166: WHEN NO_DATA_FOUND THEN
167: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
168: FND_MESSAGE.set_token('ID', 'Language Code');
169: FND_MSG_PUB.add;
170: RAISE FND_API.G_EXC_ERROR;
171: WHEN OTHERS THEN
172: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
168: FND_MESSAGE.set_token('ID', 'Language Code');
169: FND_MSG_PUB.add;
170: RAISE FND_API.G_EXC_ERROR;
171: WHEN OTHERS THEN
172: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
173: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
174: fnd_message.set_token('ERRNO', sqlcode);
175: fnd_message.set_token('REASON', sqlerrm);
176: FND_MSG_PUB.add;
169: FND_MSG_PUB.add;
170: RAISE FND_API.G_EXC_ERROR;
171: WHEN OTHERS THEN
172: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
173: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
174: fnd_message.set_token('ERRNO', sqlcode);
175: fnd_message.set_token('REASON', sqlerrm);
176: FND_MSG_PUB.add;
177: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
170: RAISE FND_API.G_EXC_ERROR;
171: WHEN OTHERS THEN
172: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
173: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
174: fnd_message.set_token('ERRNO', sqlcode);
175: fnd_message.set_token('REASON', sqlerrm);
176: FND_MSG_PUB.add;
177: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
178: END;
171: WHEN OTHERS THEN
172: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
173: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
174: fnd_message.set_token('ERRNO', sqlcode);
175: fnd_message.set_token('REASON', sqlerrm);
176: FND_MSG_PUB.add;
177: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
178: END;
179: END IF;
251: END IF;
252: WHEN OTHERS THEN
253:
254: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
255: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
256: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Create_FormattedOutput');
257: fnd_message.set_token('ERRNO', sqlcode);
258: fnd_message.set_token('REASON', sqlerrm);
259: FND_MSG_PUB.ADD;
252: WHEN OTHERS THEN
253:
254: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
255: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
256: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Create_FormattedOutput');
257: fnd_message.set_token('ERRNO', sqlcode);
258: fnd_message.set_token('REASON', sqlerrm);
259: FND_MSG_PUB.ADD;
260: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_EXCEPTION, l_module, substr(('Error in DPP_NOTIFICATION_PVT.Create_FormattedOutput: '||SQLERRM),1,4000));
253:
254: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
255: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
256: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Create_FormattedOutput');
257: fnd_message.set_token('ERRNO', sqlcode);
258: fnd_message.set_token('REASON', sqlerrm);
259: FND_MSG_PUB.ADD;
260: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_EXCEPTION, l_module, substr(('Error in DPP_NOTIFICATION_PVT.Create_FormattedOutput: '||SQLERRM),1,4000));
261:
254: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
255: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
256: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Create_FormattedOutput');
257: fnd_message.set_token('ERRNO', sqlcode);
258: fnd_message.set_token('REASON', sqlerrm);
259: FND_MSG_PUB.ADD;
260: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_EXCEPTION, l_module, substr(('Error in DPP_NOTIFICATION_PVT.Create_FormattedOutput: '||SQLERRM),1,4000));
261:
262: -- Standard call to get message count and if count=1, get the message
317: -- Initialize API return status to sucess
318: l_return_status := FND_API.G_RET_STS_SUCCESS;
319:
320: IF p_message_name IS NULL THEN
321: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
322: FND_MESSAGE.set_token('ID', 'Message Name');
323: FND_MSG_PUB.add;
324: RAISE FND_API.G_EXC_ERROR;
325: ELSIF p_application_short_name IS NULL THEN
318: l_return_status := FND_API.G_RET_STS_SUCCESS;
319:
320: IF p_message_name IS NULL THEN
321: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
322: FND_MESSAGE.set_token('ID', 'Message Name');
323: FND_MSG_PUB.add;
324: RAISE FND_API.G_EXC_ERROR;
325: ELSIF p_application_short_name IS NULL THEN
326: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
322: FND_MESSAGE.set_token('ID', 'Message Name');
323: FND_MSG_PUB.add;
324: RAISE FND_API.G_EXC_ERROR;
325: ELSIF p_application_short_name IS NULL THEN
326: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
327: FND_MESSAGE.set_token('ID', 'Application Short Name');
328: FND_MSG_PUB.add;
329: RAISE FND_API.G_EXC_ERROR;
330: END IF;
323: FND_MSG_PUB.add;
324: RAISE FND_API.G_EXC_ERROR;
325: ELSIF p_application_short_name IS NULL THEN
326: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
327: FND_MESSAGE.set_token('ID', 'Application Short Name');
328: FND_MSG_PUB.add;
329: RAISE FND_API.G_EXC_ERROR;
330: END IF;
331:
346: AND dl.lookup_code = UPPER(p_language_code)
347: AND dl.lookup_type = 'DPP_LANG_DFLT_TERRITORY';
348: EXCEPTION
349: WHEN NO_DATA_FOUND THEN
350: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
351: FND_MESSAGE.set_token('ID', 'Language Code');
352: FND_MSG_PUB.add;
353: RAISE FND_API.G_EXC_ERROR;
354: WHEN OTHERS THEN
347: AND dl.lookup_type = 'DPP_LANG_DFLT_TERRITORY';
348: EXCEPTION
349: WHEN NO_DATA_FOUND THEN
350: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
351: FND_MESSAGE.set_token('ID', 'Language Code');
352: FND_MSG_PUB.add;
353: RAISE FND_API.G_EXC_ERROR;
354: WHEN OTHERS THEN
355: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
351: FND_MESSAGE.set_token('ID', 'Language Code');
352: FND_MSG_PUB.add;
353: RAISE FND_API.G_EXC_ERROR;
354: WHEN OTHERS THEN
355: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
356: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
357: fnd_message.set_token('ERRNO', sqlcode);
358: fnd_message.set_token('REASON', sqlerrm);
359: FND_MSG_PUB.add;
352: FND_MSG_PUB.add;
353: RAISE FND_API.G_EXC_ERROR;
354: WHEN OTHERS THEN
355: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
356: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
357: fnd_message.set_token('ERRNO', sqlcode);
358: fnd_message.set_token('REASON', sqlerrm);
359: FND_MSG_PUB.add;
360: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
353: RAISE FND_API.G_EXC_ERROR;
354: WHEN OTHERS THEN
355: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
356: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
357: fnd_message.set_token('ERRNO', sqlcode);
358: fnd_message.set_token('REASON', sqlerrm);
359: FND_MSG_PUB.add;
360: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
361: END;
354: WHEN OTHERS THEN
355: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
356: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
357: fnd_message.set_token('ERRNO', sqlcode);
358: fnd_message.set_token('REASON', sqlerrm);
359: FND_MSG_PUB.add;
360: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
361: END;
362: WHEN OTHERS THEN
359: FND_MSG_PUB.add;
360: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
361: END;
362: WHEN OTHERS THEN
363: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
364: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
365: fnd_message.set_token('ERRNO', sqlcode);
366: fnd_message.set_token('REASON', sqlerrm);
367: FND_MSG_PUB.add;
360: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
361: END;
362: WHEN OTHERS THEN
363: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
364: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
365: fnd_message.set_token('ERRNO', sqlcode);
366: fnd_message.set_token('REASON', sqlerrm);
367: FND_MSG_PUB.add;
368: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
361: END;
362: WHEN OTHERS THEN
363: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
364: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
365: fnd_message.set_token('ERRNO', sqlcode);
366: fnd_message.set_token('REASON', sqlerrm);
367: FND_MSG_PUB.add;
368: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
369: END;
362: WHEN OTHERS THEN
363: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
364: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
365: fnd_message.set_token('ERRNO', sqlcode);
366: fnd_message.set_token('REASON', sqlerrm);
367: FND_MSG_PUB.add;
368: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
369: END;
370: --FND_GLOBAL.set_nls(p_nls_language => l_language_code);
370: --FND_GLOBAL.set_nls(p_nls_language => l_language_code);
371: fnd_global.set_nls_context(p_nls_language => l_language_code);
372: END IF;
373:
374: FND_MESSAGE.set_name(p_application_short_name, p_message_name);
375:
376: FOR i IN l_message_token.FIRST..l_message_token.LAST LOOP
377: FND_MESSAGE.set_token(l_message_token(i).message_token_name, l_message_token(i).message_token_value);
378: END LOOP;
373:
374: FND_MESSAGE.set_name(p_application_short_name, p_message_name);
375:
376: FOR i IN l_message_token.FIRST..l_message_token.LAST LOOP
377: FND_MESSAGE.set_token(l_message_token(i).message_token_name, l_message_token(i).message_token_value);
378: END LOOP;
379:
380: -- if no tokens
381: IF p_message_token.COUNT = 0 THEN
378: END LOOP;
379:
380: -- if no tokens
381: IF p_message_token.COUNT = 0 THEN
382: x_message_text := FND_MESSAGE.GET_STRING(p_application_short_name, p_message_name);
383: ELSE
384: x_message_text :=FND_MESSAGE.get;
385: END IF;
386:
380: -- if no tokens
381: IF p_message_token.COUNT = 0 THEN
382: x_message_text := FND_MESSAGE.GET_STRING(p_application_short_name, p_message_name);
383: ELSE
384: x_message_text :=FND_MESSAGE.get;
385: END IF;
386:
387: IF x_message_text IS NULL THEN
388: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_STATEMENT, l_module, 'Message: ' || p_message_name || ' cannot be found');
424: END IF;
425: WHEN OTHERS THEN
426:
427: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
428: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
429: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Select_Message_Text');
430: fnd_message.set_token('ERRNO', sqlcode);
431: fnd_message.set_token('REASON', sqlerrm);
432: FND_MSG_PUB.ADD;
425: WHEN OTHERS THEN
426:
427: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
428: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
429: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Select_Message_Text');
430: fnd_message.set_token('ERRNO', sqlcode);
431: fnd_message.set_token('REASON', sqlerrm);
432: FND_MSG_PUB.ADD;
433: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_EXCEPTION, l_module, substr(('Error in DPP_NOTIFICATION_PVT.Select_Message_Text: '||SQLERRM),1,2000));
426:
427: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
428: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
429: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Select_Message_Text');
430: fnd_message.set_token('ERRNO', sqlcode);
431: fnd_message.set_token('REASON', sqlerrm);
432: FND_MSG_PUB.ADD;
433: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_EXCEPTION, l_module, substr(('Error in DPP_NOTIFICATION_PVT.Select_Message_Text: '||SQLERRM),1,2000));
434:
427: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
428: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
429: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Select_Message_Text');
430: fnd_message.set_token('ERRNO', sqlcode);
431: fnd_message.set_token('REASON', sqlerrm);
432: FND_MSG_PUB.ADD;
433: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_EXCEPTION, l_module, substr(('Error in DPP_NOTIFICATION_PVT.Select_Message_Text: '||SQLERRM),1,2000));
434:
435: -- Standard call to get message count and if count=1, get the message
486: -- Initialize API return status to sucess
487: l_return_status := FND_API.G_RET_STS_SUCCESS;
488:
489: IF p_execution_detail_id IS NULL THEN
490: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
491: FND_MESSAGE.set_token('ID', 'Execution Detail ID');
492: FND_MSG_PUB.add;
493: RAISE FND_API.G_EXC_ERROR;
494: END IF;
487: l_return_status := FND_API.G_RET_STS_SUCCESS;
488:
489: IF p_execution_detail_id IS NULL THEN
490: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
491: FND_MESSAGE.set_token('ID', 'Execution Detail ID');
492: FND_MSG_PUB.add;
493: RAISE FND_API.G_EXC_ERROR;
494: END IF;
495:
500: FROM DPP_NOTIFICATION_BLOBS
501: WHERE execution_detail_id = p_execution_detail_id;
502:
503: IF x_formatted_output IS NULL THEN
504: FND_MESSAGE.set_name('DPP', 'DPP_OUTPUT_NOT_CREATED');
505: FND_MESSAGE.set_token('REQID', p_execution_detail_id); -- change token name later
506: FND_MSG_PUB.add;
507: -- Debug Message
508: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_STATEMENT, l_module, 'Formatted Output was not created by Request');
501: WHERE execution_detail_id = p_execution_detail_id;
502:
503: IF x_formatted_output IS NULL THEN
504: FND_MESSAGE.set_name('DPP', 'DPP_OUTPUT_NOT_CREATED');
505: FND_MESSAGE.set_token('REQID', p_execution_detail_id); -- change token name later
506: FND_MSG_PUB.add;
507: -- Debug Message
508: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_STATEMENT, l_module, 'Formatted Output was not created by Request');
509:
546: END IF;
547: WHEN OTHERS THEN
548:
549: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
550: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
551: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Get_FormattedOutput');
552: fnd_message.set_token('ERRNO', sqlcode);
553: fnd_message.set_token('REASON', sqlerrm);
554: FND_MSG_PUB.ADD;
547: WHEN OTHERS THEN
548:
549: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
550: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
551: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Get_FormattedOutput');
552: fnd_message.set_token('ERRNO', sqlcode);
553: fnd_message.set_token('REASON', sqlerrm);
554: FND_MSG_PUB.ADD;
555: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_EXCEPTION, l_module, substr(('Error in DPP_NOTIFICATION_PVT.Get_FormattedOutput: '||SQLERRM),1,2000));
548:
549: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
550: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
551: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Get_FormattedOutput');
552: fnd_message.set_token('ERRNO', sqlcode);
553: fnd_message.set_token('REASON', sqlerrm);
554: FND_MSG_PUB.ADD;
555: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_EXCEPTION, l_module, substr(('Error in DPP_NOTIFICATION_PVT.Get_FormattedOutput: '||SQLERRM),1,2000));
556: -- Standard call to get message count and if count=1, get the message
549: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
550: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
551: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Get_FormattedOutput');
552: fnd_message.set_token('ERRNO', sqlcode);
553: fnd_message.set_token('REASON', sqlerrm);
554: FND_MSG_PUB.ADD;
555: DPP_UTILITY_PVT.debug_message(FND_LOG.LEVEL_EXCEPTION, l_module, substr(('Error in DPP_NOTIFICATION_PVT.Get_FormattedOutput: '||SQLERRM),1,2000));
556: -- Standard call to get message count and if count=1, get the message
557: FND_MSG_PUB.Count_And_Get (