99: x_return_status := FND_API.G_RET_STS_SUCCESS;
100:
101: -- Checking to see if the OM message stack needs to be initialized
102: IF p_control_rec.p_init_msg_list THEN
103: oe_msg_pub.initialize;
104: END IF;
105:
106: IF l_debug_level > 0 THEN
107: oe_debug_pub.add( ' ==== Entering Create Account Layer ====');
197: ,x_msg_count => x_msg_count
198: ,x_msg_data => x_msg_data);
199:
200: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
201: OE_MSG_PUB.Count_And_Get
202: ( p_count => x_msg_count
203: , p_data => x_msg_data
204: );
205: IF l_debug_level > 0 THEN
327: oe_debug_pub.add( '=== ...done calling check_and_create_account' ) ;
328: END IF;
329:
330: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
331: OE_MSG_PUB.Count_And_Get
332: ( p_count => x_msg_count
333: , p_data => x_msg_data
334: );
335: IF l_debug_level > 0 THEN
396: IF l_debug_level > 0 THEN
397: oe_debug_pub.add( 'account is not active' ) ;
398: END IF;
399: FND_MESSAGE.Set_Name('ONT','ONT_AAC_INACTIVE_ACCOUNT');
400: OE_MSG_PUB.ADD;
401: CLOSE c_check_account;
402: OE_MSG_PUB.Count_And_Get
403: ( p_count => x_msg_count
404: , p_data => x_msg_data
398: END IF;
399: FND_MESSAGE.Set_Name('ONT','ONT_AAC_INACTIVE_ACCOUNT');
400: OE_MSG_PUB.ADD;
401: CLOSE c_check_account;
402: OE_MSG_PUB.Count_And_Get
403: ( p_count => x_msg_count
404: , p_data => x_msg_data
405: );
406: return;
416: IF l_debug_level > 0 THEN
417: oe_debug_pub.add( 'invalid account.no such account_id ' ) ;
418: END IF;
419: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_ACCOUNT');
420: OE_MSG_PUB.ADD;
421: CLOSE c_check_account;
422: OE_MSG_PUB.Count_And_Get
423: ( p_count => x_msg_count
424: , p_data => x_msg_data
418: END IF;
419: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_ACCOUNT');
420: OE_MSG_PUB.ADD;
421: CLOSE c_check_account;
422: OE_MSG_PUB.Count_And_Get
423: ( p_count => x_msg_count
424: , p_data => x_msg_data
425: );
426: return;
443: oe_debug_pub.add( 'invalid customer account number:'||p_party_customer_rec.p_cust_account_Number ) ;
444: END IF;
445: x_return_status := FND_API.G_RET_STS_ERROR;
446: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_ACCOUNT');
447: OE_MSG_PUB.ADD;
448: CLOSE c_get_cust_account_id;
449: OE_MSG_PUB.Count_And_Get
450: ( p_count => x_msg_count
451: , p_data => x_msg_data
445: x_return_status := FND_API.G_RET_STS_ERROR;
446: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_ACCOUNT');
447: OE_MSG_PUB.ADD;
448: CLOSE c_get_cust_account_id;
449: OE_MSG_PUB.Count_And_Get
450: ( p_count => x_msg_count
451: , p_data => x_msg_data
452: );
453: return;
457: IF l_debug_level > 0 THEN
458: oe_debug_pub.add( 'account for account number is not active' ) ;
459: END IF;
460: FND_MESSAGE.Set_Name('ONT','ONT_AAC_INACTIVE_ACCOUNT');
461: OE_MSG_PUB.ADD;
462: CLOSE c_get_cust_account_id;
463: OE_MSG_PUB.Count_And_Get
464: ( p_count => x_msg_count
465: , p_data => x_msg_data
459: END IF;
460: FND_MESSAGE.Set_Name('ONT','ONT_AAC_INACTIVE_ACCOUNT');
461: OE_MSG_PUB.ADD;
462: CLOSE c_get_cust_account_id;
463: OE_MSG_PUB.Count_And_Get
464: ( p_count => x_msg_count
465: , p_data => x_msg_data
466: );
467: return;
483: IF l_debug_level > 0 THEN
484: oe_debug_pub.add( 'INVALID CUSTOMER ACCOUNT ID' ) ;
485: END IF;
486: CLOSE c_cust_account_id;
487: OE_MSG_PUB.Count_And_Get
488: ( p_count => x_msg_count
489: , p_data => x_msg_data
490: );
491: return;
662:
663: if (l_rc_matched = FALSE ) then
664: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
665: FND_MESSAGE.Set_Token('TEXT',' Customer Relationship is not allowed. SoldTo and Site Level Customer should be same');
666: OE_MSG_PUB.ADD;
667: oe_debug_pub.add('AAC:RC: ERROR: Customers are different');
668: x_return_status := FND_API.G_RET_STS_ERROR;
669: return;
670: END IF;
716:
717: x_return_status := FND_API.G_RET_STS_ERROR;
718: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
719: FND_MESSAGE.Set_Token('TEXT',' Customer Relationship creation failed. ', FALSE);
720: OE_MSG_PUB.ADD;
721: OE_MSG_PUB.Count_And_Get ( p_count => x_msg_count , p_data => x_msg_data );
722: return;
723: END IF; -- if failure
724: oe_debug_pub.add('AAC:RC: relationship created');
717: x_return_status := FND_API.G_RET_STS_ERROR;
718: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
719: FND_MESSAGE.Set_Token('TEXT',' Customer Relationship creation failed. ', FALSE);
720: OE_MSG_PUB.ADD;
721: OE_MSG_PUB.Count_And_Get ( p_count => x_msg_count , p_data => x_msg_data );
722: return;
723: END IF; -- if failure
724: oe_debug_pub.add('AAC:RC: relationship created');
725: else -- l_add_customer = 'N'
728: oe_debug_pub.add('AAC:RC: ERROR: l_add_customer is N' );
729: END IF;
730: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
731: FND_MESSAGE.Set_Token('TEXT',' Customer Relationship not defined. No permission to create relationship. ', FALSE);
732: OE_MSG_PUB.ADD;
733: OE_MSG_PUB.Count_And_Get ( p_count => x_msg_count , p_data => x_msg_data );
734: return;
735: end if; -- l_add_customer end
736: end if; -- found_relationship
729: END IF;
730: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
731: FND_MESSAGE.Set_Token('TEXT',' Customer Relationship not defined. No permission to create relationship. ', FALSE);
732: OE_MSG_PUB.ADD;
733: OE_MSG_PUB.Count_And_Get ( p_count => x_msg_count , p_data => x_msg_data );
734: return;
735: end if; -- l_add_customer end
736: end if; -- found_relationship
737: else -- l_rc_matched = TRUE
826: END IF;
827: l_contact_status := FND_API.G_RET_STS_ERROR;
828: x_msg_data_contact := x_msg_data;
829: x_msg_count_contact := x_msg_count;
830: --OE_MSG_PUB.Count_And_Get
831: --( p_count => x_msg_count
832: --, p_data => x_msg_data
833: --);
834: --return;
1062: if l_debug_level > 0 then
1063: oe_debug_pub.add( 'not commiting the txn' ) ;
1064: END IF;
1065: l_site_failed := TRUE;
1066: OE_MSG_PUB.Count_And_Get
1067: ( p_count => x_msg_count
1068: , p_data => x_msg_data
1069: );
1070:
1113: x_return_status := FND_API.G_RET_STS_ERROR;
1114:
1115: -- Get message count and data
1116:
1117: OE_MSG_PUB.Count_And_Get
1118: ( p_count => x_msg_count
1119: , p_data => x_msg_data
1120: );
1121:
1132: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1133:
1134: -- Get message count and data
1135:
1136: OE_MSG_PUB.Count_And_Get
1137: ( p_count => x_msg_count
1138: , p_data => x_msg_data
1139: );
1140:
1152: IF l_debug_level > 0 THEN
1153: oe_debug_pub.add( 'CREATE_ACCOUNT_LAYER WHEN OTHER EXCEPTION CODE='|| SQLCODE||' MESSAGE='||SQLERRM ) ;
1154: END IF;
1155:
1156: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1157: THEN
1158: OE_MSG_PUB.Add_Exc_Msg
1159: ( G_PKG_NAME
1160: , 'create_account_layer'
1154: END IF;
1155:
1156: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1157: THEN
1158: OE_MSG_PUB.Add_Exc_Msg
1159: ( G_PKG_NAME
1160: , 'create_account_layer'
1161: );
1162: END IF;
1162: END IF;
1163:
1164: -- Get message count and data
1165:
1166: OE_MSG_PUB.Count_And_Get
1167: ( p_count => x_msg_count
1168: , p_data => x_msg_data
1169: );
1170:
1400: END IF;
1401: FND_MESSAGE.Set_Name('ONT','ONT_AAC_ERROR');
1402:
1403: FND_MESSAGE.Set_Token('TEXT','Usage of Account Site should be specified', FALSE);
1404: OE_MSG_PUB.ADD;
1405: IF p_continue_on_error THEN
1406: null;
1407: ELSE
1408: OE_MSG_PUB.Count_And_Get
1404: OE_MSG_PUB.ADD;
1405: IF p_continue_on_error THEN
1406: null;
1407: ELSE
1408: OE_MSG_PUB.Count_And_Get
1409: ( p_count => x_msg_count
1410: , p_data => x_msg_data
1411: );
1412: return;
1473: IF l_debug_level > 0 THEN
1474: oe_debug_pub.add( 'account site use is inactive' ) ;
1475: END IF;
1476: FND_MESSAGE.Set_Name('ONT','ONT_AAC_SHIPTO_INACTIVE');
1477: OE_MSG_PUB.ADD;
1478: end if;
1479: /* IF l_cust_account_id <> px_cust_account_id then
1480: x_return_status := FND_API.G_RET_STS_ERROR;
1481: l_return_status := FND_API.G_RET_STS_ERROR;
1482: IF l_debug_level > 0 THEN
1483: oe_debug_pub.add( 'site does not belong to this account, or site account' ) ;
1484: END IF;
1485: FND_MESSAGE.Set_Name('ONT','ONT_AAC_SHIPTO_ACCOUNT');
1486: OE_MSG_PUB.ADD;
1487: End if; */
1488: goto end_customer_found;
1489: Else
1490: close c_site_use;
1508: IF l_debug_level > 0 THEN
1509: oe_debug_pub.add( 'account site use is inactive' ) ;
1510: END IF;
1511: FND_MESSAGE.Set_Name('ONT','ONT_AAC_BILLTO_INACTIVE');
1512: OE_MSG_PUB.ADD;
1513: end if;
1514: /* IF l_cust_account_id <> px_cust_account_id then
1515: x_return_status := FND_API.G_RET_STS_ERROR;
1516: l_return_status := FND_API.G_RET_STS_ERROR;
1517: IF l_debug_level > 0 THEN
1518: oe_debug_pub.add( 'site does not belong to this account, or site account' ) ;
1519: END IF;
1520: FND_MESSAGE.Set_Name('ONT','ONT_AAC_BILLTO_ACCOUNT');
1521: OE_MSG_PUB.ADD;
1522: End if;*/
1523: goto end_customer_found;
1524: Else -- not invoice to
1525: close c_site_use;
1543: IF l_debug_level > 0 THEN
1544: oe_debug_pub.add( 'account site use is inactive' ) ;
1545: END IF;
1546: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_INACTIVE');
1547: OE_MSG_PUB.ADD;
1548: end if;
1549: /* IF l_cust_account_id <> px_cust_account_id then
1550: x_return_status := FND_API.G_RET_STS_ERROR;
1551: l_return_status := FND_API.G_RET_STS_ERROR;
1552: IF l_debug_level > 0 THEN
1553: oe_debug_pub.add( 'site does not belong to this account, or site account' ) ;
1554: END IF;
1555: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_ACCOUNT');
1556: OE_MSG_PUB.ADD;
1557: End if; */
1558: goto end_customer_found;
1559: else
1560: close c_site_use;
1594: ELSIF l_site_use_code = 'DELIVER_TO' then
1595: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_INACTIVE');
1596: END IF;
1597:
1598: OE_MSG_PUB.ADD;
1599: END IF;
1600:
1601: oe_debug_pub.add( 'px_accoun_id:'||px_cust_account_id||'l_accoun_id:'||l_cust_account_id ) ;
1602: /* IF l_cust_account_id <> px_cust_account_id then
1613: ELSIF l_site_use_code = 'DELIVER_TO' then
1614: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_ACCOUNT');
1615: END IF;
1616:
1617: OE_MSG_PUB.ADD;
1618: END IF;
1619: */
1620:
1621: p_site_tbl(i).p_cust_acct_site_id := l_cust_acct_site_id;
1634: ELSIF l_site_use_code = 'DELIVER_TO' then
1635: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_DELIVERTO');
1636: END IF;
1637:
1638: OE_MSG_PUB.ADD;
1639:
1640: END IF; -- if cursor found
1641: CLOSE c_site_use;
1642: END IF; -- site_ use_code (bug 4240715)
1734: ELSIF l_site_use_code = 'DELIVER_TO' then
1735: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_DELIVERTO');
1736: END IF;
1737:
1738: OE_MSG_PUB.ADD;
1739: IF p_continue_on_error THEN
1740: null;
1741: ELSE
1742: OE_MSG_PUB.Count_And_Get
1738: OE_MSG_PUB.ADD;
1739: IF p_continue_on_error THEN
1740: null;
1741: ELSE
1742: OE_MSG_PUB.Count_And_Get
1743: ( p_count => x_msg_count
1744: , p_data => x_msg_data
1745: );
1746: return;
1764: ELSIF l_site_use_code = 'DELIVER_TO' then
1765: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_INACTIVE');
1766: END IF;
1767:
1768: OE_MSG_PUB.ADD;
1769: IF l_debug_level > 0 THEN
1770: oe_debug_pub.add( 'party site is not active' ) ;
1771: END IF;
1772: CLOSE c_party_site;
1772: CLOSE c_party_site;
1773: IF p_continue_on_error THEN
1774: null;
1775: ELSE
1776: OE_MSG_PUB.Count_And_Get
1777: ( p_count => x_msg_count
1778: , p_data => x_msg_data
1779: );
1780: return;
1795: ELSIF l_site_use_code = 'DELIVER_TO' then
1796: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_ACCOUNT');
1797: END IF;
1798:
1799: OE_MSG_PUB.ADD;
1800: IF l_debug_level > 0 THEN
1801: oe_debug_pub.add( 'party site does not belong to the party' ) ;
1802: END IF;
1803:
1804: CLOSE c_party_site;
1805: IF p_continue_on_error THEN
1806: null;
1807: ELSE
1808: OE_MSG_PUB.Count_And_Get
1809: ( p_count => x_msg_count
1810: , p_data => x_msg_data
1811: );
1812: return;
1825: x_return_status := FND_API.G_RET_STS_ERROR;
1826: l_return_status := FND_API.G_RET_STS_ERROR;
1827: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
1828: FND_MESSAGE.Set_Token('TEXT','Not a Valid Account Site ', FALSE);
1829: OE_MSG_PUB.ADD;
1830: IF l_debug_level > 0 THEN
1831: oe_debug_pub.add( 'no site information is sent ' ) ;
1832: END IF;
1833: IF p_continue_on_error THEN
1832: END IF;
1833: IF p_continue_on_error THEN
1834: null;
1835: ELSE
1836: OE_MSG_PUB.Count_And_Get
1837: ( p_count => x_msg_count
1838: , p_data => x_msg_data
1839: );
1840: return;
1879: ELSIF l_site_use_code = 'DELIVER_TO' then
1880: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_DELIVERTO');
1881: END IF;
1882:
1883: OE_MSG_PUB.ADD;
1884: CLOSE c_party_site_use;
1885:
1886: IF p_continue_on_error THEN
1887: null;
1885:
1886: IF p_continue_on_error THEN
1887: null;
1888: ELSE
1889: OE_MSG_PUB.Count_And_Get
1890: ( p_count => x_msg_count
1891: , p_data => x_msg_data
1892: );
1893: return;
1938: ELSIF l_site_use_code = 'DELIVER_TO' then
1939: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_DELIVERTO');
1940: END IF;
1941:
1942: OE_MSG_PUB.ADD;
1943: IF p_continue_on_error THEN
1944: null;
1945: ELSE
1946: OE_MSG_PUB.Count_And_Get
1942: OE_MSG_PUB.ADD;
1943: IF p_continue_on_error THEN
1944: null;
1945: ELSE
1946: OE_MSG_PUB.Count_And_Get
1947: ( p_count => x_msg_count
1948: , p_data => x_msg_data
1949: );
1950: return;
1966: ELSIF l_site_use_code = 'DELIVER_TO' then
1967: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_INACTIVE');
1968: END IF;
1969:
1970: OE_MSG_PUB.ADD;
1971: IF l_debug_level > 0 THEN
1972: oe_debug_pub.add( 'party site is not active' ) ;
1973: END IF;
1974: CLOSE c_party_site;
1974: CLOSE c_party_site;
1975: IF p_continue_on_error THEN
1976: null;
1977: ELSE
1978: OE_MSG_PUB.Count_And_Get
1979: ( p_count => x_msg_count
1980: , p_data => x_msg_data
1981: );
1982: return;
1997: ELSIF l_site_use_code = 'DELIVER_TO' then
1998: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_ACCOUNT');
1999: END IF;
2000:
2001: OE_MSG_PUB.ADD;
2002: IF l_debug_level > 0 THEN
2003: oe_debug_pub.add( 'party site does not belong to the party' ) ;
2004: END IF;
2005: CLOSE c_party_site;
2005: CLOSE c_party_site;
2006: IF p_continue_on_error THEN
2007: null;
2008: ELSE
2009: OE_MSG_PUB.Count_And_Get
2010: ( p_count => x_msg_count
2011: , p_data => x_msg_data
2012: );
2013: return;
2026: x_return_status := FND_API.G_RET_STS_ERROR;
2027: l_return_status := FND_API.G_RET_STS_ERROR;
2028: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
2029: FND_MESSAGE.Set_Token('TEXT','Not a Valid Account Site ', FALSE);
2030: OE_MSG_PUB.ADD;
2031: IF l_debug_level > 0 THEN
2032: oe_debug_pub.add( 'no site information is sent ' ) ;
2033: END IF;
2034: IF p_continue_on_error THEN
2033: END IF;
2034: IF p_continue_on_error THEN
2035: null;
2036: ELSE
2037: OE_MSG_PUB.Count_And_Get
2038: ( p_count => x_msg_count
2039: , p_data => x_msg_data
2040: );
2041: return;
2198: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_SITE_CREATION');
2199: END IF;
2200:
2201: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
2202: OE_MSG_PUB.ADD;
2203: ELSE
2204: oe_msg_pub.transfer_msg_stack;
2205: END IF;
2206:
2200:
2201: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
2202: OE_MSG_PUB.ADD;
2203: ELSE
2204: oe_msg_pub.transfer_msg_stack;
2205: END IF;
2206:
2207: IF p_continue_on_error THEN
2208: null;
2213: ELSE
2214: x_return_status := FND_API.G_RET_STS_ERROR;
2215: l_return_status := FND_API.G_RET_STS_ERROR;
2216: FND_MESSAGE.Set_Name('ONT','ONT_AAC_SITE_PERMISSION');
2217: OE_MSG_PUB.ADD;
2218: IF l_debug_level > 0 THEN
2219: oe_debug_pub.add( ' not authorized to create site' ) ;
2220: END IF;
2221: CLOSE c_acct_site;
2287: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_SITE_CREATION');
2288: END IF;
2289:
2290: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
2291: OE_MSG_PUB.ADD;
2292: ELSE
2293: oe_msg_pub.transfer_msg_stack;
2294: END IF;
2295: IF p_continue_on_error THEN
2289:
2290: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
2291: OE_MSG_PUB.ADD;
2292: ELSE
2293: oe_msg_pub.transfer_msg_stack;
2294: END IF;
2295: IF p_continue_on_error THEN
2296: null;
2297: ELSE
2362: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVERTO_SITE_CREATION');
2363: END IF;
2364:
2365: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
2366: OE_MSG_PUB.ADD;
2367: ELSE
2368: IF l_debug_level > 0 THEN
2369: oe_debug_pub.add( ' transferring to message stack' ) ;
2370: END IF;
2367: ELSE
2368: IF l_debug_level > 0 THEN
2369: oe_debug_pub.add( ' transferring to message stack' ) ;
2370: END IF;
2371: oe_msg_pub.transfer_msg_stack;
2372: END IF;
2373: IF p_continue_on_error THEN
2374: null;
2375: ELSE
2384:
2385: x_return_status := FND_API.G_RET_STS_ERROR;
2386: l_return_status := FND_API.G_RET_STS_ERROR;
2387: FND_MESSAGE.Set_Name('ONT','ONT_AAC_SITE_PERMISSION');
2388: OE_MSG_PUB.ADD;
2389: IF l_debug_level > 0 THEN
2390: oe_debug_pub.add( '2 not allowed to create site' ) ;
2391: END IF;
2392: CLOSE c_acct_site;
2509: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVER_SITE_CREATION');
2510: END IF;
2511:
2512: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
2513: OE_MSG_PUB.ADD;
2514: ELSE
2515: oe_msg_pub.transfer_msg_stack;
2516: END IF;
2517:
2511:
2512: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
2513: OE_MSG_PUB.ADD;
2514: ELSE
2515: oe_msg_pub.transfer_msg_stack;
2516: END IF;
2517:
2518: IF p_continue_on_error THEN
2519: null;
2524: ELSE
2525: x_return_status := FND_API.G_RET_STS_ERROR;
2526: l_return_status := FND_API.G_RET_STS_ERROR;
2527: FND_MESSAGE.Set_Name('ONT','ONT_AAC_SITE_PERMISSION');
2528: OE_MSG_PUB.ADD;
2529: IF l_debug_level > 0 THEN
2530: oe_debug_pub.add( ' not authorized to create site' ) ;
2531: END IF;
2532: CLOSE c_acct_site;
2598: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVER_SITE_CREATION');
2599: END IF;
2600:
2601: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
2602: OE_MSG_PUB.ADD;
2603: ELSE
2604: oe_msg_pub.transfer_msg_stack;
2605: END IF;
2606: IF p_continue_on_error THEN
2600:
2601: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
2602: OE_MSG_PUB.ADD;
2603: ELSE
2604: oe_msg_pub.transfer_msg_stack;
2605: END IF;
2606: IF p_continue_on_error THEN
2607: null;
2608: ELSE
2673: FND_MESSAGE.Set_Name('ONT','ONT_AAC_DELIVER_SITE_CREATION');
2674: END IF;
2675:
2676: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
2677: OE_MSG_PUB.ADD;
2678: ELSE
2679: IF l_debug_level > 0 THEN
2680: oe_debug_pub.add( ' transferring to message stack' ) ;
2681: END IF;
2678: ELSE
2679: IF l_debug_level > 0 THEN
2680: oe_debug_pub.add( ' transferring to message stack' ) ;
2681: END IF;
2682: oe_msg_pub.transfer_msg_stack;
2683: END IF;
2684: IF p_continue_on_error THEN
2685: null;
2686: ELSE
2695:
2696: x_return_status := FND_API.G_RET_STS_ERROR;
2697: l_return_status := FND_API.G_RET_STS_ERROR;
2698: FND_MESSAGE.Set_Name('ONT','ONT_AAC_SITE_PERMISSION');
2699: OE_MSG_PUB.ADD;
2700: IF l_debug_level > 0 THEN
2701: oe_debug_pub.add( '2 not allowed to create site' ) ;
2702: END IF;
2703: CLOSE c_acct_site;
2766: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
2767: IF l_debug_level > 0 THEN
2768: oe_debug_pub.add( ' doing count and get for site' ) ;
2769: END IF;
2770: OE_MSG_PUB.Count_And_Get
2771: ( p_count => x_msg_count
2772: , p_data => x_msg_data
2773: );
2774: END IF;
2792: x_return_status := FND_API.G_RET_STS_ERROR;
2793:
2794: -- Get message count and data
2795:
2796: OE_MSG_PUB.Count_And_Get
2797: ( p_count => x_msg_count
2798: , p_data => x_msg_data
2799: );
2800:
2813: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2814:
2815: -- Get message count and data
2816:
2817: OE_MSG_PUB.Count_And_Get
2818: ( p_count => x_msg_count
2819: , p_data => x_msg_data
2820: );
2821:
2835: IF l_debug_level > 0 THEN
2836: oe_debug_pub.add( 'check_and_create_site when other code = '|| sqlcode||' message = '||sqlerrm ) ;
2837: END IF;
2838:
2839: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2840: THEN
2841: OE_MSG_PUB.Add_Exc_Msg
2842: ( G_PKG_NAME
2843: , 'Check_and_create_sites'
2837: END IF;
2838:
2839: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2840: THEN
2841: OE_MSG_PUB.Add_Exc_Msg
2842: ( G_PKG_NAME
2843: , 'Check_and_create_sites'
2844: );
2845: END IF;
2845: END IF;
2846:
2847: -- Get message count and data
2848:
2849: OE_MSG_PUB.Count_And_Get
2850: ( p_count => x_msg_count
2851: , p_data => x_msg_data
2852: );
2853:
3045: IF l_debug_level > 0 THEN
3046: oe_debug_pub.add( l_indent|| 'not a valid cust account role id' ) ;
3047: END IF;
3048: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_NO_CONTACT');
3049: OE_MSG_PUB.ADD;
3050:
3051: CLOSE c_get_cust_id;
3052: OE_MSG_PUB.Count_And_Get
3053: ( p_count => x_msg_count
3048: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_NO_CONTACT');
3049: OE_MSG_PUB.ADD;
3050:
3051: CLOSE c_get_cust_id;
3052: OE_MSG_PUB.Count_And_Get
3053: ( p_count => x_msg_count
3054: , p_data => x_msg_data
3055: );
3056:
3180: IF l_debug_level > 0 THEN
3181: oe_debug_pub.add(l_indent|| '2 contact_id not found' ) ;
3182: END IF;
3183: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_NO_CONTACT');
3184: OE_MSG_PUB.ADD;
3185: OE_MSG_PUB.Count_And_Get
3186: ( p_count => x_msg_count
3187: , p_data => x_msg_data
3188: );
3181: oe_debug_pub.add(l_indent|| '2 contact_id not found' ) ;
3182: END IF;
3183: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_NO_CONTACT');
3184: OE_MSG_PUB.ADD;
3185: OE_MSG_PUB.Count_And_Get
3186: ( p_count => x_msg_count
3187: , p_data => x_msg_data
3188: );
3189: return;
3196: END IF;
3197: CLOSE c_cust_account_role;
3198: x_return_status := FND_API.G_RET_STS_ERROR;
3199: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INACTIVE_CONTACT');
3200: OE_MSG_PUB.ADD;
3201: OE_MSG_PUB.Count_And_Get
3202: ( p_count => x_msg_count
3203: , p_data => x_msg_data
3204: );
3197: CLOSE c_cust_account_role;
3198: x_return_status := FND_API.G_RET_STS_ERROR;
3199: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INACTIVE_CONTACT');
3200: OE_MSG_PUB.ADD;
3201: OE_MSG_PUB.Count_And_Get
3202: ( p_count => x_msg_count
3203: , p_data => x_msg_data
3204: );
3205: return;
3212: END IF;
3213: CLOSE c_cust_account_role;
3214: x_return_status := FND_API.G_RET_STS_ERROR;
3215: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_ROLE_CONTACT');
3216: OE_MSG_PUB.ADD;
3217: OE_MSG_PUB.Count_And_Get
3218: ( p_count => x_msg_count
3219: , p_data => x_msg_data
3220: );
3213: CLOSE c_cust_account_role;
3214: x_return_status := FND_API.G_RET_STS_ERROR;
3215: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_ROLE_CONTACT');
3216: OE_MSG_PUB.ADD;
3217: OE_MSG_PUB.Count_And_Get
3218: ( p_count => x_msg_count
3219: , p_data => x_msg_data
3220: );
3221: return;
3229: END IF;
3230: CLOSE c_cust_account_role;
3231: x_return_status := FND_API.G_RET_STS_ERROR;
3232: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_CONTACT_ACCOUNT');
3233: OE_MSG_PUB.ADD;
3234: OE_MSG_PUB.Count_And_Get
3235: ( p_count => x_msg_count
3236: , p_data => x_msg_data
3237: );
3230: CLOSE c_cust_account_role;
3231: x_return_status := FND_API.G_RET_STS_ERROR;
3232: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_CONTACT_ACCOUNT');
3233: OE_MSG_PUB.ADD;
3234: OE_MSG_PUB.Count_And_Get
3235: ( p_count => x_msg_count
3236: , p_data => x_msg_data
3237: );
3238: return;
3271: END IF;
3272: x_return_status := FND_API.G_RET_STS_ERROR;
3273: CLOSE c_check_org_contact;
3274: FND_MESSAGE.Set_Name('ONT','ONT_AAC_CONTACT_ACCOUNT');
3275: OE_MSG_PUB.ADD;
3276: OE_MSG_PUB.Count_And_Get
3277: ( p_count => x_msg_count
3278: , p_data => x_msg_data
3279: );
3272: x_return_status := FND_API.G_RET_STS_ERROR;
3273: CLOSE c_check_org_contact;
3274: FND_MESSAGE.Set_Name('ONT','ONT_AAC_CONTACT_ACCOUNT');
3275: OE_MSG_PUB.ADD;
3276: OE_MSG_PUB.Count_And_Get
3277: ( p_count => x_msg_count
3278: , p_data => x_msg_data
3279: );
3280: IF l_debug_level > 0 THEN
3323: END IF;
3324: x_return_status := FND_API.G_RET_STS_ERROR;
3325: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
3326: FND_MESSAGE.Set_Token('TEXT',' Multiple Contacts ', FALSE);
3327: OE_MSG_PUB.ADD;
3328: OE_MSG_PUB.Count_And_Get
3329: ( p_count => x_msg_count
3330: , p_data => x_msg_data
3331: );
3324: x_return_status := FND_API.G_RET_STS_ERROR;
3325: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
3326: FND_MESSAGE.Set_Token('TEXT',' Multiple Contacts ', FALSE);
3327: OE_MSG_PUB.ADD;
3328: OE_MSG_PUB.Count_And_Get
3329: ( p_count => x_msg_count
3330: , p_data => x_msg_data
3331: );
3332: return;
3417:
3418: IF x_msg_count = 1 then
3419: FND_MESSAGE.Set_Name('ONT','ONT_AAC_CONTACT_CREATION');
3420: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
3421: OE_MSG_PUB.ADD;
3422: ELSE
3423: oe_msg_pub.transfer_msg_stack;
3424: END IF;
3425:
3419: FND_MESSAGE.Set_Name('ONT','ONT_AAC_CONTACT_CREATION');
3420: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
3421: OE_MSG_PUB.ADD;
3422: ELSE
3423: oe_msg_pub.transfer_msg_stack;
3424: END IF;
3425:
3426: OE_MSG_PUB.Count_And_Get
3427: ( p_count => x_msg_count
3422: ELSE
3423: oe_msg_pub.transfer_msg_stack;
3424: END IF;
3425:
3426: OE_MSG_PUB.Count_And_Get
3427: ( p_count => x_msg_count
3428: , p_data => x_msg_data
3429: );
3430: return;
3440: IF l_debug_level > 0 THEN
3441: oe_debug_pub.add( l_indent|| 'not allowed to create contact' ) ;
3442: end IF;
3443: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_CONTACT_PERMISSION');
3444: OE_MSG_PUB.ADD;
3445: OE_MSG_PUB.Count_And_Get
3446: ( p_count => x_msg_count
3447: , p_data => x_msg_data
3448: );
3441: oe_debug_pub.add( l_indent|| 'not allowed to create contact' ) ;
3442: end IF;
3443: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_CONTACT_PERMISSION');
3444: OE_MSG_PUB.ADD;
3445: OE_MSG_PUB.Count_And_Get
3446: ( p_count => x_msg_count
3447: , p_data => x_msg_data
3448: );
3449: return;
3506: x_return_status := FND_API.G_RET_STS_ERROR;
3507:
3508: -- Get message count and data
3509:
3510: OE_MSG_PUB.Count_And_Get
3511: ( p_count => x_msg_count
3512: , p_data => x_msg_data
3513: );
3514:
3517: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3518:
3519: -- Get message count and data
3520:
3521: OE_MSG_PUB.Count_And_Get
3522: ( p_count => x_msg_count
3523: , p_data => x_msg_data
3524: );
3525:
3529: IF l_debug_level > 0 THEN
3530: oe_debug_pub.add( 'CHECK_CONTACT WHEN OTHER EXCEPTION CODE='|| SQLCODE||' MESSAGE='||SQLERRM ) ;
3531: END IF;
3532:
3533: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
3534: THEN
3535: OE_MSG_PUB.Add_Exc_Msg
3536: ( G_PKG_NAME
3537: , 'check_and_create_contact'
3531: END IF;
3532:
3533: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
3534: THEN
3535: OE_MSG_PUB.Add_Exc_Msg
3536: ( G_PKG_NAME
3537: , 'check_and_create_contact'
3538: );
3539: END IF;
3539: END IF;
3540:
3541: -- Get message count and data
3542:
3543: OE_MSG_PUB.Count_And_Get
3544: ( p_count => x_msg_count
3545: , p_data => x_msg_data
3546: );
3547:
3653: oe_debug_pub.add(l_indent|| 'no such party found for party_number' ) ;
3654: END IF;
3655: CLOSE party_number_rec;
3656: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_PARTY');
3657: OE_MSG_PUB.ADD;
3658: return;
3659: END IF;
3660:
3661: CLOSE party_number_rec;
3670: IF l_debug_level > 0 THEN
3671: oe_debug_pub.add(l_indent|| 'no such party found for party_id' ) ;
3672: END IF;
3673: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_PARTY');
3674: OE_MSG_PUB.ADD;
3675: CLOSE party_rec;
3676: return;
3677: END IF;
3678:
3717: END IF;
3718: x_return_status := FND_API.G_RET_STS_ERROR;
3719: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
3720: FND_MESSAGE.Set_Token('TEXT','Multiple Accounts Exist', FALSE);
3721: OE_MSG_PUB.ADD;
3722: EXIT;
3723: END IF;
3724: end if;
3725: IF l_debug_level > 0 THEN
3752: IF l_debug_level > 0 THEN
3753: oe_debug_pub.add(l_indent|| ' invalid party type' ) ;
3754: end IF;
3755: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_PARTY');
3756: OE_MSG_PUB.ADD;
3757:
3758: END IF; -- party_type
3759:
3760: IF p_account_tbl.COUNT > 0 then
3872: END IF;
3873: IF x_msg_count = 1 then
3874: FND_MESSAGE.Set_Name('ONT','ONT_AAC_ACCOUNT_CREATION');
3875: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
3876: OE_MSG_PUB.ADD;
3877: ELSE
3878: oe_msg_pub.transfer_msg_stack;
3879: END IF;
3880:
3874: FND_MESSAGE.Set_Name('ONT','ONT_AAC_ACCOUNT_CREATION');
3875: FND_MESSAGE.Set_Token('TCA_MESSAGE',x_msg_data, FALSE);
3876: OE_MSG_PUB.ADD;
3877: ELSE
3878: oe_msg_pub.transfer_msg_stack;
3879: END IF;
3880:
3881: END IF;
3882: p_account_tbl(1):= x_cust_account_id;
3903: IF l_debug_level > 0 THEN
3904: oe_debug_pub.add(l_indent|| 'not allowed to create account' ) ;
3905: END IF;
3906: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_ACCOUNT_PERMISSION');
3907: OE_MSG_PUB.ADD;
3908: ELSE
3909: IF l_debug_level > 0 THEN
3910: oe_debug_pub.add('Contact Center Integration, no permission to create account');
3911: END IF;
3927: oe_debug_pub.add(l_indent|| 'party_id or party number is not passed' ) ;
3928: END IF;
3929: l_message := 'Party_id or Party Number is not passed';
3930: FND_MESSAGE.Set_Token('TEXT',l_message, FALSE);
3931: OE_MSG_PUB.ADD;
3932:
3933: END IF; -- if party_id or party_number is not null
3934:
3935:
3939: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
3940: IF l_debug_level > 0 THEN
3941: oe_debug_pub.add(l_indent|| 'doing count_and_get' ) ;
3942: END IF;
3943: oe_msg_pub.count_and_get(p_encoded=>fnd_api.G_TRUE,
3944: p_count => x_msg_count,
3945: p_data=>x_msg_data
3946: );
3947: IF l_debug_level > 0 THEN
3971: x_return_status := FND_API.G_RET_STS_ERROR;
3972:
3973: -- Get message count and data
3974:
3975: OE_MSG_PUB.Count_And_Get
3976: ( p_count => x_msg_count
3977: , p_data => x_msg_data
3978: );
3979:
3993: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3994:
3995: -- Get message count and data
3996:
3997: OE_MSG_PUB.Count_And_Get
3998: ( p_count => x_msg_count
3999: , p_data => x_msg_data
4000: );
4001:
4016: IF l_debug_level > 0 THEN
4017: oe_debug_pub.add( 'CHECK_ACCOUNT WHEN OTHERS EXCEPTION CODE='|| SQLCODE||' MESSAGE='||SQLERRM ) ;
4018: END IF;
4019:
4020: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4021: THEN
4022: OE_MSG_PUB.Add_Exc_Msg
4023: ( G_PKG_NAME
4024: , 'check_and_create_account'
4018: END IF;
4019:
4020: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4021: THEN
4022: OE_MSG_PUB.Add_Exc_Msg
4023: ( G_PKG_NAME
4024: , 'check_and_create_account'
4025: );
4026: END IF;
4026: END IF;
4027:
4028: -- Get message count and data
4029:
4030: OE_MSG_PUB.Count_And_Get
4031: ( p_count => x_msg_count
4032: , p_data => x_msg_data
4033: );
4034: END check_and_create_account;
4108: oe_debug_pub.add( 'NO SUCH PARTY FOUND FOR PARTY_NUMBER' ) ;
4109: END IF;
4110: x_return_status := FND_API.G_RET_STS_ERROR;
4111: FND_MESSAGE.Set_Name('ONT','ONT_AACC_NO_ACCOUNT');
4112: OE_MSG_PUB.ADD;
4113: CLOSE party_number_rec;
4114: return;
4115: END IF;
4116:
4126: oe_debug_pub.add( 'NO SUCH PARTY FOUND FOR PARTY_ID' ) ;
4127: END IF;
4128: x_return_status := FND_API.G_RET_STS_ERROR;
4129: FND_MESSAGE.Set_Name('ONT','ONT_AAC_NO_ACCOUNT');
4130: OE_MSG_PUB.ADD;
4131: CLOSE party_rec;
4132: return;
4133: END IF;
4134:
4181: oe_debug_pub.add( 'INVALID PARTY TYPE' ) ;
4182: END IF;
4183: x_return_status := FND_API.G_RET_STS_ERROR;
4184: FND_MESSAGE.Set_Name('ONT','ONT_AAC_INVALID_PARTY');
4185: OE_MSG_PUB.ADD;
4186: return;
4187: END IF;
4188:
4189: ELSE
4192: END IF;
4193: x_return_status := FND_API.G_RET_STS_ERROR;
4194: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
4195: FND_MESSAGE.Set_Token('TEXT','No Customer Information ', FALSE);
4196: OE_MSG_PUB.ADD;
4197: return;
4198: END IF;
4199:
4200: END if_multiple_accounts;
4498: EXCEPTION
4499:
4500: WHEN NO_DATA_FOUND THEN
4501:
4502: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4503: THEN
4504: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_ACCOUNT');
4505: OE_MSG_PUB.ADD;
4506: END IF;
4501:
4502: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4503: THEN
4504: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_ACCOUNT');
4505: OE_MSG_PUB.ADD;
4506: END IF;
4507:
4508: IF l_debug_level > 4 THEN
4509: oe_debug_pub.add ('AAC:VTI: invalid cust_account_id ');
4513: return;
4514:
4515: WHEN OTHERS THEN
4516:
4517: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4518: --THEN
4519: OE_MSG_PUB.Add_Exc_Msg(
4520: G_PKG_NAME
4521: ,'find_sold_to_id'
4515: WHEN OTHERS THEN
4516:
4517: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4518: --THEN
4519: OE_MSG_PUB.Add_Exc_Msg(
4520: G_PKG_NAME
4521: ,'find_sold_to_id'
4522: );
4523: --END IF;
4561: EXCEPTION
4562:
4563: WHEN NO_DATA_FOUND THEN
4564:
4565: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4566: THEN
4567: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_ACCOUNT');
4568: OE_MSG_PUB.ADD;
4569: END IF;
4564:
4565: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4566: THEN
4567: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_ACCOUNT');
4568: OE_MSG_PUB.ADD;
4569: END IF;
4570:
4571: IF l_debug_level > 4 THEN
4572: oe_debug_pub.add ('AAC:VTI: invalid cust_account_id ');
4576: return;
4577:
4578: WHEN OTHERS THEN
4579:
4580: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4581: --THEN
4582: OE_MSG_PUB.Add_Exc_Msg(
4583: G_PKG_NAME
4584: ,'find_sold_to_id'
4578: WHEN OTHERS THEN
4579:
4580: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4581: --THEN
4582: OE_MSG_PUB.Add_Exc_Msg(
4583: G_PKG_NAME
4584: ,'find_sold_to_id'
4585: );
4586: --END IF;
4610: EXCEPTION
4611:
4612: WHEN NO_DATA_FOUND THEN
4613:
4614: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4615: THEN
4616: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_PARTY');
4617: OE_MSG_PUB.ADD;
4618: END IF;
4613:
4614: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4615: THEN
4616: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_PARTY');
4617: OE_MSG_PUB.ADD;
4618: END IF;
4619:
4620: IF l_debug_level > 4 THEN
4621: oe_debug_pub.add ('AAC:VTI: invalid party_number ');
4626: return;
4627:
4628: WHEN OTHERS THEN
4629:
4630: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4631: --THEN
4632: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_sold_to_id' ); --modified for bug 4590205
4633: --END IF;
4634: IF l_debug_level > 4 THEN
4628: WHEN OTHERS THEN
4629:
4630: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4631: --THEN
4632: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_sold_to_id' ); --modified for bug 4590205
4633: --END IF;
4634: IF l_debug_level > 4 THEN
4635: oe_debug_pub.add ('AAC:VTI: unexpected error in find_sold_to_id');
4636: END IF;
4655: EXCEPTION
4656:
4657: WHEN NO_DATA_FOUND THEN
4658:
4659: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4660: THEN
4661: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_PARTY');
4662: OE_MSG_PUB.ADD;
4663: END IF;
4658:
4659: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4660: THEN
4661: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_PARTY');
4662: OE_MSG_PUB.ADD;
4663: END IF;
4664:
4665: IF l_debug_level > 4 THEN
4666: oe_debug_pub.add ('AAC:VTI: invalid party_site_use_id ');
4671: return;
4672:
4673: WHEN OTHERS THEN
4674:
4675: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4676: --THEN
4677: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_sold_to_id' ); --modified for bug 4590205
4678: --END IF;
4679: IF l_debug_level > 4 THEN
4673: WHEN OTHERS THEN
4674:
4675: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4676: --THEN
4677: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_sold_to_id' ); --modified for bug 4590205
4678: --END IF;
4679: IF l_debug_level > 4 THEN
4680: oe_debug_pub.add ('AAC:VTI: unexpected error in find_sold_to_id');
4681: END IF;
4699: EXCEPTION
4700:
4701: WHEN NO_DATA_FOUND THEN
4702:
4703: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4704: THEN
4705: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_PARTY');
4706: OE_MSG_PUB.ADD;
4707: END IF;
4702:
4703: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4704: THEN
4705: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_INVALID_PARTY');
4706: OE_MSG_PUB.ADD;
4707: END IF;
4708:
4709: IF l_debug_level > 4 THEN
4710: oe_debug_pub.add ('AAC:VTI: invalid party_site_id ');
4714: return;
4715:
4716: WHEN OTHERS THEN
4717:
4718: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4719: --THEN
4720: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_sold_to_id' ); --modified for bug 4590205
4721: --END IF;
4722: IF l_debug_level > 4 THEN
4716: WHEN OTHERS THEN
4717:
4718: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4719: --THEN
4720: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_sold_to_id' ); --modified for bug 4590205
4721: --END IF;
4722: IF l_debug_level > 4 THEN
4723: oe_debug_pub.add ('AAC:VTI: unexpected error in find_sold_to_id');
4724: END IF;
4757: p_site_use_id := null;
4758:
4759: WHEN OTHERS THEN
4760:
4761: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4762: --THEN
4763: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_site_id' );
4764: --END IF;
4765: IF l_debug_level > 4 THEN
4759: WHEN OTHERS THEN
4760:
4761: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4762: --THEN
4763: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_site_id' );
4764: --END IF;
4765: IF l_debug_level > 4 THEN
4766: oe_debug_pub.add ('AAC:VTI: unexpected error in find_sold_to_id');
4767: END IF;
4801: x_return_status := FND_API.G_RET_STS_ERROR;
4802: p_cust_account_id := null;
4803: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
4804: FND_MESSAGE.Set_Token('TEXT','Multiple Accounts Exist', FALSE);
4805: OE_MSG_PUB.ADD;
4806:
4807: return;
4808:
4809: WHEN OTHERS THEN
4807: return;
4808:
4809: WHEN OTHERS THEN
4810:
4811: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4812: --THEN
4813: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_site_id' );
4814: --END IF;
4815: IF l_debug_level > 4 THEN
4809: WHEN OTHERS THEN
4810:
4811: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4812: --THEN
4813: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_site_id' );
4814: --END IF;
4815: IF l_debug_level > 4 THEN
4816: oe_debug_pub.add ('AAC:VTI: unexpected error in find_sold_to_id');
4817: END IF;
4851: x_return_status := FND_API.G_RET_STS_ERROR;
4852: p_cust_account_id := null;
4853: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
4854: FND_MESSAGE.Set_Token('TEXT','Multiple Accounts Exist', FALSE);
4855: OE_MSG_PUB.ADD;
4856:
4857: return;
4858:
4859: WHEN OTHERS THEN
4857: return;
4858:
4859: WHEN OTHERS THEN
4860:
4861: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4862: --THEN
4863: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_site_id' );
4864: --END IF;
4865: IF l_debug_level > 4 THEN
4859: WHEN OTHERS THEN
4860:
4861: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4862: --THEN
4863: OE_MSG_PUB.Add_Exc_Msg( G_PKG_NAME ,'find_site_id' );
4864: --END IF;
4865: IF l_debug_level > 4 THEN
4866: oe_debug_pub.add ('AAC:VTI: unexpected error in find_sold_to_id');
4867: END IF;
4897: --x_return_status := FND_API.G_RET_STS_ERROR;
4898: p_cust_account_id := null;
4899: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
4900: FND_MESSAGE.Set_Token('TEXT','Multiple Accounts Exist', FALSE);
4901: OE_MSG_PUB.ADD;
4902: close c_get_account_id;
4903:
4904: return;
4905: end if;
4935: IF l_debug_level > 0 THEN
4936: oe_debug_pub.add ('AAC:FSTI: no permission to create account: returning');
4937: END IF;
4938: FND_MESSAGE.Set_Name('ONT', 'ONT_AAC_ACCOUNT_PERMISSION');
4939: OE_MSG_PUB.ADD;
4940: p_cust_account_id := NULL;
4941: x_return_status := FND_API.G_RET_STS_ERROR;
4942: return;
4943: END IF;
4983: EXCEPTION
4984:
4985: WHEN NO_DATA_FOUND THEN
4986:
4987: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
4988: THEN
4989:
4990: fnd_message.set_name('ONT','OE_VALUE_TO_ID_ERROR');
4991: FND_MESSAGE.SET_TOKEN('ATTRIBUTE','find_sold_to_id');
4988: THEN
4989:
4990: fnd_message.set_name('ONT','OE_VALUE_TO_ID_ERROR');
4991: FND_MESSAGE.SET_TOKEN('ATTRIBUTE','find_sold_to_id');
4992: OE_MSG_PUB.Add;
4993:
4994: END IF;
4995: IF l_debug_level > 4 THEN
4996: oe_debug_pub.add ('AAC:VTI: invalid p_cust_account_id in find_sold_to_id'); -- got a party_name
5000: return;
5001:
5002: WHEN OTHERS THEN
5003:
5004: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5005: THEN
5006: OE_MSG_PUB.Add_Exc_Msg(
5007: G_PKG_NAME
5008: ,'find_Sold_To_Org_id'
5002: WHEN OTHERS THEN
5003:
5004: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5005: THEN
5006: OE_MSG_PUB.Add_Exc_Msg(
5007: G_PKG_NAME
5008: ,'find_Sold_To_Org_id'
5009: );
5010: END IF;
5043: IF l_debug_level > 0 THEN
5044: oe_debug_pub.add ('AAC:FCI: cust_contact_id is not null, nothing to do: warn; returning}');
5045: END IF;
5046:
5047: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
5048: THEN
5049: fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
5050: FND_MESSAGE.SET_TOKEN('ATTRIBUTE','sold_to_contact');
5051: OE_MSG_PUB.Add;
5047: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_SUCCESS)
5048: THEN
5049: fnd_message.set_name('ONT','OE_BOTH_VAL_AND_ID_EXIST');
5050: FND_MESSAGE.SET_TOKEN('ATTRIBUTE','sold_to_contact');
5051: OE_MSG_PUB.Add;
5052: END IF;
5053:
5054: RETURN;
5055: END IF;
5295: EXCEPTION
5296:
5297: WHEN NO_DATA_FOUND THEN
5298:
5299: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
5300: THEN
5301: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
5302: FND_MESSAGE.Set_Token('TEXT','Not a Valid party site use ', FALSE);
5303: OE_MSG_PUB.ADD;
5299: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
5300: THEN
5301: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
5302: FND_MESSAGE.Set_Token('TEXT','Not a Valid party site use ', FALSE);
5303: OE_MSG_PUB.ADD;
5304: END IF;
5305:
5306: IF l_debug_level > 4 THEN
5307: oe_debug_pub.add ('AAC:VTI: invalid party_site_use_id ');
5311: return;
5312:
5313: WHEN OTHERS THEN
5314:
5315: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5316: --THEN
5317: OE_MSG_PUB.Add_Exc_Msg(
5318: G_PKG_NAME
5319: ,'find_site_id'
5313: WHEN OTHERS THEN
5314:
5315: --IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5316: --THEN
5317: OE_MSG_PUB.Add_Exc_Msg(
5318: G_PKG_NAME
5319: ,'find_site_id'
5320: );
5321: --END IF;
5348: EXCEPTION
5349:
5350: WHEN NO_DATA_FOUND THEN
5351:
5352: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
5353: THEN
5354: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
5355: FND_MESSAGE.Set_Token('TEXT','Not a Valid party site ', FALSE);
5356: OE_MSG_PUB.ADD;
5352: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
5353: THEN
5354: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
5355: FND_MESSAGE.Set_Token('TEXT','Not a Valid party site ', FALSE);
5356: OE_MSG_PUB.ADD;
5357:
5358: END IF;
5359: IF l_debug_level > 4 THEN
5360: oe_debug_pub.add ('AAC:VTI: invalid party_site_id ');
5363: return;
5364:
5365: WHEN OTHERS THEN
5366:
5367: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5368: THEN
5369: OE_MSG_PUB.Add_Exc_Msg(
5370: G_PKG_NAME
5371: ,'find_site_id'
5365: WHEN OTHERS THEN
5366:
5367: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5368: THEN
5369: OE_MSG_PUB.Add_Exc_Msg(
5370: G_PKG_NAME
5371: ,'find_site_id'
5372: );
5373: END IF;
5494: EXCEPTION
5495:
5496: WHEN NO_DATA_FOUND THEN
5497:
5498: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
5499: THEN
5500: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
5501: FND_MESSAGE.Set_Token('TEXT','Not a Valid account site use', FALSE);
5502: OE_MSG_PUB.ADD;
5498: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
5499: THEN
5500: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
5501: FND_MESSAGE.Set_Token('TEXT','Not a Valid account site use', FALSE);
5502: OE_MSG_PUB.ADD;
5503:
5504: END IF;
5505: IF l_debug_level > 4 THEN
5506: oe_debug_pub.add ('AAC:VTI: invalid cust_site_use_id ');
5577: EXCEPTION
5578:
5579: WHEN NO_DATA_FOUND THEN
5580:
5581: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
5582: THEN
5583: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
5584: FND_MESSAGE.Set_Token('TEXT','Not a Valid party site ', FALSE);
5585: OE_MSG_PUB.ADD;
5581: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
5582: THEN
5583: FND_MESSAGE.Set_Name('ONT','ONT_AVAIL_GENERIC');
5584: FND_MESSAGE.Set_Token('TEXT','Not a Valid party site ', FALSE);
5585: OE_MSG_PUB.ADD;
5586:
5587: END IF;
5588: IF l_debug_level > 4 THEN
5589: oe_debug_pub.add ('AAC:VTI: invalid party_site_id ');
5592: return;
5593:
5594: WHEN OTHERS THEN
5595:
5596: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5597: THEN
5598: OE_MSG_PUB.Add_Exc_Msg(
5599: G_PKG_NAME
5600: ,'find_site_id'
5594: WHEN OTHERS THEN
5595:
5596: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5597: THEN
5598: OE_MSG_PUB.Add_Exc_Msg(
5599: G_PKG_NAME
5600: ,'find_site_id'
5601: );
5602: END IF;
5682: EXCEPTION
5683:
5684: WHEN NO_DATA_FOUND THEN
5685:
5686: IF (OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR))
5687: THEN
5688:
5689: fnd_message.set_name('ONT','OE_VALUE_TO_ID_ERROR');
5690: --{bug 4240715
5699: elsif p_party_site_use_code ='END_CUST' then
5700: FND_MESSAGE.SET_TOKEN('ATTRIBUTE','end_customer_id');
5701: end if;
5702: --bug 4240715}
5703: OE_MSG_PUB.Add;
5704:
5705: END IF;
5706: IF l_debug_level > 4 THEN
5707: oe_debug_pub.add ('AAC:VTI: no data in Get_party_id'); -- got a party_name
5709: RETURN FND_API.G_MISS_NUM;
5710:
5711: WHEN OTHERS THEN
5712:
5713: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5714: THEN
5715: OE_MSG_PUB.Add_Exc_Msg(
5716: G_PKG_NAME
5717: ,'get_party_id' --modified for bug 4590205
5711: WHEN OTHERS THEN
5712:
5713: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5714: THEN
5715: OE_MSG_PUB.Add_Exc_Msg(
5716: G_PKG_NAME
5717: ,'get_party_id' --modified for bug 4590205
5718: );
5719: END IF;
6033: IF C2%ISOPEN then
6034: CLOSE C2;
6035: END IF;
6036:
6037: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
6038: THEN
6039:
6040: fnd_message.set_name('ONT','OE_VALUE_TO_ID_ERROR');
6041: FND_MESSAGE.SET_TOKEN('ATTRIBUTE','get_party_site_id');
6038: THEN
6039:
6040: fnd_message.set_name('ONT','OE_VALUE_TO_ID_ERROR');
6041: FND_MESSAGE.SET_TOKEN('ATTRIBUTE','get_party_site_id');
6042: OE_MSG_PUB.Add;
6043:
6044: END IF;
6045:
6046: RETURN NULL;
6054: IF C2%ISOPEN then
6055: CLOSE C2;
6056: END IF;
6057:
6058: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
6059: THEN
6060: OE_MSG_PUB.Add_Exc_Msg
6061: ( G_PKG_NAME
6062: , 'get_party_site_id'
6056: END IF;
6057:
6058: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
6059: THEN
6060: OE_MSG_PUB.Add_Exc_Msg
6061: ( G_PKG_NAME
6062: , 'get_party_site_id'
6063: );
6064: END IF;
6111: EXCEPTION
6112:
6113: WHEN NO_DATA_FOUND THEN
6114:
6115: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
6116: THEN
6117:
6118: fnd_message.set_name('ONT','OE_VALUE_TO_ID_ERROR');
6119: --{bug 4240715
6129: FND_MESSAGE.SET_TOKEN('ATTRIBUTE','end_customer_id');
6130: end if;
6131: -- FND_MESSAGE.SET_TOKEN('ATTRIBUTE','sold_to_org_id');
6132: --bug 4240715}
6133: OE_MSG_PUB.Add;
6134:
6135: END IF;
6136:
6137: RETURN FND_API.G_MISS_NUM;
6137: RETURN FND_API.G_MISS_NUM;
6138:
6139: WHEN OTHERS THEN
6140:
6141: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
6142: THEN
6143: OE_MSG_PUB.Add_Exc_Msg
6144: ( G_PKG_NAME
6145: , 'Sold_To_Org'
6139: WHEN OTHERS THEN
6140:
6141: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
6142: THEN
6143: OE_MSG_PUB.Add_Exc_Msg
6144: ( G_PKG_NAME
6145: , 'Sold_To_Org'
6146: );
6147: END IF;