214: FND_MESSAGE.SET_NAME('AR', 'HZ_GEO_NO_RECORD');
215: FND_MESSAGE.SET_TOKEN('TOKEN1', 'geography_element_column');
216: FND_MESSAGE.SET_TOKEN('TOKEN2', 'geography_type :'||l_get_all_parents.parent_object_type||', country_code :'||l_country_code);
217: FND_MSG_PUB.ADD;
218: x_return_status := fnd_api.g_ret_sts_error;
219: RAISE FND_API.G_EXC_ERROR;
220: END;
221:
222: -- get geography_name
215: FND_MESSAGE.SET_TOKEN('TOKEN1', 'geography_element_column');
216: FND_MESSAGE.SET_TOKEN('TOKEN2', 'geography_type :'||l_get_all_parents.parent_object_type||', country_code :'||l_country_code);
217: FND_MSG_PUB.ADD;
218: x_return_status := fnd_api.g_ret_sts_error;
219: RAISE FND_API.G_EXC_ERROR;
220: END;
221:
222: -- get geography_name
223: SELECT geography_name,geography_code INTO l_geography_name,l_geography_code
358: FND_MESSAGE.SET_TOKEN('TOKEN1', 'geography_element_column');
359: FND_MESSAGE.SET_TOKEN('TOKEN2', 'geography_type :'||l_parent_object_type||'and for country_code of geography_id:'||p_geography_id);
360: FND_MSG_PUB.ADD;
361:
362: RAISE FND_API.G_EXC_ERROR;
363: END;
364: END IF;
365: --dbms_output.put_line ('geo_element_column is '||l_geo_element_col);
366:
514: FND_MESSAGE.SET_TOKEN('VALUE', p_child_name);
515: FND_MESSAGE.SET_TOKEN('GEO_ID', p_child_id);
516: FND_MESSAGE.SET_TOKEN('PARENT_GEO_ID', p_parent_id);
517: FND_MSG_PUB.ADD;
518: x_return_status := fnd_api.g_ret_sts_error;
519:
520: END IF;
521:
522: END check_duplicate_name;
558: FND_MESSAGE.SET_TOKEN('VALUE', p_child_code);
559: FND_MESSAGE.SET_TOKEN('GEO_ID', p_child_id);
560: FND_MESSAGE.SET_TOKEN('PARENT_GEO_ID', p_parent_id);
561: FND_MSG_PUB.ADD;
562: x_return_status := fnd_api.g_ret_sts_error;
563:
564: END IF;
565:
566: END check_duplicate_code;
636: x_return_status => x_return_status
637: );
638:
639: --dbms_output.put_line('After validate relation '||x_return_status);
640: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
641: RAISE FND_API.G_EXC_ERROR;
642: END IF;
643:
644:
637: );
638:
639: --dbms_output.put_line('After validate relation '||x_return_status);
640: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
641: RAISE FND_API.G_EXC_ERROR;
642: END IF;
643:
644:
645: -- get geography types for geography_id and parent_geography_id
647: /*l_geography_type := HZ_GEOGRAPHY_VALIDATE_PVT.get_geography_type(p_geography_id =>p_master_relation_rec.geography_id,
648: x_return_status => x_return_status);
649:
650: --dbms_output.put_line('geography_type in do_create_master_relation:'||l_geography_type);
651: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
652: RAISE FND_API.G_EXC_ERROR;
653: END IF;*/
654:
655: l_parent_geography_type := HZ_GEOGRAPHY_VALIDATE_PVT.get_geography_type(p_geography_id => p_master_relation_rec.parent_geography_id,
648: x_return_status => x_return_status);
649:
650: --dbms_output.put_line('geography_type in do_create_master_relation:'||l_geography_type);
651: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
652: RAISE FND_API.G_EXC_ERROR;
653: END IF;*/
654:
655: l_parent_geography_type := HZ_GEOGRAPHY_VALIDATE_PVT.get_geography_type(p_geography_id => p_master_relation_rec.parent_geography_id,
656: x_return_status => x_return_status);
654:
655: l_parent_geography_type := HZ_GEOGRAPHY_VALIDATE_PVT.get_geography_type(p_geography_id => p_master_relation_rec.parent_geography_id,
656: x_return_status => x_return_status);
657:
658: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
659: RAISE FND_API.G_EXC_ERROR;
660: END IF;
661:
662: BEGIN
655: l_parent_geography_type := HZ_GEOGRAPHY_VALIDATE_PVT.get_geography_type(p_geography_id => p_master_relation_rec.parent_geography_id,
656: x_return_status => x_return_status);
657:
658: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
659: RAISE FND_API.G_EXC_ERROR;
660: END IF;
661:
662: BEGIN
663: -- check for the duplicate name/code with in the parent geography
703: -- The geography identifiers are not yet created
704: NULL;
705: END;
706:
707: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
708: RAISE FND_API.G_EXC_ERROR;
709: END IF;
710: END IF;
711:
704: NULL;
705: END;
706:
707: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
708: RAISE FND_API.G_EXC_ERROR;
709: END IF;
710: END IF;
711:
712: IF l_geography_code IS NOT NULL THEN
739: -- The geography identifiers are not yet created.
740: NULL;
741: END;
742:
743: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
744: RAISE FND_API.G_EXC_ERROR;
745: END IF;
746: END IF;
747:
740: NULL;
741: END;
742:
743: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
744: RAISE FND_API.G_EXC_ERROR;
745: END IF;
746: END IF;
747:
748: -- End of added section (Neeraj Shinde Bug# 5393825)
751: fnd_message.set_name('AR', 'HZ_GEO_NO_RECORD');
752: fnd_message.set_token('TOKEN1','Geography record');
753: fnd_message.set_token('TOKEN2','geography_id '||p_master_relation_rec.geography_id);
754: fnd_msg_pub.add;
755: RAISE FND_API.G_EXC_ERROR;
756: END;
757: -- a geography can not have two countries as its parents
758: IF l_parent_geography_type = 'COUNTRY' THEN
759:
767: IF l_count > 0 THEN
768: fnd_message.set_name('AR', 'HZ_GEO_MULTIPLE_COUNTRIES');
769: fnd_message.set_token('GEO_ID', p_master_relation_rec.geography_id);
770: fnd_msg_pub.add;
771: RAISE FND_API.G_EXC_ERROR;
772: END IF;
773: END IF;
774:
775:
806: --dbms_output.put_line('relationship_id is '||x_relationship_id);
807:
808: ----dbms_output.put_line('parent_id is '||to_char(l_parent_count));
809:
810: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
811: RAISE FND_API.G_EXC_ERROR;
812: END IF;
813: ----dbms_output.put_line('relationship_id is '||to_char(x_relationship_id));
814:
807:
808: ----dbms_output.put_line('parent_id is '||to_char(l_parent_count));
809:
810: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
811: RAISE FND_API.G_EXC_ERROR;
812: END IF;
813: ----dbms_output.put_line('relationship_id is '||to_char(x_relationship_id));
814:
815: -- check whether this geography_id has multiple parents
932: p_column_value => p_object_version_number,
933: x_return_status => x_return_status
934: );
935:
936: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
937: RAISE FND_API.G_EXC_ERROR;
938: END IF;
939:
940: BEGIN
933: x_return_status => x_return_status
934: );
935:
936: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
937: RAISE FND_API.G_EXC_ERROR;
938: END IF;
939:
940: BEGIN
941: -- validate relationship_id
948: fnd_message.set_name('AR', 'HZ_GEO_NO_RECORD');
949: fnd_message.set_token('token1', 'relationship');
950: fnd_message.set_token('token1', 'relationship_id '||p_relationship_id);
951: fnd_msg_pub.add;
952: RAISE FND_API.G_EXC_ERROR;
953: END;
954:
955: --dbms_output.put_line('after master relation validation');
956:
966: p_geography_id => l_geography_id,
967: x_return_status => x_return_status);
968:
969: ----dbms_output.put_line('after getting geography type '||l_geography_type);
970: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
971: RAISE FND_API.G_EXC_ERROR;
972: END IF;
973:
974: -- construct the relationship record for update
967: x_return_status => x_return_status);
968:
969: ----dbms_output.put_line('after getting geography type '||l_geography_type);
970: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
971: RAISE FND_API.G_EXC_ERROR;
972: END IF;
973:
974: -- construct the relationship record for update
975: l_relationship_rec.relationship_id := p_relationship_id;
1010: FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_NO_RECORD' );
1011: FND_MESSAGE.SET_TOKEN( 'TOKEN1', 'Relationship');
1012: FND_MESSAGE.SET_TOKEN( 'TOKEN2', 'object_id '||l_geography_id||',object_type '||l_geography_type||' and relationship_type MASTER_REF');
1013: FND_MSG_PUB.ADD;
1014: RAISE FND_API.G_EXC_ERROR;
1015: END;
1016:
1017:
1018: -- if there exists only one parent then do not update
1020: FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_SINGLE_PARENT' );
1021: FND_MESSAGE.SET_TOKEN( 'REL_ID', p_relationship_id);
1022: FND_MESSAGE.SET_TOKEN( 'GEO_ID', l_geography_id);
1023: FND_MSG_PUB.ADD;
1024: RAISE FND_API.G_EXC_ERROR;
1025: --l_update_flag := 'N';
1026: END IF;
1027: ----dbms_output.put_line ('parent_count '||to_char(l_parent_count));
1028: IF (l_parent_count = 2 AND p_status= 'I') THEN
1048: x_msg_count => x_msg_count,
1049: x_msg_data => x_msg_data
1050: );
1051:
1052: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1053: RAISE FND_API.G_EXC_ERROR;
1054: END IF;
1055: END IF;
1056:
1049: x_msg_data => x_msg_data
1050: );
1051:
1052: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1053: RAISE FND_API.G_EXC_ERROR;
1054: END IF;
1055: END IF;
1056:
1057:
1183: p_create_update_flag => 'C',
1184: x_return_status => x_return_status
1185: );
1186:
1187: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1188: RAISE FND_API.G_EXC_ERROR;
1189: END IF;
1190:
1191: -- check for the duplicate name and code
1184: x_return_status => x_return_status
1185: );
1186:
1187: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1188: RAISE FND_API.G_EXC_ERROR;
1189: END IF;
1190:
1191: -- check for the duplicate name and code
1192:
1202: fnd_message.set_name('AR', 'HZ_GEO_NO_RECORD');
1203: fnd_message.set_token('TOKEN1','Geography record');
1204: fnd_message.set_token('TOKEN2','geography_id '||p_geo_identifier_rec.geography_id);
1205: fnd_msg_pub.add;
1206: RAISE FND_API.G_EXC_ERROR;
1207: END;
1208:
1209: IF l_geography_use = 'MASTER_REF' THEN
1210: IF l_geography_type <> 'COUNTRY' THEN
1221: p_child_identifier_subtype => l_identifier_subtype,
1222: p_child_language => l_language_code,
1223: x_return_status => x_return_status
1224: );
1225: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1226: RAISE FND_API.G_EXC_ERROR;
1227: EXIT;
1228: END IF;
1229: ELSIF p_geo_identifier_rec.identifier_type = 'CODE' THEN
1222: p_child_language => l_language_code,
1223: x_return_status => x_return_status
1224: );
1225: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1226: RAISE FND_API.G_EXC_ERROR;
1227: EXIT;
1228: END IF;
1229: ELSIF p_geo_identifier_rec.identifier_type = 'CODE' THEN
1230: check_duplicate_code(p_parent_id => l_get_all_parents.subject_id,
1235: p_child_language => l_language_code,
1236: x_return_status => x_return_status
1237: );
1238:
1239: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1240: RAISE FND_API.G_EXC_ERROR;
1241: EXIT;
1242: END IF;
1243: END IF;
1236: x_return_status => x_return_status
1237: );
1238:
1239: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1240: RAISE FND_API.G_EXC_ERROR;
1241: EXIT;
1242: END IF;
1243: END IF;
1244: END LOOP;
1256: IF l_count > 0 THEN
1257: FND_MESSAGE.SET_NAME('AR', 'HZ_GEO_DUP_COUNTRY_IDEN');
1258: FND_MESSAGE.SET_TOKEN('IDEN_VAL', p_geo_identifier_rec.identifier_value);
1259: FND_MSG_PUB.ADD;
1260: x_return_status := fnd_api.g_ret_sts_error;
1261: RAISE FND_API.G_EXC_ERROR;
1262: END IF;
1263: END IF;
1264:
1257: FND_MESSAGE.SET_NAME('AR', 'HZ_GEO_DUP_COUNTRY_IDEN');
1258: FND_MESSAGE.SET_TOKEN('IDEN_VAL', p_geo_identifier_rec.identifier_value);
1259: FND_MSG_PUB.ADD;
1260: x_return_status := fnd_api.g_ret_sts_error;
1261: RAISE FND_API.G_EXC_ERROR;
1262: END IF;
1263: END IF;
1264:
1265: END IF;
1269: IF p_geo_identifier_rec.identifier_subtype <> 'STANDARD_NAME' THEN
1270: FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_INVALID_SUBTYPE' );
1271: FND_MESSAGE.SET_TOKEN( 'SUBTYPE', p_geo_identifier_rec.identifier_subtype);
1272: FND_MSG_PUB.ADD;
1273: x_return_status := FND_API.G_RET_STS_ERROR;
1274: RAISE FND_API.G_EXC_ERROR;
1275: END IF;
1276: END IF;
1277:
1270: FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_INVALID_SUBTYPE' );
1271: FND_MESSAGE.SET_TOKEN( 'SUBTYPE', p_geo_identifier_rec.identifier_subtype);
1272: FND_MSG_PUB.ADD;
1273: x_return_status := FND_API.G_RET_STS_ERROR;
1274: RAISE FND_API.G_EXC_ERROR;
1275: END IF;
1276: END IF;
1277:
1278: -- If this is the first row for the language_code for type NAME then if it is of subtype other than STANDAR_NAME,
1378: FND_MESSAGE.SET_NAME('AR', 'HZ_GEO_NO_RECORD');
1379: FND_MESSAGE.SET_TOKEN('TOKEN1', 'geography structure level');
1380: FND_MESSAGE.SET_TOKEN('TOKEN2', 'geography_id: '||to_char(l_count)||',country_code: '||l_country_code||',geography_type: '||l_geography_type);
1381: FND_MSG_PUB.ADD;
1382: x_return_status := FND_API.G_RET_STS_ERROR;
1383: END;
1384: END IF;
1385:
1386:
1492: p_create_update_flag => 'U',
1493: x_return_status => x_return_status
1494: );
1495:
1496: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1497: RAISE FND_API.G_EXC_ERROR;
1498: END IF;
1499:
1500: hz_utility_v2pub.validate_mandatory(
1493: x_return_status => x_return_status
1494: );
1495:
1496: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1497: RAISE FND_API.G_EXC_ERROR;
1498: END IF;
1499:
1500: hz_utility_v2pub.validate_mandatory(
1501: p_create_update_flag => 'U',
1502: p_column => 'object_version_number',
1503: p_column_value => p_object_version_number,
1504: x_return_status => x_return_status
1505: );
1506: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1507: RAISE FND_API.G_EXC_ERROR;
1508: END IF;
1509:
1510: BEGIN
1503: p_column_value => p_object_version_number,
1504: x_return_status => x_return_status
1505: );
1506: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1507: RAISE FND_API.G_EXC_ERROR;
1508: END IF;
1509:
1510: BEGIN
1511:
1523: IF l_object_version_number <> p_object_version_number THEN
1524: FND_MESSAGE.SET_NAME('AR', 'HZ_API_RECORD_CHANGED');
1525: FND_MESSAGE.SET_TOKEN('TABLE', 'hz_geography_identifiers');
1526: FND_MSG_PUB.ADD;
1527: RAISE FND_API.G_EXC_ERROR;
1528: ELSE
1529: p_object_version_number := l_object_version_number + 1;
1530: END IF;
1531:
1535: FND_MESSAGE.SET_TOKEN('TOKEN2', 'geography_id: '||p_geo_identifier_rec.geography_id||', identifier_type: '||
1536: p_geo_identifier_rec.identifier_type||', identifier_subtype: '||p_geo_identifier_rec.identifier_subtype||', identifier_value: '||
1537: p_geo_identifier_rec.identifier_value||', language_code: '||p_geo_identifier_rec.language_code);
1538: FND_MSG_PUB.ADD;
1539: RAISE FND_API.G_EXC_ERROR;
1540: END;
1541:
1542: -- Validate new subtype. Update only if valid and geo type is CODE.
1543: IF (p_geo_identifier_rec.identifier_type = 'CODE') THEN
1549: p_lookup_type => 'HZ_GEO_IDENTIFIER_SUBTYPE',
1550: p_column_value => l_new_geo_subtype,
1551: x_return_status => x_return_status
1552: );
1553: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1554: RAISE FND_API.G_EXC_ERROR;
1555: END IF;
1556: l_subtype_updated := 'Y';
1557: ELSE -- new geo subtype is null (i.e. no need to update), use the old subtype
1550: p_column_value => l_new_geo_subtype,
1551: x_return_status => x_return_status
1552: );
1553: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1554: RAISE FND_API.G_EXC_ERROR;
1555: END IF;
1556: l_subtype_updated := 'Y';
1557: ELSE -- new geo subtype is null (i.e. no need to update), use the old subtype
1558: l_new_geo_subtype := l_geo_identifier_subtype;
1566: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_INVALID_LOOKUP' );
1567: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'identifier_subtype' );
1568: FND_MESSAGE.SET_TOKEN( 'LOOKUP_TYPE', 'HZ_GEO_IDENTIFIER_SUBTYPE' );
1569: FND_MSG_PUB.ADD;
1570: x_return_status := FND_API.G_RET_STS_ERROR;
1571: END IF;
1572: l_subtype_updated := 'Y';
1573: ELSE -- new geo subtype is null (i.e. no need to update), use the old subtype
1574: l_new_geo_subtype := l_geo_identifier_subtype;
1622: FND_MESSAGE.SET_TOKEN('VALUE', l_new_geo_value);
1623: FND_MESSAGE.SET_TOKEN('GEO_ID', p_geo_identifier_rec.geography_id);
1624: FND_MESSAGE.SET_TOKEN('PARENT_GEO_ID', l_get_all_parents.subject_id);
1625: FND_MSG_PUB.ADD;
1626: x_return_status := fnd_api.g_ret_sts_error;
1627: RAISE FND_API.G_EXC_ERROR;
1628: EXIT;
1629: END IF;
1630: ELSIF p_geo_identifier_rec.identifier_type = 'CODE' THEN
1623: FND_MESSAGE.SET_TOKEN('GEO_ID', p_geo_identifier_rec.geography_id);
1624: FND_MESSAGE.SET_TOKEN('PARENT_GEO_ID', l_get_all_parents.subject_id);
1625: FND_MSG_PUB.ADD;
1626: x_return_status := fnd_api.g_ret_sts_error;
1627: RAISE FND_API.G_EXC_ERROR;
1628: EXIT;
1629: END IF;
1630: ELSIF p_geo_identifier_rec.identifier_type = 'CODE' THEN
1631: -- check if the name is duplicated with in the parent of p_child_id
1651: FND_MESSAGE.SET_TOKEN('VALUE', l_new_geo_value);
1652: FND_MESSAGE.SET_TOKEN('GEO_ID', p_geo_identifier_rec.geography_id);
1653: FND_MESSAGE.SET_TOKEN('PARENT_GEO_ID', l_get_all_parents.subject_id);
1654: FND_MSG_PUB.ADD;
1655: x_return_status := fnd_api.g_ret_sts_error;
1656: RAISE FND_API.G_EXC_ERROR;
1657: EXIT;
1658: END IF;
1659: END IF;
1652: FND_MESSAGE.SET_TOKEN('GEO_ID', p_geo_identifier_rec.geography_id);
1653: FND_MESSAGE.SET_TOKEN('PARENT_GEO_ID', l_get_all_parents.subject_id);
1654: FND_MSG_PUB.ADD;
1655: x_return_status := fnd_api.g_ret_sts_error;
1656: RAISE FND_API.G_EXC_ERROR;
1657: EXIT;
1658: END IF;
1659: END IF;
1660: END LOOP;
1673: IF l_count > 0 THEN
1674: FND_MESSAGE.SET_NAME('AR', 'HZ_GEO_DUP_COUNTRY_IDEN');
1675: FND_MESSAGE.SET_TOKEN('IDEN_VAL', l_new_geo_value);
1676: FND_MSG_PUB.ADD;
1677: x_return_status := fnd_api.g_ret_sts_error;
1678: RAISE FND_API.G_EXC_ERROR;
1679: END IF;
1680:
1681: END IF;
1674: FND_MESSAGE.SET_NAME('AR', 'HZ_GEO_DUP_COUNTRY_IDEN');
1675: FND_MESSAGE.SET_TOKEN('IDEN_VAL', l_new_geo_value);
1676: FND_MSG_PUB.ADD;
1677: x_return_status := fnd_api.g_ret_sts_error;
1678: RAISE FND_API.G_EXC_ERROR;
1679: END IF;
1680:
1681: END IF;
1682:
1687: IF (l_old_primary_flag = 'Y' AND p_geo_identifier_rec.primary_flag = 'N') THEN
1688: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_NONUPDATEABLE_COLUMN' );
1689: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'primary_flag from Y to N');
1690: FND_MSG_PUB.ADD;
1691: x_return_status := FND_API.G_RET_STS_ERROR;
1692: RAISE FND_API.G_EXC_ERROR;
1693: END IF;
1694:
1695: -- for updating primary_flag from 'N' to 'Y'
1688: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_NONUPDATEABLE_COLUMN' );
1689: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'primary_flag from Y to N');
1690: FND_MSG_PUB.ADD;
1691: x_return_status := FND_API.G_RET_STS_ERROR;
1692: RAISE FND_API.G_EXC_ERROR;
1693: END IF;
1694:
1695: -- for updating primary_flag from 'N' to 'Y'
1696: IF (l_old_primary_flag = 'N' AND p_geo_identifier_rec.primary_flag = 'Y') THEN
1811: IF l_primary_flag = 'Y' THEN
1812: l_delete_flag := 'N';
1813: FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_NONDELETEABLE' );
1814: FND_MSG_PUB.ADD;
1815: x_return_status := FND_API.G_RET_STS_ERROR;
1816: RAISE FND_API.G_EXC_ERROR;
1817: END IF;
1818:
1819: -- If a STANDARD_NAME is being deleted , if there exists another name mark it as STANDARD and delete
1812: l_delete_flag := 'N';
1813: FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_NONDELETEABLE' );
1814: FND_MSG_PUB.ADD;
1815: x_return_status := FND_API.G_RET_STS_ERROR;
1816: RAISE FND_API.G_EXC_ERROR;
1817: END IF;
1818:
1819: -- If a STANDARD_NAME is being deleted , if there exists another name mark it as STANDARD and delete
1820: -- this row else if another name doesn't exist then delete the row.
1857: FND_MESSAGE.SET_TOKEN('TOKEN2', 'geography_id: '||p_geography_id||', identifier_type: '||
1858: p_identifier_type||', identifier_subtype: '||p_identifier_subtype||', identifier_value: '||
1859: p_identifier_value||', language_code: '||p_language_code);
1860: FND_MSG_PUB.ADD;
1861: RAISE FND_API.G_EXC_ERROR;
1862:
1863: END do_delete_geo_identifier;
1864:
1865:
1897: );
1898:
1899: --dbms_output.put_line('In do_create_master_geography , after validate_master_geography '|| x_return_status);
1900:
1901: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1902: RAISE FND_API.G_EXC_ERROR;
1903: END IF;
1904:
1905: -- determine the country_code
1898:
1899: --dbms_output.put_line('In do_create_master_geography , after validate_master_geography '|| x_return_status);
1900:
1901: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1902: RAISE FND_API.G_EXC_ERROR;
1903: END IF;
1904:
1905: -- determine the country_code
1906: IF p_master_geography_rec.geography_type='COUNTRY' THEN
2005: x_msg_data => x_msg_data
2006: );
2007: END IF;
2008: END;
2009: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2010: RAISE FND_API.G_EXC_ERROR;
2011: END IF;
2012: -- --dbms_output.put_line('after create_master_relation id is '|| to_char(x_relationship_id));
2013: END LOOP;
2006: );
2007: END IF;
2008: END;
2009: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2010: RAISE FND_API.G_EXC_ERROR;
2011: END IF;
2012: -- --dbms_output.put_line('after create_master_relation id is '|| to_char(x_relationship_id));
2013: END LOOP;
2014: END IF;
2036: x_msg_count => x_msg_count,
2037: x_msg_data => x_msg_data
2038: );
2039:
2040: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2041: RAISE FND_API.G_EXC_ERROR;
2042: END IF;
2043: --dbms_output.put_line('after creating name identifier');
2044:
2037: x_msg_data => x_msg_data
2038: );
2039:
2040: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2041: RAISE FND_API.G_EXC_ERROR;
2042: END IF;
2043: --dbms_output.put_line('after creating name identifier');
2044:
2045: IF p_master_geography_rec.geography_code IS NOT NULL
2043: --dbms_output.put_line('after creating name identifier');
2044:
2045: IF p_master_geography_rec.geography_code IS NOT NULL
2046: -- Bug 4579847 : do not call for g_miss value for code
2047: and p_master_geography_rec.geography_code <> fnd_api.g_miss_char THEN
2048:
2049: -- create an identifier for this geography for identifier_type 'CODE'
2050: l_geo_identifier_rec.identifier_subtype := p_master_geography_rec.geography_code_type;
2051: l_geo_identifier_rec.identifier_value := UPPER(p_master_geography_rec.geography_code);
2060: x_msg_count => x_msg_count,
2061: x_msg_data => x_msg_data
2062: );
2063:
2064: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2065: RAISE FND_API.G_EXC_ERROR;
2066: END IF;
2067: END IF;
2068:
2061: x_msg_data => x_msg_data
2062: );
2063:
2064: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2065: RAISE FND_API.G_EXC_ERROR;
2066: END IF;
2067: END IF;
2068:
2069: END do_create_master_geography;
2113: p_column_value => p_object_version_number,
2114: x_return_status => x_return_status
2115: );
2116:
2117: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2118: RAISE FND_API.G_EXC_ERROR;
2119: END IF;
2120:
2121: BEGIN
2114: x_return_status => x_return_status
2115: );
2116:
2117: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2118: RAISE FND_API.G_EXC_ERROR;
2119: END IF;
2120:
2121: BEGIN
2122:
2131: IF l_object_version_number <> p_object_version_number THEN
2132: FND_MESSAGE.SET_NAME('AR', 'HZ_API_RECORD_CHANGED');
2133: FND_MESSAGE.SET_TOKEN('TABLE', 'hz_geographies');
2134: FND_MSG_PUB.ADD;
2135: RAISE FND_API.G_EXC_ERROR;
2136: ELSE
2137: p_object_version_number := l_object_version_number + 1;
2138: END IF;
2139:
2141: FND_MESSAGE.SET_NAME('AR', 'HZ_GEO_NO_RECORD');
2142: FND_MESSAGE.SET_TOKEN('TOKEN1','geography');
2143: FND_MESSAGE.SET_TOKEN('TOKEN2', 'geography_id '||p_geography_id);
2144: FND_MSG_PUB.ADD;
2145: RAISE FND_API.G_EXC_ERROR;
2146: END;
2147: --dbms_output.put_line('start date and old end date and end date '||to_char(l_start_date,'dd-mon-yyyy')||'*'||to_char(l_end_date,'dd-mon-yyyy')||'*'||to_char(p_end_date,'dd-mon-yyyy')||'*');
2148: --dbms_output.put_line('After date validation '|| x_return_status);
2149: -- check whether end_date >= start_date
2157: p_old_end_date => l_end_date,
2158: x_return_status => x_return_status
2159: );
2160:
2161: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2162: RAISE FND_API.G_EXC_ERROR;
2163: END IF;
2164: -- in case g_miss_date is passed for end_date, assign the default future date to end_date
2165: l_end_date := p_end_date;
2158: x_return_status => x_return_status
2159: );
2160:
2161: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2162: RAISE FND_API.G_EXC_ERROR;
2163: END IF;
2164: -- in case g_miss_date is passed for end_date, assign the default future date to end_date
2165: l_end_date := p_end_date;
2166:
2163: END IF;
2164: -- in case g_miss_date is passed for end_date, assign the default future date to end_date
2165: l_end_date := p_end_date;
2166:
2167: IF l_end_date = fnd_api.g_miss_date THEN
2168: l_end_date := to_date('31-12-4712','DD-MM-YYYY');
2169: END IF;
2170:
2171: -- dbms_output.put_line('timezone_code is '||p_timezone_code);
2182: fnd_message.set_token('FK', 'timezone_code');
2183: fnd_message.set_token('COLUMN','timezone_code');
2184: fnd_message.set_token('TABLE','FND_TIMEZONES_B');
2185: fnd_msg_pub.add;
2186: RAISE FND_API.G_EXC_ERROR;
2187: END IF;
2188: END IF;
2189: --dbms_output.put_line('After date validation '|| x_return_status);
2190:
2295: set status = l_status,
2296: end_date = p_end_date
2297: WHERE relationship_id=l_get_all_relationships.relationship_id;*/
2298:
2299: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2300: RAISE FND_API.G_EXC_ERROR;
2301: EXIT;
2302: END IF;
2303:
2296: end_date = p_end_date
2297: WHERE relationship_id=l_get_all_relationships.relationship_id;*/
2298:
2299: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2300: RAISE FND_API.G_EXC_ERROR;
2301: EXIT;
2302: END IF;
2303:
2304:
2347: l_msg_count NUMBER;
2348: l_count NUMBER;
2349: */
2350: BEGIN
2351: x_return_status := FND_API.G_RET_STS_SUCCESS;
2352: /*
2353: l_geography_range_rec := p_geography_range_rec;
2354: l_geo_range_from := TO_NUMBER(l_geography_range_rec.geography_from);
2355: l_geo_range_to := TO_NUMBER(l_geography_range_rec.geography_to);
2420:
2421: IF (l_count = 0) THEN
2422: -- create geography
2423: HZ_GEOGRAPHY_PUB.create_master_geography(
2424: p_init_msg_list => FND_API.G_FALSE,
2425: p_master_geography_rec => l_master_geography_rec,
2426: x_geography_id => l_geography_id,
2427: x_return_status => x_return_status,
2428: x_msg_count => l_msg_count,
2427: x_return_status => x_return_status,
2428: x_msg_count => l_msg_count,
2429: x_msg_data => l_msg_data);
2430:
2431: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2432: -- In case api throuws any exception, raise execution error
2433: -- which will be cought by calling api.
2434: RAISE FND_API.G_EXC_ERROR;
2435: END IF;
2430:
2431: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2432: -- In case api throuws any exception, raise execution error
2433: -- which will be cought by calling api.
2434: RAISE FND_API.G_EXC_ERROR;
2435: END IF;
2436: END IF;
2437: --dbms_output.put_line('Create Master Geo For :'||l_master_geography_rec.geography_name||':GeoId:'||l_geography_id);
2438: END LOOP;
2490: IF l_count > 0 THEN
2491: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_DUPLICATE_COLUMN' );
2492: FND_MESSAGE.SET_TOKEN( 'COLUMN','geography_id, geography_from, start_date');
2493: FND_MSG_PUB.ADD;
2494: RAISE FND_API.G_EXC_ERROR;
2495: END IF; */
2496:
2497:
2498: -- validate geography range
2501: p_create_update_flag => 'C',
2502: x_return_status => x_return_status
2503: );
2504:
2505: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2506: RAISE FND_API.G_EXC_ERROR;
2507: END IF;
2508:
2509: -- get the geography_type of the zone_id
2502: x_return_status => x_return_status
2503: );
2504:
2505: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2506: RAISE FND_API.G_EXC_ERROR;
2507: END IF;
2508:
2509: -- get the geography_type of the zone_id
2510: l_zone_type := hz_geography_validate_pvt.get_geography_type(p_geography_id => p_geography_range_rec.zone_id,
2572: p_create_update_flag => 'U',
2573: x_return_status => x_return_status
2574: );
2575:
2576: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2577: RAISE FND_API.G_EXC_ERROR;
2578: END IF;
2579:
2580: hz_utility_v2pub.validate_mandatory(
2573: x_return_status => x_return_status
2574: );
2575:
2576: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2577: RAISE FND_API.G_EXC_ERROR;
2578: END IF;
2579:
2580: hz_utility_v2pub.validate_mandatory(
2581: p_create_update_flag => 'U',
2583: p_column_value => p_object_version_number,
2584: x_return_status => x_return_status
2585: );
2586:
2587: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2588: RAISE FND_API.G_EXC_ERROR;
2589: END IF;
2590:
2591: -- check if the row exists
2584: x_return_status => x_return_status
2585: );
2586:
2587: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2588: RAISE FND_API.G_EXC_ERROR;
2589: END IF;
2590:
2591: -- check if the row exists
2592: BEGIN
2602: IF l_object_version_number <> p_object_version_number THEN
2603: FND_MESSAGE.SET_NAME('AR', 'HZ_API_RECORD_CHANGED');
2604: FND_MESSAGE.SET_TOKEN('TABLE', 'hz_geography_ranges');
2605: FND_MSG_PUB.ADD;
2606: RAISE FND_API.G_EXC_ERROR;
2607: ELSE
2608: p_object_version_number := l_object_version_number + 1;
2609: END IF;
2610:
2612: FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_NO_RECORD' );
2613: FND_MESSAGE.SET_TOKEN( 'TOKEN1', 'Geography Range');
2614: FND_MESSAGE.SET_TOKEN( 'TOKEN2', 'geography_id '||p_geography_id||', geography_from '||p_geography_from||', start_date '||p_start_date);
2615: FND_MSG_PUB.ADD;
2616: RAISE FND_API.G_EXC_ERROR;
2617:
2618: END;
2619: -- check if start_date <= end_date
2620:
2628: p_old_end_date => l_end_date,
2629: x_return_status => x_return_status
2630: );
2631:
2632: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2633: RAISE FND_API.G_EXC_ERROR;
2634: END IF;
2635:
2636: -- call table handler to update the row
2629: x_return_status => x_return_status
2630: );
2631:
2632: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2633: RAISE FND_API.G_EXC_ERROR;
2634: END IF;
2635:
2636: -- call table handler to update the row
2637: HZ_GEOGRAPHY_RANGES_PKG.update_row(
2689: l_zone_type := HZ_GEOGRAPHY_VALIDATE_PVT.get_geography_type(p_geography_id =>p_geography_id,
2690: x_return_status => x_return_status);
2691:
2692:
2693: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2694: RAISE FND_API.G_EXC_ERROR;
2695: END IF;
2696:
2697: SELECT geography_use,limited_by_geography_id INTO l_geography_use,l_limited_by_geography_id
2690: x_return_status => x_return_status);
2691:
2692:
2693: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2694: RAISE FND_API.G_EXC_ERROR;
2695: END IF;
2696:
2697: SELECT geography_use,limited_by_geography_id INTO l_geography_use,l_limited_by_geography_id
2698: FROM hz_geography_types_b
2712: p_create_update_flag => 'C',
2713: x_return_status => x_return_status
2714: );
2715:
2716: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2717: RAISE FND_API.G_EXC_ERROR;
2718: EXIT;
2719: END IF;
2720:
2713: x_return_status => x_return_status
2714: );
2715:
2716: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2717: RAISE FND_API.G_EXC_ERROR;
2718: EXIT;
2719: END IF;
2720:
2721: --dbms_output.put_line('In loop after validate zone relaion '||x_return_status);
2723: --get geography_type of included_geography_id
2724: l_incl_geo_type := HZ_GEOGRAPHY_VALIDATE_PVT.get_geography_type(p_geography_id =>p_zone_relation_tbl(i).included_geography_id,
2725: x_return_status => x_return_status);
2726:
2727: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2728: RAISE FND_API.G_EXC_ERROR;
2729: EXIT;
2730: END IF;
2731:
2724: l_incl_geo_type := HZ_GEOGRAPHY_VALIDATE_PVT.get_geography_type(p_geography_id =>p_zone_relation_tbl(i).included_geography_id,
2725: x_return_status => x_return_status);
2726:
2727: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2728: RAISE FND_API.G_EXC_ERROR;
2729: EXIT;
2730: END IF;
2731:
2732: IF l_limited_by_geography_id IS NOT NULL THEN
2748: FND_MESSAGE.SET_TOKEN( 'INCL_GEO_ID',p_zone_relation_tbl(i).included_geography_id);
2749: FND_MESSAGE.SET_TOKEN( 'LIM_GEO_ID', l_limited_by_geography_id );
2750: FND_MESSAGE.SET_TOKEN( 'ZONE_TYPE', l_zone_type);
2751: FND_MSG_PUB.ADD;
2752: RAISE FND_API.G_EXC_ERROR;
2753: END;
2754: END IF;
2755:
2756: -- Fix for ER 4232852
2781: x_msg_count => x_msg_count,
2782: x_msg_data => x_msg_data
2783: );
2784:
2785: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2786: RAISE FND_API.G_EXC_ERROR;
2787: END IF;
2788: END IF;
2789: END IF;
2782: x_msg_data => x_msg_data
2783: );
2784:
2785: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2786: RAISE FND_API.G_EXC_ERROR;
2787: END IF;
2788: END IF;
2789: END IF;
2790:
2808: FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_OVERLAPPING_GEOGS' );
2809: FND_MESSAGE.SET_TOKEN( 'GEO_ID',p_zone_relation_tbl(i).included_geography_id );
2810: FND_MESSAGE.SET_TOKEN( 'ZONE_TYPE', l_zone_type);
2811: FND_MSG_PUB.ADD;
2812: RAISE FND_API.G_EXC_ERROR;
2813: EXIT;
2814: END IF;
2815:
2816: -- included_geography_id must be unique within a geography_id
2829: FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_DUPL_INCL_GEO_ID' );
2830: FND_MESSAGE.SET_TOKEN( 'GEO_ID',p_zone_relation_tbl(i).included_geography_id );
2831: FND_MESSAGE.SET_TOKEN( 'ZONE_ID', p_geography_id);
2832: FND_MSG_PUB.ADD;
2833: RAISE FND_API.G_EXC_ERROR;
2834: EXIT;
2835: END IF;
2836:
2837: -- call relationship API to create a relationship between geography_id and included_geography_id
2861: x_msg_data => x_msg_data,
2862: p_create_org_contact => 'N'
2863: );
2864:
2865: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2866: --dbms_output.put_line('After call to create relationship API '|| x_return_status);
2867: RAISE FND_API.G_EXC_ERROR;
2868: EXIT;
2869: END IF;
2863: );
2864:
2865: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2866: --dbms_output.put_line('After call to create relationship API '|| x_return_status);
2867: RAISE FND_API.G_EXC_ERROR;
2868: EXIT;
2869: END IF;
2870: IF (p_zone_relation_tbl(i).geography_from IS NOT NULL AND
2871: p_zone_relation_tbl(i).geography_to IS NOT NULL AND
2868: EXIT;
2869: END IF;
2870: IF (p_zone_relation_tbl(i).geography_from IS NOT NULL AND
2871: p_zone_relation_tbl(i).geography_to IS NOT NULL AND
2872: p_zone_relation_tbl(i).geography_from <> fnd_api.g_miss_char AND
2873: p_zone_relation_tbl(i).geography_to <> fnd_api.g_miss_char) THEN
2874: --call create_geography_range API
2875:
2876: l_geography_range_rec.zone_id := p_geography_id;
2869: END IF;
2870: IF (p_zone_relation_tbl(i).geography_from IS NOT NULL AND
2871: p_zone_relation_tbl(i).geography_to IS NOT NULL AND
2872: p_zone_relation_tbl(i).geography_from <> fnd_api.g_miss_char AND
2873: p_zone_relation_tbl(i).geography_to <> fnd_api.g_miss_char) THEN
2874: --call create_geography_range API
2875:
2876: l_geography_range_rec.zone_id := p_geography_id;
2877: l_geography_range_rec.master_ref_geography_id := p_zone_relation_tbl(i).included_geography_id;
2894: x_msg_count => x_msg_count,
2895: x_msg_data => x_msg_data
2896: );
2897:
2898: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2899: RAISE FND_API.G_EXC_ERROR;
2900: EXIT;
2901: END IF;
2902: END IF;
2895: x_msg_data => x_msg_data
2896: );
2897:
2898: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2899: RAISE FND_API.G_EXC_ERROR;
2900: EXIT;
2901: END IF;
2902: END IF;
2903: END LOOP;
2947: p_restricted => 'N',
2948: x_return_status => x_return_status
2949: );
2950:
2951: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2952: RAISE FND_API.G_EXC_ERROR;
2953: END IF;
2954:
2955: HZ_UTILITY_V2PUB.validate_mandatory (
2948: x_return_status => x_return_status
2949: );
2950:
2951: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2952: RAISE FND_API.G_EXC_ERROR;
2953: END IF;
2954:
2955: HZ_UTILITY_V2PUB.validate_mandatory (
2956: p_create_update_flag =>'C',
2959: p_restricted => 'N',
2960: x_return_status => x_return_status
2961: );
2962:
2963: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2964: RAISE FND_API.G_EXC_ERROR;
2965: END IF;
2966:
2967: -- get geography_use
2960: x_return_status => x_return_status
2961: );
2962:
2963: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2964: RAISE FND_API.G_EXC_ERROR;
2965: END IF;
2966:
2967: -- get geography_use
2968: BEGIN
2976: fnd_message.set_token('FK', 'geography_type');
2977: fnd_message.set_token('COLUMN','zone_type');
2978: fnd_message.set_token('TABLE','HZ_GEOGRAPHY_TYPES_B');
2979: fnd_msg_pub.add;
2980: RAISE FND_API.G_EXC_ERROR;
2981: END;
2982:
2983: -- zone_name must be unique with in a zone_type
2984: SELECT count(*) INTO l_count
2990: IF l_count > 0 THEN
2991: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_DUPLICATE_COLUMN' );
2992: FND_MESSAGE.SET_TOKEN( 'COLUMN','zone name');
2993: FND_MSG_PUB.ADD;
2994: RAISE FND_API.G_EXC_ERROR;
2995: END IF;
2996:
2997: -- zone_code must be unique within a zone_type
2998:
3006: IF l_count > 0 THEN
3007: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_DUPLICATE_COLUMN' );
3008: FND_MESSAGE.SET_TOKEN( 'COLUMN','zone code');
3009: FND_MSG_PUB.ADD;
3010: RAISE FND_API.G_EXC_ERROR;
3011: END IF;
3012: END IF;
3013:
3014: -- zone_code_type is mandatory if zone_code is NOT NULL
3015: IF (p_zone_code IS NOT NULL AND p_zone_code_type IS NULL) THEN
3016: FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
3017: FND_MESSAGE.SET_TOKEN( 'COLUMN', 'zone_code_type' );
3018: FND_MSG_PUB.ADD;
3019: RAISE FND_API.G_EXC_ERROR;
3020: END IF;
3021:
3022:
3023: -- timezone_code must be FK to fnd_timezones_b
3032: fnd_message.set_token('FK', 'timezone_code');
3033: fnd_message.set_token('COLUMN','timezone_code');
3034: fnd_message.set_token('TABLE','FND_TIMEZONES_B');
3035: fnd_msg_pub.add;
3036: RAISE FND_API.G_EXC_ERROR;
3037: END IF;
3038: END IF;
3039:
3040: -- there must be atleast one included geography for a zone
3040: -- there must be atleast one included geography for a zone
3041: IF p_zone_relation_tbl.count = 0 THEN
3042: fnd_message.set_name('AR', 'HZ_GEO_NO_INCL_GEOGRAPHIES');
3043: fnd_msg_pub.add;
3044: RAISE FND_API.G_EXC_ERROR;
3045: END IF;
3046:
3047: -- get country code of one of the included_geography_id of this zone_type
3048:
3061: FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_NO_RECORD');
3062: FND_MESSAGE.SET_TOKEN( 'TOKEN1','country code');
3063: FND_MESSAGE.SET_TOKEN( 'TOKEN2', 'included_geography_id '||p_zone_relation_tbl(i).included_geography_id);
3064: FND_MSG_PUB.ADD;
3065: RAISE FND_API.G_EXC_ERROR;
3066: EXIT;
3067: END;
3068: END IF;
3069: END LOOP;
3165: x_msg_count => x_msg_count,
3166: x_msg_data => x_msg_data
3167: );
3168:
3169: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3170: RAISE FND_API.G_EXC_ERROR;
3171: END IF;
3172:
3173: --dbms_output.put_line('After first identifier row '||x_return_status);
3166: x_msg_data => x_msg_data
3167: );
3168:
3169: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3170: RAISE FND_API.G_EXC_ERROR;
3171: END IF;
3172:
3173: --dbms_output.put_line('After first identifier row '||x_return_status);
3174:
3173: --dbms_output.put_line('After first identifier row '||x_return_status);
3174:
3175: IF p_zone_code IS NOT NULL
3176: -- Bug 4579847 : do not call for g_miss value for code
3177: and p_zone_code <> fnd_api.g_miss_char THEN
3178: -- create identifier for zone code
3179: l_geo_identifier_rec.identifier_subtype := p_zone_code_type;
3180: l_geo_identifier_rec.identifier_value := p_zone_code;
3181: l_geo_identifier_rec.identifier_type := 'CODE';
3187: x_msg_count => x_msg_count,
3188: x_msg_data => x_msg_data
3189: );
3190:
3191: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3192: RAISE FND_API.G_EXC_ERROR;
3193: END IF;
3194:
3195: --dbms_output.put_line('After second identifier row '||x_return_status);
3188: x_msg_data => x_msg_data
3189: );
3190:
3191: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3192: RAISE FND_API.G_EXC_ERROR;
3193: END IF;
3194:
3195: --dbms_output.put_line('After second identifier row '||x_return_status);
3196: END IF;
3206: x_msg_count => x_msg_count,
3207: x_msg_data => x_msg_data
3208: );
3209:
3210: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3211: RAISE FND_API.G_EXC_ERROR;
3212: END IF;
3213: --dbms_output.put_line('After insert zone relation '||x_return_status);
3214:
3207: x_msg_data => x_msg_data
3208: );
3209:
3210: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3211: RAISE FND_API.G_EXC_ERROR;
3212: END IF;
3213: --dbms_output.put_line('After insert zone relation '||x_return_status);
3214:
3215: END do_create_zone;
3228: *
3229: * ARGUMENTS
3230: * IN:
3231: * p_init_msg_list Initialize message stack if it is set to
3232: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3233: * p_master_relation_rec Geography type record.
3234: * IN/OUT:
3235: * OUT:
3236: * x_relationship_id Returns relationship_id for the relationship created.
3234: * IN/OUT:
3235: * OUT:
3236: * x_relationship_id Returns relationship_id for the relationship created.
3237: * x_return_status Return status after the call. The status can
3238: * be FND_API.G_RET_STS_SUCCESS (success),
3239: * FND_API.G_RET_STS_ERROR (error),
3240: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3241: * x_msg_count Number of messages in message stack.
3242: * x_msg_data Message text if x_msg_count is 1.
3235: * OUT:
3236: * x_relationship_id Returns relationship_id for the relationship created.
3237: * x_return_status Return status after the call. The status can
3238: * be FND_API.G_RET_STS_SUCCESS (success),
3239: * FND_API.G_RET_STS_ERROR (error),
3240: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3241: * x_msg_count Number of messages in message stack.
3242: * x_msg_data Message text if x_msg_count is 1.
3243: *
3236: * x_relationship_id Returns relationship_id for the relationship created.
3237: * x_return_status Return status after the call. The status can
3238: * be FND_API.G_RET_STS_SUCCESS (success),
3239: * FND_API.G_RET_STS_ERROR (error),
3240: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3241: * x_msg_count Number of messages in message stack.
3242: * x_msg_data Message text if x_msg_count is 1.
3243: *
3244: * NOTES
3249: *
3250: */
3251:
3252: PROCEDURE create_master_relation (
3253: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3254: p_master_relation_rec IN MASTER_RELATION_REC_TYPE,
3255: x_relationship_id OUT NOCOPY NUMBER,
3256: x_return_status OUT NOCOPY VARCHAR2,
3257: x_msg_count OUT NOCOPY NUMBER,
3264: -- Standard start of API savepoint
3265: SAVEPOINT create_master_relation;
3266:
3267: -- Initialize message list if p_init_msg_list is set to TRUE.
3268: IF FND_API.to_Boolean(p_init_msg_list) THEN
3269: FND_MSG_PUB.initialize;
3270: END IF;
3271:
3272: -- Initialize API return status to success.
3269: FND_MSG_PUB.initialize;
3270: END IF;
3271:
3272: -- Initialize API return status to success.
3273: x_return_status := FND_API.G_RET_STS_SUCCESS;
3274:
3275: -- Call to business logic.
3276: do_create_master_relation(
3277: p_master_relation_rec => p_master_relation_rec,
3279: x_return_status => x_return_status
3280: );
3281:
3282: --if validation failed at any point, then raise an exception to stop processing
3283: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3284: RAISE FND_API.G_EXC_ERROR;
3285: END IF;
3286:
3287: --g_dup_checked := 'N';
3280: );
3281:
3282: --if validation failed at any point, then raise an exception to stop processing
3283: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3284: RAISE FND_API.G_EXC_ERROR;
3285: END IF;
3286:
3287: --g_dup_checked := 'N';
3288: -- Standard call to get message count and if count is 1, get message info.
3286:
3287: --g_dup_checked := 'N';
3288: -- Standard call to get message count and if count is 1, get message info.
3289: FND_MSG_PUB.Count_And_Get(
3290: p_encoded => FND_API.G_FALSE,
3291: p_count => x_msg_count,
3292: p_data => x_msg_data);
3293:
3294: EXCEPTION
3291: p_count => x_msg_count,
3292: p_data => x_msg_data);
3293:
3294: EXCEPTION
3295: WHEN FND_API.G_EXC_ERROR THEN
3296: g_dup_checked := 'N';
3297: ROLLBACK TO create_master_relation;
3298: x_return_status := FND_API.G_RET_STS_ERROR;
3299: FND_MSG_PUB.Count_And_Get(
3294: EXCEPTION
3295: WHEN FND_API.G_EXC_ERROR THEN
3296: g_dup_checked := 'N';
3297: ROLLBACK TO create_master_relation;
3298: x_return_status := FND_API.G_RET_STS_ERROR;
3299: FND_MSG_PUB.Count_And_Get(
3300: p_encoded => FND_API.G_FALSE,
3301: p_count => x_msg_count,
3302: p_data => x_msg_data);
3296: g_dup_checked := 'N';
3297: ROLLBACK TO create_master_relation;
3298: x_return_status := FND_API.G_RET_STS_ERROR;
3299: FND_MSG_PUB.Count_And_Get(
3300: p_encoded => FND_API.G_FALSE,
3301: p_count => x_msg_count,
3302: p_data => x_msg_data);
3303: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3304: --g_dup_checked := 'N';
3299: FND_MSG_PUB.Count_And_Get(
3300: p_encoded => FND_API.G_FALSE,
3301: p_count => x_msg_count,
3302: p_data => x_msg_data);
3303: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3304: --g_dup_checked := 'N';
3305: ROLLBACK TO create_master_relation;
3306: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3307: FND_MSG_PUB.Count_And_Get(
3302: p_data => x_msg_data);
3303: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3304: --g_dup_checked := 'N';
3305: ROLLBACK TO create_master_relation;
3306: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3307: FND_MSG_PUB.Count_And_Get(
3308: p_encoded => FND_API.G_FALSE,
3309: p_count => x_msg_count,
3310: p_data => x_msg_data);
3304: --g_dup_checked := 'N';
3305: ROLLBACK TO create_master_relation;
3306: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3307: FND_MSG_PUB.Count_And_Get(
3308: p_encoded => FND_API.G_FALSE,
3309: p_count => x_msg_count,
3310: p_data => x_msg_data);
3311:
3312: WHEN OTHERS THEN
3311:
3312: WHEN OTHERS THEN
3313: --g_dup_checked := 'N';
3314: ROLLBACK TO create_master_relation;
3315: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3316: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3317: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3318: FND_MSG_PUB.ADD;
3319: FND_MSG_PUB.Count_And_Get(
3316: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3317: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3318: FND_MSG_PUB.ADD;
3319: FND_MSG_PUB.Count_And_Get(
3320: p_encoded => FND_API.G_FALSE,
3321: p_count => x_msg_count,
3322: p_data => x_msg_data);
3323:
3324: END create_master_relation;
3333: *
3334: * ARGUMENTS
3335: * IN:
3336: * p_init_msg_list Initialize message stack if it is set to
3337: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3338: * p_master_relation_rec Geography type record.
3339: * p_object_version_number Object version number of the row
3340: * IN/OUT:
3341: * OUT:
3340: * IN/OUT:
3341: * OUT:
3342: *
3343: * x_return_status Return status after the call. The status can
3344: * be FND_API.G_RET_STS_SUCCESS (success),
3345: * FND_API.G_RET_STS_ERROR (error),
3346: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3347: * x_msg_count Number of messages in message stack.
3348: * x_msg_data Message text if x_msg_count is 1.
3341: * OUT:
3342: *
3343: * x_return_status Return status after the call. The status can
3344: * be FND_API.G_RET_STS_SUCCESS (success),
3345: * FND_API.G_RET_STS_ERROR (error),
3346: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3347: * x_msg_count Number of messages in message stack.
3348: * x_msg_data Message text if x_msg_count is 1.
3349: *
3342: *
3343: * x_return_status Return status after the call. The status can
3344: * be FND_API.G_RET_STS_SUCCESS (success),
3345: * FND_API.G_RET_STS_ERROR (error),
3346: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3347: * x_msg_count Number of messages in message stack.
3348: * x_msg_data Message text if x_msg_count is 1.
3349: *
3350: * NOTES
3354: *
3355: */
3356:
3357: PROCEDURE update_relationship (
3358: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3359: p_relationship_id IN NUMBER,
3360: p_status IN VARCHAR2,
3361: p_object_version_number IN OUT NOCOPY NUMBER,
3362: x_return_status OUT NOCOPY VARCHAR2,
3368: -- Standard start of API savepoint
3369: SAVEPOINT update_relationship;
3370:
3371: -- Initialize message list if p_init_msg_list is set to TRUE.
3372: IF FND_API.to_Boolean(p_init_msg_list) THEN
3373: FND_MSG_PUB.initialize;
3374: END IF;
3375:
3376: -- Initialize API return status to success.
3373: FND_MSG_PUB.initialize;
3374: END IF;
3375:
3376: -- Initialize API return status to success.
3377: x_return_status := FND_API.G_RET_STS_SUCCESS;
3378:
3379: -- Call to business logic.
3380: do_update_relationship(
3381: p_relationship_id => p_relationship_id,
3384: x_return_status => x_return_status
3385: );
3386:
3387: --if validation failed at any point, then raise an exception to stop processing
3388: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3389: RAISE FND_API.G_EXC_ERROR;
3390: END IF;
3391:
3392: -- Standard call to get message count and if count is 1, get message info.
3385: );
3386:
3387: --if validation failed at any point, then raise an exception to stop processing
3388: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3389: RAISE FND_API.G_EXC_ERROR;
3390: END IF;
3391:
3392: -- Standard call to get message count and if count is 1, get message info.
3393: FND_MSG_PUB.Count_And_Get(
3390: END IF;
3391:
3392: -- Standard call to get message count and if count is 1, get message info.
3393: FND_MSG_PUB.Count_And_Get(
3394: p_encoded => FND_API.G_FALSE,
3395: p_count => x_msg_count,
3396: p_data => x_msg_data);
3397:
3398: EXCEPTION
3395: p_count => x_msg_count,
3396: p_data => x_msg_data);
3397:
3398: EXCEPTION
3399: WHEN FND_API.G_EXC_ERROR THEN
3400: ROLLBACK TO update_relationship;
3401: x_return_status := FND_API.G_RET_STS_ERROR;
3402: FND_MSG_PUB.Count_And_Get(
3403: p_encoded => FND_API.G_FALSE,
3397:
3398: EXCEPTION
3399: WHEN FND_API.G_EXC_ERROR THEN
3400: ROLLBACK TO update_relationship;
3401: x_return_status := FND_API.G_RET_STS_ERROR;
3402: FND_MSG_PUB.Count_And_Get(
3403: p_encoded => FND_API.G_FALSE,
3404: p_count => x_msg_count,
3405: p_data => x_msg_data);
3399: WHEN FND_API.G_EXC_ERROR THEN
3400: ROLLBACK TO update_relationship;
3401: x_return_status := FND_API.G_RET_STS_ERROR;
3402: FND_MSG_PUB.Count_And_Get(
3403: p_encoded => FND_API.G_FALSE,
3404: p_count => x_msg_count,
3405: p_data => x_msg_data);
3406: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3407: ROLLBACK TO update_relationship;
3402: FND_MSG_PUB.Count_And_Get(
3403: p_encoded => FND_API.G_FALSE,
3404: p_count => x_msg_count,
3405: p_data => x_msg_data);
3406: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3407: ROLLBACK TO update_relationship;
3408: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3409: FND_MSG_PUB.Count_And_Get(
3410: p_encoded => FND_API.G_FALSE,
3404: p_count => x_msg_count,
3405: p_data => x_msg_data);
3406: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3407: ROLLBACK TO update_relationship;
3408: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3409: FND_MSG_PUB.Count_And_Get(
3410: p_encoded => FND_API.G_FALSE,
3411: p_count => x_msg_count,
3412: p_data => x_msg_data);
3406: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3407: ROLLBACK TO update_relationship;
3408: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3409: FND_MSG_PUB.Count_And_Get(
3410: p_encoded => FND_API.G_FALSE,
3411: p_count => x_msg_count,
3412: p_data => x_msg_data);
3413:
3414: WHEN OTHERS THEN
3412: p_data => x_msg_data);
3413:
3414: WHEN OTHERS THEN
3415: ROLLBACK TO update_relationship;
3416: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3417: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3418: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3419: FND_MSG_PUB.ADD;
3420: FND_MSG_PUB.Count_And_Get(
3417: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3418: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3419: FND_MSG_PUB.ADD;
3420: FND_MSG_PUB.Count_And_Get(
3421: p_encoded => FND_API.G_FALSE,
3422: p_count => x_msg_count,
3423: p_data => x_msg_data);
3424:
3425: END update_relationship;
3434: *
3435: * ARGUMENTS
3436: * IN:
3437: * p_init_msg_list Initialize message stack if it is set to
3438: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3439: * p_geo_identifier_rec Geo_identifier type record.
3440: * IN/OUT:
3441: * OUT:
3442: *
3440: * IN/OUT:
3441: * OUT:
3442: *
3443: * x_return_status Return status after the call. The status can
3444: * be FND_API.G_RET_STS_SUCCESS (success),
3445: * FND_API.G_RET_STS_ERROR (error),
3446: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3447: * x_msg_count Number of messages in message stack.
3448: * x_msg_data Message text if x_msg_count is 1.
3441: * OUT:
3442: *
3443: * x_return_status Return status after the call. The status can
3444: * be FND_API.G_RET_STS_SUCCESS (success),
3445: * FND_API.G_RET_STS_ERROR (error),
3446: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3447: * x_msg_count Number of messages in message stack.
3448: * x_msg_data Message text if x_msg_count is 1.
3449: *
3442: *
3443: * x_return_status Return status after the call. The status can
3444: * be FND_API.G_RET_STS_SUCCESS (success),
3445: * FND_API.G_RET_STS_ERROR (error),
3446: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3447: * x_msg_count Number of messages in message stack.
3448: * x_msg_data Message text if x_msg_count is 1.
3449: *
3450: * NOTES
3454: *
3455: */
3456:
3457: PROCEDURE create_geo_identifier(
3458: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3459: p_geo_identifier_rec IN GEO_IDENTIFIER_REC_TYPE,
3460: x_return_status OUT NOCOPY VARCHAR2,
3461: x_msg_count OUT NOCOPY NUMBER,
3462: x_msg_data OUT NOCOPY VARCHAR2
3468: -- Standard start of API savepoint
3469: SAVEPOINT create_geo_identifier;
3470:
3471: -- Initialize message list if p_init_msg_list is set to TRUE.
3472: IF FND_API.to_Boolean(p_init_msg_list) THEN
3473: FND_MSG_PUB.initialize;
3474: END IF;
3475:
3476: -- Initialize API return status to success.
3473: FND_MSG_PUB.initialize;
3474: END IF;
3475:
3476: -- Initialize API return status to success.
3477: x_return_status := FND_API.G_RET_STS_SUCCESS;
3478:
3479: -- Call to business logic.
3480: do_create_geo_identifier(
3481: p_geo_identifier_rec => p_geo_identifier_rec,
3482: x_return_status => x_return_status
3483: );
3484:
3485: --if validation failed at any point, then raise an exception to stop processing
3486: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3487: RAISE FND_API.G_EXC_ERROR;
3488: END IF;
3489:
3490: -- Standard call to get message count and if count is 1, get message info.
3483: );
3484:
3485: --if validation failed at any point, then raise an exception to stop processing
3486: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3487: RAISE FND_API.G_EXC_ERROR;
3488: END IF;
3489:
3490: -- Standard call to get message count and if count is 1, get message info.
3491: FND_MSG_PUB.Count_And_Get(
3488: END IF;
3489:
3490: -- Standard call to get message count and if count is 1, get message info.
3491: FND_MSG_PUB.Count_And_Get(
3492: p_encoded => FND_API.G_FALSE,
3493: p_count => x_msg_count,
3494: p_data => x_msg_data);
3495:
3496: EXCEPTION
3493: p_count => x_msg_count,
3494: p_data => x_msg_data);
3495:
3496: EXCEPTION
3497: WHEN FND_API.G_EXC_ERROR THEN
3498: ROLLBACK TO create_geo_identifier;
3499: x_return_status := FND_API.G_RET_STS_ERROR;
3500: FND_MSG_PUB.Count_And_Get(
3501: p_encoded => FND_API.G_FALSE,
3495:
3496: EXCEPTION
3497: WHEN FND_API.G_EXC_ERROR THEN
3498: ROLLBACK TO create_geo_identifier;
3499: x_return_status := FND_API.G_RET_STS_ERROR;
3500: FND_MSG_PUB.Count_And_Get(
3501: p_encoded => FND_API.G_FALSE,
3502: p_count => x_msg_count,
3503: p_data => x_msg_data);
3497: WHEN FND_API.G_EXC_ERROR THEN
3498: ROLLBACK TO create_geo_identifier;
3499: x_return_status := FND_API.G_RET_STS_ERROR;
3500: FND_MSG_PUB.Count_And_Get(
3501: p_encoded => FND_API.G_FALSE,
3502: p_count => x_msg_count,
3503: p_data => x_msg_data);
3504: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3505: ROLLBACK TO create_geo_identifier;
3500: FND_MSG_PUB.Count_And_Get(
3501: p_encoded => FND_API.G_FALSE,
3502: p_count => x_msg_count,
3503: p_data => x_msg_data);
3504: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3505: ROLLBACK TO create_geo_identifier;
3506: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3507: FND_MSG_PUB.Count_And_Get(
3508: p_encoded => FND_API.G_FALSE,
3502: p_count => x_msg_count,
3503: p_data => x_msg_data);
3504: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3505: ROLLBACK TO create_geo_identifier;
3506: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3507: FND_MSG_PUB.Count_And_Get(
3508: p_encoded => FND_API.G_FALSE,
3509: p_count => x_msg_count,
3510: p_data => x_msg_data);
3504: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3505: ROLLBACK TO create_geo_identifier;
3506: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3507: FND_MSG_PUB.Count_And_Get(
3508: p_encoded => FND_API.G_FALSE,
3509: p_count => x_msg_count,
3510: p_data => x_msg_data);
3511:
3512: WHEN DUP_VAL_ON_INDEX THEN
3510: p_data => x_msg_data);
3511:
3512: WHEN DUP_VAL_ON_INDEX THEN
3513: ROLLBACK TO create_geo_identifier;
3514: x_return_status := FND_API.G_RET_STS_ERROR;
3515: HZ_UTILITY_V2PUB.find_index_name(p_index_name);
3516: IF p_index_name = 'HZ_GEOGRAPHY_IDENTIFIERS_U1' THEN
3517: FND_MESSAGE.SET_NAME('AR', 'HZ_API_DUPLICATE_COLUMN');
3518: FND_MESSAGE.SET_TOKEN('COLUMN', 'geography_id,identifier_type,identifier_subtype,identifier_value,language_code');
3518: FND_MESSAGE.SET_TOKEN('COLUMN', 'geography_id,identifier_type,identifier_subtype,identifier_value,language_code');
3519: FND_MSG_PUB.ADD;
3520: END IF;
3521: FND_MSG_PUB.Count_And_Get(
3522: p_encoded => FND_API.G_FALSE,
3523: p_count => x_msg_count,
3524: p_data => x_msg_data);
3525:
3526: WHEN OTHERS THEN
3524: p_data => x_msg_data);
3525:
3526: WHEN OTHERS THEN
3527: ROLLBACK TO create_geo_identifier;
3528: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3529: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3530: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3531: FND_MSG_PUB.ADD;
3532: FND_MSG_PUB.Count_And_Get(
3529: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3530: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3531: FND_MSG_PUB.ADD;
3532: FND_MSG_PUB.Count_And_Get(
3533: p_encoded => FND_API.G_FALSE,
3534: p_count => x_msg_count,
3535: p_data => x_msg_data);
3536: END create_geo_identifier;
3537:
3545: *
3546: * ARGUMENTS
3547: * IN:
3548: * p_init_msg_list Initialize message stack if it is set to
3549: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3550: * p_geo_identifier_rec Geo_identifier type record.
3551: *
3552: * IN/OUT:
3553: * p_object_version_number
3555: *
3556: * x_cp_request_id Concurrent Program Request Id, whenever CP
3557: * to update denormalized data gets kicked off.
3558: * x_return_status Return status after the call. The status can
3559: * be FND_API.G_RET_STS_SUCCESS (success),
3560: * FND_API.G_RET_STS_ERROR (error),
3561: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3562: * x_msg_count Number of messages in message stack.
3563: * x_msg_data Message text if x_msg_count is 1.
3556: * x_cp_request_id Concurrent Program Request Id, whenever CP
3557: * to update denormalized data gets kicked off.
3558: * x_return_status Return status after the call. The status can
3559: * be FND_API.G_RET_STS_SUCCESS (success),
3560: * FND_API.G_RET_STS_ERROR (error),
3561: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3562: * x_msg_count Number of messages in message stack.
3563: * x_msg_data Message text if x_msg_count is 1.
3564: *
3557: * to update denormalized data gets kicked off.
3558: * x_return_status Return status after the call. The status can
3559: * be FND_API.G_RET_STS_SUCCESS (success),
3560: * FND_API.G_RET_STS_ERROR (error),
3561: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3562: * x_msg_count Number of messages in message stack.
3563: * x_msg_data Message text if x_msg_count is 1.
3564: *
3565: * NOTES
3570: * for Bug 457886
3571: *
3572: */
3573: PROCEDURE update_geo_identifier (
3574: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3575: p_geo_identifier_rec IN GEO_IDENTIFIER_REC_TYPE,
3576: p_object_version_number IN OUT NOCOPY NUMBER,
3577: x_cp_request_id OUT NOCOPY NUMBER,
3578: x_return_status OUT NOCOPY VARCHAR2,
3585: -- Standard start of API savepoint
3586: SAVEPOINT update_geo_identifier;
3587:
3588: -- Initialize message list if p_init_msg_list is set to TRUE.
3589: IF FND_API.to_Boolean(p_init_msg_list) THEN
3590: FND_MSG_PUB.initialize;
3591: END IF;
3592:
3593: -- Initialize API return status to success.
3590: FND_MSG_PUB.initialize;
3591: END IF;
3592:
3593: -- Initialize API return status to success.
3594: x_return_status := FND_API.G_RET_STS_SUCCESS;
3595:
3596: -- Call to business logic.
3597: do_update_geo_identifier(
3598: p_geo_identifier_rec => p_geo_identifier_rec,
3601: x_return_status => x_return_status
3602: );
3603:
3604: --if validation failed at any point, then raise an exception to stop processing
3605: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3606: RAISE FND_API.G_EXC_ERROR;
3607: END IF;
3608:
3609: -- Standard call to get message count and if count is 1, get message info.
3602: );
3603:
3604: --if validation failed at any point, then raise an exception to stop processing
3605: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3606: RAISE FND_API.G_EXC_ERROR;
3607: END IF;
3608:
3609: -- Standard call to get message count and if count is 1, get message info.
3610: FND_MSG_PUB.Count_And_Get(
3607: END IF;
3608:
3609: -- Standard call to get message count and if count is 1, get message info.
3610: FND_MSG_PUB.Count_And_Get(
3611: p_encoded => FND_API.G_FALSE,
3612: p_count => x_msg_count,
3613: p_data => x_msg_data);
3614:
3615: EXCEPTION
3612: p_count => x_msg_count,
3613: p_data => x_msg_data);
3614:
3615: EXCEPTION
3616: WHEN FND_API.G_EXC_ERROR THEN
3617: ROLLBACK TO update_geo_identifier;
3618: x_return_status := FND_API.G_RET_STS_ERROR;
3619: FND_MSG_PUB.Count_And_Get(
3620: p_encoded => FND_API.G_FALSE,
3614:
3615: EXCEPTION
3616: WHEN FND_API.G_EXC_ERROR THEN
3617: ROLLBACK TO update_geo_identifier;
3618: x_return_status := FND_API.G_RET_STS_ERROR;
3619: FND_MSG_PUB.Count_And_Get(
3620: p_encoded => FND_API.G_FALSE,
3621: p_count => x_msg_count,
3622: p_data => x_msg_data);
3616: WHEN FND_API.G_EXC_ERROR THEN
3617: ROLLBACK TO update_geo_identifier;
3618: x_return_status := FND_API.G_RET_STS_ERROR;
3619: FND_MSG_PUB.Count_And_Get(
3620: p_encoded => FND_API.G_FALSE,
3621: p_count => x_msg_count,
3622: p_data => x_msg_data);
3623: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3624: ROLLBACK TO update_geo_identifier;
3619: FND_MSG_PUB.Count_And_Get(
3620: p_encoded => FND_API.G_FALSE,
3621: p_count => x_msg_count,
3622: p_data => x_msg_data);
3623: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3624: ROLLBACK TO update_geo_identifier;
3625: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3626: FND_MSG_PUB.Count_And_Get(
3627: p_encoded => FND_API.G_FALSE,
3621: p_count => x_msg_count,
3622: p_data => x_msg_data);
3623: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3624: ROLLBACK TO update_geo_identifier;
3625: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3626: FND_MSG_PUB.Count_And_Get(
3627: p_encoded => FND_API.G_FALSE,
3628: p_count => x_msg_count,
3629: p_data => x_msg_data);
3623: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3624: ROLLBACK TO update_geo_identifier;
3625: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3626: FND_MSG_PUB.Count_And_Get(
3627: p_encoded => FND_API.G_FALSE,
3628: p_count => x_msg_count,
3629: p_data => x_msg_data);
3630:
3631: WHEN OTHERS THEN
3629: p_data => x_msg_data);
3630:
3631: WHEN OTHERS THEN
3632: ROLLBACK TO update_geo_identifier;
3633: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3634: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3635: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3636: FND_MSG_PUB.ADD;
3637: FND_MSG_PUB.Count_And_Get(
3634: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3635: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3636: FND_MSG_PUB.ADD;
3637: FND_MSG_PUB.Count_And_Get(
3638: p_encoded => FND_API.G_FALSE,
3639: p_count => x_msg_count,
3640: p_data => x_msg_data);
3641:
3642: END update_geo_identifier;
3651: *
3652: * ARGUMENTS
3653: * IN:
3654: * p_init_msg_list Initialize message stack if it is set to
3655: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3656: * p_geography_id geography id
3657: * p_identifier_type
3658: * p_identifier_subtype
3659: * p_identifier_value
3660: *
3661: * OUT:
3662: *
3663: * x_return_status Return status after the call. The status can
3664: * be FND_API.G_RET_STS_SUCCESS (success),
3665: * FND_API.G_RET_STS_ERROR (error),
3666: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3667: * x_msg_count Number of messages in message stack.
3668: * x_msg_data Message text if x_msg_count is 1.
3661: * OUT:
3662: *
3663: * x_return_status Return status after the call. The status can
3664: * be FND_API.G_RET_STS_SUCCESS (success),
3665: * FND_API.G_RET_STS_ERROR (error),
3666: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3667: * x_msg_count Number of messages in message stack.
3668: * x_msg_data Message text if x_msg_count is 1.
3669: *
3662: *
3663: * x_return_status Return status after the call. The status can
3664: * be FND_API.G_RET_STS_SUCCESS (success),
3665: * FND_API.G_RET_STS_ERROR (error),
3666: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3667: * x_msg_count Number of messages in message stack.
3668: * x_msg_data Message text if x_msg_count is 1.
3669: *
3670: * NOTES
3674: *
3675: */
3676:
3677: PROCEDURE delete_geo_identifier(
3678: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3679: p_geography_id IN NUMBER,
3680: p_identifier_type IN VARCHAR2,
3681: p_identifier_subtype IN VARCHAR2,
3682: p_identifier_value IN VARCHAR2,
3690: -- Standard start of API savepoint
3691: SAVEPOINT delete_geo_identifier;
3692:
3693: -- Initialize message list if p_init_msg_list is set to TRUE.
3694: IF FND_API.to_Boolean(p_init_msg_list) THEN
3695: FND_MSG_PUB.initialize;
3696: END IF;
3697:
3698: -- Initialize API return status to success.
3695: FND_MSG_PUB.initialize;
3696: END IF;
3697:
3698: -- Initialize API return status to success.
3699: x_return_status := FND_API.G_RET_STS_SUCCESS;
3700:
3701: -- Call to business logic.
3702: do_delete_geo_identifier(
3703: p_geography_id => p_geography_id,
3708: x_return_status => x_return_status
3709: );
3710:
3711: --if validation failed at any point, then raise an exception to stop processing
3712: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3713: RAISE FND_API.G_EXC_ERROR;
3714: END IF;
3715:
3716: -- Standard call to get message count and if count is 1, get message info.
3709: );
3710:
3711: --if validation failed at any point, then raise an exception to stop processing
3712: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3713: RAISE FND_API.G_EXC_ERROR;
3714: END IF;
3715:
3716: -- Standard call to get message count and if count is 1, get message info.
3717: FND_MSG_PUB.Count_And_Get(
3714: END IF;
3715:
3716: -- Standard call to get message count and if count is 1, get message info.
3717: FND_MSG_PUB.Count_And_Get(
3718: p_encoded => FND_API.G_FALSE,
3719: p_count => x_msg_count,
3720: p_data => x_msg_data);
3721:
3722: EXCEPTION
3719: p_count => x_msg_count,
3720: p_data => x_msg_data);
3721:
3722: EXCEPTION
3723: WHEN FND_API.G_EXC_ERROR THEN
3724: ROLLBACK TO delete_geo_identifier;
3725: x_return_status := FND_API.G_RET_STS_ERROR;
3726: FND_MSG_PUB.Count_And_Get(
3727: p_encoded => FND_API.G_FALSE,
3721:
3722: EXCEPTION
3723: WHEN FND_API.G_EXC_ERROR THEN
3724: ROLLBACK TO delete_geo_identifier;
3725: x_return_status := FND_API.G_RET_STS_ERROR;
3726: FND_MSG_PUB.Count_And_Get(
3727: p_encoded => FND_API.G_FALSE,
3728: p_count => x_msg_count,
3729: p_data => x_msg_data);
3723: WHEN FND_API.G_EXC_ERROR THEN
3724: ROLLBACK TO delete_geo_identifier;
3725: x_return_status := FND_API.G_RET_STS_ERROR;
3726: FND_MSG_PUB.Count_And_Get(
3727: p_encoded => FND_API.G_FALSE,
3728: p_count => x_msg_count,
3729: p_data => x_msg_data);
3730: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3731: ROLLBACK TO delete_geo_identifier;
3726: FND_MSG_PUB.Count_And_Get(
3727: p_encoded => FND_API.G_FALSE,
3728: p_count => x_msg_count,
3729: p_data => x_msg_data);
3730: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3731: ROLLBACK TO delete_geo_identifier;
3732: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3733: FND_MSG_PUB.Count_And_Get(
3734: p_encoded => FND_API.G_FALSE,
3728: p_count => x_msg_count,
3729: p_data => x_msg_data);
3730: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3731: ROLLBACK TO delete_geo_identifier;
3732: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3733: FND_MSG_PUB.Count_And_Get(
3734: p_encoded => FND_API.G_FALSE,
3735: p_count => x_msg_count,
3736: p_data => x_msg_data);
3730: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3731: ROLLBACK TO delete_geo_identifier;
3732: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3733: FND_MSG_PUB.Count_And_Get(
3734: p_encoded => FND_API.G_FALSE,
3735: p_count => x_msg_count,
3736: p_data => x_msg_data);
3737:
3738: WHEN OTHERS THEN
3736: p_data => x_msg_data);
3737:
3738: WHEN OTHERS THEN
3739: ROLLBACK TO delete_geo_identifier;
3740: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3741: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3742: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3743: FND_MSG_PUB.ADD;
3744: FND_MSG_PUB.Count_And_Get(
3741: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3742: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3743: FND_MSG_PUB.ADD;
3744: FND_MSG_PUB.Count_And_Get(
3745: p_encoded => FND_API.G_FALSE,
3746: p_count => x_msg_count,
3747: p_data => x_msg_data);
3748:
3749: END delete_geo_identifier;
3759: *
3760: * ARGUMENTS
3761: * IN:
3762: * p_init_msg_list Initialize message stack if it is set to
3763: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3764: * p_master_geography_rec Master Geography type record.
3765: * IN/OUT:
3766: * OUT:
3767: *
3766: * OUT:
3767: *
3768: * x_geography_id Return ID of the geography being created.
3769: * x_return_status Return status after the call. The status can
3770: * be FND_API.G_RET_STS_SUCCESS (success),
3771: * FND_API.G_RET_STS_ERROR (error),
3772: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3773: * x_msg_count Number of messages in message stack.
3774: * x_msg_data Message text if x_msg_count is 1.
3767: *
3768: * x_geography_id Return ID of the geography being created.
3769: * x_return_status Return status after the call. The status can
3770: * be FND_API.G_RET_STS_SUCCESS (success),
3771: * FND_API.G_RET_STS_ERROR (error),
3772: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3773: * x_msg_count Number of messages in message stack.
3774: * x_msg_data Message text if x_msg_count is 1.
3775: *
3768: * x_geography_id Return ID of the geography being created.
3769: * x_return_status Return status after the call. The status can
3770: * be FND_API.G_RET_STS_SUCCESS (success),
3771: * FND_API.G_RET_STS_ERROR (error),
3772: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3773: * x_msg_count Number of messages in message stack.
3774: * x_msg_data Message text if x_msg_count is 1.
3775: *
3776: * NOTES
3780: *
3781: */
3782:
3783: PROCEDURE create_master_geography(
3784: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3785: p_master_geography_rec IN MASTER_GEOGRAPHY_REC_TYPE,
3786: x_geography_id OUT NOCOPY NUMBER,
3787: x_return_status OUT NOCOPY VARCHAR2,
3788: x_msg_count OUT NOCOPY NUMBER,
3794: SAVEPOINT create_master_geography;
3795: --dbms_output.put_line('In the beginning of create_master_geography');
3796:
3797: -- Initialize message list if p_init_msg_list is set to TRUE.
3798: IF FND_API.to_Boolean(p_init_msg_list) THEN
3799: FND_MSG_PUB.initialize;
3800: END IF;
3801:
3802: -- Initialize API return status to success.
3799: FND_MSG_PUB.initialize;
3800: END IF;
3801:
3802: -- Initialize API return status to success.
3803: x_return_status := FND_API.G_RET_STS_SUCCESS;
3804:
3805: --dbms_output.put_line('before do_create_master_geography');
3806: -- Call to business logic.
3807: do_create_master_geography(
3810: x_return_status => x_return_status
3811: );
3812:
3813: --if validation failed at any point, then raise an exception to stop processing
3814: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3815: RAISE FND_API.G_EXC_ERROR;
3816: END IF;
3817:
3818: -- Standard call to get message count and if count is 1, get message info.
3811: );
3812:
3813: --if validation failed at any point, then raise an exception to stop processing
3814: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3815: RAISE FND_API.G_EXC_ERROR;
3816: END IF;
3817:
3818: -- Standard call to get message count and if count is 1, get message info.
3819: FND_MSG_PUB.Count_And_Get(
3816: END IF;
3817:
3818: -- Standard call to get message count and if count is 1, get message info.
3819: FND_MSG_PUB.Count_And_Get(
3820: p_encoded => FND_API.G_FALSE,
3821: p_count => x_msg_count,
3822: p_data => x_msg_data);
3823:
3824: EXCEPTION
3821: p_count => x_msg_count,
3822: p_data => x_msg_data);
3823:
3824: EXCEPTION
3825: WHEN FND_API.G_EXC_ERROR THEN
3826: ROLLBACK TO create_master_geography;
3827: x_return_status := FND_API.G_RET_STS_ERROR;
3828: FND_MSG_PUB.Count_And_Get(
3829: p_encoded => FND_API.G_FALSE,
3823:
3824: EXCEPTION
3825: WHEN FND_API.G_EXC_ERROR THEN
3826: ROLLBACK TO create_master_geography;
3827: x_return_status := FND_API.G_RET_STS_ERROR;
3828: FND_MSG_PUB.Count_And_Get(
3829: p_encoded => FND_API.G_FALSE,
3830: p_count => x_msg_count,
3831: p_data => x_msg_data);
3825: WHEN FND_API.G_EXC_ERROR THEN
3826: ROLLBACK TO create_master_geography;
3827: x_return_status := FND_API.G_RET_STS_ERROR;
3828: FND_MSG_PUB.Count_And_Get(
3829: p_encoded => FND_API.G_FALSE,
3830: p_count => x_msg_count,
3831: p_data => x_msg_data);
3832: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3833: ROLLBACK TO create_master_geography;
3828: FND_MSG_PUB.Count_And_Get(
3829: p_encoded => FND_API.G_FALSE,
3830: p_count => x_msg_count,
3831: p_data => x_msg_data);
3832: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3833: ROLLBACK TO create_master_geography;
3834: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3835: FND_MSG_PUB.Count_And_Get(
3836: p_encoded => FND_API.G_FALSE,
3830: p_count => x_msg_count,
3831: p_data => x_msg_data);
3832: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3833: ROLLBACK TO create_master_geography;
3834: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3835: FND_MSG_PUB.Count_And_Get(
3836: p_encoded => FND_API.G_FALSE,
3837: p_count => x_msg_count,
3838: p_data => x_msg_data);
3832: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3833: ROLLBACK TO create_master_geography;
3834: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3835: FND_MSG_PUB.Count_And_Get(
3836: p_encoded => FND_API.G_FALSE,
3837: p_count => x_msg_count,
3838: p_data => x_msg_data);
3839:
3840: WHEN OTHERS THEN
3838: p_data => x_msg_data);
3839:
3840: WHEN OTHERS THEN
3841: ROLLBACK TO create_master_geography;
3842: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3843: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3844: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3845: FND_MSG_PUB.ADD;
3846: FND_MSG_PUB.Count_And_Get(
3843: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3844: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3845: FND_MSG_PUB.ADD;
3846: FND_MSG_PUB.Count_And_Get(
3847: p_encoded => FND_API.G_FALSE,
3848: p_count => x_msg_count,
3849: p_data => x_msg_data);
3850:
3851: END create_master_geography;
3860: *
3861: * ARGUMENTS
3862: * IN:
3863: * p_init_msg_list Initialize message stack if it is set to
3864: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3865: * p_master_geography_rec Master Geography type record.
3866: *
3867: * IN/OUT:
3868: * p_object_version_number
3868: * p_object_version_number
3869: * OUT:
3870: *
3871: * x_return_status Return status after the call. The status can
3872: * be FND_API.G_RET_STS_SUCCESS (success),
3873: * FND_API.G_RET_STS_ERROR (error),
3874: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3875: * x_msg_count Number of messages in message stack.
3876: * x_msg_data Message text if x_msg_count is 1.
3869: * OUT:
3870: *
3871: * x_return_status Return status after the call. The status can
3872: * be FND_API.G_RET_STS_SUCCESS (success),
3873: * FND_API.G_RET_STS_ERROR (error),
3874: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3875: * x_msg_count Number of messages in message stack.
3876: * x_msg_data Message text if x_msg_count is 1.
3877: *
3870: *
3871: * x_return_status Return status after the call. The status can
3872: * be FND_API.G_RET_STS_SUCCESS (success),
3873: * FND_API.G_RET_STS_ERROR (error),
3874: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3875: * x_msg_count Number of messages in message stack.
3876: * x_msg_data Message text if x_msg_count is 1.
3877: *
3878: * NOTES
3881: * 12-12-2002 Rekha Nalluri o Created.
3882: *
3883: */
3884: PROCEDURE update_geography (
3885: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3886: p_geography_id IN NUMBER,
3887: p_end_date IN DATE,
3888: p_geometry IN MDSYS.SDO_GEOMETRY,
3889: p_timezone_code IN VARCHAR2,
3898: -- Standard start of API savepoint
3899: SAVEPOINT update_geography;
3900:
3901: -- Initialize message list if p_init_msg_list is set to TRUE.
3902: IF FND_API.to_Boolean(p_init_msg_list) THEN
3903: FND_MSG_PUB.initialize;
3904: END IF;
3905:
3906: -- Initialize API return status to success.
3903: FND_MSG_PUB.initialize;
3904: END IF;
3905:
3906: -- Initialize API return status to success.
3907: x_return_status := FND_API.G_RET_STS_SUCCESS;
3908:
3909: -- Call to business logic.
3910: do_update_geography(
3911: p_geography_id => p_geography_id,
3916: x_return_status => x_return_status
3917: );
3918:
3919: --if validation failed at any point, then raise an exception to stop processing
3920: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3921: RAISE FND_API.G_EXC_ERROR;
3922: END IF;
3923:
3924: -- Standard call to get message count and if count is 1, get message info.
3917: );
3918:
3919: --if validation failed at any point, then raise an exception to stop processing
3920: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3921: RAISE FND_API.G_EXC_ERROR;
3922: END IF;
3923:
3924: -- Standard call to get message count and if count is 1, get message info.
3925: FND_MSG_PUB.Count_And_Get(
3922: END IF;
3923:
3924: -- Standard call to get message count and if count is 1, get message info.
3925: FND_MSG_PUB.Count_And_Get(
3926: p_encoded => FND_API.G_FALSE,
3927: p_count => x_msg_count,
3928: p_data => x_msg_data);
3929:
3930: EXCEPTION
3927: p_count => x_msg_count,
3928: p_data => x_msg_data);
3929:
3930: EXCEPTION
3931: WHEN FND_API.G_EXC_ERROR THEN
3932: ROLLBACK TO update_geography;
3933: x_return_status := FND_API.G_RET_STS_ERROR;
3934: FND_MSG_PUB.Count_And_Get(
3935: p_encoded => FND_API.G_FALSE,
3929:
3930: EXCEPTION
3931: WHEN FND_API.G_EXC_ERROR THEN
3932: ROLLBACK TO update_geography;
3933: x_return_status := FND_API.G_RET_STS_ERROR;
3934: FND_MSG_PUB.Count_And_Get(
3935: p_encoded => FND_API.G_FALSE,
3936: p_count => x_msg_count,
3937: p_data => x_msg_data);
3931: WHEN FND_API.G_EXC_ERROR THEN
3932: ROLLBACK TO update_geography;
3933: x_return_status := FND_API.G_RET_STS_ERROR;
3934: FND_MSG_PUB.Count_And_Get(
3935: p_encoded => FND_API.G_FALSE,
3936: p_count => x_msg_count,
3937: p_data => x_msg_data);
3938: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3939: ROLLBACK TO update_geography;
3934: FND_MSG_PUB.Count_And_Get(
3935: p_encoded => FND_API.G_FALSE,
3936: p_count => x_msg_count,
3937: p_data => x_msg_data);
3938: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3939: ROLLBACK TO update_geography;
3940: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3941: FND_MSG_PUB.Count_And_Get(
3942: p_encoded => FND_API.G_FALSE,
3936: p_count => x_msg_count,
3937: p_data => x_msg_data);
3938: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3939: ROLLBACK TO update_geography;
3940: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3941: FND_MSG_PUB.Count_And_Get(
3942: p_encoded => FND_API.G_FALSE,
3943: p_count => x_msg_count,
3944: p_data => x_msg_data);
3938: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3939: ROLLBACK TO update_geography;
3940: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3941: FND_MSG_PUB.Count_And_Get(
3942: p_encoded => FND_API.G_FALSE,
3943: p_count => x_msg_count,
3944: p_data => x_msg_data);
3945:
3946: WHEN OTHERS THEN
3944: p_data => x_msg_data);
3945:
3946: WHEN OTHERS THEN
3947: ROLLBACK TO update_geography;
3948: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3949: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3950: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3951: FND_MSG_PUB.ADD;
3952: FND_MSG_PUB.Count_And_Get(
3949: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
3950: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
3951: FND_MSG_PUB.ADD;
3952: FND_MSG_PUB.Count_And_Get(
3953: p_encoded => FND_API.G_FALSE,
3954: p_count => x_msg_count,
3955: p_data => x_msg_data);
3956:
3957: END update_geography;
3966: *
3967: * ARGUMENTS
3968: * IN:
3969: * p_init_msg_list Initialize message stack if it is set to
3970: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3971: * p_geography_range_rec Geography range type record.
3972: * IN/OUT:
3973: * OUT:
3974: *
3972: * IN/OUT:
3973: * OUT:
3974: *
3975: * x_return_status Return status after the call. The status can
3976: * be FND_API.G_RET_STS_SUCCESS (success),
3977: * FND_API.G_RET_STS_ERROR (error),
3978: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3979: * x_msg_count Number of messages in message stack.
3980: * x_msg_data Message text if x_msg_count is 1.
3973: * OUT:
3974: *
3975: * x_return_status Return status after the call. The status can
3976: * be FND_API.G_RET_STS_SUCCESS (success),
3977: * FND_API.G_RET_STS_ERROR (error),
3978: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3979: * x_msg_count Number of messages in message stack.
3980: * x_msg_data Message text if x_msg_count is 1.
3981: *
3974: *
3975: * x_return_status Return status after the call. The status can
3976: * be FND_API.G_RET_STS_SUCCESS (success),
3977: * FND_API.G_RET_STS_ERROR (error),
3978: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3979: * x_msg_count Number of messages in message stack.
3980: * x_msg_data Message text if x_msg_count is 1.
3981: *
3982: * NOTES
3986: *
3987: */
3988:
3989: PROCEDURE create_geography_range(
3990: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3991: p_geography_range_rec IN GEOGRAPHY_RANGE_REC_TYPE,
3992: x_return_status OUT NOCOPY VARCHAR2,
3993: x_msg_count OUT NOCOPY NUMBER,
3994: x_msg_data OUT NOCOPY VARCHAR2
4001: SAVEPOINT create_geography_range;
4002: --dbms_output.put_line('In the beginning of create_master_geography');
4003:
4004: -- Initialize message list if p_init_msg_list is set to TRUE.
4005: IF FND_API.to_Boolean(p_init_msg_list) THEN
4006: FND_MSG_PUB.initialize;
4007: END IF;
4008:
4009: -- Initialize API return status to success.
4006: FND_MSG_PUB.initialize;
4007: END IF;
4008:
4009: -- Initialize API return status to success.
4010: x_return_status := FND_API.G_RET_STS_SUCCESS;
4011:
4012: --dbms_output.put_line('before do_create_geography_range');
4013: -- Call to business logic.
4014: do_create_geography_range(
4016: x_return_status => x_return_status
4017: );
4018:
4019: --if validation failed at any point, then raise an exception to stop processing
4020: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4021: RAISE FND_API.G_EXC_ERROR;
4022: END IF;
4023:
4024: -- Standard call to get message count and if count is 1, get message info.
4017: );
4018:
4019: --if validation failed at any point, then raise an exception to stop processing
4020: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4021: RAISE FND_API.G_EXC_ERROR;
4022: END IF;
4023:
4024: -- Standard call to get message count and if count is 1, get message info.
4025: FND_MSG_PUB.Count_And_Get(
4022: END IF;
4023:
4024: -- Standard call to get message count and if count is 1, get message info.
4025: FND_MSG_PUB.Count_And_Get(
4026: p_encoded => FND_API.G_FALSE,
4027: p_count => x_msg_count,
4028: p_data => x_msg_data);
4029:
4030: EXCEPTION
4027: p_count => x_msg_count,
4028: p_data => x_msg_data);
4029:
4030: EXCEPTION
4031: WHEN FND_API.G_EXC_ERROR THEN
4032: ROLLBACK TO create_geography_range;
4033: x_return_status := FND_API.G_RET_STS_ERROR;
4034: FND_MSG_PUB.Count_And_Get(
4035: p_encoded => FND_API.G_FALSE,
4029:
4030: EXCEPTION
4031: WHEN FND_API.G_EXC_ERROR THEN
4032: ROLLBACK TO create_geography_range;
4033: x_return_status := FND_API.G_RET_STS_ERROR;
4034: FND_MSG_PUB.Count_And_Get(
4035: p_encoded => FND_API.G_FALSE,
4036: p_count => x_msg_count,
4037: p_data => x_msg_data);
4031: WHEN FND_API.G_EXC_ERROR THEN
4032: ROLLBACK TO create_geography_range;
4033: x_return_status := FND_API.G_RET_STS_ERROR;
4034: FND_MSG_PUB.Count_And_Get(
4035: p_encoded => FND_API.G_FALSE,
4036: p_count => x_msg_count,
4037: p_data => x_msg_data);
4038: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4039: ROLLBACK TO create_geography_range;
4034: FND_MSG_PUB.Count_And_Get(
4035: p_encoded => FND_API.G_FALSE,
4036: p_count => x_msg_count,
4037: p_data => x_msg_data);
4038: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4039: ROLLBACK TO create_geography_range;
4040: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4041: FND_MSG_PUB.Count_And_Get(
4042: p_encoded => FND_API.G_FALSE,
4036: p_count => x_msg_count,
4037: p_data => x_msg_data);
4038: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4039: ROLLBACK TO create_geography_range;
4040: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4041: FND_MSG_PUB.Count_And_Get(
4042: p_encoded => FND_API.G_FALSE,
4043: p_count => x_msg_count,
4044: p_data => x_msg_data);
4038: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4039: ROLLBACK TO create_geography_range;
4040: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4041: FND_MSG_PUB.Count_And_Get(
4042: p_encoded => FND_API.G_FALSE,
4043: p_count => x_msg_count,
4044: p_data => x_msg_data);
4045:
4046: WHEN DUP_VAL_ON_INDEX THEN
4044: p_data => x_msg_data);
4045:
4046: WHEN DUP_VAL_ON_INDEX THEN
4047: ROLLBACK TO create_geography_range;
4048: x_return_status := FND_API.G_RET_STS_ERROR;
4049: HZ_UTILITY_V2PUB.find_index_name(p_index_name);
4050: IF p_index_name = 'HZ_GEOGRAPHY_RANGES_U1' THEN
4051: FND_MESSAGE.SET_NAME('AR', 'HZ_API_DUPLICATE_COLUMN');
4052: FND_MESSAGE.SET_TOKEN('COLUMN', 'geography_id,geography_from and start_date');
4052: FND_MESSAGE.SET_TOKEN('COLUMN', 'geography_id,geography_from and start_date');
4053: FND_MSG_PUB.ADD;
4054: END IF;
4055: FND_MSG_PUB.Count_And_Get(
4056: p_encoded => FND_API.G_FALSE,
4057: p_count => x_msg_count,
4058: p_data => x_msg_data);
4059:
4060: WHEN OTHERS THEN
4058: p_data => x_msg_data);
4059:
4060: WHEN OTHERS THEN
4061: ROLLBACK TO create_geography_range;
4062: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4063: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
4064: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
4065: FND_MSG_PUB.ADD;
4066: FND_MSG_PUB.Count_And_Get(
4063: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
4064: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
4065: FND_MSG_PUB.ADD;
4066: FND_MSG_PUB.Count_And_Get(
4067: p_encoded => FND_API.G_FALSE,
4068: p_count => x_msg_count,
4069: p_data => x_msg_data);
4070:
4071: END create_geography_range;
4080: *
4081: * ARGUMENTS
4082: * IN:
4083: * p_init_msg_list Initialize message stack if it is set to
4084: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
4085: * geography_id
4086: * geography_from
4087: * start_date
4088: * end_date
4091: * p_object_version_number
4092: * OUT:
4093: *
4094: * x_return_status Return status after the call. The status can
4095: * be FND_API.G_RET_STS_SUCCESS (success),
4096: * FND_API.G_RET_STS_ERROR (error),
4097: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
4098: * x_msg_count Number of messages in message stack.
4099: * x_msg_data Message text if x_msg_count is 1.
4092: * OUT:
4093: *
4094: * x_return_status Return status after the call. The status can
4095: * be FND_API.G_RET_STS_SUCCESS (success),
4096: * FND_API.G_RET_STS_ERROR (error),
4097: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
4098: * x_msg_count Number of messages in message stack.
4099: * x_msg_data Message text if x_msg_count is 1.
4100: *
4093: *
4094: * x_return_status Return status after the call. The status can
4095: * be FND_API.G_RET_STS_SUCCESS (success),
4096: * FND_API.G_RET_STS_ERROR (error),
4097: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
4098: * x_msg_count Number of messages in message stack.
4099: * x_msg_data Message text if x_msg_count is 1.
4100: *
4101: * NOTES
4104: * 01-23-2003 Rekha Nalluri o Created.
4105: *
4106: */
4107: PROCEDURE update_geography_range (
4108: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
4109: p_geography_id IN NUMBER,
4110: p_geography_from IN VARCHAR2,
4111: p_start_date IN DATE,
4112: p_end_date IN DATE,
4121: -- Standard start of API savepoint
4122: SAVEPOINT update_geography_range;
4123:
4124: -- Initialize message list if p_init_msg_list is set to TRUE.
4125: IF FND_API.to_Boolean(p_init_msg_list) THEN
4126: FND_MSG_PUB.initialize;
4127: END IF;
4128:
4129: -- Initialize API return status to success.
4126: FND_MSG_PUB.initialize;
4127: END IF;
4128:
4129: -- Initialize API return status to success.
4130: x_return_status := FND_API.G_RET_STS_SUCCESS;
4131:
4132: -- Call to business logic.
4133: do_update_geography_range(
4134: p_geography_id => p_geography_id,
4139: x_return_status => x_return_status
4140: );
4141:
4142: --if validation failed at any point, then raise an exception to stop processing
4143: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4144: RAISE FND_API.G_EXC_ERROR;
4145: END IF;
4146:
4147: -- Standard call to get message count and if count is 1, get message info.
4140: );
4141:
4142: --if validation failed at any point, then raise an exception to stop processing
4143: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4144: RAISE FND_API.G_EXC_ERROR;
4145: END IF;
4146:
4147: -- Standard call to get message count and if count is 1, get message info.
4148: FND_MSG_PUB.Count_And_Get(
4145: END IF;
4146:
4147: -- Standard call to get message count and if count is 1, get message info.
4148: FND_MSG_PUB.Count_And_Get(
4149: p_encoded => FND_API.G_FALSE,
4150: p_count => x_msg_count,
4151: p_data => x_msg_data);
4152:
4153: EXCEPTION
4150: p_count => x_msg_count,
4151: p_data => x_msg_data);
4152:
4153: EXCEPTION
4154: WHEN FND_API.G_EXC_ERROR THEN
4155: ROLLBACK TO update_geography_range;
4156: x_return_status := FND_API.G_RET_STS_ERROR;
4157: FND_MSG_PUB.Count_And_Get(
4158: p_encoded => FND_API.G_FALSE,
4152:
4153: EXCEPTION
4154: WHEN FND_API.G_EXC_ERROR THEN
4155: ROLLBACK TO update_geography_range;
4156: x_return_status := FND_API.G_RET_STS_ERROR;
4157: FND_MSG_PUB.Count_And_Get(
4158: p_encoded => FND_API.G_FALSE,
4159: p_count => x_msg_count,
4160: p_data => x_msg_data);
4154: WHEN FND_API.G_EXC_ERROR THEN
4155: ROLLBACK TO update_geography_range;
4156: x_return_status := FND_API.G_RET_STS_ERROR;
4157: FND_MSG_PUB.Count_And_Get(
4158: p_encoded => FND_API.G_FALSE,
4159: p_count => x_msg_count,
4160: p_data => x_msg_data);
4161: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4162: ROLLBACK TO update_geography_range;
4157: FND_MSG_PUB.Count_And_Get(
4158: p_encoded => FND_API.G_FALSE,
4159: p_count => x_msg_count,
4160: p_data => x_msg_data);
4161: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4162: ROLLBACK TO update_geography_range;
4163: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4164: FND_MSG_PUB.Count_And_Get(
4165: p_encoded => FND_API.G_FALSE,
4159: p_count => x_msg_count,
4160: p_data => x_msg_data);
4161: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4162: ROLLBACK TO update_geography_range;
4163: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4164: FND_MSG_PUB.Count_And_Get(
4165: p_encoded => FND_API.G_FALSE,
4166: p_count => x_msg_count,
4167: p_data => x_msg_data);
4161: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4162: ROLLBACK TO update_geography_range;
4163: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4164: FND_MSG_PUB.Count_And_Get(
4165: p_encoded => FND_API.G_FALSE,
4166: p_count => x_msg_count,
4167: p_data => x_msg_data);
4168:
4169: WHEN OTHERS THEN
4167: p_data => x_msg_data);
4168:
4169: WHEN OTHERS THEN
4170: ROLLBACK TO update_geography_range;
4171: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4172: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
4173: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
4174: FND_MSG_PUB.ADD;
4175: FND_MSG_PUB.Count_And_Get(
4172: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
4173: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
4174: FND_MSG_PUB.ADD;
4175: FND_MSG_PUB.Count_And_Get(
4176: p_encoded => FND_API.G_FALSE,
4177: p_count => x_msg_count,
4178: p_data => x_msg_data);
4179:
4180: END update_geography_range;
4189: *
4190: * ARGUMENTS
4191: * IN:
4192: * p_init_msg_list Initialize message stack if it is set to
4193: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
4194: * p_geography_id
4195: * p_zone_relation_tbl Zone relation table of records.
4196: * IN/OUT:
4197: * OUT:
4196: * IN/OUT:
4197: * OUT:
4198: *
4199: * x_return_status Return status after the call. The status can
4200: * be FND_API.G_RET_STS_SUCCESS (success),
4201: * FND_API.G_RET_STS_ERROR (error),
4202: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
4203: * x_msg_count Number of messages in message stack.
4204: * x_msg_data Message text if x_msg_count is 1.
4197: * OUT:
4198: *
4199: * x_return_status Return status after the call. The status can
4200: * be FND_API.G_RET_STS_SUCCESS (success),
4201: * FND_API.G_RET_STS_ERROR (error),
4202: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
4203: * x_msg_count Number of messages in message stack.
4204: * x_msg_data Message text if x_msg_count is 1.
4205: *
4198: *
4199: * x_return_status Return status after the call. The status can
4200: * be FND_API.G_RET_STS_SUCCESS (success),
4201: * FND_API.G_RET_STS_ERROR (error),
4202: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
4203: * x_msg_count Number of messages in message stack.
4204: * x_msg_data Message text if x_msg_count is 1.
4205: *
4206: * NOTES
4210: *
4211: */
4212:
4213: PROCEDURE create_zone_relation(
4214: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
4215: p_geography_id IN NUMBER,
4216: p_zone_relation_tbl IN ZONE_RELATION_TBL_TYPE,
4217: p_created_by_module IN VARCHAR2,
4218: p_application_id IN NUMBER,
4226: SAVEPOINT create_zone_relation;
4227: --dbms_output.put_line('In the beginning of create_zone_relation');
4228:
4229: -- Initialize message list if p_init_msg_list is set to TRUE.
4230: IF FND_API.to_Boolean(p_init_msg_list) THEN
4231: FND_MSG_PUB.initialize;
4232: END IF;
4233:
4234: -- Initialize API return status to success.
4231: FND_MSG_PUB.initialize;
4232: END IF;
4233:
4234: -- Initialize API return status to success.
4235: x_return_status := FND_API.G_RET_STS_SUCCESS;
4236:
4237: --dbms_output.put_line('before do_create_zone_relation');
4238: -- Call to business logic.
4239: do_create_zone_relation(
4244: x_return_status => x_return_status
4245: );
4246:
4247: --if validation failed at any point, then raise an exception to stop processing
4248: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4249: RAISE FND_API.G_EXC_ERROR;
4250: END IF;
4251:
4252: --dbms_output.put_line('after call to do_create '|| x_return_status);
4245: );
4246:
4247: --if validation failed at any point, then raise an exception to stop processing
4248: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4249: RAISE FND_API.G_EXC_ERROR;
4250: END IF;
4251:
4252: --dbms_output.put_line('after call to do_create '|| x_return_status);
4253:
4252: --dbms_output.put_line('after call to do_create '|| x_return_status);
4253:
4254: -- Standard call to get message count and if count is 1, get message info.
4255: FND_MSG_PUB.Count_And_Get(
4256: p_encoded => FND_API.G_FALSE,
4257: p_count => x_msg_count,
4258: p_data => x_msg_data);
4259:
4260: EXCEPTION
4257: p_count => x_msg_count,
4258: p_data => x_msg_data);
4259:
4260: EXCEPTION
4261: WHEN FND_API.G_EXC_ERROR THEN
4262: ROLLBACK TO create_zone_relation;
4263: x_return_status := FND_API.G_RET_STS_ERROR;
4264: FND_MSG_PUB.Count_And_Get(
4265: p_encoded => FND_API.G_FALSE,
4259:
4260: EXCEPTION
4261: WHEN FND_API.G_EXC_ERROR THEN
4262: ROLLBACK TO create_zone_relation;
4263: x_return_status := FND_API.G_RET_STS_ERROR;
4264: FND_MSG_PUB.Count_And_Get(
4265: p_encoded => FND_API.G_FALSE,
4266: p_count => x_msg_count,
4267: p_data => x_msg_data);
4261: WHEN FND_API.G_EXC_ERROR THEN
4262: ROLLBACK TO create_zone_relation;
4263: x_return_status := FND_API.G_RET_STS_ERROR;
4264: FND_MSG_PUB.Count_And_Get(
4265: p_encoded => FND_API.G_FALSE,
4266: p_count => x_msg_count,
4267: p_data => x_msg_data);
4268: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4269: ROLLBACK TO create_zone_relation;
4264: FND_MSG_PUB.Count_And_Get(
4265: p_encoded => FND_API.G_FALSE,
4266: p_count => x_msg_count,
4267: p_data => x_msg_data);
4268: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4269: ROLLBACK TO create_zone_relation;
4270: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4271: FND_MSG_PUB.Count_And_Get(
4272: p_encoded => FND_API.G_FALSE,
4266: p_count => x_msg_count,
4267: p_data => x_msg_data);
4268: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4269: ROLLBACK TO create_zone_relation;
4270: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4271: FND_MSG_PUB.Count_And_Get(
4272: p_encoded => FND_API.G_FALSE,
4273: p_count => x_msg_count,
4274: p_data => x_msg_data);
4268: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4269: ROLLBACK TO create_zone_relation;
4270: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4271: FND_MSG_PUB.Count_And_Get(
4272: p_encoded => FND_API.G_FALSE,
4273: p_count => x_msg_count,
4274: p_data => x_msg_data);
4275:
4276: WHEN OTHERS THEN
4274: p_data => x_msg_data);
4275:
4276: WHEN OTHERS THEN
4277: ROLLBACK TO create_zone_relation;
4278: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4279: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
4280: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
4281: FND_MSG_PUB.ADD;
4282: FND_MSG_PUB.Count_And_Get(
4279: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
4280: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
4281: FND_MSG_PUB.ADD;
4282: FND_MSG_PUB.Count_And_Get(
4283: p_encoded => FND_API.G_FALSE,
4284: p_count => x_msg_count,
4285: p_data => x_msg_data);
4286:
4287: END create_zone_relation;
4297: *
4298: * ARGUMENTS
4299: * IN:
4300: * p_init_msg_list Initialize message stack if it is set to
4301: * FND_API.G_TRUE. Default is FND_API.G_FALSE.
4302: * p_zone_type
4303: * p_zone_name
4304: * p_zone_code
4305: * p_start_date
4314: *
4315: * OUT:
4316: * x_return_status
4317: * Return status after the call. The status can
4318: * be FND_API.G_RET_STS_SUCCESS (success),
4319: * FND_API.G_RET_STS_ERROR (error),
4320: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
4321: * x_msg_count Number of messages in message stack.
4322: * x_msg_data Message text if x_msg_count is 1.
4315: * OUT:
4316: * x_return_status
4317: * Return status after the call. The status can
4318: * be FND_API.G_RET_STS_SUCCESS (success),
4319: * FND_API.G_RET_STS_ERROR (error),
4320: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
4321: * x_msg_count Number of messages in message stack.
4322: * x_msg_data Message text if x_msg_count is 1.
4323: *
4316: * x_return_status
4317: * Return status after the call. The status can
4318: * be FND_API.G_RET_STS_SUCCESS (success),
4319: * FND_API.G_RET_STS_ERROR (error),
4320: * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
4321: * x_msg_count Number of messages in message stack.
4322: * x_msg_data Message text if x_msg_count is 1.
4323: *
4324: * NOTES
4328: *
4329: */
4330:
4331: PROCEDURE create_zone(
4332: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
4333: p_zone_type IN VARCHAR2,
4334: p_zone_name IN VARCHAR2,
4335: p_zone_code IN VARCHAR2,
4336: p_zone_code_type IN VARCHAR2,
4356: SAVEPOINT create_zone;
4357: --dbms_output.put_line('In the beginning of create_zone');
4358:
4359: -- Initialize message list if p_init_msg_list is set to TRUE.
4360: IF FND_API.to_Boolean(p_init_msg_list) THEN
4361: FND_MSG_PUB.initialize;
4362: END IF;
4363:
4364: -- Initialize API return status to success.
4361: FND_MSG_PUB.initialize;
4362: END IF;
4363:
4364: -- Initialize API return status to success.
4365: x_return_status := FND_API.G_RET_STS_SUCCESS;
4366:
4367: --dbms_output.put_line('before do_create_zone');
4368: -- Call to business logic.
4369: do_create_zone (
4384: x_return_status => x_return_status
4385: );
4386:
4387: --if validation failed at any point, then raise an exception to stop processing
4388: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4389: RAISE FND_API.G_EXC_ERROR;
4390: END IF;
4391:
4392: -- Standard call to get message count and if count is 1, get message info.
4385: );
4386:
4387: --if validation failed at any point, then raise an exception to stop processing
4388: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4389: RAISE FND_API.G_EXC_ERROR;
4390: END IF;
4391:
4392: -- Standard call to get message count and if count is 1, get message info.
4393: FND_MSG_PUB.Count_And_Get(
4390: END IF;
4391:
4392: -- Standard call to get message count and if count is 1, get message info.
4393: FND_MSG_PUB.Count_And_Get(
4394: p_encoded => FND_API.G_FALSE,
4395: p_count => x_msg_count,
4396: p_data => x_msg_data);
4397:
4398: EXCEPTION
4395: p_count => x_msg_count,
4396: p_data => x_msg_data);
4397:
4398: EXCEPTION
4399: WHEN FND_API.G_EXC_ERROR THEN
4400: ROLLBACK TO create_zone;
4401: x_return_status := FND_API.G_RET_STS_ERROR;
4402: FND_MSG_PUB.Count_And_Get(
4403: p_encoded => FND_API.G_FALSE,
4397:
4398: EXCEPTION
4399: WHEN FND_API.G_EXC_ERROR THEN
4400: ROLLBACK TO create_zone;
4401: x_return_status := FND_API.G_RET_STS_ERROR;
4402: FND_MSG_PUB.Count_And_Get(
4403: p_encoded => FND_API.G_FALSE,
4404: p_count => x_msg_count,
4405: p_data => x_msg_data);
4399: WHEN FND_API.G_EXC_ERROR THEN
4400: ROLLBACK TO create_zone;
4401: x_return_status := FND_API.G_RET_STS_ERROR;
4402: FND_MSG_PUB.Count_And_Get(
4403: p_encoded => FND_API.G_FALSE,
4404: p_count => x_msg_count,
4405: p_data => x_msg_data);
4406: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4407: ROLLBACK TO create_zone;
4402: FND_MSG_PUB.Count_And_Get(
4403: p_encoded => FND_API.G_FALSE,
4404: p_count => x_msg_count,
4405: p_data => x_msg_data);
4406: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4407: ROLLBACK TO create_zone;
4408: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4409: FND_MSG_PUB.Count_And_Get(
4410: p_encoded => FND_API.G_FALSE,
4404: p_count => x_msg_count,
4405: p_data => x_msg_data);
4406: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4407: ROLLBACK TO create_zone;
4408: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4409: FND_MSG_PUB.Count_And_Get(
4410: p_encoded => FND_API.G_FALSE,
4411: p_count => x_msg_count,
4412: p_data => x_msg_data);
4406: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4407: ROLLBACK TO create_zone;
4408: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4409: FND_MSG_PUB.Count_And_Get(
4410: p_encoded => FND_API.G_FALSE,
4411: p_count => x_msg_count,
4412: p_data => x_msg_data);
4413:
4414: WHEN OTHERS THEN
4412: p_data => x_msg_data);
4413:
4414: WHEN OTHERS THEN
4415: ROLLBACK TO create_zone;
4416: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4417: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
4418: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
4419: FND_MSG_PUB.ADD;
4420: FND_MSG_PUB.Count_And_Get(
4417: FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
4418: FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
4419: FND_MSG_PUB.ADD;
4420: FND_MSG_PUB.Count_And_Get(
4421: p_encoded => FND_API.G_FALSE,
4422: p_count => x_msg_count,
4423: p_data => x_msg_data);
4424: END create_zone;
4425: