25:
26: /* Local variable section */
27: l_api_name CONSTANT VARCHAR2(30) := 'INSERT_RESOURCES';
28: l_row_id ROWID;
29: l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
30:
31:
32: /* get a record type */
33: l_resources_rec cr_rsrc_mst%ROWTYPE;
42: SAVEPOINT create_resources;
43: gmd_debug.log_initialize('CreateResourcesPub');
44:
45: /* Set the return status to success initially */
46: x_return_status := FND_API.G_RET_STS_SUCCESS;
47: l_resources_rec := p_resources;
48:
49: /* Initialize message list and count if needed */
50: IF p_init_msg_list THEN
51: fnd_msg_pub.initialize;
52: END IF;
53:
54: /* Make sure we are call compatible */
55: IF NOT FND_API.compatible_api_call ( GMP_RESOURCES_PUB.m_api_version
56: ,p_api_version
57: ,'INSERT_RESOURCES'
58: ,GMP_RESOURCES_PUB.m_pkg_name) THEN
59: x_return_status := FND_API.G_RET_STS_ERROR;
55: IF NOT FND_API.compatible_api_call ( GMP_RESOURCES_PUB.m_api_version
56: ,p_api_version
57: ,'INSERT_RESOURCES'
58: ,GMP_RESOURCES_PUB.m_pkg_name) THEN
59: x_return_status := FND_API.G_RET_STS_ERROR;
60: RAISE invalid_version;
61: END IF;
62:
63: v_insert_flag := 'Y';
136: END IF; /* p_resources.resources IS NOT NULL */
137:
138: fnd_msg_pub.count_and_get (
139: p_count => x_message_count
140: ,p_encoded => FND_API.g_false
141: ,p_data => x_message_list);
142:
143: IF x_message_count = 0 THEN
144: gmd_debug.put_line('Resource Header was created successfully');
151: WHEN resource_creation_failure OR invalid_version THEN
152: ROLLBACK TO SAVEPOINT create_resources;
153: fnd_msg_pub.count_and_get (
154: p_count => x_message_count
155: ,p_encoded => FND_API.g_false
156: ,p_data => x_message_list);
157: x_return_status := FND_API.G_RET_STS_ERROR;
158:
159: WHEN RESOURCE_REQUIRED THEN
153: fnd_msg_pub.count_and_get (
154: p_count => x_message_count
155: ,p_encoded => FND_API.g_false
156: ,p_data => x_message_list);
157: x_return_status := FND_API.G_RET_STS_ERROR;
158:
159: WHEN RESOURCE_REQUIRED THEN
160: x_return_status := FND_API.G_RET_STS_ERROR;
161: FND_MESSAGE.SET_NAME('GMP','GMP_VALUE_REQUIRED');
156: ,p_data => x_message_list);
157: x_return_status := FND_API.G_RET_STS_ERROR;
158:
159: WHEN RESOURCE_REQUIRED THEN
160: x_return_status := FND_API.G_RET_STS_ERROR;
161: FND_MESSAGE.SET_NAME('GMP','GMP_VALUE_REQUIRED');
162: FND_MESSAGE.SET_TOKEN('VALUE_REQUIRED',X_msg);
163: FND_MSG_PUB.ADD;
164: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
169: FND_MESSAGE.SET_TOKEN('ERROR', sqlerrm);
170: FND_MSG_PUB.ADD;
171: fnd_msg_pub.count_and_get (
172: p_count => x_message_count
173: ,p_encoded => FND_API.g_false
174: ,p_data => x_message_list);
175: x_return_status := FND_API.g_ret_sts_unexp_error;
176: END insert_resources;
177:
171: fnd_msg_pub.count_and_get (
172: p_count => x_message_count
173: ,p_encoded => FND_API.g_false
174: ,p_data => x_message_list);
175: x_return_status := FND_API.g_ret_sts_unexp_error;
176: END insert_resources;
177:
178: /* =============================================================== */
179: /* Procedure: */
362: END IF ;
363: --
364: EXCEPTION
365: WHEN INVALID_MIN_MAX THEN
366: x_return_status := FND_API.G_RET_STS_ERROR;
367: FND_MESSAGE.SET_NAME('GMP','GMP_MIN_MAX_CAPACITY');
368: FND_MSG_PUB.ADD;
369: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
370: --
368: FND_MSG_PUB.ADD;
369: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
370: --
371: WHEN MIN_MAX_CAPACITY_REQUIRED THEN
372: x_return_status := FND_API.G_RET_STS_ERROR;
373: FND_MESSAGE.SET_NAME('GMP','GMP_VALUE_REQUIRED');
374: FND_MESSAGE.SET_TOKEN('VALUE_REQUIRED',X_msg);
375: FND_MSG_PUB.ADD;
376: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
376: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
377: --
378: /* Bug: 7015717 Vpedarla */
379: WHEN STD_USAGE_UM_REQUIRED THEN
380: x_return_status := FND_API.G_RET_STS_ERROR;
381: FND_MESSAGE.SET_NAME('GMP','GMP_VALUE_REQUIRED');
382: FND_MESSAGE.SET_TOKEN('VALUE_REQUIRED',X_msg);
383: FND_MSG_PUB.ADD;
384: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
383: FND_MSG_PUB.ADD;
384: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
385: --
386: WHEN PS_DUP_REC THEN
387: x_return_status := FND_API.G_RET_STS_ERROR;
388: FND_MESSAGE.SET_NAME('GMP','PS_DUP_REC');
389: FND_MSG_PUB.ADD;
390: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
391: --
389: FND_MSG_PUB.ADD;
390: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
391: --
392: WHEN INVALID_VALUE THEN
393: x_return_status := FND_API.G_RET_STS_ERROR;
394: FND_MESSAGE.SET_NAME('GMP','GMP_INVALID_VALUE');
395: FND_MESSAGE.SET_TOKEN('FIELD',X_field);
396: FND_MESSAGE.SET_TOKEN('VALUE',X_value);
397: FND_MSG_PUB.ADD;
397: FND_MSG_PUB.ADD;
398: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
399: --
400: WHEN RESOURCE_DESC_REQUIRED THEN
401: x_return_status := FND_API.G_RET_STS_ERROR;
402: FND_MESSAGE.SET_NAME('GMP','GMP_VALUE_REQUIRED');
403: FND_MESSAGE.SET_TOKEN('VALUE_REQUIRED',X_msg);
404: FND_MSG_PUB.ADD;
405: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
404: FND_MSG_PUB.ADD;
405: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
406: --
407: WHEN INVALID_USAGE_UM THEN
408: x_return_status := FND_API.G_RET_STS_ERROR;
409: FND_MESSAGE.SET_NAME('GMA','SY_INVALID_UM_CODE');
410: FND_MSG_PUB.ADD;
411: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
412: --
410: FND_MSG_PUB.ADD;
411: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
412: --
413: WHEN INVALID_RSRC_CLASS THEN
414: x_return_status := FND_API.G_RET_STS_ERROR;
415: FND_MESSAGE.SET_NAME('GMP','CR_INVALID_RSRC_CLASS');
416: FND_MSG_PUB.ADD;
417: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
418: -- vkinduri Bug 13575854
416: FND_MSG_PUB.ADD;
417: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
418: -- vkinduri Bug 13575854
419: WHEN COST_CMPTCLSID_REQUIRED THEN
420: x_return_status := FND_API.G_RET_STS_ERROR;
421: FND_MESSAGE.SET_NAME('GMP','GMP_VALUE_REQUIRED');
422: FND_MESSAGE.SET_TOKEN('VALUE_REQUIRED',X_msg);
423: FND_MSG_PUB.ADD;
424: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
423: FND_MSG_PUB.ADD;
424: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
425: -- vkinduri Bug 13575854
426: WHEN INVALID_CMPTCLS_ID THEN
427: x_return_status := FND_API.G_RET_STS_ERROR;
428: FND_MESSAGE.SET_NAME('GMP','INVALID_COST_CMPTCLSID');
429: FND_MSG_PUB.ADD;
430: FND_MSG_PUB.Count_And_Get(p_count=>x_message_count, p_data=>x_message_list);
431:
457:
458: /* Local variable section */
459: l_api_name CONSTANT VARCHAR2(30) := 'INSERT_RESOURCES';
460: l_row_id ROWID;
461: l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
462:
463: /* Define Exceptions */
464: resource_update_failure EXCEPTION;
465: invalid_version EXCEPTION;
468: SAVEPOINT update_resources;
469: gmd_debug.log_initialize('UpdateResourcePub');
470:
471: /* Set the return status to success initially */
472: x_return_status := FND_API.G_RET_STS_SUCCESS;
473:
474: /* Initialize message list and count if needed */
475: IF p_init_msg_list THEN
476: fnd_msg_pub.initialize;
476: fnd_msg_pub.initialize;
477: END IF;
478:
479: /* Make sure we are call compatible */
480: IF NOT FND_API.compatible_api_call ( GMP_RESOURCES_PUB.m_api_version
481: ,p_api_version
482: ,l_api_name
483: ,GMP_RESOURCES_PUB.m_pkg_name) THEN
484: x_return_status := FND_API.G_RET_STS_ERROR;
480: IF NOT FND_API.compatible_api_call ( GMP_RESOURCES_PUB.m_api_version
481: ,p_api_version
482: ,l_api_name
483: ,GMP_RESOURCES_PUB.m_pkg_name) THEN
484: x_return_status := FND_API.G_RET_STS_ERROR;
485: RAISE invalid_version;
486: END IF;
487:
488: IF p_resources.resources IS NOT NULL THEN
535: END IF;
536: END IF;
537:
538: /* Check if work was done */
539: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
540: RAISE resource_update_failure;
541: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
542:
543: fnd_msg_pub.count_and_get (
537:
538: /* Check if work was done */
539: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
540: RAISE resource_update_failure;
541: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
542:
543: fnd_msg_pub.count_and_get (
544: p_count => x_message_count
545: ,p_encoded => FND_API.g_false
541: END IF; /* IF x_return_status <> FND_API.G_RET_STS_SUCCESS */
542:
543: fnd_msg_pub.count_and_get (
544: p_count => x_message_count
545: ,p_encoded => FND_API.g_false
546: ,p_data => x_message_list);
547:
548: IF x_message_count = 0 THEN
549: gmd_debug.put_line('Resource was Updated successfullly');
556: ROLLBACK TO SAVEPOINT update_resources;
557: gmd_debug.put_line (m_pkg_name||'.'||l_api_name||':'||'API not complete');
558: fnd_msg_pub.count_and_get (
559: p_count => x_message_count
560: ,p_encoded => FND_API.g_false
561: ,p_data => x_message_list);
562: x_return_status := FND_API.G_RET_STS_ERROR;
563: WHEN OTHERS THEN
564: ROLLBACK TO SAVEPOINT update_resources;
558: fnd_msg_pub.count_and_get (
559: p_count => x_message_count
560: ,p_encoded => FND_API.g_false
561: ,p_data => x_message_list);
562: x_return_status := FND_API.G_RET_STS_ERROR;
563: WHEN OTHERS THEN
564: ROLLBACK TO SAVEPOINT update_resources;
565: gmd_debug.put_line (m_pkg_name||'.'||l_api_name||':'||'When others exception:'||SQLERRM);
566: FND_MESSAGE.SET_NAME('GMD', 'GMD_UNEXPECTED_ERROR');
567: FND_MESSAGE.SET_TOKEN('ERROR', sqlerrm);
568: FND_MSG_PUB.ADD;
569: fnd_msg_pub.count_and_get (
570: p_count => x_message_count
571: ,p_encoded => FND_API.g_false
572: ,p_data => x_message_list);
573: x_return_status := FND_API.g_ret_sts_unexp_error;
574: END update_resources;
575:
569: fnd_msg_pub.count_and_get (
570: p_count => x_message_count
571: ,p_encoded => FND_API.g_false
572: ,p_data => x_message_list);
573: x_return_status := FND_API.g_ret_sts_unexp_error;
574: END update_resources;
575:
576: /* =============================================================== */
577: /* Procedure: */
602: l_counter number;
603:
604: /* Local variable section */
605: l_api_name CONSTANT VARCHAR2(30) := 'DELETE_RESOURCES';
606: l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
607:
608: /* Define Exceptions */
609: resource_delete_failure EXCEPTION;
610: invalid_version EXCEPTION;
612: SAVEPOINT delete_resources;
613: gmd_debug.log_initialize('DeleteResourcePub');
614:
615: /* Set the return status to success initially */
616: x_return_status := FND_API.G_RET_STS_SUCCESS;
617:
618: /* Initialize message list and count if needed */
619: IF p_init_msg_list THEN
620: fnd_msg_pub.initialize;
620: fnd_msg_pub.initialize;
621: END IF;
622:
623: /* Make sure we are call compatible */
624: IF NOT FND_API.compatible_api_call ( GMP_RESOURCES_PUB.m_api_version
625: ,p_api_version
626: ,l_api_name
627: ,GMP_RESOURCES_PUB.m_pkg_name) THEN
628: x_return_status := FND_API.G_RET_STS_ERROR;
624: IF NOT FND_API.compatible_api_call ( GMP_RESOURCES_PUB.m_api_version
625: ,p_api_version
626: ,l_api_name
627: ,GMP_RESOURCES_PUB.m_pkg_name) THEN
628: x_return_status := FND_API.G_RET_STS_ERROR;
629: RAISE invalid_version;
630: END IF;
631:
632: OPEN Cur_resources;
648: END IF;
649: --
650: fnd_msg_pub.count_and_get (
651: p_count => x_message_count
652: ,p_encoded => FND_API.g_false
653: ,p_data => x_message_list);
654:
655: IF x_message_count = 0 THEN
656: gmd_debug.put_line('Resource was deleted successfully');
663: ROLLBACK TO SAVEPOINT delete_resources;
664: gmd_debug.put_line (m_pkg_name||'.'||l_api_name||':'||'API not complete');
665: fnd_msg_pub.count_and_get (
666: p_count => x_message_count
667: ,p_encoded => FND_API.g_false
668: ,p_data => x_message_list);
669: x_return_status := FND_API.G_RET_STS_ERROR;
670: WHEN OTHERS THEN
671: ROLLBACK TO SAVEPOINT delete_resources;
665: fnd_msg_pub.count_and_get (
666: p_count => x_message_count
667: ,p_encoded => FND_API.g_false
668: ,p_data => x_message_list);
669: x_return_status := FND_API.G_RET_STS_ERROR;
670: WHEN OTHERS THEN
671: ROLLBACK TO SAVEPOINT delete_resources;
672: gmd_debug.put_line (m_pkg_name||'.'||l_api_name||':'||'When others exception:'||SQLERRM);
673: FND_MESSAGE.SET_NAME('GMD', 'GMD_UNEXPECTED_ERROR');
674: FND_MESSAGE.SET_TOKEN('ERROR', sqlerrm);
675: FND_MSG_PUB.ADD;
676: fnd_msg_pub.count_and_get (
677: p_count => x_message_count
678: ,p_encoded => FND_API.g_false
679: ,p_data => x_message_list);
680: x_return_status := FND_API.g_ret_sts_unexp_error;
681: END delete_resources;
682:
676: fnd_msg_pub.count_and_get (
677: p_count => x_message_count
678: ,p_encoded => FND_API.g_false
679: ,p_data => x_message_list);
680: x_return_status := FND_API.g_ret_sts_unexp_error;
681: END delete_resources;
682:
683: END GMP_RESOURCES_PUB;