8: g_view_name CONSTANT VARCHAR2(48) := 'jtf_amv_attachments a';
9:
10: PROCEDURE list_attachment (
11: p_api_version IN NUMBER,
12: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
13: x_return_status OUT VARCHAR2,
14: x_msg_count OUT NUMBER,
15: x_msg_data OUT VARCHAR2,
16:
63:
64: l_version_tbl JTF_NUMBER_TABLE;
65: BEGIN
66: -- Standard call to check for call compatibility
67: IF NOT FND_API.compatible_api_call(
68: g_api_version,
69: p_api_version,
70: l_api_name,
71: g_pkg_name ) THEN
68: g_api_version,
69: p_api_version,
70: l_api_name,
71: g_pkg_name ) THEN
72: RAISE FND_API.g_exc_unexpected_error;
73: END IF;
74:
75: -- Initialize message list if p_init_msg_list is set to TRUE
76: IF FND_API.to_boolean(p_init_msg_list) THEN
72: RAISE FND_API.g_exc_unexpected_error;
73: END IF;
74:
75: -- Initialize message list if p_init_msg_list is set to TRUE
76: IF FND_API.to_boolean(p_init_msg_list) THEN
77: FND_MSG_PUB.initialize;
78: END IF;
79:
80: -- Initialize API rturn status to success
77: FND_MSG_PUB.initialize;
78: END IF;
79:
80: -- Initialize API rturn status to success
81: x_return_status := FND_API.g_ret_sts_success;
82:
83: -- API body
84:
85: IF p_start_id < -1 OR p_batch_size < 0
87: FND_MESSAGE.set_name('JTF', 'JTF_DSP_QUERY_INVLD');
88: FND_MESSAGE.set_token('0', p_start_id);
89: FND_MESSAGE.set_token('1', p_batch_size);
90: FND_MSG_PUB.add;
91: RAISE FND_API.g_exc_unexpected_error;
92: END IF;
93:
94: IF p_deliverable_id IS NOT NULL THEN
95: l_flag := 1;
114: CLOSE l_ath_cv;
115:
116: IF x_row_count = 0 THEN
117: FND_MSG_PUB.count_and_get(
118: p_encoded => FND_API.g_false,
119: p_count => x_msg_count,
120: p_data => x_msg_data
121: );
122: RETURN;
137: -- Get matchined rows
138: IF p_start_id > -1 THEN
139: IF p_start_id >= x_row_count THEN
140: FND_MSG_PUB.count_and_get(
141: p_encoded => FND_API.g_false,
142: p_count => x_msg_count,
143: p_data => x_msg_data
144: );
145: RETURN;
247: END IF;
248:
249: -- Standard call to get message count and if count is 1, get message info
250: FND_MSG_PUB.count_and_get(
251: p_encoded => FND_API.g_false,
252: p_count => x_msg_count,
253: p_data => x_msg_data
254: );
255:
256: -- dbms_output.put_line('reached where');
257:
258: EXCEPTION
259:
260: WHEN FND_API.g_exc_unexpected_error THEN
261: x_return_status := FND_API.g_ret_sts_unexp_error ;
262: FND_MSG_PUB.count_and_get(
263: p_encoded => FND_API.g_false,
264: p_count => x_msg_count,
257:
258: EXCEPTION
259:
260: WHEN FND_API.g_exc_unexpected_error THEN
261: x_return_status := FND_API.g_ret_sts_unexp_error ;
262: FND_MSG_PUB.count_and_get(
263: p_encoded => FND_API.g_false,
264: p_count => x_msg_count,
265: p_data => x_msg_data
259:
260: WHEN FND_API.g_exc_unexpected_error THEN
261: x_return_status := FND_API.g_ret_sts_unexp_error ;
262: FND_MSG_PUB.count_and_get(
263: p_encoded => FND_API.g_false,
264: p_count => x_msg_count,
265: p_data => x_msg_data
266: );
267:
265: p_data => x_msg_data
266: );
267:
268: WHEN OTHERS THEN
269: x_return_status := FND_API.g_ret_sts_unexp_error ;
270:
271: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
272: END IF;
273:
271: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
272: END IF;
273:
274: FND_MSG_PUB.count_and_get(
275: p_encoded => FND_API.g_false,
276: p_count => x_msg_count,
277: p_data => x_msg_data
278: );
279:
299: -- 5. Raise an exception for any other errors
300: ---------------------------------------------------------------------+
301: PROCEDURE save_attachment (
302: p_api_version IN NUMBER,
303: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
304: p_commit IN VARCHAR2 := FND_API.g_false,
305: x_return_status OUT VARCHAR2,
306: x_msg_count OUT NUMBER,
307: x_msg_data OUT VARCHAR2,
300: ---------------------------------------------------------------------+
301: PROCEDURE save_attachment (
302: p_api_version IN NUMBER,
303: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
304: p_commit IN VARCHAR2 := FND_API.g_false,
305: x_return_status OUT VARCHAR2,
306: x_msg_count OUT NUMBER,
307: x_msg_data OUT VARCHAR2,
308: p_attachment_rec IN OUT ATTACHMENT_REC_TYPE ) IS
320: -- Standard start of API savepoint
321: SAVEPOINT save_attachment_grp;
322:
323: -- Standard call to check for call compatibility
324: IF NOT FND_API.compatible_api_call(
325: g_api_version,
326: p_api_version,
327: l_api_name,
328: g_pkg_name ) THEN
325: g_api_version,
326: p_api_version,
327: l_api_name,
328: g_pkg_name ) THEN
329: RAISE FND_API.g_exc_unexpected_error;
330: END IF;
331:
332: -- Initialize message list if p_init_msg_list is set to TRUE
333: IF FND_API.to_boolean(p_init_msg_list) THEN
329: RAISE FND_API.g_exc_unexpected_error;
330: END IF;
331:
332: -- Initialize message list if p_init_msg_list is set to TRUE
333: IF FND_API.to_boolean(p_init_msg_list) THEN
334: FND_MSG_PUB.initialize;
335: END IF;
336:
337: -- Initialize API rturn status to success
334: FND_MSG_PUB.initialize;
335: END IF;
336:
337: -- Initialize API rturn status to success
338: x_return_status := FND_API.g_ret_sts_success;
339:
340: -- API body
341:
342: l_act_attachment_rec.LAST_UPDATE_DATE := NULL;
442: -- being used by mutiple items.
443: --IF NOT JTF_DSPMGRVALIDATION_GRP.check_attachment_filename(
444: -- l_act_attachment_rec.attachment_id,
445: -- l_act_attachment_rec.file_name) THEN
446: -- RAISE FND_API.g_exc_error;
447: --END IF;
448:
449: --added by G. Zhang 04/30/2001 11:18AM
450: IF l_act_attachment_rec.APPLICATION_ID IS NULL THEN
447: --END IF;
448:
449: --added by G. Zhang 04/30/2001 11:18AM
450: IF l_act_attachment_rec.APPLICATION_ID IS NULL THEN
451: RAISE FND_API.g_exc_error;
452: END IF;
453: IF l_act_attachment_rec.ATTACHMENT_USED_BY IS NULL THEN
454: RAISE FND_API.g_exc_error;
455: END IF;
450: IF l_act_attachment_rec.APPLICATION_ID IS NULL THEN
451: RAISE FND_API.g_exc_error;
452: END IF;
453: IF l_act_attachment_rec.ATTACHMENT_USED_BY IS NULL THEN
454: RAISE FND_API.g_exc_error;
455: END IF;
456:
457: IF l_act_attachment_rec.attachment_id IS NOT NULL THEN
458: -- Update an existing attachment
459: l_operation_type := 'UPDATE';
460: ELSE
461: IF NOT JTF_DSPMGRVALIDATION_GRP.check_deliverable_exists(
462: p_attachment_rec.deliverable_id) THEN
463: RAISE FND_API.g_exc_error;
464: END IF;
465: END IF;
466:
467: IF (l_operation_type = 'INSERT') THEN
475: p_act_attachment_rec => l_act_attachment_rec,
476: x_act_attachment_id => l_attachment_id
477: );
478:
479: IF l_return_status = FND_API.g_ret_sts_error THEN
480: RAISE FND_API.g_exc_error;
481: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
482: RAISE FND_API.g_exc_unexpected_error;
483: END IF;
476: x_act_attachment_id => l_attachment_id
477: );
478:
479: IF l_return_status = FND_API.g_ret_sts_error THEN
480: RAISE FND_API.g_exc_error;
481: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
482: RAISE FND_API.g_exc_unexpected_error;
483: END IF;
484:
477: );
478:
479: IF l_return_status = FND_API.g_ret_sts_error THEN
480: RAISE FND_API.g_exc_error;
481: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
482: RAISE FND_API.g_exc_unexpected_error;
483: END IF;
484:
485: -- update the attachment_id and object_version_number
478:
479: IF l_return_status = FND_API.g_ret_sts_error THEN
480: RAISE FND_API.g_exc_error;
481: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
482: RAISE FND_API.g_exc_unexpected_error;
483: END IF;
484:
485: -- update the attachment_id and object_version_number
486: p_attachment_rec.attachment_id := l_attachment_id;
488:
489: ELSE
490:
491: l_act_attachment_rec.attachment_used_by_id
492: := FND_API.G_MISS_NUM;
493:
494: JTF_AMV_ATTACHMENT_PUB.update_act_attachment(
495: p_api_version => g_amv_api_version,
496: x_return_status => l_return_status,
498: x_msg_data => x_msg_data,
499: p_act_attachment_rec => l_act_attachment_rec
500: );
501:
502: IF l_return_status = FND_API.g_ret_sts_error THEN
503: RAISE FND_API.g_exc_error;
504: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
505: RAISE FND_API.g_exc_unexpected_error;
506: END IF;
499: p_act_attachment_rec => l_act_attachment_rec
500: );
501:
502: IF l_return_status = FND_API.g_ret_sts_error THEN
503: RAISE FND_API.g_exc_error;
504: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
505: RAISE FND_API.g_exc_unexpected_error;
506: END IF;
507:
500: );
501:
502: IF l_return_status = FND_API.g_ret_sts_error THEN
503: RAISE FND_API.g_exc_error;
504: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
505: RAISE FND_API.g_exc_unexpected_error;
506: END IF;
507:
508: -- update the object_version_number
501:
502: IF l_return_status = FND_API.g_ret_sts_error THEN
503: RAISE FND_API.g_exc_error;
504: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
505: RAISE FND_API.g_exc_unexpected_error;
506: END IF;
507:
508: -- update the object_version_number
509: p_attachment_rec.object_version_number :=
511:
512: END IF;
513:
514: p_attachment_rec.x_action_status
515: := FND_API.g_ret_sts_success;
516:
517: -- Check if the caller requested to commit ,
518: -- If p_commit set to true, commit the transaction
519: IF FND_API.to_boolean(p_commit) THEN
515: := FND_API.g_ret_sts_success;
516:
517: -- Check if the caller requested to commit ,
518: -- If p_commit set to true, commit the transaction
519: IF FND_API.to_boolean(p_commit) THEN
520: COMMIT;
521: END IF;
522:
523: -- Standard call to get message count and if count is 1, get message info
521: END IF;
522:
523: -- Standard call to get message count and if count is 1, get message info
524: FND_MSG_PUB.count_and_get(
525: p_encoded => FND_API.g_false,
526: p_count => x_msg_count,
527: p_data => x_msg_data
528: );
529:
528: );
529:
530: EXCEPTION
531:
532: WHEN FND_API.g_exc_error THEN
533: ROLLBACK TO save_attachment_grp;
534: x_return_status := FND_API.g_ret_sts_error;
535: p_attachment_rec.x_action_status := FND_API.g_ret_sts_error;
536: FND_MSG_PUB.count_and_get(
530: EXCEPTION
531:
532: WHEN FND_API.g_exc_error THEN
533: ROLLBACK TO save_attachment_grp;
534: x_return_status := FND_API.g_ret_sts_error;
535: p_attachment_rec.x_action_status := FND_API.g_ret_sts_error;
536: FND_MSG_PUB.count_and_get(
537: p_encoded => FND_API.g_false,
538: p_count => x_msg_count,
531:
532: WHEN FND_API.g_exc_error THEN
533: ROLLBACK TO save_attachment_grp;
534: x_return_status := FND_API.g_ret_sts_error;
535: p_attachment_rec.x_action_status := FND_API.g_ret_sts_error;
536: FND_MSG_PUB.count_and_get(
537: p_encoded => FND_API.g_false,
538: p_count => x_msg_count,
539: p_data => x_msg_data
533: ROLLBACK TO save_attachment_grp;
534: x_return_status := FND_API.g_ret_sts_error;
535: p_attachment_rec.x_action_status := FND_API.g_ret_sts_error;
536: FND_MSG_PUB.count_and_get(
537: p_encoded => FND_API.g_false,
538: p_count => x_msg_count,
539: p_data => x_msg_data
540: );
541:
538: p_count => x_msg_count,
539: p_data => x_msg_data
540: );
541:
542: WHEN FND_API.g_exc_unexpected_error THEN
543: ROLLBACK TO save_attachment_grp;
544: x_return_status := FND_API.g_ret_sts_unexp_error ;
545: p_attachment_rec.x_action_status := FND_API.g_ret_sts_unexp_error;
546: FND_MSG_PUB.count_and_get(
540: );
541:
542: WHEN FND_API.g_exc_unexpected_error THEN
543: ROLLBACK TO save_attachment_grp;
544: x_return_status := FND_API.g_ret_sts_unexp_error ;
545: p_attachment_rec.x_action_status := FND_API.g_ret_sts_unexp_error;
546: FND_MSG_PUB.count_and_get(
547: p_encoded => FND_API.g_false,
548: p_count => x_msg_count,
541:
542: WHEN FND_API.g_exc_unexpected_error THEN
543: ROLLBACK TO save_attachment_grp;
544: x_return_status := FND_API.g_ret_sts_unexp_error ;
545: p_attachment_rec.x_action_status := FND_API.g_ret_sts_unexp_error;
546: FND_MSG_PUB.count_and_get(
547: p_encoded => FND_API.g_false,
548: p_count => x_msg_count,
549: p_data => x_msg_data
543: ROLLBACK TO save_attachment_grp;
544: x_return_status := FND_API.g_ret_sts_unexp_error ;
545: p_attachment_rec.x_action_status := FND_API.g_ret_sts_unexp_error;
546: FND_MSG_PUB.count_and_get(
547: p_encoded => FND_API.g_false,
548: p_count => x_msg_count,
549: p_data => x_msg_data
550: );
551:
550: );
551:
552: WHEN OTHERS THEN
553: ROLLBACK TO save_attachment_grp;
554: x_return_status := FND_API.g_ret_sts_unexp_error ;
555: p_attachment_rec.x_action_status := FND_API.g_ret_sts_unexp_error;
556:
557: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
558: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
551:
552: WHEN OTHERS THEN
553: ROLLBACK TO save_attachment_grp;
554: x_return_status := FND_API.g_ret_sts_unexp_error ;
555: p_attachment_rec.x_action_status := FND_API.g_ret_sts_unexp_error;
556:
557: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
558: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
559: END IF;
558: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
559: END IF;
560:
561: FND_MSG_PUB.count_and_get(
562: p_encoded => FND_API.g_false,
563: p_count => x_msg_count,
564: p_data => x_msg_data
565: );
566:
586: -- 5. Raise an exception for any other errors
587: ---------------------------------------------------------------------
588: PROCEDURE save_attachment (
589: p_api_version IN NUMBER,
590: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
591: p_commit IN VARCHAR2 := FND_API.g_false,
592: x_return_status OUT VARCHAR2,
593: x_msg_count OUT NUMBER,
594: x_msg_data OUT VARCHAR2,
587: ---------------------------------------------------------------------
588: PROCEDURE save_attachment (
589: p_api_version IN NUMBER,
590: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
591: p_commit IN VARCHAR2 := FND_API.g_false,
592: x_return_status OUT VARCHAR2,
593: x_msg_count OUT NUMBER,
594: x_msg_data OUT VARCHAR2,
595: p_attachment_tbl IN OUT ATTACHMENT_TBL_TYPE ) IS
606: -- Standard start of API savepoint
607: SAVEPOINT save_attachment_grp;
608:
609: -- Standard call to check for call compatibility
610: IF NOT FND_API.compatible_api_call(
611: g_api_version,
612: p_api_version,
613: l_api_name,
614: g_pkg_name
612: p_api_version,
613: l_api_name,
614: g_pkg_name
615: ) THEN
616: RAISE FND_API.g_exc_unexpected_error;
617: END IF;
618:
619: -- Initialize message list if p_init_msg_list is set to TRUE
620: IF FND_API.to_boolean(p_init_msg_list) THEN
616: RAISE FND_API.g_exc_unexpected_error;
617: END IF;
618:
619: -- Initialize message list if p_init_msg_list is set to TRUE
620: IF FND_API.to_boolean(p_init_msg_list) THEN
621: FND_MSG_PUB.initialize;
622: END IF;
623:
624: -- Initialize API rturn status to success
621: FND_MSG_PUB.initialize;
622: END IF;
623:
624: -- Initialize API rturn status to success
625: x_return_status := FND_API.g_ret_sts_success;
626:
627: -- API body
628:
629: IF p_attachment_tbl IS NOT NULL THEN
637: p_attachment_rec => p_attachment_tbl(l_index)
638: );
639:
640:
641: IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
642: x_return_status := FND_API.g_ret_sts_unexp_error;
643: ELSIF l_return_status = FND_API.g_ret_sts_error
644: AND x_return_status <> FND_API.g_ret_sts_unexp_error THEN
645: x_return_status := FND_API.g_ret_sts_error;
638: );
639:
640:
641: IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
642: x_return_status := FND_API.g_ret_sts_unexp_error;
643: ELSIF l_return_status = FND_API.g_ret_sts_error
644: AND x_return_status <> FND_API.g_ret_sts_unexp_error THEN
645: x_return_status := FND_API.g_ret_sts_error;
646: END IF;
639:
640:
641: IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
642: x_return_status := FND_API.g_ret_sts_unexp_error;
643: ELSIF l_return_status = FND_API.g_ret_sts_error
644: AND x_return_status <> FND_API.g_ret_sts_unexp_error THEN
645: x_return_status := FND_API.g_ret_sts_error;
646: END IF;
647:
640:
641: IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
642: x_return_status := FND_API.g_ret_sts_unexp_error;
643: ELSIF l_return_status = FND_API.g_ret_sts_error
644: AND x_return_status <> FND_API.g_ret_sts_unexp_error THEN
645: x_return_status := FND_API.g_ret_sts_error;
646: END IF;
647:
648: END LOOP;
641: IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
642: x_return_status := FND_API.g_ret_sts_unexp_error;
643: ELSIF l_return_status = FND_API.g_ret_sts_error
644: AND x_return_status <> FND_API.g_ret_sts_unexp_error THEN
645: x_return_status := FND_API.g_ret_sts_error;
646: END IF;
647:
648: END LOOP;
649: END IF;
649: END IF;
650:
651: -- Check if the caller requested to commit ,
652: -- If p_commit set to true, commit the transaction
653: IF FND_API.to_boolean(p_commit) THEN
654: COMMIT;
655: END IF;
656:
657: -- Standard call to get message count and if count is 1, get message info
655: END IF;
656:
657: -- Standard call to get message count and if count is 1, get message info
658: FND_MSG_PUB.count_and_get(
659: p_encoded => FND_API.g_false,
660: p_count => x_msg_count,
661: p_data => x_msg_data
662: );
663:
663:
664:
665: EXCEPTION
666:
667: WHEN FND_API.g_exc_error THEN
668: ROLLBACK TO save_attachment_grp;
669: x_return_status := FND_API.g_ret_sts_error;
670: FND_MSG_PUB.count_and_get(
671: p_encoded => FND_API.g_false,
665: EXCEPTION
666:
667: WHEN FND_API.g_exc_error THEN
668: ROLLBACK TO save_attachment_grp;
669: x_return_status := FND_API.g_ret_sts_error;
670: FND_MSG_PUB.count_and_get(
671: p_encoded => FND_API.g_false,
672: p_count => x_msg_count,
673: p_data => x_msg_data
667: WHEN FND_API.g_exc_error THEN
668: ROLLBACK TO save_attachment_grp;
669: x_return_status := FND_API.g_ret_sts_error;
670: FND_MSG_PUB.count_and_get(
671: p_encoded => FND_API.g_false,
672: p_count => x_msg_count,
673: p_data => x_msg_data
674: );
675:
672: p_count => x_msg_count,
673: p_data => x_msg_data
674: );
675:
676: WHEN FND_API.g_exc_unexpected_error THEN
677: ROLLBACK TO save_attachment_grp;
678: x_return_status := FND_API.g_ret_sts_unexp_error ;
679: FND_MSG_PUB.count_and_get(
680: p_encoded => FND_API.g_false,
674: );
675:
676: WHEN FND_API.g_exc_unexpected_error THEN
677: ROLLBACK TO save_attachment_grp;
678: x_return_status := FND_API.g_ret_sts_unexp_error ;
679: FND_MSG_PUB.count_and_get(
680: p_encoded => FND_API.g_false,
681: p_count => x_msg_count,
682: p_data => x_msg_data
676: WHEN FND_API.g_exc_unexpected_error THEN
677: ROLLBACK TO save_attachment_grp;
678: x_return_status := FND_API.g_ret_sts_unexp_error ;
679: FND_MSG_PUB.count_and_get(
680: p_encoded => FND_API.g_false,
681: p_count => x_msg_count,
682: p_data => x_msg_data
683: );
684:
683: );
684:
685: WHEN OTHERS THEN
686: ROLLBACK TO save_attachment_grp;
687: x_return_status := FND_API.g_ret_sts_unexp_error ;
688: FND_MSG_PUB.count_and_get(
689: p_encoded => FND_API.g_false,
690: p_count => x_msg_count,
691: p_data => x_msg_data
685: WHEN OTHERS THEN
686: ROLLBACK TO save_attachment_grp;
687: x_return_status := FND_API.g_ret_sts_unexp_error ;
688: FND_MSG_PUB.count_and_get(
689: p_encoded => FND_API.g_false,
690: p_count => x_msg_count,
691: p_data => x_msg_data
692: );
693:
690: p_count => x_msg_count,
691: p_data => x_msg_data
692: );
693:
694: x_return_status := FND_API.g_ret_sts_unexp_error ;
695:
696: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
697: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
698: END IF;
697: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
698: END IF;
699:
700: FND_MSG_PUB.count_and_get(
701: p_encoded => FND_API.g_false,
702: p_count => x_msg_count,
703: p_data => x_msg_data
704: );
705:
725: -- 3. Raise an exception for any other errors
726: ---------------------------------------------------------------------
727: PROCEDURE delete_attachment (
728: p_api_version IN NUMBER,
729: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
730: p_commit IN VARCHAR2 := FND_API.g_false,
731: x_return_status OUT VARCHAR2,
732: x_msg_count OUT NUMBER,
733: x_msg_data OUT VARCHAR2,
726: ---------------------------------------------------------------------
727: PROCEDURE delete_attachment (
728: p_api_version IN NUMBER,
729: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
730: p_commit IN VARCHAR2 := FND_API.g_false,
731: x_return_status OUT VARCHAR2,
732: x_msg_count OUT NUMBER,
733: x_msg_data OUT VARCHAR2,
734: p_ath_id_ver_tbl IN OUT ATH_ID_VER_TBL_TYPE ) IS
745: -- Standard start of API savepoint
746: SAVEPOINT save_attachment_grp;
747:
748: -- Standard call to check for call compatibility
749: IF NOT FND_API.compatible_api_call(
750: g_api_version,
751: p_api_version,
752: l_api_name,
753: g_pkg_name
751: p_api_version,
752: l_api_name,
753: g_pkg_name
754: ) THEN
755: RAISE FND_API.g_exc_unexpected_error;
756: END IF;
757:
758: -- Initialize message list if p_init_msg_list is set to TRUE
759: IF FND_API.to_boolean(p_init_msg_list) THEN
755: RAISE FND_API.g_exc_unexpected_error;
756: END IF;
757:
758: -- Initialize message list if p_init_msg_list is set to TRUE
759: IF FND_API.to_boolean(p_init_msg_list) THEN
760: FND_MSG_PUB.initialize;
761: END IF;
762:
763: -- Initialize API rturn status to success
760: FND_MSG_PUB.initialize;
761: END IF;
762:
763: -- Initialize API rturn status to success
764: x_return_status := FND_API.g_ret_sts_success;
765:
766: -- API body
767:
768: IF p_ath_id_ver_tbl IS NOT NULL THEN
773: SAVEPOINT delete_one_attachment_grp;
774:
775: /*
776: p_ath_id_ver_tbl(l_index).x_action_status
777: := FND_API.g_ret_sts_error;
778: */
779:
780: IF NOT JTF_DSPMGRVALIDATION_GRP.check_attachment_exists(
781: p_ath_id_ver_tbl(l_index).attachment_id,
779:
780: IF NOT JTF_DSPMGRVALIDATION_GRP.check_attachment_exists(
781: p_ath_id_ver_tbl(l_index).attachment_id,
782: p_ath_id_ver_tbl(l_index).object_version_number) THEN
783: RAISE FND_API.g_exc_error;
784: END IF;
785:
786: JTF_PhysicalMap_GRP.delete_attachment(
787: p_ath_id_ver_tbl(l_index).attachment_id
796: p_act_attachment_id => p_ath_id_ver_tbl(l_index).attachment_id,
797: p_object_version => p_ath_id_ver_tbl(l_index).object_version_number
798: );
799:
800: IF l_return_status = FND_API.g_ret_sts_error THEN
801: RAISE FND_API.g_exc_error;
802: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
803: RAISE FND_API.g_exc_unexpected_error;
804: END IF;
797: p_object_version => p_ath_id_ver_tbl(l_index).object_version_number
798: );
799:
800: IF l_return_status = FND_API.g_ret_sts_error THEN
801: RAISE FND_API.g_exc_error;
802: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
803: RAISE FND_API.g_exc_unexpected_error;
804: END IF;
805:
798: );
799:
800: IF l_return_status = FND_API.g_ret_sts_error THEN
801: RAISE FND_API.g_exc_error;
802: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
803: RAISE FND_API.g_exc_unexpected_error;
804: END IF;
805:
806: p_ath_id_ver_tbl(l_index).x_action_status
799:
800: IF l_return_status = FND_API.g_ret_sts_error THEN
801: RAISE FND_API.g_exc_error;
802: ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
803: RAISE FND_API.g_exc_unexpected_error;
804: END IF;
805:
806: p_ath_id_ver_tbl(l_index).x_action_status
807: := FND_API.g_ret_sts_success;
803: RAISE FND_API.g_exc_unexpected_error;
804: END IF;
805:
806: p_ath_id_ver_tbl(l_index).x_action_status
807: := FND_API.g_ret_sts_success;
808:
809: EXCEPTION
810:
811: WHEN FND_API.g_exc_error THEN
807: := FND_API.g_ret_sts_success;
808:
809: EXCEPTION
810:
811: WHEN FND_API.g_exc_error THEN
812: ROLLBACK TO delete_one_attachment_grp;
813: IF x_return_status <> FND_API.g_ret_sts_unexp_error THEN
814: x_return_status := FND_API.g_ret_sts_error;
815: END IF;
809: EXCEPTION
810:
811: WHEN FND_API.g_exc_error THEN
812: ROLLBACK TO delete_one_attachment_grp;
813: IF x_return_status <> FND_API.g_ret_sts_unexp_error THEN
814: x_return_status := FND_API.g_ret_sts_error;
815: END IF;
816: p_ath_id_ver_tbl(l_index).x_action_status
817: := FND_API.g_ret_sts_error;
810:
811: WHEN FND_API.g_exc_error THEN
812: ROLLBACK TO delete_one_attachment_grp;
813: IF x_return_status <> FND_API.g_ret_sts_unexp_error THEN
814: x_return_status := FND_API.g_ret_sts_error;
815: END IF;
816: p_ath_id_ver_tbl(l_index).x_action_status
817: := FND_API.g_ret_sts_error;
818:
813: IF x_return_status <> FND_API.g_ret_sts_unexp_error THEN
814: x_return_status := FND_API.g_ret_sts_error;
815: END IF;
816: p_ath_id_ver_tbl(l_index).x_action_status
817: := FND_API.g_ret_sts_error;
818:
819: WHEN FND_API.g_exc_unexpected_error THEN
820: ROLLBACK TO delete_one_attachment_grp;
821: x_return_status := FND_API.g_ret_sts_unexp_error ;
815: END IF;
816: p_ath_id_ver_tbl(l_index).x_action_status
817: := FND_API.g_ret_sts_error;
818:
819: WHEN FND_API.g_exc_unexpected_error THEN
820: ROLLBACK TO delete_one_attachment_grp;
821: x_return_status := FND_API.g_ret_sts_unexp_error ;
822: p_ath_id_ver_tbl(l_index).x_action_status
823: := FND_API.g_ret_sts_unexp_error ;
817: := FND_API.g_ret_sts_error;
818:
819: WHEN FND_API.g_exc_unexpected_error THEN
820: ROLLBACK TO delete_one_attachment_grp;
821: x_return_status := FND_API.g_ret_sts_unexp_error ;
822: p_ath_id_ver_tbl(l_index).x_action_status
823: := FND_API.g_ret_sts_unexp_error ;
824:
825: WHEN OTHERS THEN
819: WHEN FND_API.g_exc_unexpected_error THEN
820: ROLLBACK TO delete_one_attachment_grp;
821: x_return_status := FND_API.g_ret_sts_unexp_error ;
822: p_ath_id_ver_tbl(l_index).x_action_status
823: := FND_API.g_ret_sts_unexp_error ;
824:
825: WHEN OTHERS THEN
826: ROLLBACK TO delete_one_attachment_grp;
827: x_return_status := FND_API.g_ret_sts_unexp_error ;
823: := FND_API.g_ret_sts_unexp_error ;
824:
825: WHEN OTHERS THEN
826: ROLLBACK TO delete_one_attachment_grp;
827: x_return_status := FND_API.g_ret_sts_unexp_error ;
828: p_ath_id_ver_tbl(l_index).x_action_status
829: := FND_API.g_ret_sts_unexp_error ;
830: IF FND_MSG_PUB.check_msg_level(
831: FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
825: WHEN OTHERS THEN
826: ROLLBACK TO delete_one_attachment_grp;
827: x_return_status := FND_API.g_ret_sts_unexp_error ;
828: p_ath_id_ver_tbl(l_index).x_action_status
829: := FND_API.g_ret_sts_unexp_error ;
830: IF FND_MSG_PUB.check_msg_level(
831: FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
832: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
833: END IF;
837: END IF;
838:
839: -- Check if the caller requested to commit ,
840: -- If p_commit set to true, commit the transaction
841: IF FND_API.to_boolean(p_commit) THEN
842: COMMIT;
843: END IF;
844:
845: -- Standard call to get message count and if count is 1, get message info
843: END IF;
844:
845: -- Standard call to get message count and if count is 1, get message info
846: FND_MSG_PUB.count_and_get(
847: p_encoded => FND_API.g_false,
848: p_count => x_msg_count,
849: p_data => x_msg_data
850: );
851: -- x_msg_count := FND_MSG_PUB.count_msg();
848: p_count => x_msg_count,
849: p_data => x_msg_data
850: );
851: -- x_msg_count := FND_MSG_PUB.count_msg();
852: -- x_msg_data := FND_MSG_PUB.get(FND_MSG_PUB.g_last, FND_API.g_false);
853:
854: EXCEPTION
855:
856: WHEN FND_API.g_exc_error THEN
852: -- x_msg_data := FND_MSG_PUB.get(FND_MSG_PUB.g_last, FND_API.g_false);
853:
854: EXCEPTION
855:
856: WHEN FND_API.g_exc_error THEN
857: ROLLBACK TO delete_attachment_grp;
858: x_return_status := FND_API.g_ret_sts_error;
859: FND_MSG_PUB.count_and_get(
860: p_encoded => FND_API.g_false,
854: EXCEPTION
855:
856: WHEN FND_API.g_exc_error THEN
857: ROLLBACK TO delete_attachment_grp;
858: x_return_status := FND_API.g_ret_sts_error;
859: FND_MSG_PUB.count_and_get(
860: p_encoded => FND_API.g_false,
861: p_count => x_msg_count,
862: p_data => x_msg_data
856: WHEN FND_API.g_exc_error THEN
857: ROLLBACK TO delete_attachment_grp;
858: x_return_status := FND_API.g_ret_sts_error;
859: FND_MSG_PUB.count_and_get(
860: p_encoded => FND_API.g_false,
861: p_count => x_msg_count,
862: p_data => x_msg_data
863: );
864:
861: p_count => x_msg_count,
862: p_data => x_msg_data
863: );
864:
865: WHEN FND_API.g_exc_unexpected_error THEN
866: ROLLBACK TO delete_attachment_grp;
867: x_return_status := FND_API.g_ret_sts_unexp_error ;
868: FND_MSG_PUB.count_and_get(
869: p_encoded => FND_API.g_false,
863: );
864:
865: WHEN FND_API.g_exc_unexpected_error THEN
866: ROLLBACK TO delete_attachment_grp;
867: x_return_status := FND_API.g_ret_sts_unexp_error ;
868: FND_MSG_PUB.count_and_get(
869: p_encoded => FND_API.g_false,
870: p_count => x_msg_count,
871: p_data => x_msg_data
865: WHEN FND_API.g_exc_unexpected_error THEN
866: ROLLBACK TO delete_attachment_grp;
867: x_return_status := FND_API.g_ret_sts_unexp_error ;
868: FND_MSG_PUB.count_and_get(
869: p_encoded => FND_API.g_false,
870: p_count => x_msg_count,
871: p_data => x_msg_data
872: );
873:
872: );
873:
874: WHEN OTHERS THEN
875: ROLLBACK TO delete_attachment_grp;
876: x_return_status := FND_API.g_ret_sts_unexp_error ;
877:
878: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
879: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
880: END IF;
879: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
880: END IF;
881:
882: FND_MSG_PUB.count_and_get(
883: p_encoded => FND_API.g_false,
884: p_count => x_msg_count,
885: p_data => x_msg_data
886: );
887: