DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGW_SPONSOR_ACTION_PVT

Source


1 PACKAGE BODY IGW_SPONSOR_ACTION_PVT AS
2 --$Header: igwvspab.pls 115.2 2002/11/15 00:48:58 ashkumar noship $
3 
4    ---------------------------------------------------------------------------
5 
6    G_PKG_NAME  VARCHAR2(30) := 'IGW_SPONSOR_ACTION_PVT';
7 
8    ---------------------------------------------------------------------------
9 
10    PROCEDURE Check_Lock
11    (
12       p_rowid                  IN VARCHAR2,
13       p_record_version_number  IN NUMBER,
14       x_return_status          OUT NOCOPY VARCHAR2
15    ) IS
16 
17       l_api_name      CONSTANT VARCHAR2(30) := 'Check_Lock';
18 
19       l_locked                 VARCHAR2(1);
20 
21    BEGIN
22 
23       /*
24       **   Initialize
25       */
26 
27       x_return_status := Fnd_Api.G_Ret_Sts_Success;
28 
29       IF p_rowid IS NOT NULL AND p_record_version_number IS NOT NULL THEN
30 
31          SELECT 'N'
32          INTO   l_locked
33          FROM   igw_prop_comments
34          WHERE  rowid = p_rowid
35          AND    record_version_number  = p_record_version_number;
36 
37       END IF;
38 
39    EXCEPTION
40 
41       WHEN no_data_found THEN
42 
43          x_return_status := Fnd_Api.G_Ret_Sts_Error;
44          Fnd_Message.Set_Name('IGW','IGW_SS_RECORD_CHANGED');
45          Fnd_Msg_Pub.Add;
46 
47       WHEN others THEN
48 
49          x_return_status := Fnd_Api.G_Ret_Sts_Unexp_Error;
50 
51          Fnd_Msg_Pub.Add_Exc_Msg
52          (
53             p_pkg_name       => G_PKG_NAME,
54             p_procedure_name => l_api_name
55          );
56 
57          RAISE Fnd_Api.G_Exc_Unexpected_Error;
58 
59    END Check_Lock;
60 
61    ---------------------------------------------------------------------------
62 
63    PROCEDURE Create_Sponsor_Action
64    (
65       p_init_msg_list          IN VARCHAR2   := Fnd_Api.G_False,
66       p_validate_only          IN VARCHAR2   := Fnd_Api.G_False,
67       p_commit                 IN VARCHAR2   := Fnd_Api.G_False,
68       x_rowid                  OUT NOCOPY VARCHAR2,
69       p_proposal_id            IN NUMBER,
70       p_proposal_number        IN VARCHAR2,
71       p_comments               IN VARCHAR2,
72       p_sponsor_action_code    IN VARCHAR2,
73       p_sponsor_action_date    IN DATE,
74       x_return_status          OUT NOCOPY VARCHAR2,
75       x_msg_count              OUT NOCOPY NUMBER,
76       x_msg_data               OUT NOCOPY VARCHAR2
77    ) IS
78 
79       l_api_name      CONSTANT VARCHAR2(30) := 'Create_Sponsor_Action';
80 
81       l_proposal_id            NUMBER       := p_proposal_id;
82 
83       l_return_status          VARCHAR2(1);
84 
85    BEGIN
86 
87       /*
88       **   Establish Savepoint for Rollback
89       */
90 
91       SAVEPOINT CREATE_SPONSOR_ACTION_PVT;
92 
93 
94       /*
95       **   Initialize
96       */
97 
98       x_return_status := Fnd_Api.G_Ret_Sts_Success;
99 
100       IF Fnd_Api.To_Boolean(p_init_msg_list) THEN
101 
102          Fnd_Msg_Pub.Initialize;
103 
104       END IF;
105 
106 
107       /*
108       **   Get Ids from Values if Ids not passed. Check Mandatory columns
109       */
110 
111       IF p_proposal_id IS NULL THEN
112 
113          Igw_Utils.Get_Proposal_Id
114          (
115             p_context_field    => 'PROPOSAL_ID',
116             p_check_id_flag    => 'Y',
117             p_proposal_number  => p_proposal_number,
118             p_proposal_id      => p_proposal_id,
119             x_proposal_id      => l_proposal_id,
120             x_return_status    => l_return_status
121          );
122 
123       END IF;
124 
125 
126 /*
127       IF Igw_Security.Allow_Modify
128          (
129             p_function_name => 'PROPOSAL',
130             p_proposal_id   => l_proposal_id,
131             p_user_id       => Fnd_Global.User_Id
132          )
133          = 'N' THEN
134 
135          x_return_status := Fnd_Api.G_Ret_Sts_Error;
136          Fnd_Message.Set_Name('IGW','IGW_SS_SEC_NO_MODIFY_RIGHTS');
137          Fnd_Msg_Pub.Add;
138          RAISE Fnd_Api.G_Exc_Error;
139 
140       END IF;
141 */
142 
143 
144       /*
145       **   Discontinue processing if API invoked in validation mode
146       */
147 
148       IF Fnd_Api.To_Boolean(p_validate_only) THEN
149 
150          RETURN;
151 
152       END IF;
153 
154 
155       /*
156       **   Invoke Table Handler to insert data
157       */
158 
159       Igw_Sponsor_Action_Tbh.Insert_Row
160       (
161          x_rowid                  => x_rowid,
162          p_proposal_id            => l_proposal_id,
163          p_comments               => p_comments,
164          p_sponsor_action_code    => p_sponsor_action_code,
165          p_sponsor_action_date    => p_sponsor_action_date,
166          x_return_status          => l_return_status
167       );
168 
169 
170       /*
171       **   Commit data if API invoked in commit mode
172       */
173 
174       IF Fnd_Api.To_Boolean(p_commit) THEN
175 
176          COMMIT;
177 
178       END IF;
179 
180 
181    EXCEPTION
182 
183       WHEN Fnd_Api.G_Exc_Error THEN
184 
185          ROLLBACK TO CREATE_SPONSOR_ACTION_PVT;
186 
187          x_return_status := Fnd_Api.G_Ret_Sts_Error;
188 
189          Fnd_Msg_Pub.Count_And_Get
190          (
191             p_count   => x_msg_count,
192             p_data    => x_msg_data
193          );
194 
195       WHEN Fnd_Api.G_Exc_Unexpected_Error THEN
196 
197          ROLLBACK TO CREATE_SPONSOR_ACTION_PVT;
198 
199          x_return_status := Fnd_Api.G_Ret_Sts_Unexp_Error;
200 
201          Fnd_Msg_Pub.Count_And_Get
202          (
203             p_count   => x_msg_count,
204             p_data    => x_msg_data
205          );
206 
207       WHEN others THEN
208 
209          ROLLBACK TO CREATE_SPONSOR_ACTION_PVT;
210 
211          x_return_status := Fnd_Api.G_Ret_Sts_Unexp_Error;
212 
213          Fnd_Msg_Pub.Add_Exc_Msg
214          (
215             p_pkg_name       => G_PKG_NAME,
216             p_procedure_name => l_api_name
217          );
218 
219          Fnd_Msg_Pub.Count_And_Get
220          (
221             p_count   => x_msg_count,
222             p_data    => x_msg_data
223          );
224 
225    END Create_Sponsor_Action;
226 
227    ---------------------------------------------------------------------------
228 
229    PROCEDURE Update_Sponsor_Action
230    (
231       p_init_msg_list         IN VARCHAR2   := Fnd_Api.G_False,
232       p_validate_only         IN VARCHAR2   := Fnd_Api.G_False,
233       p_commit                IN VARCHAR2   := Fnd_Api.G_False,
234       p_rowid                 IN VARCHAR2,
235       p_proposal_id           IN NUMBER,
236       p_proposal_number       IN VARCHAR2,
237       p_comment_id            IN NUMBER,
238       p_comments              IN VARCHAR2,
239       p_sponsor_action_code    IN VARCHAR2,
240       p_sponsor_action_date    IN DATE,
241       p_record_version_number IN NUMBER,
242       x_return_status         OUT NOCOPY VARCHAR2,
243       x_msg_count             OUT NOCOPY NUMBER,
244       x_msg_data              OUT NOCOPY VARCHAR2
245    ) IS
246 
247       l_api_name      CONSTANT VARCHAR2(30) := 'Update_Sponsor_Action';
248 
249       l_proposal_id            NUMBER       := p_proposal_id;
250 
251       l_return_status          VARCHAR2(1);
252 
253    BEGIN
254 
255       /*
256       **   Establish Savepoint for Rollback
257       */
258 
259       SAVEPOINT UPDATE_SPONSOR_ACTION_PVT;
260 
261 
262       /*
263       **   Initialize
264       */
265 
266       x_return_status := Fnd_Api.G_Ret_Sts_Success;
267 
268       IF Fnd_Api.To_Boolean(p_init_msg_list) THEN
269 
270          Fnd_Msg_Pub.Initialize;
271 
272       END IF;
273 
274 
275       /*
276       **   Get Ids from Values if Ids not passed
277       */
278 
279       IF p_proposal_id IS NULL THEN
280 
281          Igw_Utils.Get_Proposal_Id
282          (
283             p_context_field    => 'PROPOSAL_ID',
284             p_check_id_flag    => 'Y',
285             p_proposal_number  => p_proposal_number,
286             p_proposal_id      => p_proposal_id,
287             x_proposal_id      => l_proposal_id,
288             x_return_status    => l_return_status
289          );
290 
291       END IF;
292 
293       IF Fnd_Msg_Pub.Count_Msg > 0 THEN
294 
295          RAISE Fnd_Api.G_Exc_Error;
296 
297       END IF;
298 
299 
300       /*
301       **   Check Modify Rights
302       */
303 /*
304 
305       IF Igw_Security.Allow_Modify
306          (
307             p_function_name => 'PROPOSAL',
308             p_proposal_id   => l_proposal_id,
309             p_user_id       => Fnd_Global.User_Id
310          )
311          = 'N' THEN
312 
313          x_return_status := Fnd_Api.G_Ret_Sts_Error;
314          Fnd_Message.Set_Name('IGW','IGW_SS_SEC_NO_MODIFY_RIGHTS');
315          Fnd_Msg_Pub.Add;
316          RAISE Fnd_Api.G_Exc_Error;
317 
318       END IF;
319 
320 */
321 
322 
323       /*
324       **   Check Lock before proceeding
325       */
326 
327       Check_Lock
328       (
329          p_rowid                  => p_rowid,
330          p_record_version_number  => p_record_version_number,
331          x_return_status          => l_return_status
332       );
333 
334 
335       /*
336       **   Discontinue processing if any error has been encountered during
337       **   the earlier stages
338       */
339 
340 
341       IF Fnd_Msg_Pub.Count_Msg > 0 THEN
342 
343          RAISE Fnd_Api.G_Exc_Error;
344 
345       END IF;
346 
347 
348       /*
349       **   Discontinue processing if any error has been encountered during
350       **   the earlier stages
351       */
352 
353       IF Fnd_Msg_Pub.Count_Msg > 0 THEN
354 
355          RAISE Fnd_Api.G_Exc_Error;
356 
357       END IF;
358 
359 
360       /*
361       **   Discontinue processing if API invoked in validation mode
362       */
363 
364       IF Fnd_Api.To_Boolean(p_validate_only) THEN
365 
366          RETURN;
367 
368       END IF;
369 
370 
371       /*
372       **   Invoke Table Handler to Update data
373       */
374 
375       Igw_Sponsor_Action_Tbh.Update_Row
376       (
377          p_rowid                 => p_rowid,
378          p_proposal_id           => l_proposal_id,
379          p_comment_id            => p_comment_id,
380          p_comments              => p_comments,
381          p_sponsor_action_code   => p_sponsor_action_code,
382          p_sponsor_action_date   => p_sponsor_action_date,
383          p_record_version_number => p_record_version_number,
384          x_return_status         => x_return_status
385       );
386 
387 
388       /*
389       **   Commit data if API invoked in commit mode
390       */
391 
392       IF Fnd_Api.To_Boolean(p_commit) THEN
393 
394          COMMIT;
395 
396       END IF;
397 
398 
399    EXCEPTION
400 
401       WHEN Fnd_Api.G_Exc_Error THEN
402 
403          ROLLBACK TO UPDATE_SPONSOR_ACTION_PVT;
404 
405          x_return_status := Fnd_Api.G_Ret_Sts_Error;
406 
407          Fnd_Msg_Pub.Count_And_Get
408          (
409             p_count   => x_msg_count,
410             p_data    => x_msg_data
411          );
412 
413       WHEN Fnd_Api.G_Exc_Unexpected_Error THEN
414 
415          ROLLBACK TO UPDATE_SPONSOR_ACTION_PVT;
416 
417          x_return_status := Fnd_Api.G_Ret_Sts_Unexp_Error;
418 
419          Fnd_Msg_Pub.Count_And_Get
420          (
421             p_count   => x_msg_count,
422             p_data    => x_msg_data
423          );
424 
425       WHEN others THEN
426 
427          ROLLBACK TO UPDATE_SPONSOR_ACTION_PVT;
428 
429          x_return_status := Fnd_Api.G_Ret_Sts_Unexp_Error;
430 
431          Fnd_Msg_Pub.Add_Exc_Msg
432          (
433             p_pkg_name       => G_PKG_NAME,
434             p_procedure_name => l_api_name
435          );
436 
437          Fnd_Msg_Pub.Count_And_Get
438          (
439             p_count   => x_msg_count,
440             p_data    => x_msg_data
441          );
442 
443    END Update_Sponsor_Action;
444 
445    ---------------------------------------------------------------------------
446 
447    PROCEDURE Delete_Sponsor_Action
448    (
449       p_init_msg_list         IN VARCHAR2   := Fnd_Api.G_False,
450       p_validate_only         IN VARCHAR2   := Fnd_Api.G_False,
451       p_commit                IN VARCHAR2   := Fnd_Api.G_False,
452       p_rowid                 IN VARCHAR2,
453       p_proposal_id           IN NUMBER,
454       p_record_version_number IN NUMBER,
455       x_return_status         OUT NOCOPY VARCHAR2,
456       x_msg_count             OUT NOCOPY NUMBER,
457       x_msg_data              OUT NOCOPY VARCHAR2
458    ) IS
459 
460       l_api_name      CONSTANT VARCHAR2(30) := 'Delete_Sponsor_Action';
461 
462       l_return_status          VARCHAR2(1);
463 
464    BEGIN
465 
466       /*
467       **   Establish Savepoint for Rollback
468       */
469 
470       SAVEPOINT DELETE_SPONSOR_ACTION_PVT;
471 
472 
473       /*
474       **   Initialize
475       */
476 
477       x_return_status := Fnd_Api.G_Ret_Sts_Success;
478 
479       IF Fnd_Api.To_Boolean(p_init_msg_list) THEN
480 
481          Fnd_Msg_Pub.Initialize;
482 
483       END IF;
484 
485       /*
486       **   Check Modify Rights
487       */
488 
489 
490 /*
491       IF Igw_Security.Allow_Modify
492          (
493             p_function_name => 'PROPOSAL',
494             p_proposal_id   => p_proposal_id,
495             p_user_id       => Fnd_Global.User_Id
496          )
497          = 'N' THEN
498 
499          x_return_status := Fnd_Api.G_Ret_Sts_Error;
500          Fnd_Message.Set_Name('IGW','IGW_SS_SEC_NO_MODIFY_RIGHTS');
501          Fnd_Msg_Pub.Add;
502          RAISE Fnd_Api.G_Exc_Error;
503 
504       END IF;
505 */
506 
507 
508       /*
509       **   Check Lock before proceeding
510       */
511 
512       Check_Lock
513       (
514          p_rowid                  => p_rowid,
515          p_record_version_number  => p_record_version_number,
516          x_return_status          => l_return_status
517       );
518 
519       /*
520       **   Discontinue processing if any error has been encountered during
521       **   the earlier stages
522       */
523 
524       IF Fnd_Msg_Pub.Count_Msg > 0 THEN
525 
526          RAISE Fnd_Api.G_Exc_Error;
527 
528       END IF;
529 
530 
531       /*
532       **   Discontinue processing if API invoked in validation mode
533       */
534 
535       IF Fnd_Api.To_Boolean(p_validate_only) THEN
536 
537          RETURN;
538 
539       END IF;
540 
541       /*
542       **   Invoke Table Handler to Delete data
543       */
544 
545       Igw_Sponsor_Action_Tbh.Delete_Row
546       (
547          p_rowid                  => p_rowid,
548          p_proposal_id            => p_proposal_id,
549          p_record_version_number  => p_record_version_number,
550          x_return_status          => x_return_status
551       );
552 
553 
554       /*
555       **   Commit data if API invoked in commit mode
556       */
557 
558       IF Fnd_Api.To_Boolean(p_commit) THEN
559 
560          COMMIT;
561 
562       END IF;
563 
564 
565    EXCEPTION
566 
567       WHEN Fnd_Api.G_Exc_Error THEN
568 
569          ROLLBACK TO DELETE_SPONSOR_ACTION_PVT;
570 
571          x_return_status := Fnd_Api.G_Ret_Sts_Error;
572 
573          Fnd_Msg_Pub.Count_And_Get
574          (
575             p_count   => x_msg_count,
576             p_data    => x_msg_data
577          );
578 
579       WHEN Fnd_Api.G_Exc_Unexpected_Error THEN
580 
581          ROLLBACK TO DELETE_SPONSOR_ACTION_PVT;
582 
583          x_return_status := Fnd_Api.G_Ret_Sts_Unexp_Error;
584 
585          Fnd_Msg_Pub.Count_And_Get
586          (
587             p_count   => x_msg_count,
588             p_data    => x_msg_data
589          );
590 
591       WHEN others THEN
592 
593          ROLLBACK TO DELETE_SPONSOR_ACTION_PVT;
594 
595          x_return_status := Fnd_Api.G_Ret_Sts_Unexp_Error;
596 
597          Fnd_Msg_Pub.Add_Exc_Msg
598          (
599             p_pkg_name       => G_PKG_NAME,
600             p_procedure_name => l_api_name
601          );
602 
603          Fnd_Msg_Pub.Count_And_Get
604          (
605             p_count   => x_msg_count,
606             p_data    => x_msg_data
607          );
608 
609    END Delete_Sponsor_Action;
610 
611    ---------------------------------------------------------------------------
612 
613 END IGW_SPONSOR_ACTION_PVT;