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:
165: WHERE lookup_code = UPPER(p_notif_language)
166: AND lookup_type = 'DPP_LANG_DFLT_TERRITORY';
167: EXCEPTION
168: WHEN NO_DATA_FOUND THEN
169: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
170: FND_MESSAGE.set_token('ID', 'Language Code');
171: FND_MSG_PUB.add;
172: RAISE FND_API.G_EXC_ERROR;
173: WHEN OTHERS THEN
166: AND lookup_type = 'DPP_LANG_DFLT_TERRITORY';
167: EXCEPTION
168: WHEN NO_DATA_FOUND THEN
169: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
170: FND_MESSAGE.set_token('ID', 'Language Code');
171: FND_MSG_PUB.add;
172: RAISE FND_API.G_EXC_ERROR;
173: WHEN OTHERS THEN
174: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
170: FND_MESSAGE.set_token('ID', 'Language Code');
171: FND_MSG_PUB.add;
172: RAISE FND_API.G_EXC_ERROR;
173: WHEN OTHERS THEN
174: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
175: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
176: fnd_message.set_token('ERRNO', sqlcode);
177: fnd_message.set_token('REASON', sqlerrm);
178: FND_MSG_PUB.add;
171: FND_MSG_PUB.add;
172: RAISE FND_API.G_EXC_ERROR;
173: WHEN OTHERS THEN
174: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
175: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
176: fnd_message.set_token('ERRNO', sqlcode);
177: fnd_message.set_token('REASON', sqlerrm);
178: FND_MSG_PUB.add;
179: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
172: RAISE FND_API.G_EXC_ERROR;
173: WHEN OTHERS THEN
174: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
175: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
176: fnd_message.set_token('ERRNO', sqlcode);
177: fnd_message.set_token('REASON', sqlerrm);
178: FND_MSG_PUB.add;
179: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
180: END;
173: WHEN OTHERS THEN
174: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
175: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
176: fnd_message.set_token('ERRNO', sqlcode);
177: fnd_message.set_token('REASON', sqlerrm);
178: FND_MSG_PUB.add;
179: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
180: END;
181: END IF;
254: END IF;
255: WHEN OTHERS THEN
256:
257: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
258: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
259: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Create_FormattedOutput');
260: fnd_message.set_token('ERRNO', sqlcode);
261: fnd_message.set_token('REASON', sqlerrm);
262: FND_MSG_PUB.ADD;
255: WHEN OTHERS THEN
256:
257: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
258: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
259: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Create_FormattedOutput');
260: fnd_message.set_token('ERRNO', sqlcode);
261: fnd_message.set_token('REASON', sqlerrm);
262: FND_MSG_PUB.ADD;
263: DPP_UTILITY_PVT.debug_message(substr(('Error in DPP_NOTIFICATION_PVT.Create_FormattedOutput: '||SQLERRM),1,4000));
256:
257: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
258: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
259: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Create_FormattedOutput');
260: fnd_message.set_token('ERRNO', sqlcode);
261: fnd_message.set_token('REASON', sqlerrm);
262: FND_MSG_PUB.ADD;
263: DPP_UTILITY_PVT.debug_message(substr(('Error in DPP_NOTIFICATION_PVT.Create_FormattedOutput: '||SQLERRM),1,4000));
264:
257: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
258: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
259: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Create_FormattedOutput');
260: fnd_message.set_token('ERRNO', sqlcode);
261: fnd_message.set_token('REASON', sqlerrm);
262: FND_MSG_PUB.ADD;
263: DPP_UTILITY_PVT.debug_message(substr(('Error in DPP_NOTIFICATION_PVT.Create_FormattedOutput: '||SQLERRM),1,4000));
264:
265: -- Standard call to get message count and if count=1, get the message
320: -- Initialize API return status to sucess
321: l_return_status := FND_API.G_RET_STS_SUCCESS;
322:
323: IF p_message_name IS NULL THEN
324: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
325: FND_MESSAGE.set_token('ID', 'Message Name');
326: FND_MSG_PUB.add;
327: RAISE FND_API.G_EXC_ERROR;
328: ELSIF p_application_short_name IS NULL THEN
321: l_return_status := FND_API.G_RET_STS_SUCCESS;
322:
323: IF p_message_name IS NULL THEN
324: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
325: FND_MESSAGE.set_token('ID', 'Message Name');
326: FND_MSG_PUB.add;
327: RAISE FND_API.G_EXC_ERROR;
328: ELSIF p_application_short_name IS NULL THEN
329: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
325: FND_MESSAGE.set_token('ID', 'Message Name');
326: FND_MSG_PUB.add;
327: RAISE FND_API.G_EXC_ERROR;
328: ELSIF p_application_short_name IS NULL THEN
329: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
330: FND_MESSAGE.set_token('ID', 'Application Short Name');
331: FND_MSG_PUB.add;
332: RAISE FND_API.G_EXC_ERROR;
333: END IF;
326: FND_MSG_PUB.add;
327: RAISE FND_API.G_EXC_ERROR;
328: ELSIF p_application_short_name IS NULL THEN
329: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
330: FND_MESSAGE.set_token('ID', 'Application Short Name');
331: FND_MSG_PUB.add;
332: RAISE FND_API.G_EXC_ERROR;
333: END IF;
334:
349: AND dl.lookup_code = UPPER(p_language_code)
350: AND dl.lookup_type = 'DPP_LANG_DFLT_TERRITORY';
351: EXCEPTION
352: WHEN NO_DATA_FOUND THEN
353: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
354: FND_MESSAGE.set_token('ID', 'Language Code');
355: FND_MSG_PUB.add;
356: RAISE FND_API.G_EXC_ERROR;
357: WHEN OTHERS THEN
350: AND dl.lookup_type = 'DPP_LANG_DFLT_TERRITORY';
351: EXCEPTION
352: WHEN NO_DATA_FOUND THEN
353: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
354: FND_MESSAGE.set_token('ID', 'Language Code');
355: FND_MSG_PUB.add;
356: RAISE FND_API.G_EXC_ERROR;
357: WHEN OTHERS THEN
358: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
354: FND_MESSAGE.set_token('ID', 'Language Code');
355: FND_MSG_PUB.add;
356: RAISE FND_API.G_EXC_ERROR;
357: WHEN OTHERS THEN
358: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
359: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
360: fnd_message.set_token('ERRNO', sqlcode);
361: fnd_message.set_token('REASON', sqlerrm);
362: FND_MSG_PUB.add;
355: FND_MSG_PUB.add;
356: RAISE FND_API.G_EXC_ERROR;
357: WHEN OTHERS THEN
358: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
359: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
360: fnd_message.set_token('ERRNO', sqlcode);
361: fnd_message.set_token('REASON', sqlerrm);
362: FND_MSG_PUB.add;
363: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
356: RAISE FND_API.G_EXC_ERROR;
357: WHEN OTHERS THEN
358: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
359: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
360: fnd_message.set_token('ERRNO', sqlcode);
361: fnd_message.set_token('REASON', sqlerrm);
362: FND_MSG_PUB.add;
363: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
364: END;
357: WHEN OTHERS THEN
358: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
359: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
360: fnd_message.set_token('ERRNO', sqlcode);
361: fnd_message.set_token('REASON', sqlerrm);
362: FND_MSG_PUB.add;
363: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
364: END;
365: WHEN OTHERS THEN
362: FND_MSG_PUB.add;
363: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
364: END;
365: WHEN OTHERS THEN
366: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
367: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
368: fnd_message.set_token('ERRNO', sqlcode);
369: fnd_message.set_token('REASON', sqlerrm);
370: FND_MSG_PUB.add;
363: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
364: END;
365: WHEN OTHERS THEN
366: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
367: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
368: fnd_message.set_token('ERRNO', sqlcode);
369: fnd_message.set_token('REASON', sqlerrm);
370: FND_MSG_PUB.add;
371: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
364: END;
365: WHEN OTHERS THEN
366: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
367: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
368: fnd_message.set_token('ERRNO', sqlcode);
369: fnd_message.set_token('REASON', sqlerrm);
370: FND_MSG_PUB.add;
371: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
372: END;
365: WHEN OTHERS THEN
366: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
367: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT');
368: fnd_message.set_token('ERRNO', sqlcode);
369: fnd_message.set_token('REASON', sqlerrm);
370: FND_MSG_PUB.add;
371: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
372: END;
373: --FND_GLOBAL.set_nls(p_nls_language => l_language_code);
373: --FND_GLOBAL.set_nls(p_nls_language => l_language_code);
374: fnd_global.set_nls_context(p_nls_language => l_language_code);
375: END IF;
376:
377: FND_MESSAGE.set_name(p_application_short_name, p_message_name);
378:
379: FOR i IN l_message_token.FIRST..l_message_token.LAST LOOP
380: FND_MESSAGE.set_token(l_message_token(i).message_token_name, l_message_token(i).message_token_value);
381: END LOOP;
376:
377: FND_MESSAGE.set_name(p_application_short_name, p_message_name);
378:
379: FOR i IN l_message_token.FIRST..l_message_token.LAST LOOP
380: FND_MESSAGE.set_token(l_message_token(i).message_token_name, l_message_token(i).message_token_value);
381: END LOOP;
382:
383: -- if no tokens
384: IF p_message_token.COUNT = 0 THEN
381: END LOOP;
382:
383: -- if no tokens
384: IF p_message_token.COUNT = 0 THEN
385: x_message_text := FND_MESSAGE.GET_STRING(p_application_short_name, p_message_name);
386: ELSE
387: x_message_text :=FND_MESSAGE.get;
388: END IF;
389:
383: -- if no tokens
384: IF p_message_token.COUNT = 0 THEN
385: x_message_text := FND_MESSAGE.GET_STRING(p_application_short_name, p_message_name);
386: ELSE
387: x_message_text :=FND_MESSAGE.get;
388: END IF;
389:
390: IF x_message_text IS NULL THEN
391: DPP_UTILITY_PVT.debug_message('Message: ' || p_message_name || ' cannot be found');
428: END IF;
429: WHEN OTHERS THEN
430:
431: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
432: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
433: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Select_Message_Text');
434: fnd_message.set_token('ERRNO', sqlcode);
435: fnd_message.set_token('REASON', sqlerrm);
436: FND_MSG_PUB.ADD;
429: WHEN OTHERS THEN
430:
431: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
432: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
433: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Select_Message_Text');
434: fnd_message.set_token('ERRNO', sqlcode);
435: fnd_message.set_token('REASON', sqlerrm);
436: FND_MSG_PUB.ADD;
437: DPP_UTILITY_PVT.debug_message(substr(('Error in DPP_NOTIFICATION_PVT.Select_Message_Text: '||SQLERRM),1,2000));
430:
431: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
432: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
433: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Select_Message_Text');
434: fnd_message.set_token('ERRNO', sqlcode);
435: fnd_message.set_token('REASON', sqlerrm);
436: FND_MSG_PUB.ADD;
437: DPP_UTILITY_PVT.debug_message(substr(('Error in DPP_NOTIFICATION_PVT.Select_Message_Text: '||SQLERRM),1,2000));
438:
431: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
432: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
433: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Select_Message_Text');
434: fnd_message.set_token('ERRNO', sqlcode);
435: fnd_message.set_token('REASON', sqlerrm);
436: FND_MSG_PUB.ADD;
437: DPP_UTILITY_PVT.debug_message(substr(('Error in DPP_NOTIFICATION_PVT.Select_Message_Text: '||SQLERRM),1,2000));
438:
439: -- Standard call to get message count and if count=1, get the message
490: -- Initialize API return status to sucess
491: l_return_status := FND_API.G_RET_STS_SUCCESS;
492:
493: IF p_execution_detail_id IS NULL THEN
494: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
495: FND_MESSAGE.set_token('ID', 'Execution Detail ID');
496: FND_MSG_PUB.add;
497: RAISE FND_API.G_EXC_ERROR;
498: END IF;
491: l_return_status := FND_API.G_RET_STS_SUCCESS;
492:
493: IF p_execution_detail_id IS NULL THEN
494: FND_MESSAGE.set_name('DPP', 'DPP_API_INPUT_ID_MISSING');
495: FND_MESSAGE.set_token('ID', 'Execution Detail ID');
496: FND_MSG_PUB.add;
497: RAISE FND_API.G_EXC_ERROR;
498: END IF;
499:
504: FROM DPP_NOTIFICATION_BLOBS
505: WHERE execution_detail_id = p_execution_detail_id;
506:
507: IF x_formatted_output IS NULL THEN
508: FND_MESSAGE.set_name('DPP', 'DPP_OUTPUT_NOT_CREATED');
509: FND_MESSAGE.set_token('REQID', p_execution_detail_id); -- change token name later
510: FND_MSG_PUB.add;
511: -- Debug Message
512: IF g_debug THEN
505: WHERE execution_detail_id = p_execution_detail_id;
506:
507: IF x_formatted_output IS NULL THEN
508: FND_MESSAGE.set_name('DPP', 'DPP_OUTPUT_NOT_CREATED');
509: FND_MESSAGE.set_token('REQID', p_execution_detail_id); -- change token name later
510: FND_MSG_PUB.add;
511: -- Debug Message
512: IF g_debug THEN
513: DPP_UTILITY_PVT.debug_message('Formatted Output was not created by Request');
552: END IF;
553: WHEN OTHERS THEN
554:
555: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
556: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
557: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Get_FormattedOutput');
558: fnd_message.set_token('ERRNO', sqlcode);
559: fnd_message.set_token('REASON', sqlerrm);
560: FND_MSG_PUB.ADD;
553: WHEN OTHERS THEN
554:
555: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
556: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
557: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Get_FormattedOutput');
558: fnd_message.set_token('ERRNO', sqlcode);
559: fnd_message.set_token('REASON', sqlerrm);
560: FND_MSG_PUB.ADD;
561: DPP_UTILITY_PVT.debug_message(substr(('Error in DPP_NOTIFICATION_PVT.Get_FormattedOutput: '||SQLERRM),1,2000));
554:
555: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
556: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
557: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Get_FormattedOutput');
558: fnd_message.set_token('ERRNO', sqlcode);
559: fnd_message.set_token('REASON', sqlerrm);
560: FND_MSG_PUB.ADD;
561: DPP_UTILITY_PVT.debug_message(substr(('Error in DPP_NOTIFICATION_PVT.Get_FormattedOutput: '||SQLERRM),1,2000));
562: -- Standard call to get message count and if count=1, get the message
555: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
556: fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
557: fnd_message.set_token('ROUTINE', 'DPP_NOTIFICATION_PVT.Get_FormattedOutput');
558: fnd_message.set_token('ERRNO', sqlcode);
559: fnd_message.set_token('REASON', sqlerrm);
560: FND_MSG_PUB.ADD;
561: DPP_UTILITY_PVT.debug_message(substr(('Error in DPP_NOTIFICATION_PVT.Get_FormattedOutput: '||SQLERRM),1,2000));
562: -- Standard call to get message count and if count=1, get the message
563: FND_MSG_PUB.Count_And_Get (