DBA Data[Home] [Help]

PACKAGE BODY: APPS.QP_CURRENCY_PVT

Source


1 PACKAGE BODY QP_Currency_PVT AS
2 /* $Header: QPXVCURB.pls 120.2 2005/07/07 04:29:57 appldev ship $ */
3 
4 --  Global constant holding the package name
5 
6 G_PKG_NAME                    CONSTANT VARCHAR2(30) := 'QP_Currency_PVT';
7 
8 --  Curr_Lists
9 
10 PROCEDURE Curr_Lists
11 (   p_validation_level              IN  NUMBER
12 ,   p_control_rec                   IN  QP_GLOBALS.Control_Rec_Type
13 ,   p_CURR_LISTS_rec                IN  QP_Currency_PUB.Curr_Lists_Rec_Type
14 ,   p_old_CURR_LISTS_rec            IN  QP_Currency_PUB.Curr_Lists_Rec_Type
15 ,   x_CURR_LISTS_rec                OUT NOCOPY /* file.sql.39 change */ QP_Currency_PUB.Curr_Lists_Rec_Type
16 ,   x_old_CURR_LISTS_rec            OUT NOCOPY /* file.sql.39 change */ QP_Currency_PUB.Curr_Lists_Rec_Type
17 )
18 IS
19 l_return_status               VARCHAR2(1);
20 l_control_rec                 QP_GLOBALS.Control_Rec_Type;
21 l_CURR_LISTS_rec              QP_Currency_PUB.Curr_Lists_Rec_Type := p_CURR_LISTS_rec;
22 l_old_CURR_LISTS_rec          QP_Currency_PUB.Curr_Lists_Rec_Type := p_old_CURR_LISTS_rec;
23 
24 l_p_CURR_LISTS_rec	      QP_Currency_PUB.Curr_Lists_Rec_Type; --[prarasto]
25 
26 BEGIN
27 
28 	/* Debug Code
29     oe_debug_pub.add('Entered CURR_LISTS procedure');
30     -- oe_debug_pub.add('Check Point-1');
31 -- Debugging statements only by Sunil
32         oe_debug_pub.add('Inside CURR_LISTS: CHECK POINT-1; CHECKING l_control_rec');
33         if l_control_rec.default_attributes then
34             oe_debug_pub.add('Before Init_Control_rec: default_attributes is TRUE');
35         else
36             oe_debug_pub.add('Before Init_Control_rec: default_attributes is FALSE');
37         end if;
38         if l_control_rec.change_attributes then
39             oe_debug_pub.add('Before Init_Control_rec: change_attributes is TRUE');
40         else
41             oe_debug_pub.add('Before Init_Control_rec: change_attributes is FALSE');
42         end if;
43         IF l_control_rec.write_to_db THEN
44           oe_debug_pub.add('Before Init_Control_rec: write_to_db is TRUE');
45         ELSE
46           oe_debug_pub.add('Before Init_Control_rec: write_to_db is FALSE');
47         END IF;
48         oe_debug_pub.add('Before Init_Control_rec: Operation: '||l_CURR_LISTS_rec.operation);
49         IF l_control_rec.validate_entity THEN
50           oe_debug_pub.add('Before Init_Control_rec: validate_entity is TRUE');
51         else
52           oe_debug_pub.add('Before Init_Control_rec: validate_entity is FALSE');
53         end if;
54 -- Debugging statements only by Sunil
55 	Debug Code */
56     --  Load API control record
57 
58     l_control_rec := QP_GLOBALS.Init_Control_Rec
59     (   p_operation     => l_CURR_LISTS_rec.operation
60     ,   p_control_rec   => p_control_rec
61     );
62 	/* Debug Code
63 -- Debugging statements only by Sunil
64         oe_debug_pub.add('After Init_Control_rec: CHECK POINT-2; CHECKING l_control_rec');
65         if l_control_rec.default_attributes then
66             oe_debug_pub.add('After Init_Control_rec: default_attributes is TRUE');
67         else
68             oe_debug_pub.add('After Init_Control_rec: default_attributes is FALSE');
69         end if;
70         if l_control_rec.change_attributes then
71             oe_debug_pub.add('After Init_Control_rec: change_attributes is TRUE');
72         else
73             oe_debug_pub.add('After Init_Control_rec: change_attributes is FALSE');
74         end if;
75         IF l_control_rec.write_to_db THEN
76           oe_debug_pub.add('After Init_Control_rec: write_to_db is TRUE');
77         ELSE
78           oe_debug_pub.add('After Init_Control_rec: write_to_db is FALSE');
79         END IF;
80         oe_debug_pub.add('After Init_Control_rec: Operation: '||l_CURR_LISTS_rec.operation);
81         IF l_control_rec.validate_entity THEN
82           oe_debug_pub.add('After Init_Control_rec: validate_entity is TRUE');
83         else
84           oe_debug_pub.add('After Init_Control_rec: validate_entity is FALSE');
85         end if;
86 -- Debugging statements only by Sunil
87 	Debug Code */
88 
89     --  Set record return status.
90 
91     l_CURR_LISTS_rec.return_status := FND_API.G_RET_STS_SUCCESS;
92 
93     --  Prepare record.
94 
95     IF l_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_CREATE THEN
96 
97         l_CURR_LISTS_rec.db_flag := FND_API.G_FALSE;
98 
99         --  Set missing old record elements to NULL.
100 
101         l_old_CURR_LISTS_rec :=
102         QP_Curr_Lists_Util.Convert_Miss_To_Null (l_old_CURR_LISTS_rec);
103 
104     ELSIF l_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_UPDATE
105     OR    l_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_DELETE
106     THEN
107 
108         l_CURR_LISTS_rec.db_flag := FND_API.G_TRUE;
109 
110         --  Query Old if missing
111 
112         IF  l_old_CURR_LISTS_rec.currency_header_id = FND_API.G_MISS_NUM
113         THEN
114 
115             l_old_CURR_LISTS_rec := QP_Curr_Lists_Util.Query_Row
116             (   p_currency_header_id          => l_CURR_LISTS_rec.currency_header_id
117             );
118 
119         ELSE
120 
121             --  Set missing old record elements to NULL.
122 
123             l_old_CURR_LISTS_rec :=
124             QP_Curr_Lists_Util.Convert_Miss_To_Null (l_old_CURR_LISTS_rec);
125 
126         END IF;
127 
128         --  Complete new record from old
129 
130         l_CURR_LISTS_rec := QP_Curr_Lists_Util.Complete_Record
131         (   p_CURR_LISTS_rec              => l_CURR_LISTS_rec
132         ,   p_old_CURR_LISTS_rec          => l_old_CURR_LISTS_rec
133         );
134 
135     END IF;
136 
137     -- oe_debug_pub.add('Check Pint-2');
138     --  Attribute level validation.
139 
140    IF ( l_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_UPDATE
141      or l_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_CREATE
142      or l_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_DELETE ) THEN
143     -- Above if statement added by Sunil Pandey in order to avoid header level validations
144     -- for detail record
145     IF  l_control_rec.default_attributes
146     OR  l_control_rec.change_attributes
147     THEN
148 
149         IF p_validation_level > FND_API.G_VALID_LEVEL_NONE THEN
150 
151             QP_Validate_Curr_Lists.Attributes
152             (   x_return_status               => l_return_status
153             ,   p_CURR_LISTS_rec              => l_CURR_LISTS_rec
154             ,   p_old_CURR_LISTS_rec          => l_old_CURR_LISTS_rec
155             );
156 
157             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
158                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
159             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
160                 RAISE FND_API.G_EXC_ERROR;
161             END IF;
162 
163         END IF;
164 
165     END IF;
166     -- oe_debug_pub.add('Check Pint-3');
167 
168         --  Clear dependent attributes.
169 
170     IF  l_control_rec.change_attributes THEN
171 
172         l_p_CURR_LISTS_rec := l_CURR_LISTS_rec; --[prarasto]
173 
174         QP_Curr_Lists_Util.Clear_Dependent_Attr
175         (   p_CURR_LISTS_rec              => l_p_CURR_LISTS_rec
176         ,   p_old_CURR_LISTS_rec          => l_old_CURR_LISTS_rec
177         ,   x_CURR_LISTS_rec              => l_CURR_LISTS_rec
178         );
179 
180     END IF;
181 
182     -- oe_debug_pub.add('Check Pint-4');
183     --  Default missing attributes
184 
185     IF  l_control_rec.default_attributes
186     OR  l_control_rec.change_attributes
187     THEN
188 
189     -- oe_debug_pub.add('Before Calling HDR D Attributes procedure: l_CURR_LISTS_rec.currency_header_id'||l_CURR_LISTS_rec.currency_header_id);
190 
191         l_p_CURR_LISTS_rec := l_CURR_LISTS_rec; --[prarasto]
192 
193         QP_Default_Curr_Lists.Attributes
194         (   p_CURR_LISTS_rec              => l_p_CURR_LISTS_rec
195         ,   x_CURR_LISTS_rec              => l_CURR_LISTS_rec
196         );
197     -- oe_debug_pub.add('After Calling HDR D Attributes procedure: l_CURR_LISTS_rec.currency_header_id'||l_CURR_LISTS_rec.currency_header_id);
198 
199     END IF;
200     -- oe_debug_pub.add('Check Pint-5');
201 
202     --  Apply attribute changes
203 
204     IF  l_control_rec.default_attributes
205     OR  l_control_rec.change_attributes
206     THEN
207 
208         l_p_CURR_LISTS_rec := l_CURR_LISTS_rec; --[prarasto]
209 
210         QP_Curr_Lists_Util.Apply_Attribute_Changes
211         (   p_CURR_LISTS_rec              => l_p_CURR_LISTS_rec
212         ,   p_old_CURR_LISTS_rec          => l_old_CURR_LISTS_rec
213         ,   x_CURR_LISTS_rec              => l_CURR_LISTS_rec
214         );
215 
216     END IF;
217     -- oe_debug_pub.add('Check Pint-6');
218 
219     --  Entity level validation.
220     -- oe_debug_pub.add('Inside  CURR_LISTS Just before calling QP_Validate_Curr_Lists L-Package');
221 
222     IF l_control_rec.validate_entity THEN
223 
224         IF l_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_DELETE THEN
225             -- Added by sunilpandey to prevent delete operation of details from Public package
226             FND_MESSAGE.SET_NAME('QP','QP_CAN_NOT_DELETE_CURR_HDR');
227             OE_MSG_PUB.Add;
228 
229             RAISE FND_API.G_EXC_ERROR;
230 
231 
232            /*
233             QP_Validate_Curr_Lists.Entity_Delete
234             (   x_return_status               => l_return_status
235             ,   p_CURR_LISTS_rec              => l_CURR_LISTS_rec
236             );
237            */
238 
239         ELSE
240 
241             QP_Validate_Curr_Lists.Entity
242             (   x_return_status               => l_return_status
243             ,   p_CURR_LISTS_rec              => l_CURR_LISTS_rec
244             ,   p_old_CURR_LISTS_rec          => l_old_CURR_LISTS_rec
245             );
246 
247         END IF;
248 
249         IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
250             RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
251         ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
252             RAISE FND_API.G_EXC_ERROR;
253         END IF;
254 
255     END IF;
256 -- Added by SunilP
257     -- oe_debug_pub.add('Inside  CURR_LISTS after calling QP_Validate_Curr_Lists and before calling update_row');
258     -- oe_debug_pub.add('Operation: '||l_CURR_LISTS_rec.operation);
259 
260 /*
261     IF l_control_rec.write_to_db THEN
262       oe_debug_pub.add('write_to_db is TRUE');
263     ELSE
264       oe_debug_pub.add('write_to_db is FALSE');
265     END IF;
266 -- Added by SunilP
267 */
268 
269     --  Step 4. Write to DB
270 
271     IF l_control_rec.write_to_db THEN
272 
273         IF l_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_DELETE THEN
274 
275             QP_Curr_Lists_Util.Delete_Row
276             (   p_currency_header_id          => l_CURR_LISTS_rec.currency_header_id
277             );
278 
279         ELSE
280 
281             --  Get Who Information
282 
283             l_CURR_LISTS_rec.last_update_date := SYSDATE;
284             l_CURR_LISTS_rec.last_updated_by := FND_GLOBAL.USER_ID;
285             l_CURR_LISTS_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
286 
287             IF l_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_UPDATE THEN
288 
289     -- oe_debug_pub.add('Calling  QP_Curr_Lists_Util.Update_Row from CURR_LISTS package');
290                 QP_Curr_Lists_Util.Update_Row (l_CURR_LISTS_rec);
291 
292             ELSIF l_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_CREATE THEN
293 
294                 l_CURR_LISTS_rec.creation_date := SYSDATE;
295                 l_CURR_LISTS_rec.created_by    := FND_GLOBAL.USER_ID;
296 
297                 QP_Curr_Lists_Util.Insert_Row (l_CURR_LISTS_rec);
298 
299             END IF;
300 
301         END IF;
302 
303     END IF;
304    END IF; /* if operation is create, update or delete */
305 
306    --  Load OUT parameters
307 
308    x_CURR_LISTS_rec               := l_CURR_LISTS_rec;
309    x_old_CURR_LISTS_rec           := l_old_CURR_LISTS_rec;
310 
311 EXCEPTION
312 
313     WHEN FND_API.G_EXC_ERROR THEN
314 
315         l_CURR_LISTS_rec.return_status := FND_API.G_RET_STS_ERROR;
316         x_CURR_LISTS_rec               := l_CURR_LISTS_rec;
317         x_old_CURR_LISTS_rec           := l_old_CURR_LISTS_rec;
318         RAISE;
319 
320     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
321 
322         l_CURR_LISTS_rec.return_status := FND_API.G_RET_STS_UNEXP_ERROR;
323         x_CURR_LISTS_rec               := l_CURR_LISTS_rec;
324         x_old_CURR_LISTS_rec           := l_old_CURR_LISTS_rec;
325 
326         RAISE;
327 
328     WHEN OTHERS THEN
329 
330         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
331         THEN
332             OE_MSG_PUB.Add_Exc_Msg
333             (   G_PKG_NAME
334             ,   'Curr_Lists'
335             );
336         END IF;
337 
338         l_CURR_LISTS_rec.return_status := FND_API.G_RET_STS_UNEXP_ERROR;
339         x_CURR_LISTS_rec               := l_CURR_LISTS_rec;
340         x_old_CURR_LISTS_rec           := l_old_CURR_LISTS_rec;
341 
342         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
343 
344 END Curr_Lists;
345 
346 --  Curr_Detailss
347 
348 PROCEDURE Curr_Detailss
349 (   p_validation_level              IN  NUMBER
350 ,   p_control_rec                   IN  QP_GLOBALS.Control_Rec_Type
351 ,   p_CURR_DETAILS_tbl              IN  QP_Currency_PUB.Curr_Details_Tbl_Type
352 ,   p_old_CURR_DETAILS_tbl          IN  QP_Currency_PUB.Curr_Details_Tbl_Type
353 ,   x_CURR_DETAILS_tbl              OUT NOCOPY /* file.sql.39 change */ QP_Currency_PUB.Curr_Details_Tbl_Type
354 ,   x_old_CURR_DETAILS_tbl          OUT NOCOPY /* file.sql.39 change */ QP_Currency_PUB.Curr_Details_Tbl_Type
355 )
356 IS
357 l_return_status               VARCHAR2(1);
358 l_control_rec                 QP_GLOBALS.Control_Rec_Type;
359 l_CURR_DETAILS_rec            QP_Currency_PUB.Curr_Details_Rec_Type;
360 l_CURR_DETAILS_tbl            QP_Currency_PUB.Curr_Details_Tbl_Type;
361 l_old_CURR_DETAILS_rec        QP_Currency_PUB.Curr_Details_Rec_Type;
362 l_old_CURR_DETAILS_tbl        QP_Currency_PUB.Curr_Details_Tbl_Type;
363 
364 l_p_CURR_DETAILS_rec	      QP_Currency_PUB.Curr_Details_Rec_Type; --[prarasto]
365 
366 BEGIN
367     -- oe_debug_pub.add('Entered curr_detailss');
368 
369     --  Init local table variables.
370 
371     l_CURR_DETAILS_tbl             := p_CURR_DETAILS_tbl;
372     l_old_CURR_DETAILS_tbl         := p_old_CURR_DETAILS_tbl;
373 
374     FOR I IN 1..l_CURR_DETAILS_tbl.COUNT LOOP
375     BEGIN
376 
377         --  Load local records.
378 
379         l_CURR_DETAILS_rec := l_CURR_DETAILS_tbl(I);
380 
381         IF l_old_CURR_DETAILS_tbl.EXISTS(I) THEN
382             l_old_CURR_DETAILS_rec := l_old_CURR_DETAILS_tbl(I);
383         ELSE
384             l_old_CURR_DETAILS_rec := QP_Currency_PUB.G_MISS_CURR_DETAILS_REC;
385         END IF;
386 
387         --  Load API control record
388 
389         l_control_rec := QP_GLOBALS.Init_Control_Rec
390         (   p_operation     => l_CURR_DETAILS_rec.operation
391         ,   p_control_rec   => p_control_rec
392         );
393 
394 	/* Debug Code
395 -- Debugging statements only by Sunil
396         oe_debug_pub.add('CHECK POINT-1; CHECKING l_control_rec');
397         if l_control_rec.default_attributes then
398             oe_debug_pub.add('default_attributes is TRUE');
399         else
400             oe_debug_pub.add('default_attributes is FALSE');
401         end if;
402         if l_control_rec.change_attributes then
403             oe_debug_pub.add('change_attributes is TRUE');
404         else
405             oe_debug_pub.add('change_attributes is FALSE');
406         end if;
407         IF l_control_rec.write_to_db THEN
408           oe_debug_pub.add('write_to_db is TRUE');
409         ELSE
410           oe_debug_pub.add('write_to_db is FALSE');
411         END IF;
412         oe_debug_pub.add('Operation: '||l_CURR_DETAILS_rec.operation);
413         IF l_control_rec.validate_entity THEN
414           oe_debug_pub.add('validate_entity is TRUE');
415         else
416           oe_debug_pub.add('validate_entity is FALSE');
417         end if;
418 -- Debugging statements only by Sunil
419 	Debug Code */
420 
421         --  Set record return status.
422 
423         l_CURR_DETAILS_rec.return_status := FND_API.G_RET_STS_SUCCESS;
424 
425         --  Prepare record.
426 
427         IF l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_CREATE THEN
428 
429             l_CURR_DETAILS_rec.db_flag := FND_API.G_FALSE;
430 
431             --  Set missing old record elements to NULL.
432 
433             l_old_CURR_DETAILS_rec :=
434             QP_Curr_Details_Util.Convert_Miss_To_Null (l_old_CURR_DETAILS_rec);
435 
436         ELSIF l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_UPDATE
437         OR    l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_DELETE
438         THEN
439 
440             l_CURR_DETAILS_rec.db_flag := FND_API.G_TRUE;
441 
442             --  Query Old if missing
443 
444             IF  l_old_CURR_DETAILS_rec.currency_detail_id = FND_API.G_MISS_NUM
445             THEN
446 
447                 l_old_CURR_DETAILS_rec := QP_Curr_Details_Util.Query_Row
448                 (   p_currency_detail_id          => l_CURR_DETAILS_rec.currency_detail_id
449                 );
450 
451             ELSE
452 
453                 --  Set missing old record elements to NULL.
454 
455                 l_old_CURR_DETAILS_rec :=
456                 QP_Curr_Details_Util.Convert_Miss_To_Null (l_old_CURR_DETAILS_rec);
457 
458             END IF;
459 
460             --  Complete new record from old
461 
462             l_CURR_DETAILS_rec := QP_Curr_Details_Util.Complete_Record
463             (   p_CURR_DETAILS_rec            => l_CURR_DETAILS_rec
464             ,   p_old_CURR_DETAILS_rec        => l_old_CURR_DETAILS_rec
465             );
466 
467         END IF;
468 	/* Debug Code
469 -- Debugging statements only by Sunil
470         oe_debug_pub.add('CHECK POINT-2; CHECKING l_control_rec');
471         if l_control_rec.default_attributes then
472             oe_debug_pub.add('default_attributes is TRUE');
473         else
474             oe_debug_pub.add('default_attributes is FALSE');
475         end if;
476         if l_control_rec.change_attributes then
477             oe_debug_pub.add('change_attributes is TRUE');
478         else
479             oe_debug_pub.add('change_attributes is FALSE');
480         end if;
481         IF l_control_rec.write_to_db THEN
482           oe_debug_pub.add('write_to_db is TRUE');
483         ELSE
484           oe_debug_pub.add('write_to_db is FALSE');
485         END IF;
486         oe_debug_pub.add('Operation: '||l_CURR_DETAILS_rec.operation);
487         IF l_control_rec.validate_entity THEN
488           oe_debug_pub.add('validate_entity is TRUE');
489         else
490           oe_debug_pub.add('validate_entity is FALSE');
491         end if;
492 -- Debugging statements only by Sunil
493 	Debug Code */
494 
495         --  Attribute level validation.
496 
497    IF ( l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_UPDATE
498      or l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_CREATE
499      or l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_DELETE ) THEN
500     -- Above if statement added by Sunil Pandey in order to avoid header level validations
501     -- for detail record
502         IF  l_control_rec.default_attributes
503         OR  l_control_rec.change_attributes
504         THEN
505 
506             IF p_validation_level > FND_API.G_VALID_LEVEL_NONE THEN
507 
508                 QP_Validate_Curr_Details.Attributes
509                 (   x_return_status               => l_return_status
510                 ,   p_CURR_DETAILS_rec            => l_CURR_DETAILS_rec
511                 ,   p_old_CURR_DETAILS_rec        => l_old_CURR_DETAILS_rec
512                 );
513 
514                 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
515                     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
516                 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
517                     RAISE FND_API.G_EXC_ERROR;
518                 END IF;
519 
520             END IF;
521 
522         END IF;
523 	/* Debug Code
524 -- Debugging statements only by Sunil
525         oe_debug_pub.add('CHECK POINT-3; CHECKING l_control_rec');
526         if l_control_rec.default_attributes then
527             oe_debug_pub.add('default_attributes is TRUE');
528         else
529             oe_debug_pub.add('default_attributes is FALSE');
530         end if;
531         if l_control_rec.change_attributes then
532             oe_debug_pub.add('change_attributes is TRUE');
533         else
534             oe_debug_pub.add('change_attributes is FALSE');
535         end if;
536         IF l_control_rec.write_to_db THEN
537           oe_debug_pub.add('write_to_db is TRUE');
538         ELSE
539           oe_debug_pub.add('write_to_db is FALSE');
540         END IF;
541         oe_debug_pub.add('Operation: '||l_CURR_DETAILS_rec.operation);
542         IF l_control_rec.validate_entity THEN
543           oe_debug_pub.add('validate_entity is TRUE');
544         else
545           oe_debug_pub.add('validate_entity is FALSE');
546         end if;
547 -- Debugging statements only by Sunil
548 	Debug Code */
549 
550             --  Clear dependent attributes.
551 
552         IF  l_control_rec.change_attributes THEN
553 
554 	    l_p_CURR_DETAILS_rec := l_CURR_DETAILS_rec; --[prarasto]
555 
556             QP_Curr_Details_Util.Clear_Dependent_Attr
557             (   p_CURR_DETAILS_rec            => l_p_CURR_DETAILS_rec
558             ,   p_old_CURR_DETAILS_rec        => l_old_CURR_DETAILS_rec
559             ,   x_CURR_DETAILS_rec            => l_CURR_DETAILS_rec
560             );
561 
562         END IF;
563 	/* Debug Code
564 -- Debugging statements only by Sunil
565         oe_debug_pub.add('CHECK POINT-4; CHECKING l_control_rec');
566         if l_control_rec.default_attributes then
567             oe_debug_pub.add('default_attributes is TRUE');
568         else
569             oe_debug_pub.add('default_attributes is FALSE');
570         end if;
571         if l_control_rec.change_attributes then
572             oe_debug_pub.add('change_attributes is TRUE');
573         else
574             oe_debug_pub.add('change_attributes is FALSE');
575         end if;
576         IF l_control_rec.write_to_db THEN
577           oe_debug_pub.add('write_to_db is TRUE');
578         ELSE
579           oe_debug_pub.add('write_to_db is FALSE');
580         END IF;
581         oe_debug_pub.add('Operation: '||l_CURR_DETAILS_rec.operation);
582         IF l_control_rec.validate_entity THEN
583           oe_debug_pub.add('validate_entity is TRUE');
584         else
585           oe_debug_pub.add('validate_entity is FALSE');
586         end if;
587 -- Debugging statements only by Sunil
588 	Debug Code */
589 
590         --  Default missing attributes
591 
592         IF  l_control_rec.default_attributes
593         OR  l_control_rec.change_attributes
594         THEN
595 
596     -- oe_debug_pub.add('Before Calling LINE D Attributes procedure: l_CURR_DETAILS_rec.currency_header_id'||l_CURR_DETAILS_rec.currency_header_id);
597 
598 	    l_p_CURR_DETAILS_rec := l_CURR_DETAILS_rec; --[prarasto]
599 
600             QP_Default_Curr_Details.Attributes
601             (   p_CURR_DETAILS_rec            => l_p_CURR_DETAILS_rec
602             ,   x_CURR_DETAILS_rec            => l_CURR_DETAILS_rec
603             );
604     -- oe_debug_pub.add('After Calling LINE D Attributes procedure: l_CURR_DETAILS_rec.currency_header_id'||l_CURR_DETAILS_rec.currency_header_id);
605 
606         END IF;
607 	/* Debug Code
608 -- Debugging statements only by Sunil
609         oe_debug_pub.add('CHECK POINT-5; CHECKING l_control_rec');
610         if l_control_rec.default_attributes then
611             oe_debug_pub.add('default_attributes is TRUE');
612         else
613             oe_debug_pub.add('default_attributes is FALSE');
614         end if;
615         if l_control_rec.change_attributes then
616             oe_debug_pub.add('change_attributes is TRUE');
617         else
618             oe_debug_pub.add('change_attributes is FALSE');
619         end if;
620         IF l_control_rec.write_to_db THEN
621           oe_debug_pub.add('write_to_db is TRUE');
622         ELSE
623           oe_debug_pub.add('write_to_db is FALSE');
624         END IF;
625         oe_debug_pub.add('Operation: '||l_CURR_DETAILS_rec.operation);
626         IF l_control_rec.validate_entity THEN
627           oe_debug_pub.add('validate_entity is TRUE');
628         else
629           oe_debug_pub.add('validate_entity is FALSE');
630         end if;
631 -- Debugging statements only by Sunil
632 	Debug Code */
633 
634         --  Apply attribute changes
635 
636         IF  l_control_rec.default_attributes
637         OR  l_control_rec.change_attributes
638         THEN
639 
640 	    l_p_CURR_DETAILS_rec := l_CURR_DETAILS_rec; --[prarasto]
641 
642             QP_Curr_Details_Util.Apply_Attribute_Changes
643             (   p_CURR_DETAILS_rec            => l_p_CURR_DETAILS_rec
644             ,   p_old_CURR_DETAILS_rec        => l_old_CURR_DETAILS_rec
645             ,   x_CURR_DETAILS_rec            => l_CURR_DETAILS_rec
646             );
647 
648         END IF;
649 
650 	/* Debug Code
651 -- Debugging statements only by Sunil
652         oe_debug_pub.add('CHECK POINT-6; CHECKING l_control_rec');
653         if l_control_rec.default_attributes then
654             oe_debug_pub.add('default_attributes is TRUE');
655         else
656             oe_debug_pub.add('default_attributes is FALSE');
657         end if;
658         if l_control_rec.change_attributes then
659             oe_debug_pub.add('change_attributes is TRUE');
660         else
661             oe_debug_pub.add('change_attributes is FALSE');
662         end if;
663         IF l_control_rec.write_to_db THEN
664           oe_debug_pub.add('write_to_db is TRUE');
665         ELSE
666           oe_debug_pub.add('write_to_db is FALSE');
667         END IF;
668         oe_debug_pub.add('Operation: '||l_CURR_DETAILS_rec.operation);
669         IF l_control_rec.validate_entity THEN
670           oe_debug_pub.add('validate_entity is TRUE');
671         else
672           oe_debug_pub.add('validate_entity is FALSE');
673         end if;
674 -- Debugging statements only by Sunil
675 	Debug Code */
676         --  Entity level validation.
677 
678         -- oe_debug_pub.add('** BEFORE Calling QP_Validate_Curr_Details package; OUTSIDE IF');
679         IF l_control_rec.validate_entity THEN
680             -- oe_debug_pub.add('** BEFORE Calling QP_Validate_Curr_Details package; INSIDE FIRST IF');
681 
682             IF l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_DELETE THEN
683 
684 		-- Added by sunilpandey to prevent delete operation of details from Public package
685                 FND_MESSAGE.SET_NAME('QP','QP_CAN_NOT_DELETE_CURR_DTL');
686                 OE_MSG_PUB.Add;
687 
688                 RAISE FND_API.G_EXC_ERROR;
689 
690 
691 		/*
692                 QP_Validate_Curr_Details.Entity_Delete
693                 (   x_return_status               => l_return_status
694                 ,   p_CURR_DETAILS_rec            => l_CURR_DETAILS_rec
695                 );
696 		*/
697 
698             ELSE
699 
700                 -- oe_debug_pub.add('** BEFORE Calling QP_Validate_Curr_Details.Entity; INSIDE IF');
701                 QP_Validate_Curr_Details.Entity
702                 (   x_return_status               => l_return_status
703                 ,   p_CURR_DETAILS_rec            => l_CURR_DETAILS_rec
704                 ,   p_old_CURR_DETAILS_rec        => l_old_CURR_DETAILS_rec
705                 );
706         -- oe_debug_pub.add(' Inside V after Entity call; G_MSG_COUNT: '||OE_MSG_PUB.G_MSG_COUNT);
707 
708             END IF;
709 
710             -- oe_debug_pub.add('After Calling QP_Validate_Curr_Details.Entity from V package; l_return_status :'||l_return_status);
711 
712             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
713                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
714             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
715                 RAISE FND_API.G_EXC_ERROR;
716             END IF;
717 
718         END IF;
719 
720         --  Step 4. Write to DB
721 
722 	/* Debug Code
723         oe_debug_pub.add('CHECKING VALUES BEFORE LINES INSERT/UPDATE/DELETE_ROW IS CALLED FROM VCUR');
724         IF l_control_rec.write_to_db THEN
725           oe_debug_pub.add('write_to_db is TRUE');
726         ELSE
727           oe_debug_pub.add('write_to_db is FALSE');
728         END IF;
729         oe_debug_pub.add('Operation: '||l_CURR_DETAILS_rec.operation);
730 	Debug Code */
731 
732         IF l_control_rec.write_to_db THEN
733 
734             IF l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_DELETE THEN
735 
736                 -- oe_debug_pub.add('QP_Curr_Details_Util.Delete_Row is being called');
737                 QP_Curr_Details_Util.Delete_Row
738                 (   p_currency_detail_id          => l_CURR_DETAILS_rec.currency_detail_id
739                 );
740                 -- oe_debug_pub.add('QP_Curr_Details_Util.Delete_Row is done');
741 
742             ELSE
743 
744                 --  Get Who Information
745 
746                 l_CURR_DETAILS_rec.last_update_date := SYSDATE;
747                 l_CURR_DETAILS_rec.last_updated_by := FND_GLOBAL.USER_ID;
748                 l_CURR_DETAILS_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
749 
750                 IF l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_UPDATE THEN
751 
752                     QP_Curr_Details_Util.Update_Row (l_CURR_DETAILS_rec);
753 
754                 ELSIF l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_CREATE THEN
755 
756                     l_CURR_DETAILS_rec.creation_date := SYSDATE;
757                     l_CURR_DETAILS_rec.created_by  := FND_GLOBAL.USER_ID;
758 
759                     QP_Curr_Details_Util.Insert_Row (l_CURR_DETAILS_rec);
760 
761                 END IF;
762 
763             END IF;
764 
765         END IF;
766    END IF; /* if operation is create, update or delete */
767 
768         --  Load tables.
769 
770         l_CURR_DETAILS_tbl(I)          := l_CURR_DETAILS_rec;
771         l_old_CURR_DETAILS_tbl(I)      := l_old_CURR_DETAILS_rec;
772 
773     --  For loop exception handler.
774 
775 
776     EXCEPTION
777 
778         WHEN FND_API.G_EXC_ERROR THEN
779 
780             l_CURR_DETAILS_rec.return_status := FND_API.G_RET_STS_ERROR;
781             l_CURR_DETAILS_tbl(I)          := l_CURR_DETAILS_rec;
782             l_old_CURR_DETAILS_tbl(I)      := l_old_CURR_DETAILS_rec;
783             -- oe_debug_pub.add('Raised Inner FND_API.G_EXC_ERROR EXCEPTION');
784             RAISE FND_API.G_EXC_ERROR;
785 
786         WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
787 
788             l_CURR_DETAILS_rec.return_status := FND_API.G_RET_STS_UNEXP_ERROR;
789             l_CURR_DETAILS_tbl(I)          := l_CURR_DETAILS_rec;
790             l_old_CURR_DETAILS_tbl(I)      := l_old_CURR_DETAILS_rec;
791             RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
792 
793         WHEN OTHERS THEN
794 
795             l_CURR_DETAILS_rec.return_status := FND_API.G_RET_STS_UNEXP_ERROR;
796             l_CURR_DETAILS_tbl(I)          := l_CURR_DETAILS_rec;
797             l_old_CURR_DETAILS_tbl(I)      := l_old_CURR_DETAILS_rec;
798 
799             IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
800             THEN
801                 OE_MSG_PUB.Add_Exc_Msg
802                 (   G_PKG_NAME
803                 ,   'Curr_Detailss'
804                 );
805             END IF;
806 
807             RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
808 
809     END;
810     END LOOP;
811 
812     --  Load OUT parameters
813 
814     x_CURR_DETAILS_tbl             := l_CURR_DETAILS_tbl;
815     x_old_CURR_DETAILS_tbl         := l_old_CURR_DETAILS_tbl;
816 
817 EXCEPTION
818 
819     WHEN FND_API.G_EXC_ERROR THEN
820 
821         RAISE;
822 
823     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
824 
825 
826         RAISE;
827 
828     WHEN OTHERS THEN
829 
830         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
831         THEN
832             OE_MSG_PUB.Add_Exc_Msg
833             (   G_PKG_NAME
834             ,   'Curr_Detailss'
835             );
836         END IF;
837 
838 
839         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
840 
841 END Curr_Detailss;
842 
843 --  Start of Comments
844 --  API name    Process_Currency
845 --  Type        Private
846 --  Function
847 --
848 --  Pre-reqs
849 --
850 --  Parameters
851 --
852 --  Version     Current version = 1.0
853 --              Initial version = 1.0
854 --
855 --  Notes
856 --
857 --  End of Comments
858 
859 PROCEDURE Process_Currency
860 (   p_api_version_number            IN  NUMBER
861 ,   p_init_msg_list                 IN  VARCHAR2 := FND_API.G_FALSE
862 ,   p_commit                        IN  VARCHAR2 := FND_API.G_FALSE
863 ,   p_validation_level              IN  NUMBER := FND_API.G_VALID_LEVEL_FULL
864 ,   p_control_rec                   IN  QP_GLOBALS.Control_Rec_Type :=
865                                         QP_GLOBALS.G_MISS_CONTROL_REC
866 ,   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
867 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
868 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
869 ,   p_CURR_LISTS_rec                IN  QP_Currency_PUB.Curr_Lists_Rec_Type :=
870                                         QP_Currency_PUB.G_MISS_CURR_LISTS_REC
871 ,   p_old_CURR_LISTS_rec            IN  QP_Currency_PUB.Curr_Lists_Rec_Type :=
872                                         QP_Currency_PUB.G_MISS_CURR_LISTS_REC
873 ,   p_CURR_DETAILS_tbl              IN  QP_Currency_PUB.Curr_Details_Tbl_Type :=
874                                         QP_Currency_PUB.G_MISS_CURR_DETAILS_TBL
875 ,   p_old_CURR_DETAILS_tbl          IN  QP_Currency_PUB.Curr_Details_Tbl_Type :=
876                                         QP_Currency_PUB.G_MISS_CURR_DETAILS_TBL
877 ,   x_CURR_LISTS_rec                OUT NOCOPY /* file.sql.39 change */ QP_Currency_PUB.Curr_Lists_Rec_Type
878 ,   x_CURR_DETAILS_tbl              OUT NOCOPY /* file.sql.39 change */ QP_Currency_PUB.Curr_Details_Tbl_Type
879 )
880 IS
881 l_api_version_number          CONSTANT NUMBER := 1.0;
882 l_api_name                    CONSTANT VARCHAR2(30):= 'Process_Currency';
883 l_return_status               VARCHAR2(1);
884 l_control_rec                 QP_GLOBALS.Control_Rec_Type;
885 l_CURR_LISTS_rec              QP_Currency_PUB.Curr_Lists_Rec_Type := p_CURR_LISTS_rec;
886 l_old_CURR_LISTS_rec          QP_Currency_PUB.Curr_Lists_Rec_Type := p_old_CURR_LISTS_rec;
887 l_CURR_DETAILS_rec            QP_Currency_PUB.Curr_Details_Rec_Type;
888 l_CURR_DETAILS_tbl            QP_Currency_PUB.Curr_Details_Tbl_Type;
889 l_old_CURR_DETAILS_rec        QP_Currency_PUB.Curr_Details_Rec_Type;
890 l_old_CURR_DETAILS_tbl        QP_Currency_PUB.Curr_Details_Tbl_Type;
891 
892 l_p_CURR_LISTS_rec            QP_Currency_PUB.Curr_Lists_Rec_Type; --[prarasto]
893 l_p_old_CURR_LISTS_rec	      QP_Currency_PUB.Curr_Lists_Rec_Type; --[prarasto]
894 l_p_CURR_DETAILS_tbl	      QP_Currency_PUB.Curr_Details_Tbl_Type;     --[prarasto]
895 l_p_old_CURR_DETAILS_tbl      QP_Currency_PUB.Curr_Details_Tbl_Type; --[prarasto]
896 
897 BEGIN
898 
899     -- oe_debug_pub.add('@#@#@Inside Process_Currency V');
900     --  Standard call to check for call compatibility
901     -- oe_debug_pub.add('Markup Value: '||l_CURR_LISTS_rec.base_markup_value);
902     -- oe_debug_pub.add('Description: '||l_CURR_LISTS_rec.description);
903 
904     IF NOT FND_API.Compatible_API_Call
905            (   l_api_version_number
906            ,   p_api_version_number
907            ,   l_api_name
908            ,   G_PKG_NAME
909            )
910     THEN
911         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
912     END IF;
913 
914     --  Initialize message list.
915 
916     IF FND_API.to_Boolean(p_init_msg_list) THEN
917         OE_MSG_PUB.initialize;
918     END IF;
919 
920     --  Init local table variables.
921 
922     l_CURR_DETAILS_tbl             := p_CURR_DETAILS_tbl;
923     l_old_CURR_DETAILS_tbl         := p_old_CURR_DETAILS_tbl;
924 
925     --  Curr_Lists
926     -- oe_debug_pub.add('**BEFORE CALLING CURR_LIST Header_id :'||l_CURR_LISTS_rec.currency_header_id);
927     -- oe_debug_pub.add('**BEFORE CALLING CURR_LIST Base_Currency_Code :'||l_CURR_LISTS_rec.base_currency_code);
928     -- oe_debug_pub.add('Calling  CURR_LISTS from Process_Currency of V package');
929 
930     l_p_CURR_LISTS_rec		:= l_CURR_LISTS_rec;     --[prarasto]
931     l_p_old_CURR_LISTS_rec	:= l_old_CURR_LISTS_rec; --[prarasto]
932 
933     Curr_Lists
934     (   p_validation_level            => p_validation_level
935     ,   p_control_rec                 => p_control_rec
936     ,   p_CURR_LISTS_rec              => l_p_CURR_LISTS_rec
937     ,   p_old_CURR_LISTS_rec          => l_p_old_CURR_LISTS_rec
938     ,   x_CURR_LISTS_rec              => l_CURR_LISTS_rec
939     ,   x_old_CURR_LISTS_rec          => l_old_CURR_LISTS_rec
940     );
941 
942     -- oe_debug_pub.add('**AFTER CALLING CURR_LIST Header_id :'||l_CURR_LISTS_rec.currency_header_id);
943     -- oe_debug_pub.add('**AFTER CALLING CURR_LIST Base_Currency_Code :'||l_CURR_LISTS_rec.base_currency_code);
944     -- oe_debug_pub.add('** AFTER  CALLING CURR_LIST Markup Value: '||l_CURR_LISTS_rec.base_markup_value);
945 
946     --  Perform CURR_LISTS group requests.
947 
948     IF p_control_rec.process AND
949         (p_control_rec.process_entity = QP_GLOBALS.G_ENTITY_ALL OR
950         p_control_rec.process_entity = QP_GLOBALS.G_ENTITY_CURR_LISTS)
951     THEN
952 
953         NULL;
954 
955     END IF;
956 
957     --  Load parent key if missing and operation is create.
958 
959     FOR I IN 1..l_CURR_DETAILS_tbl.COUNT LOOP
960 
961         l_CURR_DETAILS_rec := l_CURR_DETAILS_tbl(I);
962 
963         IF l_CURR_DETAILS_rec.operation = QP_GLOBALS.G_OPR_CREATE
964         AND (l_CURR_DETAILS_rec.currency_header_id IS NULL OR
965             l_CURR_DETAILS_rec.currency_header_id = FND_API.G_MISS_NUM)
966         THEN
967 
968             --  Copy parent_id.
969 
970             l_CURR_DETAILS_tbl(I).currency_header_id := l_CURR_LISTS_rec.currency_header_id;
971             --oe_debug_pub.add('##**Header_id :'||l_CURR_LISTS_rec.currency_header_id);
972         END IF;
973     END LOOP;
974 
975     --  Curr_Detailss
976 
977     l_p_CURR_DETAILS_tbl	:= l_CURR_DETAILS_tbl;     --[prarasto]
978     l_p_old_CURR_DETAILS_tbl	:= l_old_CURR_DETAILS_tbl; --[prarasto]
979 
980     Curr_Detailss
981     (   p_validation_level            => p_validation_level
982     ,   p_control_rec                 => p_control_rec
983     ,   p_CURR_DETAILS_tbl            => l_p_CURR_DETAILS_tbl
984     ,   p_old_CURR_DETAILS_tbl        => l_p_old_CURR_DETAILS_tbl
985     ,   x_CURR_DETAILS_tbl            => l_CURR_DETAILS_tbl
986     ,   x_old_CURR_DETAILS_tbl        => l_old_CURR_DETAILS_tbl
987     );
988 
989     --  Perform CURR_DETAILS group requests.
990 
991     IF p_control_rec.process AND
992         (p_control_rec.process_entity = QP_GLOBALS.G_ENTITY_ALL OR
993         p_control_rec.process_entity = QP_GLOBALS.G_ENTITY_CURR_DETAILS)
994     THEN
995 
996        QP_DELAYED_REQUESTS_PVT.Process_Request_for_Entity
997           (p_entity_code   => QP_GLOBALS.G_ENTITY_CURR_DETAILS
998           ,p_delete        => FND_API.G_TRUE
999           ,x_return_status => l_return_status
1000           );
1001        IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1002                  RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1003        ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1004                  RAISE FND_API.G_EXC_ERROR;
1005        END IF;
1006 
1007     END IF;
1008 
1009     --  Step 6. Perform Object group logic
1010 
1011     IF p_control_rec.process AND
1012         p_control_rec.process_entity = QP_GLOBALS.G_ENTITY_ALL
1013     THEN
1014 
1015         NULL;
1016 
1017     END IF;
1018 
1019     --  Done processing, load OUT parameters.
1020 
1021     x_CURR_LISTS_rec               := l_CURR_LISTS_rec;
1022     x_CURR_DETAILS_tbl             := l_CURR_DETAILS_tbl;
1023 
1024     --  Clear API cache.
1025 
1026     IF p_control_rec.clear_api_cache THEN
1027 
1028         NULL;
1029 
1030     END IF;
1031 
1032     --  Clear API request tbl.
1033 
1034     IF p_control_rec.clear_api_requests THEN
1035 
1036         NULL;
1037 
1038     END IF;
1039 
1040     --  Derive return status.
1041 
1042     x_return_status := FND_API.G_RET_STS_SUCCESS;
1043 
1044     IF l_CURR_LISTS_rec.return_status = FND_API.G_RET_STS_ERROR THEN
1045         x_return_status := FND_API.G_RET_STS_ERROR;
1046     END IF;
1047 
1048     FOR I IN 1..l_CURR_DETAILS_tbl.COUNT LOOP
1049 
1050         IF l_CURR_DETAILS_tbl(I).return_status = FND_API.G_RET_STS_ERROR THEN
1051             x_return_status := FND_API.G_RET_STS_ERROR;
1052         END IF;
1053 
1054     END LOOP;
1055 
1056     --  Get message count and data
1057 
1058     OE_MSG_PUB.Count_And_Get
1059     (   p_count                       => x_msg_count
1060     ,   p_data                        => x_msg_data
1061     );
1062 
1063 
1064 EXCEPTION
1065 
1066     WHEN FND_API.G_EXC_ERROR THEN
1067 
1068         x_return_status := FND_API.G_RET_STS_ERROR;
1069 
1070         --  Get message count and data
1071 
1072         OE_MSG_PUB.Count_And_Get
1073         (   p_count                       => x_msg_count
1074         ,   p_data                        => x_msg_data
1075         );
1076 
1077     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1078 
1079         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1080 
1081         --  Get message count and data
1082 
1083         OE_MSG_PUB.Count_And_Get
1084         (   p_count                       => x_msg_count
1085         ,   p_data                        => x_msg_data
1086         );
1087 
1088     WHEN OTHERS THEN
1089 
1090         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1091 
1092         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1093         THEN
1094             OE_MSG_PUB.Add_Exc_Msg
1095             (   G_PKG_NAME
1096             ,   'Process_Currency'
1097             );
1098         END IF;
1099 
1100         --  Get message count and data
1101 
1102         OE_MSG_PUB.Count_And_Get
1103         (   p_count                       => x_msg_count
1104         ,   p_data                        => x_msg_data
1105         );
1106 
1107 END Process_Currency;
1108 
1109 --  Start of Comments
1110 --  API name    Lock_Currency
1111 --  Type        Private
1112 --  Function
1113 --
1114 --  Pre-reqs
1115 --
1116 --  Parameters
1117 --
1118 --  Version     Current version = 1.0
1119 --              Initial version = 1.0
1120 --
1121 --  Notes
1122 --
1123 --  End of Comments
1124 
1125 PROCEDURE Lock_Currency
1126 (   p_api_version_number            IN  NUMBER
1127 ,   p_init_msg_list                 IN  VARCHAR2 := FND_API.G_FALSE
1128 ,   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
1129 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
1130 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
1131 ,   p_CURR_LISTS_rec                IN  QP_Currency_PUB.Curr_Lists_Rec_Type :=
1132                                         QP_Currency_PUB.G_MISS_CURR_LISTS_REC
1133 ,   p_CURR_DETAILS_tbl              IN  QP_Currency_PUB.Curr_Details_Tbl_Type :=
1134                                         QP_Currency_PUB.G_MISS_CURR_DETAILS_TBL
1135 ,   x_CURR_LISTS_rec                OUT NOCOPY /* file.sql.39 change */ QP_Currency_PUB.Curr_Lists_Rec_Type
1136 ,   x_CURR_DETAILS_tbl              OUT NOCOPY /* file.sql.39 change */ QP_Currency_PUB.Curr_Details_Tbl_Type
1137 )
1138 IS
1139 l_api_version_number          CONSTANT NUMBER := 1.0;
1140 l_api_name                    CONSTANT VARCHAR2(30):= 'Lock_Currency';
1141 l_return_status               VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
1142 l_CURR_DETAILS_rec            QP_Currency_PUB.Curr_Details_Rec_Type;
1143 BEGIN
1144 
1145     --  Standard call to check for call compatibility
1146 
1147     IF NOT FND_API.Compatible_API_Call
1148            (   l_api_version_number
1149            ,   p_api_version_number
1150            ,   l_api_name
1151            ,   G_PKG_NAME
1152            )
1153     THEN
1154         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1155     END IF;
1156 
1157     --  Initialize message list.
1158 
1159     IF FND_API.to_Boolean(p_init_msg_list) THEN
1160         OE_MSG_PUB.initialize;
1161     END IF;
1162 
1163     --  Set Savepoint
1164 
1165     SAVEPOINT Lock_Currency_PVT;
1166 
1167     --  Lock CURR_LISTS
1168 
1169     -- oe_debug_pub.add('Inside QPXFCURB Lock_Row; p_CURR_LISTS_rec.operation: '||p_CURR_LISTS_rec.operation);
1170 
1171     IF p_CURR_LISTS_rec.operation = QP_GLOBALS.G_OPR_LOCK THEN
1172 
1173         QP_Curr_Lists_Util.Lock_Row
1174         (   p_CURR_LISTS_rec              => p_CURR_LISTS_rec
1175         ,   x_CURR_LISTS_rec              => x_CURR_LISTS_rec
1176         ,   x_return_status               => l_return_status
1177         );
1178 
1179         IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1180             RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1181         ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1182             RAISE FND_API.G_EXC_ERROR;
1183         END IF;
1184 
1185 
1186     END IF;
1187 
1188     --  Lock CURR_DETAILS
1189 
1190     FOR I IN 1..p_CURR_DETAILS_tbl.COUNT LOOP
1191 
1192         IF p_CURR_DETAILS_tbl(I).operation = QP_GLOBALS.G_OPR_LOCK THEN
1193 
1194             QP_Curr_Details_Util.Lock_Row
1195             (   p_CURR_DETAILS_rec            => p_CURR_DETAILS_tbl(I)
1196             ,   x_CURR_DETAILS_rec            => l_CURR_DETAILS_rec
1197             ,   x_return_status               => l_return_status
1198             );
1199 
1200             IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1201                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1202             ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1203                 RAISE FND_API.G_EXC_ERROR;
1204             END IF;
1205 
1206             x_CURR_DETAILS_tbl(I)          := l_CURR_DETAILS_rec;
1207 
1208         END IF;
1209 
1210     END LOOP;
1211 
1212     --  Set return status
1213 
1214     x_return_status := FND_API.G_RET_STS_SUCCESS;
1215 
1216     --  Get message count and data
1217 
1218     OE_MSG_PUB.Count_And_Get
1219     (   p_count                       => x_msg_count
1220     ,   p_data                        => x_msg_data
1221     );
1222 
1223 
1224 EXCEPTION
1225 
1226     WHEN FND_API.G_EXC_ERROR THEN
1227 
1228         x_return_status := FND_API.G_RET_STS_ERROR;
1229 
1230         --  Get message count and data
1231 
1232         OE_MSG_PUB.Count_And_Get
1233         (   p_count                       => x_msg_count
1234         ,   p_data                        => x_msg_data
1235         );
1236 
1237         --  Rollback
1238 
1239         ROLLBACK TO Lock_Currency_PVT;
1240 
1241     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1242 
1243         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1244 
1245         --  Get message count and data
1246 
1247         OE_MSG_PUB.Count_And_Get
1248         (   p_count                       => x_msg_count
1249         ,   p_data                        => x_msg_data
1250         );
1251 
1252         --  Rollback
1253 
1254         ROLLBACK TO Lock_Currency_PVT;
1255 
1256     WHEN OTHERS THEN
1257 
1258         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1259 
1260         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1261         THEN
1262             OE_MSG_PUB.Add_Exc_Msg
1263             (   G_PKG_NAME
1264             ,   'Lock_Currency'
1265             );
1266         END IF;
1267 
1268         --  Get message count and data
1269 
1270         OE_MSG_PUB.Count_And_Get
1271         (   p_count                       => x_msg_count
1272         ,   p_data                        => x_msg_data
1273         );
1274 
1275         --  Rollback
1276 
1277         ROLLBACK TO Lock_Currency_PVT;
1278 
1279 END Lock_Currency;
1280 
1281 --  Start of Comments
1282 --  API name    Get_Currency
1283 --  Type        Private
1284 --  Function
1285 --
1286 --  Pre-reqs
1287 --
1288 --  Parameters
1289 --
1290 --  Version     Current version = 1.0
1291 --              Initial version = 1.0
1292 --
1293 --  Notes
1294 --
1295 --  End of Comments
1296 
1297 PROCEDURE Get_Currency
1298 (   p_api_version_number            IN  NUMBER
1299 ,   p_init_msg_list                 IN  VARCHAR2 := FND_API.G_FALSE
1300 ,   x_return_status                 OUT NOCOPY /* file.sql.39 change */ VARCHAR2
1301 ,   x_msg_count                     OUT NOCOPY /* file.sql.39 change */ NUMBER
1302 ,   x_msg_data                      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
1303 ,   p_currency_header_id            IN  NUMBER
1304 ,   x_CURR_LISTS_rec                OUT NOCOPY /* file.sql.39 change */ QP_Currency_PUB.Curr_Lists_Rec_Type
1305 ,   x_CURR_DETAILS_tbl              OUT NOCOPY /* file.sql.39 change */ QP_Currency_PUB.Curr_Details_Tbl_Type
1306 )
1307 IS
1308 l_api_version_number          CONSTANT NUMBER := 1.0;
1309 l_api_name                    CONSTANT VARCHAR2(30):= 'Get_Currency';
1310 l_CURR_LISTS_rec              QP_Currency_PUB.Curr_Lists_Rec_Type;
1311 l_CURR_DETAILS_tbl            QP_Currency_PUB.Curr_Details_Tbl_Type;
1312 BEGIN
1313 
1314     --  Standard call to check for call compatibility
1315 
1316     IF NOT FND_API.Compatible_API_Call
1317            (   l_api_version_number
1318            ,   p_api_version_number
1319            ,   l_api_name
1320            ,   G_PKG_NAME
1321            )
1322     THEN
1323         RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1324     END IF;
1325 
1326     --  Initialize message list.
1327 
1328     IF FND_API.to_Boolean(p_init_msg_list) THEN
1329         OE_MSG_PUB.initialize;
1330     END IF;
1331 
1332     --  Get CURR_LISTS ( parent = CURR_LISTS )
1333 
1334     l_CURR_LISTS_rec :=  QP_Curr_Lists_Util.Query_Row
1335     (   p_currency_header_id  => p_currency_header_id
1336     );
1337 
1338         --  Get CURR_DETAILS ( parent = CURR_LISTS )
1339 
1340         l_CURR_DETAILS_tbl :=  QP_Curr_Details_Util.Query_Rows
1341         (   p_currency_header_id    => l_CURR_LISTS_rec.currency_header_id
1342         );
1343 
1344 
1345     --  Load out parameters
1346 
1347     x_CURR_LISTS_rec               := l_CURR_LISTS_rec;
1348     x_CURR_DETAILS_tbl             := l_CURR_DETAILS_tbl;
1349 
1350     --  Set return status
1351 
1352     x_return_status := FND_API.G_RET_STS_SUCCESS;
1353 
1354     --  Get message count and data
1355 
1356     OE_MSG_PUB.Count_And_Get
1357     (   p_count                       => x_msg_count
1358     ,   p_data                        => x_msg_data
1359     );
1360 
1361 
1362 EXCEPTION
1363 
1364     WHEN FND_API.G_EXC_ERROR THEN
1365 
1366         x_return_status := FND_API.G_RET_STS_ERROR;
1367 
1368         --  Get message count and data
1369 
1370         OE_MSG_PUB.Count_And_Get
1371         (   p_count                       => x_msg_count
1372         ,   p_data                        => x_msg_data
1373         );
1374 
1375     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1376 
1377         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1378 
1379         --  Get message count and data
1380 
1381         OE_MSG_PUB.Count_And_Get
1382         (   p_count                       => x_msg_count
1383         ,   p_data                        => x_msg_data
1384         );
1385 
1386     WHEN OTHERS THEN
1387 
1388         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1389 
1390         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1391         THEN
1392             OE_MSG_PUB.Add_Exc_Msg
1393             (   G_PKG_NAME
1394             ,   'Get_Currency'
1395             );
1396         END IF;
1397 
1398         --  Get message count and data
1399 
1400         OE_MSG_PUB.Count_And_Get
1401         (   p_count                       => x_msg_count
1402         ,   p_data                        => x_msg_data
1403         );
1404 
1405 END Get_Currency;
1406 
1407 END QP_Currency_PVT;