DBA Data[Home] [Help]

PACKAGE BODY: APPS.DPP_NOTIFICATION_PVT

Source


1 PACKAGE BODY DPP_NOTIFICATION_PVT AS
2 /* $Header: dppvnotb.pls 120.24 2008/05/29 06:21:44 sdasan noship $ */
3 
4 -- Package name     : DPP_NOTIFICATION_PVT
5 -- Purpose          :
6 -- History          :
7 -- NOTE             :
8 -- End of Comments
9 
10 G_PKG_NAME      CONSTANT VARCHAR2(30) := 'DPP_NOTIFICATION_PVT';
11 G_DEBUG BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_high);
12 G_FILE_NAME     CONSTANT VARCHAR2(14) := 'dppvnotb.pls';
13 
14 ---------------------------------------------------------------------
15 -- PROCEDURE
16 --    Create_FormattedOutput
17 --
18 -- PURPOSE
19 --    Create Formatted Output
20 --
21 -- PARAMETERS
22 --
23 -- NOTES
24 --    1.
25 --    2.
26 ----------------------------------------------------------------------
27 
28 PROCEDURE Create_Formattedoutput
29      (p_api_version          IN NUMBER,
30       p_init_msg_list        IN VARCHAR2 := FND_API.G_FALSE,
31       p_commit               IN VARCHAR2 := FND_API.G_FALSE,
32       p_validation_level     IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
33       x_return_status        OUT NOCOPY VARCHAR2,
34       x_msg_count            OUT NOCOPY NUMBER,
35       x_msg_data             OUT NOCOPY VARCHAR2,
36       p_execution_detail_id  IN NUMBER,
37       p_user_id              IN NUMBER,
38       p_process_code         IN VARCHAR2,
39       p_input_xml            IN CLOB,
40       p_notif_language       IN VARCHAR2,
41       p_notif_territory      IN VARCHAR2,
42       x_request_id           OUT NOCOPY NUMBER)
43 IS
44   l_api_name           CONSTANT VARCHAR2(30) := 'Create_FormattedOutput';
45   l_api_version        CONSTANT NUMBER := 1.0;
46   l_full_name          CONSTANT VARCHAR2(60) := G_PKG_NAME
47                                                 ||'.'
48                                                 ||L_API_NAME;
49   l_return_status      VARCHAR2(1);
50   l_req_id             NUMBER := 0;
51   l_wait_req           BOOLEAN;
52   l_cancel_req_out     BOOLEAN;
53   l_phase              VARCHAR2(30);
54   l_status             VARCHAR2(30);
55   l_dev_phase          VARCHAR2(30);
56   l_dev_status         VARCHAR2(30);
57   l_message            VARCHAR2(4000);
58   l_cancel_req_msg     VARCHAR2(4000);
59   l_responsibility_id  NUMBER;
60   l_application_id     NUMBER;
61   l_output_type        VARCHAR2(240);
62   l_notif_territory    VARCHAR2(240) := p_notif_territory;
63 
64 BEGIN
65 
66 -- Standard begin of API savepoint
67     SAVEPOINT  Create_FormattedOutput_PVT;
68 -- Standard call to check for call compatibility.
69   IF NOT FND_API.Compatible_API_Call ( l_api_version,
70       p_api_version,
71       l_api_name,
72       G_PKG_NAME)
73    THEN
74       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
75    END IF;
76 -- Initialize message list if p_init_msg_list is set to TRUE.
77    IF FND_API.to_Boolean( p_init_msg_list )
78    THEN
79       FND_MSG_PUB.initialize;
80    END IF;
81 
82    -- Debug Message
83    IF g_debug THEN
84       DPP_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
85    END IF;
86 -- Initialize API return status to sucess
87     l_return_status := FND_API.G_RET_STS_SUCCESS;
88 
89 --
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
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');
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 
110   BEGIN
111      SELECT u.RESPONSIBILITY_ID,
112             u.RESPONSIBILITY_APPLICATION_ID
113        INTO l_responsibility_id,
114             l_application_id
115        FROM fnd_user_resp_groups u,
116             fnd_responsibility_vl r
117       WHERE user_id = p_user_id
118         AND r.RESPONSIBILITY_ID = u.RESPONSIBILITY_ID
119         AND u.RESPONSIBILITY_APPLICATION_ID = 9000          -- for dpp
120         AND ROWNUM = 1;
121   EXCEPTION
122      WHEN NO_DATA_FOUND THEN
123         DPP_UTILITY_PVT.debug_message('Price Protection responsibility not available for User');
124         RAISE FND_API.G_EXC_ERROR;
125   END;
126 
127   FND_GLOBAL.APPS_INITIALIZE(p_user_id,l_responsibility_id,l_application_id);
128 
129   l_output_type := fnd_profile.VALUE('DPP_NOTIFICATION_REPORT_TYPE');
130 
131   IF g_debug THEN
132 	      DPP_UTILITY_PVT.debug_message('Output Type: ' || l_output_type);
133    END IF;
134 
135 
136 INSERT INTO DPP_NOTIFICATION_BLOBS
137 (
138 	execution_detail_id,
139 	creation_date,
140 	created_by,
141 	last_update_date,
142 	last_updated_by,
143 	last_update_login,
144 	notification_xml_input,
145 	Notification_Output_Type
146 )
147 VALUES
148 (
149 	p_execution_detail_id,
150 	sysdate,
151 	p_user_id,
152 	sysdate,
153 	p_user_id,
154 	fnd_global.login_id,
155 	p_input_xml,
156 	l_output_type
157 );
158 
159 --Retrieve the default territory from the look up
160   IF l_notif_territory IS NULL THEN
161      BEGIN
162        SELECT tag
163          INTO l_notif_territory
164          FROM dpp_lookups
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
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;
182 
183 l_req_id := FND_REQUEST.submit_request(
184 							application => 'DPP',
185 							program => 'DPPNOTIF',
186 							description => NULL,
187 							start_time => NULL,
188 							sub_request => FALSE,
189 							argument1 => p_execution_detail_id,
190 							argument2 => p_process_code,
191 							argument3 => l_output_type,
192 							argument4 => p_notif_language,
193 							argument5 => l_notif_territory);
194 
195 COMMIT;
196 
197 x_request_id := l_req_id;
198 
199 IF l_req_id = 0 THEN
200 
201    DPP_UTILITY_PVT.debug_message('Error in Conc Request Submission');
202    RAISE FND_API.G_EXC_ERROR;
203 
204 END IF;
205 
206 
207 x_return_status := l_return_status;
208 
209 -- Standard check for p_commit
210    IF FND_API.to_Boolean( p_commit )
211    THEN
212       COMMIT WORK;
213    END IF;
214 
215    -- Debug Message
216    IF g_debug THEN
217       DPP_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
218    END IF;
219    -- Standard call to get message count and if count is 1, get message info.
220    FND_MSG_PUB.Count_And_Get
221    (p_count          =>   x_msg_count,
222     p_data           =>   x_msg_data
223    );
224 
225 
226 --Exception Handling
227 EXCEPTION
228 WHEN FND_API.G_EXC_ERROR THEN
229    x_return_status := FND_API.G_RET_STS_ERROR;
230    -- Standard call to get message count and if count=1, get the message
231    FND_MSG_PUB.Count_And_Get (
232    p_encoded => FND_API.G_FALSE,
233    p_count   => x_msg_count,
234    p_data    => x_msg_data
235    );
236    IF x_msg_count > 1 THEN
237    FOR I IN 1..x_msg_count LOOP
238        x_msg_data := SUBSTR((x_msg_data||' '|| FND_MSG_PUB.GET(P_MSG_INDEX => I, P_ENCODED => 'F')), 1, 4000);
239    END LOOP;
240  END IF;
241 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
242 
243    x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
244    -- Standard call to get message count and if count=1, get the message
245    FND_MSG_PUB.Count_And_Get (
246    p_encoded => FND_API.G_FALSE,
247    p_count => x_msg_count,
248    p_data  => x_msg_data
249    );
250    IF x_msg_count > 1 THEN
251    FOR I IN 1..x_msg_count LOOP
252        x_msg_data := SUBSTR((x_msg_data||' '|| FND_MSG_PUB.GET(P_MSG_INDEX => I, P_ENCODED => 'F')), 1, 4000);
253    END LOOP;
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;
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
266    FND_MSG_PUB.Count_And_Get (
267    p_encoded => FND_API.G_FALSE,
268    p_count => x_msg_count,
269    p_data  => x_msg_data
270    );
271 IF x_msg_count > 1 THEN
272    FOR I IN 1..x_msg_count LOOP
273        x_msg_data := SUBSTR((x_msg_data||' '|| FND_MSG_PUB.GET(P_MSG_INDEX => I, P_ENCODED => 'F')), 1, 4000);
274    END LOOP;
275  END IF;
276   END Create_FormattedOutput;
277 
278 ---------------------------------------------------------------------
279 -- PROCEDURE
280 --    Select_Message_Text
281 --
282 -- PURPOSE
283 --    Select Message Text
284 --
285 -- PARAMETERS
286 --
287 -- NOTES
288 --    1.
289 --    2.
290 ----------------------------------------------------------------------
291 
292 PROCEDURE Select_Message_Text
293      (x_return_status           OUT NOCOPY VARCHAR2,
294       x_msg_count               OUT NOCOPY NUMBER,
295       x_msg_data                OUT NOCOPY VARCHAR2,
296       p_message_name            IN VARCHAR2,
297       p_application_short_name  IN VARCHAR2,
298       p_language_code           IN VARCHAR2,
299       p_message_token           IN MESSAGE_TOKENS_TBL_TYPE,
300       x_message_type            OUT NOCOPY VARCHAR2,
301       x_message_category        OUT NOCOPY VARCHAR2,
302       x_message_text            OUT NOCOPY VARCHAR2,
303       x_message_severity        OUT NOCOPY VARCHAR2)
304 IS
305   l_api_name           CONSTANT VARCHAR2(30) := 'Select_Message_Text';
306   l_api_version        CONSTANT NUMBER := 1.0;
307   l_full_name          CONSTANT VARCHAR2(60) := g_pkg_name
308                                                 ||'.'
309                                                 ||l_api_name;
310   l_return_status      VARCHAR2(1);
311   l_message_token      DPP_NOTIFICATION_PVT.message_tokens_tbl_type := p_message_token;
312   l_language_code      VARCHAR2(10);
313 
314 BEGIN
315 
316    -- Debug Message
317    IF g_debug THEN
318       DPP_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
319    END IF;
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
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 
335   IF p_language_code IS NOT NULL THEN
336      BEGIN
337        SELECT nls_language
338          INTO l_language_code
339          FROM fnd_languages
340         WHERE upper((iso_language||'-'||iso_territory)) = UPPER(p_language_code);
341      EXCEPTION
342        WHEN NO_DATA_FOUND THEN
343             BEGIN
344               SELECT fl.nls_language
345                 INTO l_language_code
346                 FROM fnd_languages fl,
347                      dpp_lookups dl
348                WHERE upper((fl.iso_language||'-'||fl.iso_territory)) = UPPER((p_language_code||'-'||dl.tag))
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
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
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);
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;
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 
390    IF x_message_text IS NULL THEN
391       DPP_UTILITY_PVT.debug_message('Message: ' || p_message_name || ' cannot be found');
392    END IF;
393 
394     x_return_status := l_return_status;
395 
396    -- Debug Message
397    IF g_debug THEN
398       DPP_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
399    END IF;
400 --Exception Handling
401 EXCEPTION
402 WHEN FND_API.G_EXC_ERROR THEN
403    x_return_status := FND_API.G_RET_STS_ERROR;
404    -- Standard call to get message count and if count=1, get the message
405    FND_MSG_PUB.Count_And_Get (
406    p_encoded => FND_API.G_FALSE,
407    p_count   => x_msg_count,
408    p_data    => x_msg_data
409    );
410    IF x_msg_count > 1 THEN
411    FOR I IN 1..x_msg_count LOOP
412        x_msg_data := SUBSTR((x_msg_data||' '|| FND_MSG_PUB.GET(P_MSG_INDEX => I, P_ENCODED => 'F')), 1, 2000);
413    END LOOP;
414  END IF;
415 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
416 
417    x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
418    -- Standard call to get message count and if count=1, get the message
419    FND_MSG_PUB.Count_And_Get (
420    p_encoded => FND_API.G_FALSE,
421    p_count => x_msg_count,
422    p_data  => x_msg_data
423    );
424    IF x_msg_count > 1 THEN
425    FOR I IN 1..x_msg_count LOOP
426        x_msg_data := SUBSTR((x_msg_data||' '|| FND_MSG_PUB.GET(P_MSG_INDEX => I, P_ENCODED => 'F')), 1, 2000);
427    END LOOP;
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;
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
440    FND_MSG_PUB.Count_And_Get (
441    p_encoded => FND_API.G_FALSE,
442    p_count => x_msg_count,
443    p_data  => x_msg_data
444    );
445 IF x_msg_count > 1 THEN
446    FOR I IN 1..x_msg_count LOOP
447        x_msg_data := SUBSTR((x_msg_data||' '|| FND_MSG_PUB.GET(P_MSG_INDEX => I, P_ENCODED => 'F')), 1, 2000);
448    END LOOP;
449  END IF;
450 END Select_Message_Text;
451 
452 ---------------------------------------------------------------------
453 -- PROCEDURE
454 --    Get_FormattedOutput
455 --
456 -- PURPOSE
457 --    Get Formatted Output
458 --
459 -- PARAMETERS
460 --
461 -- NOTES
462 --    1.
463 --    2.
464 ----------------------------------------------------------------------
465 
466 PROCEDURE Get_FormattedOutput
467      (p_api_version          IN NUMBER,
468       p_init_msg_list        IN VARCHAR2 := FND_API.G_FALSE,
469       p_commit               IN VARCHAR2 := FND_API.G_FALSE,
470       p_validation_level     IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
471       x_return_status        OUT NOCOPY VARCHAR2,
472       x_msg_count            OUT NOCOPY NUMBER,
473       x_msg_data             OUT NOCOPY VARCHAR2,
474       p_execution_detail_id  IN NUMBER,
475       x_output_type          OUT NOCOPY VARCHAR2,
476       x_formatted_output     OUT NOCOPY BLOB)
477 IS
478   l_api_name           CONSTANT VARCHAR2(30) := 'Get_FormattedOutput';
479   l_api_version        CONSTANT NUMBER := 1.0;
480   l_full_name          CONSTANT VARCHAR2(60) := g_pkg_name
481                                                 ||'.'
482                                                 ||l_api_name;
483   l_return_status      VARCHAR2(1);
484 BEGIN
485 
486    -- Debug Message
487    IF g_debug THEN
488       DPP_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
489    END IF;
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;
499 
500  -- x_output_type := fnd_profile.VALUE('DPP_NOTIFICATION_REPORT_TYPE');
501 
502 	SELECT notification_attachment,notification_output_type
503     INTO x_formatted_output,x_output_type
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
513 	      DPP_UTILITY_PVT.debug_message('Formatted Output was not created by Request');
514 	   END IF;
515 	   RAISE FND_API.G_EXC_ERROR;
516      END IF;
517 
518     x_return_status := l_return_status;
519 
520    -- Debug Message
521    IF g_debug THEN
522       DPP_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
523    END IF;
524 --Exception Handling
525 EXCEPTION
526 WHEN FND_API.G_EXC_ERROR THEN
527    x_return_status := FND_API.G_RET_STS_ERROR;
528    -- Standard call to get message count and if count=1, get the message
529    FND_MSG_PUB.Count_And_Get (
530    p_encoded => FND_API.G_FALSE,
531    p_count   => x_msg_count,
532    p_data    => x_msg_data
533    );
534    IF x_msg_count > 1 THEN
535    FOR I IN 1..x_msg_count LOOP
536        x_msg_data := SUBSTR((x_msg_data||' '|| FND_MSG_PUB.GET(P_MSG_INDEX => I, P_ENCODED => 'F')), 1, 2000);
537    END LOOP;
538  END IF;
539 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
540 
541    x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
542    -- Standard call to get message count and if count=1, get the message
543    FND_MSG_PUB.Count_And_Get (
544    p_encoded => FND_API.G_FALSE,
545    p_count => x_msg_count,
546    p_data  => x_msg_data
547    );
548    IF x_msg_count > 1 THEN
549    FOR I IN 1..x_msg_count LOOP
550        x_msg_data := SUBSTR((x_msg_data||' '|| FND_MSG_PUB.GET(P_MSG_INDEX => I, P_ENCODED => 'F')), 1, 2000);
551    END LOOP;
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;
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 (
564    p_encoded => FND_API.G_FALSE,
565    p_count => x_msg_count,
566    p_data  => x_msg_data
567    );
568 IF x_msg_count > 1 THEN
569    FOR I IN 1..x_msg_count LOOP
570        x_msg_data := SUBSTR((x_msg_data||' '|| FND_MSG_PUB.GET(P_MSG_INDEX => I, P_ENCODED => 'F')), 1, 2000);
571    END LOOP;
572  END IF;
573 END Get_FormattedOutput;
574 
575 END DPP_NOTIFICATION_PVT;