405: p_index IN NUMBER := 1
406: ) IS
407: Begin
408: IF PG_DEBUG in ('Y', 'C') THEN
409: msc_sch_wb.atp_debug('***** Begin Extend_Atp Procedure *****');
410: END IF;
411:
412: x_return_status := FND_API.G_RET_STS_SUCCESS;
413: msc_atp_global.extend_atp(p_atp_tab,
495: -- 24x7 Support
496: p_atp_tab.attribute_04.Extend(p_index);
497: p_atp_tab.attribute_08.Extend(p_index); -- 24x7
498: e_cto_ench */
499: -- msc_sch_wb.atp_debug('***** End Extend_Atp Procedure *****');
500:
501: END Extend_Atp;
502:
503:
510:
511: l_count PLS_INTEGER;
512: Begin
513: IF PG_DEBUG in ('Y', 'C') THEN
514: msc_sch_wb.atp_debug('***** Begin Assign_Atp_Input_Rec Procedure *****');
515: END IF;
516:
517: x_return_status := FND_API.G_RET_STS_SUCCESS;
518:
602: x_atp_table.Ship_Date(l_count+1):=
603: p_atp_table.Ship_Date(p_index);
604: END IF;
605: IF PG_DEBUG in ('Y', 'C') THEN
606: msc_sch_wb.atp_debug('Extend_Atp: ' || 'test1 = '||1);
607: END IF;
608: IF p_atp_table.arrival_date.Exists(p_index) THEN
609: x_atp_table.arrival_Date(l_count+1):=
610: p_atp_table.arrival_date(p_index);
697: (p_atp_table.Order_Number(p_index) is NULL) AND
698: (p_atp_table.attribute_08(p_index) is not NULL) THEN
699:
700: IF PG_DEBUG in ('Y', 'C') THEN
701: msc_sch_wb.atp_debug('Calling 24x7 SO Processing');
702: END IF;
703: MSC_ATP_24x7.Parse_Sales_Order_Number (p_atp_table.attribute_08(p_index),
704: x_atp_table.Order_number(l_count + 1)
705: );
841:
842: END IF;
843:
844: IF PG_DEBUG in ('Y', 'C') THEN
845: msc_sch_wb.atp_debug('Extend_Atp: ' || 'test1 = '||2);
846: END IF;
847: IF p_atp_table.ATO_Parent_Model_Line_Id.Exists(p_index) THEN
848: x_atp_table.ATO_Parent_Model_Line_Id(l_count + 1):=
849: p_atp_table.ATO_Parent_Model_Line_Id(p_index);
879: p_atp_table.Validation_Org(p_index);
880: END IF;
881:
882: IF PG_DEBUG in ('Y', 'C') THEN
883: msc_sch_wb.atp_debug('Extend_Atp: ' || 'test1 = '||3);
884: END IF;
885: IF p_atp_table.Component_Sequence_ID.Exists(p_index) THEN
886: x_atp_table.Component_Sequence_ID(l_count + 1):=
887: p_atp_table.Component_Sequence_ID(p_index);
902: p_atp_table.included_item_flag(p_index);
903: END IF;
904:
905: IF PG_DEBUG in ('Y', 'C') THEN
906: msc_sch_wb.atp_debug('Extend_Atp: ' || 'test1 = '||4);
907: END IF;
908:
909: IF p_atp_table.atp_flag.Exists(p_index) THEN
910: x_atp_table.atp_flag(l_count + 1):=
921: p_atp_table.wip_supply_type(p_index);
922: END IF;
923:
924: IF PG_DEBUG in ('Y', 'C') THEN
925: msc_sch_wb.atp_debug('Extend_Atp: ' || 'test1 = '||5);
926: END IF;
927: IF p_atp_table.bom_item_type.Exists(p_index) THEN
928: x_atp_table.bom_item_type(l_count + 1):=
929: p_atp_table.bom_item_type(p_index);
945: p_atp_table.attribute_12(p_index);
946: END IF;
947:
948: IF PG_DEBUG in ('Y', 'C') THEN
949: msc_sch_wb.atp_debug('Extend_Atp: ' || 'test1 = '||1);
950: END IF;
951:
952: IF p_atp_table.attribute_13.Exists(p_index) THEN
953: x_atp_table.attribute_13(l_count + 1):=
1086: --4500382 ENDS
1087: END IF;
1088: ---e_cto_rearch
1089: IF PG_DEBUG in ('Y', 'C') THEN
1090: msc_sch_wb.atp_debug('***** End Assign_Atp_Input_Rec Procedure *****');
1091: END IF;
1092: END Assign_Atp_Input_Rec;
1093:
1094:
1102: l_count PLS_INTEGER;
1103: Begin
1104:
1105: IF PG_DEBUG in ('Y', 'C') THEN
1106: msc_sch_wb.atp_debug('***** Begin Assign_Atp_Output_Rec Procedure *****');
1107: END IF;
1108:
1109: x_return_status := FND_API.G_RET_STS_SUCCESS;
1110:
1113: l_count := x_atp_table.Action.COUNT;
1114:
1115: IF nvl(l_count, 0) > 0 THEN
1116: IF PG_DEBUG in ('Y', 'C') THEN
1117: msc_sch_wb.atp_debug('Assign_Atp_Output_Rec: ' || 'x_atp_table.Action : ' || x_atp_table.Action(l_count));
1118: END IF;
1119: END IF;
1120:
1121: FOR l_atp_count in 1..p_atp_table.Action.COUNT LOOP
1435: p_atp_table.part_of_set(l_atp_count);
1436: END LOOP;
1437:
1438: IF PG_DEBUG in ('Y', 'C') THEN
1439: msc_sch_wb.atp_debug('***** End Assign_Atp_Output_Rec Procedure *****');
1440: END IF;
1441:
1442: END Assign_Atp_Output_Rec;
1443:
1448: ) IS
1449:
1450: Begin
1451:
1452: -- msc_sch_wb.atp_debug('***** Begin Extend_Atp_Period Procedure *****');
1453:
1454: x_return_status := FND_API.G_RET_STS_SUCCESS;
1455:
1456: p_atp_period.Level.Extend;
1497: p_atp_period.Unallocated_Net_Quantity.Extend;
1498: -- ssurendr: additional fields for allocation w/b end
1499: -- time_phased_atp
1500: p_atp_period.total_bucketed_demand_quantity.Extend;
1501: -- msc_sch_wb.atp_debug('***** End Extend_Atp_Period Procedure *****');
1502:
1503: END Extend_Atp_Period;
1504:
1505:
1509: p_index IN NUMBER -- added by rajjain 12/10/2002
1510: ) IS
1511: Begin
1512: IF PG_DEBUG in ('Y', 'C') THEN
1513: msc_sch_wb.atp_debug('***** Begin Extend_Atp_Supply_Demand Procedure *****');
1514: msc_sch_wb.atp_debug('Extend_Atp_Supply_Demand: ' || 'p_index = ' || p_index);
1515: END IF;
1516:
1517: x_return_status := FND_API.G_RET_STS_SUCCESS;
1510: ) IS
1511: Begin
1512: IF PG_DEBUG in ('Y', 'C') THEN
1513: msc_sch_wb.atp_debug('***** Begin Extend_Atp_Supply_Demand Procedure *****');
1514: msc_sch_wb.atp_debug('Extend_Atp_Supply_Demand: ' || 'p_index = ' || p_index);
1515: END IF;
1516:
1517: x_return_status := FND_API.G_RET_STS_SUCCESS;
1518:
1555: p_atp_supply_demand.Pf_Display_Flag.Extend(p_index);
1556: -- time_phased_atp change end
1557:
1558: IF PG_DEBUG in ('Y', 'C') THEN
1559: msc_sch_wb.atp_debug('***** End Extend_Atp_Supply_Demand Procedure *****');
1560: END IF;
1561:
1562: END Extend_Atp_Supply_Demand;
1563:
1568: p_index IN NUMBER
1569: ) IS
1570: Begin
1571: IF PG_DEBUG in ('Y', 'C') THEN
1572: msc_sch_wb.atp_debug('***** Begin Trim_Atp_Supply_Demand Procedure *****');
1573: msc_sch_wb.atp_debug('Trim_Atp_Supply_Demand: ' || 'p_index = ' || p_index);
1574: END IF;
1575: x_return_status := FND_API.G_RET_STS_SUCCESS;
1576:
1569: ) IS
1570: Begin
1571: IF PG_DEBUG in ('Y', 'C') THEN
1572: msc_sch_wb.atp_debug('***** Begin Trim_Atp_Supply_Demand Procedure *****');
1573: msc_sch_wb.atp_debug('Trim_Atp_Supply_Demand: ' || 'p_index = ' || p_index);
1574: END IF;
1575: x_return_status := FND_API.G_RET_STS_SUCCESS;
1576:
1577: p_atp_supply_demand.Level.Trim(p_index);
1612: p_atp_supply_demand.Pf_Display_Flag.Extend(p_index);
1613: -- time_phased_atp change end
1614:
1615: IF PG_DEBUG in ('Y', 'C') THEN
1616: msc_sch_wb.atp_debug('***** End Trim_Atp_Supply_Demand Procedure *****');
1617: END IF;
1618:
1619: END Trim_Atp_Supply_Demand;
1620: -- rajjain end 12/10/2002
1681:
1682: BEGIN
1683: -- Bug 2732267 Change the debug message qualifier from Get_Regions to Get_Regions_Old
1684: IF PG_DEBUG in ('Y', 'C') THEN
1685: msc_sch_wb.atp_debug('Begin Get_Regions_Old');
1686: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_customer_site_id : ' || p_customer_site_id);
1687: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_calling_module : ' || p_calling_module);
1688: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_instance_id : ' || p_instance_id);
1689: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_session_id : ' || p_session_id);
1682: BEGIN
1683: -- Bug 2732267 Change the debug message qualifier from Get_Regions to Get_Regions_Old
1684: IF PG_DEBUG in ('Y', 'C') THEN
1685: msc_sch_wb.atp_debug('Begin Get_Regions_Old');
1686: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_customer_site_id : ' || p_customer_site_id);
1687: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_calling_module : ' || p_calling_module);
1688: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_instance_id : ' || p_instance_id);
1689: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_session_id : ' || p_session_id);
1690: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_dblink : ' || p_dblink);
1683: -- Bug 2732267 Change the debug message qualifier from Get_Regions to Get_Regions_Old
1684: IF PG_DEBUG in ('Y', 'C') THEN
1685: msc_sch_wb.atp_debug('Begin Get_Regions_Old');
1686: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_customer_site_id : ' || p_customer_site_id);
1687: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_calling_module : ' || p_calling_module);
1688: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_instance_id : ' || p_instance_id);
1689: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_session_id : ' || p_session_id);
1690: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_dblink : ' || p_dblink);
1691: END IF;
1684: IF PG_DEBUG in ('Y', 'C') THEN
1685: msc_sch_wb.atp_debug('Begin Get_Regions_Old');
1686: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_customer_site_id : ' || p_customer_site_id);
1687: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_calling_module : ' || p_calling_module);
1688: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_instance_id : ' || p_instance_id);
1689: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_session_id : ' || p_session_id);
1690: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_dblink : ' || p_dblink);
1691: END IF;
1692:
1685: msc_sch_wb.atp_debug('Begin Get_Regions_Old');
1686: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_customer_site_id : ' || p_customer_site_id);
1687: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_calling_module : ' || p_calling_module);
1688: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_instance_id : ' || p_instance_id);
1689: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_session_id : ' || p_session_id);
1690: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_dblink : ' || p_dblink);
1691: END IF;
1692:
1693: x_return_status := FND_API.G_RET_STS_SUCCESS;
1686: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_customer_site_id : ' || p_customer_site_id);
1687: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_calling_module : ' || p_calling_module);
1688: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_instance_id : ' || p_instance_id);
1689: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_session_id : ' || p_session_id);
1690: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_dblink : ' || p_dblink);
1691: END IF;
1692:
1693: x_return_status := FND_API.G_RET_STS_SUCCESS;
1694: IF p_calling_module <> 724 THEN
1733: END IF;
1734: /********************* BUG 2085071 Fix ************************/
1735:
1736: IF PG_DEBUG in ('Y', 'C') THEN
1737: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_postal_code : ' || l_postal_code);
1738: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_city : ' || l_city);
1739: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_state : ' || l_state);
1740: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_country : ' || l_country);
1741: END IF;
1734: /********************* BUG 2085071 Fix ************************/
1735:
1736: IF PG_DEBUG in ('Y', 'C') THEN
1737: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_postal_code : ' || l_postal_code);
1738: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_city : ' || l_city);
1739: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_state : ' || l_state);
1740: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_country : ' || l_country);
1741: END IF;
1742:
1735:
1736: IF PG_DEBUG in ('Y', 'C') THEN
1737: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_postal_code : ' || l_postal_code);
1738: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_city : ' || l_city);
1739: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_state : ' || l_state);
1740: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_country : ' || l_country);
1741: END IF;
1742:
1743: -- Bug 3010834: Backport bug 2882331 to 11.5.9 to be included in I.1
1736: IF PG_DEBUG in ('Y', 'C') THEN
1737: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_postal_code : ' || l_postal_code);
1738: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_city : ' || l_city);
1739: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_state : ' || l_state);
1740: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_country : ' || l_country);
1741: END IF;
1742:
1743: -- Bug 3010834: Backport bug 2882331 to 11.5.9 to be included in I.1
1744: -- Length Variables assigned the NVL(LENGTH(var)) to avoid repeated calls bug 2882331.
1747: l_state_length := NVL(LENGTH(l_state), 0);
1748: l_country_length := NVL(LENGTH(l_country), 0);
1749:
1750: IF PG_DEBUG in ('Y', 'C') THEN
1751: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_postal_code) : ' || l_postal_code_length);
1752: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_state) : ' || l_state_length);
1753: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_country) : ' || l_country_length);
1754: END IF;
1755:
1748: l_country_length := NVL(LENGTH(l_country), 0);
1749:
1750: IF PG_DEBUG in ('Y', 'C') THEN
1751: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_postal_code) : ' || l_postal_code_length);
1752: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_state) : ' || l_state_length);
1753: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_country) : ' || l_country_length);
1754: END IF;
1755:
1756:
1749:
1750: IF PG_DEBUG in ('Y', 'C') THEN
1751: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_postal_code) : ' || l_postal_code_length);
1752: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_state) : ' || l_state_length);
1753: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_country) : ' || l_country_length);
1754: END IF;
1755:
1756:
1757: l_cnt := 0;
1806: END IF;
1807:
1808: l_stmt := l_stmt || ' AND region_type = :counter AND rownum = 1';
1809: IF PG_DEBUG in ('Y', 'C') THEN
1810: msc_sch_wb.atp_debug('Get_Regions_Old: searching region_type: ' || i);
1811: IF l_cnt = 0 THEN
1812: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt1: '||l_stmt1);
1813: ELSE
1814: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt: ' || l_stmt);
1808: l_stmt := l_stmt || ' AND region_type = :counter AND rownum = 1';
1809: IF PG_DEBUG in ('Y', 'C') THEN
1810: msc_sch_wb.atp_debug('Get_Regions_Old: searching region_type: ' || i);
1811: IF l_cnt = 0 THEN
1812: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt1: '||l_stmt1);
1813: ELSE
1814: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt: ' || l_stmt);
1815: END IF;
1816: END IF;
1810: msc_sch_wb.atp_debug('Get_Regions_Old: searching region_type: ' || i);
1811: IF l_cnt = 0 THEN
1812: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt1: '||l_stmt1);
1813: ELSE
1814: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt: ' || l_stmt);
1815: END IF;
1816: END IF;
1817:
1818: -- Bug 3010834: Backport bug 2882331 to 11.5.9 to be included in I.1
1845: using l_country, i;
1846: END IF;
1847:
1848: IF PG_DEBUG in ('Y', 'C') THEN
1849: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_cnt: ' || l_cnt);
1850: END IF;
1851: exit; -- to exit the loop.
1852:
1853: EXCEPTION
1864: l_dynstring := '@'||p_dblink;
1865: END IF;
1866:
1867: IF PG_DEBUG in ('Y', 'C') THEN
1868: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_dynstring: ' || l_dynstring);
1869: END IF;
1870:
1871: BEGIN
1872: -- Modified the SQL for bug 2484964. For better performance
1885: START WITH region_id = :l_region_id
1886: CONNECT BY PRIOR parent_region_id = region_id)';
1887:
1888: IF PG_DEBUG in ('Y', 'C') THEN
1889: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_stmt : ' || l_stmt);
1890: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_session_id : ' || p_session_id);
1891: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_customer_site_id : ' || p_customer_site_id);
1892: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_region_id : ' || l_region_id);
1893: END IF;
1886: CONNECT BY PRIOR parent_region_id = region_id)';
1887:
1888: IF PG_DEBUG in ('Y', 'C') THEN
1889: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_stmt : ' || l_stmt);
1890: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_session_id : ' || p_session_id);
1891: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_customer_site_id : ' || p_customer_site_id);
1892: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_region_id : ' || l_region_id);
1893: END IF;
1894:
1887:
1888: IF PG_DEBUG in ('Y', 'C') THEN
1889: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_stmt : ' || l_stmt);
1890: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_session_id : ' || p_session_id);
1891: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_customer_site_id : ' || p_customer_site_id);
1892: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_region_id : ' || l_region_id);
1893: END IF;
1894:
1895: EXECUTE immediate l_stmt
1888: IF PG_DEBUG in ('Y', 'C') THEN
1889: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_stmt : ' || l_stmt);
1890: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_session_id : ' || p_session_id);
1891: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'p_customer_site_id : ' || p_customer_site_id);
1892: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_region_id : ' || l_region_id);
1893: END IF;
1894:
1895: EXECUTE immediate l_stmt
1896: using p_session_id, l_partner_site_id, l_customer_type, l_region_id; --2814895
1917: AND c.partner_site_id = :p_partner_site_id1
1918: AND c.partner_type = :partner_type1)';
1919:
1920: IF PG_DEBUG in ('Y', 'C') THEN
1921: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_stmt : ' || l_stmt);
1922: END IF;
1923:
1924: EXECUTE immediate l_stmt using p_session_id, l_partner_site_id, l_customer_type,
1925: p_session_id, l_partner_site_id, l_customer_type; --2814895
1931: -- requests from many customer sites. If a same customer is
1932: --- seperated by one or more customers then we would come in this
1933: -- procedure both time. One second time this exception will be raised.
1934: IF PG_DEBUG in ('Y', 'C') THEN
1935: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Regions for this customer are already there in the temp table');
1936: END IF;
1937: END;
1938: END IF; -- IF l_region_id is NOT NULL THEN
1939:
1952: AND tpsid.partner_type = 2
1953: AND tpsid.tp_site_id = mtps.partner_site_id;
1954:
1955: IF PG_DEBUG in ('Y', 'C') THEN
1956: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_postal_code : ' || l_postal_code);
1957: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_city : ' || l_city);
1958: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_state : ' || l_state);
1959: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_country : ' || l_country);
1960: END IF;
1953: AND tpsid.tp_site_id = mtps.partner_site_id;
1954:
1955: IF PG_DEBUG in ('Y', 'C') THEN
1956: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_postal_code : ' || l_postal_code);
1957: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_city : ' || l_city);
1958: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_state : ' || l_state);
1959: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_country : ' || l_country);
1960: END IF;
1961:
1954:
1955: IF PG_DEBUG in ('Y', 'C') THEN
1956: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_postal_code : ' || l_postal_code);
1957: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_city : ' || l_city);
1958: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_state : ' || l_state);
1959: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_country : ' || l_country);
1960: END IF;
1961:
1962: -- Bug 3010834: Backport bug 2882331 to 11.5.9 to be included in I.1
1955: IF PG_DEBUG in ('Y', 'C') THEN
1956: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_postal_code : ' || l_postal_code);
1957: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_city : ' || l_city);
1958: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_state : ' || l_state);
1959: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_country : ' || l_country);
1960: END IF;
1961:
1962: -- Bug 3010834: Backport bug 2882331 to 11.5.9 to be included in I.1
1963: -- Length Variables assigned the NVL(LENGTH(var)) to avoid repeated calls bug 2882331.
1966: l_state_length := NVL(LENGTH(l_state), 0);
1967: l_country_length := NVL(LENGTH(l_country), 0);
1968:
1969: IF PG_DEBUG in ('Y', 'C') THEN
1970: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_postal_code) : ' || l_postal_code_length);
1971: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_state) : ' || l_state_length);
1972: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_country) : ' || l_country_length);
1973: END IF;
1974:
1967: l_country_length := NVL(LENGTH(l_country), 0);
1968:
1969: IF PG_DEBUG in ('Y', 'C') THEN
1970: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_postal_code) : ' || l_postal_code_length);
1971: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_state) : ' || l_state_length);
1972: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_country) : ' || l_country_length);
1973: END IF;
1974:
1975:
1968:
1969: IF PG_DEBUG in ('Y', 'C') THEN
1970: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_postal_code) : ' || l_postal_code_length);
1971: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_state) : ' || l_state_length);
1972: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Length(l_country) : ' || l_country_length);
1973: END IF;
1974:
1975:
1976: l_cnt := 0;
2025:
2026: l_stmt := l_stmt || ' AND region_type = :counter AND rownum = 1';
2027:
2028: IF PG_DEBUG in ('Y', 'C') THEN
2029: msc_sch_wb.atp_debug('Get_Regions_Old: searching region_type : ' || i);
2030: IF l_cnt = 0 THEN
2031: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt1: ' ||l_stmt1);
2032: ELSE
2033: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt : ' || l_stmt);
2027:
2028: IF PG_DEBUG in ('Y', 'C') THEN
2029: msc_sch_wb.atp_debug('Get_Regions_Old: searching region_type : ' || i);
2030: IF l_cnt = 0 THEN
2031: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt1: ' ||l_stmt1);
2032: ELSE
2033: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt : ' || l_stmt);
2034: END IF;
2035: END IF;
2029: msc_sch_wb.atp_debug('Get_Regions_Old: searching region_type : ' || i);
2030: IF l_cnt = 0 THEN
2031: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt1: ' ||l_stmt1);
2032: ELSE
2033: msc_sch_wb.atp_debug('Get_Regions_Old: l_stmt : ' || l_stmt);
2034: END IF;
2035: END IF;
2036:
2037: -- Bug 3010834: Backport bug 2882331 to 11.5.9 to be included in I.1
2069: using p_instance_id, l_country, i;
2070: END IF;
2071:
2072: IF PG_DEBUG in ('Y', 'C') THEN
2073: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_cnt: ' || l_cnt);
2074: END IF;
2075: exit; -- to exit the loop.
2076:
2077: EXCEPTION
2083:
2084: IF l_region_id is NOT NULL THEN
2085:
2086: IF PG_DEBUG in ('Y', 'C') THEN
2087: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'l_region_id: ' || l_region_id);
2088: END IF;
2089:
2090: -- Bug 2837366 : krajan : Catch the DUP_VAL_ON_INDEX error
2091: -- also update Partner_type for supplier intransit LT project
2107: -- Removed Subquery for performance Bug 2498174
2108: -- End Bug 2498174
2109:
2110: IF PG_DEBUG in ('Y', 'C') THEN
2111: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'After Region Fetch for ' || l_region_id);
2112: END IF;
2113:
2114: -- Begin Bug 2498174
2115: -- Ensure that regions and zones query has instance_id filter
2135: -- End Bug 2498174
2136: EXCEPTION
2137: WHEN DUP_VAL_ON_INDEX THEN
2138: IF PG_DEBUG in ('Y', 'C') THEN
2139: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Regions for this customer are already there in the temp table');
2140: END IF;
2141: END;
2142:
2143: END IF; -- IF l_region_id is NOT NULL THEN
2146: END IF;
2147: EXCEPTION
2148: WHEN NO_DATA_FOUND THEN
2149: IF PG_DEBUG in ('Y', 'C') THEN
2150: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Customer with following customer_site_id does not exist: ' || p_customer_site_id);
2151: END IF;
2152: return;
2153: WHEN OTHERS THEN
2154: IF (SQLCODE = -942) THEN
2152: return;
2153: WHEN OTHERS THEN
2154: IF (SQLCODE = -942) THEN
2155: IF PG_DEBUG in ('Y', 'C') THEN
2156: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Table/View doesnt exist');
2157: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Continue as normal');
2158: END IF;
2159: return;
2160: ELSE
2153: WHEN OTHERS THEN
2154: IF (SQLCODE = -942) THEN
2155: IF PG_DEBUG in ('Y', 'C') THEN
2156: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Table/View doesnt exist');
2157: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Continue as normal');
2158: END IF;
2159: return;
2160: ELSE
2161: IF PG_DEBUG in ('Y', 'C') THEN
2158: END IF;
2159: return;
2160: ELSE
2161: IF PG_DEBUG in ('Y', 'C') THEN
2162: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'sqlcode : ' || sqlcode || ' : ' || sqlerrm);
2163: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Error for Customer with customer_site_id : ' || p_customer_site_id);
2164: END IF;
2165: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2166: return;
2159: return;
2160: ELSE
2161: IF PG_DEBUG in ('Y', 'C') THEN
2162: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'sqlcode : ' || sqlcode || ' : ' || sqlerrm);
2163: msc_sch_wb.atp_debug('Get_Regions_Old: ' || 'Error for Customer with customer_site_id : ' || p_customer_site_id);
2164: END IF;
2165: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2166: return;
2167: END IF;
2208: l_partner_type NUMBER := 2; --2814895, default as 2
2209:
2210: BEGIN
2211: IF PG_DEBUG in ('Y', 'C') THEN
2212: msc_sch_wb.atp_debug('Begin Get_regions_SHIPPING');
2213: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_customer_site_id : ' || p_customer_site_id);
2214: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_calling_module : ' || p_calling_module);
2215: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_instance_id : ' || p_instance_id);
2216: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_session_id : ' || p_session_id);
2209:
2210: BEGIN
2211: IF PG_DEBUG in ('Y', 'C') THEN
2212: msc_sch_wb.atp_debug('Begin Get_regions_SHIPPING');
2213: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_customer_site_id : ' || p_customer_site_id);
2214: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_calling_module : ' || p_calling_module);
2215: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_instance_id : ' || p_instance_id);
2216: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_session_id : ' || p_session_id);
2217: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_dblink : ' || p_dblink);
2210: BEGIN
2211: IF PG_DEBUG in ('Y', 'C') THEN
2212: msc_sch_wb.atp_debug('Begin Get_regions_SHIPPING');
2213: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_customer_site_id : ' || p_customer_site_id);
2214: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_calling_module : ' || p_calling_module);
2215: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_instance_id : ' || p_instance_id);
2216: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_session_id : ' || p_session_id);
2217: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_dblink : ' || p_dblink);
2218: END IF;
2211: IF PG_DEBUG in ('Y', 'C') THEN
2212: msc_sch_wb.atp_debug('Begin Get_regions_SHIPPING');
2213: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_customer_site_id : ' || p_customer_site_id);
2214: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_calling_module : ' || p_calling_module);
2215: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_instance_id : ' || p_instance_id);
2216: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_session_id : ' || p_session_id);
2217: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_dblink : ' || p_dblink);
2218: END IF;
2219:
2212: msc_sch_wb.atp_debug('Begin Get_regions_SHIPPING');
2213: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_customer_site_id : ' || p_customer_site_id);
2214: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_calling_module : ' || p_calling_module);
2215: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_instance_id : ' || p_instance_id);
2216: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_session_id : ' || p_session_id);
2217: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_dblink : ' || p_dblink);
2218: END IF;
2219:
2220: x_return_status := FND_API.G_RET_STS_SUCCESS;
2213: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_customer_site_id : ' || p_customer_site_id);
2214: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_calling_module : ' || p_calling_module);
2215: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_instance_id : ' || p_instance_id);
2216: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_session_id : ' || p_session_id);
2217: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'p_dblink : ' || p_dblink);
2218: END IF;
2219:
2220: x_return_status := FND_API.G_RET_STS_SUCCESS;
2221: -- Always use destination table if supplier site is passed
2227: IF p_dblink IS NOT NULL THEN
2228: l_dynstring := '@'||p_dblink;
2229: END IF;
2230: IF PG_DEBUG in ('Y', 'C') THEN
2231: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'l_dynstring: ' || l_dynstring);
2232: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'New Code starting ');
2233: END IF;
2234: if (p_customer_site_id <> -1) THEN
2235: --process as usual
2228: l_dynstring := '@'||p_dblink;
2229: END IF;
2230: IF PG_DEBUG in ('Y', 'C') THEN
2231: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'l_dynstring: ' || l_dynstring);
2232: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'New Code starting ');
2233: END IF;
2234: if (p_customer_site_id <> -1) THEN
2235: --process as usual
2236: IF PG_DEBUG in ('Y', 'C') THEN
2233: END IF;
2234: if (p_customer_site_id <> -1) THEN
2235: --process as usual
2236: IF PG_DEBUG in ('Y', 'C') THEN
2237: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Customer_Site_id is populated : ' || p_customer_site_id);
2238: END IF;
2239: --bug 2744106: chnage hard coded stings to bind variables
2240: -- bug 2974334. Change the SQL into static if dbink is null.
2241:
2309: AND WRL.location_source = l_HZ
2310: AND WRL.region_id is not null; -- 2837468
2311:
2312: IF PG_DEBUG in ('Y', 'C') THEN
2313: msc_sch_wb.atp_debug('Row Count := ' || SQL%ROWCOUNT);
2314: END IF;
2315:
2316: ELSIF (NVL(p_party_site_id, -1) <> -1) THEN --2814895, only adding it if nvl(p_calling_module,-99) <> 724
2317:
2327: AND WRL.location_source = l_HZ
2328: AND WRL.region_id is not null;
2329:
2330: IF PG_DEBUG in ('Y', 'C') THEN --2814895
2331: msc_sch_wb.atp_debug('Row Count := ' || SQL%ROWCOUNT);
2332: END IF;
2333: else
2334: IF PG_DEBUG in ('Y', 'C') THEN
2335: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Going by the location ID');
2331: msc_sch_wb.atp_debug('Row Count := ' || SQL%ROWCOUNT);
2332: END IF;
2333: else
2334: IF PG_DEBUG in ('Y', 'C') THEN
2335: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Going by the location ID');
2336: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Location ID : ' ||p_location_id);
2337: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Location Src: ' || p_location_source);
2338: END IF;
2339:
2332: END IF;
2333: else
2334: IF PG_DEBUG in ('Y', 'C') THEN
2335: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Going by the location ID');
2336: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Location ID : ' ||p_location_id);
2337: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Location Src: ' || p_location_source);
2338: END IF;
2339:
2340: -- bug 2974334. Change the SQL into static if dbink is null
2333: else
2334: IF PG_DEBUG in ('Y', 'C') THEN
2335: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Going by the location ID');
2336: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Location ID : ' ||p_location_id);
2337: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Location Src: ' || p_location_source);
2338: END IF;
2339:
2340: -- bug 2974334. Change the SQL into static if dbink is null
2341: /* 3425497: first insert locally.
2355: AND location_source = :p_location_source
2356: AND region_id is not null'; --2837468
2357:
2358: IF PG_DEBUG in ('Y', 'C') THEN
2359: msc_sch_wb.atp_debug ('Get_Regions_Shipping: ' || 'l_stmt = ' || l_stmt);
2360: END IF;
2361:
2362: EXECUTE immediate l_stmt
2363: using p_session_id, l_NO, p_location_id, p_location_source;
2384: AND location_source = p_location_source
2385: AND region_id is not null; --2837468
2386:
2387: IF PG_DEBUG in ('Y', 'C') THEN
2388: msc_sch_wb.atp_debug('Row Count := ' || SQL%ROWCOUNT);
2389: END IF;
2390: END if;
2391:
2392: --- RMEHRA : Sql Performance Tuning
2417: AND c.partner_type = :partner_type1'; -- For supplier intransit LT project
2418:
2419:
2420: IF PG_DEBUG in ('Y', 'C') THEN
2421: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'l_stmt : ' || l_stmt);
2422: END IF;
2423:
2424:
2425: EXECUTE immediate l_stmt using p_session_id, p_customer_site_id, l_YES,
2469: AND c.partner_site_id = decode(l_partner_type, l_customer_type, p_customer_site_id, p_party_site_id) --2814895
2470: AND c.partner_type = l_partner_type; -- 2814895 -- For supplier intransit LT project
2471:
2472: IF PG_DEBUG in ('Y', 'C') THEN
2473: msc_sch_wb.atp_debug('Row Count := ' || SQL%ROWCOUNT);
2474: END IF;
2475: /*bug3520746 do not push the data across dblink
2476: --bug 3425497: Now if dblink is not null then transfer the data across dblink
2477: IF p_dblink IS NOT NULL THEN
2481: select SESSION_ID, PARTNER_SITE_ID, REGION_ID, REGION_TYPE, ZONE_FLAG, PARTNER_TYPE
2482: from msc_regions_temp
2483: where session_id = :p_session_id';
2484: IF PG_DEBUG in ('Y', 'C') THEN
2485: msc_sch_wb.atp_debug('l_stmt:= ' || l_stmt);
2486: END IF;
2487:
2488: execute immediate l_stmt using p_session_id;
2489: IF PG_DEBUG in ('Y', 'C') THEN
2486: END IF;
2487:
2488: execute immediate l_stmt using p_session_id;
2489: IF PG_DEBUG in ('Y', 'C') THEN
2490: msc_sch_wb.atp_debug('Row Count := ' || SQL%ROWCOUNT);
2491: END IF;
2492:
2493: --now delete the data locally
2494: delete msc_regions_temp where session_id = p_session_id;
2496: */
2497: EXCEPTION
2498: WHEN DUP_VAL_ON_INDEX THEN
2499: IF PG_DEBUG in ('Y', 'C') THEN
2500: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Regions for this customer are already there in the temp table');
2501: END IF;
2502: END;
2503: ELSE -- IF p_calling_module <> 724 AND nvl(p_supplier_site_id,-1)=-1 THEN
2504:
2598: EXCEPTION
2599: -- Bug 2837366 : krajan : Catch exception
2600: WHEN DUP_VAL_ON_INDEX THEN
2601: IF PG_DEBUG in ('Y', 'C') THEN
2602: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Regions for this customer are already there in the temp table');
2603: END IF;
2604: WHEN NO_DATA_FOUND THEN
2605: IF PG_DEBUG in ('Y', 'C') THEN
2606: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Customer with following customer_site_id does not exist: ');
2602: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Regions for this customer are already there in the temp table');
2603: END IF;
2604: WHEN NO_DATA_FOUND THEN
2605: IF PG_DEBUG in ('Y', 'C') THEN
2606: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Customer with following customer_site_id does not exist: ');
2607: END IF;
2608: END;
2609:
2610: ELSE -- IF nvl(p_customer_site_id,-1) <> -1 THEN -- For supplier intransit LT project
2624: and sr_instance_id = p_instance_id;
2625: EXCEPTION
2626: WHEN DUP_VAL_ON_INDEX THEN
2627: IF PG_DEBUG in ('Y', 'C') THEN
2628: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Regions for this supplier are already there in the temp table');
2629: END IF;
2630: WHEN NO_DATA_FOUND THEN
2631: IF PG_DEBUG in ('Y', 'C') THEN
2632: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Region data for the following supplier_site_id does not exist: ' || p_supplier_site_id);
2628: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Regions for this supplier are already there in the temp table');
2629: END IF;
2630: WHEN NO_DATA_FOUND THEN
2631: IF PG_DEBUG in ('Y', 'C') THEN
2632: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Region data for the following supplier_site_id does not exist: ' || p_supplier_site_id);
2633: END IF;
2634: END;
2635:
2636: END IF; -- IF nvl(p_customer_site_id,-1) <> -1 THEN -- For supplier intransit LT project
2638: END IF;
2639: EXCEPTION
2640: WHEN NO_DATA_FOUND THEN
2641: IF PG_DEBUG in ('Y', 'C') THEN
2642: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Customer with following customer_site_id does not exist: ' || p_customer_site_id);
2643: END IF;
2644: return;
2645: WHEN OTHERS THEN
2646: IF (SQLCODE = -942) THEN
2644: return;
2645: WHEN OTHERS THEN
2646: IF (SQLCODE = -942) THEN
2647: IF PG_DEBUG in ('Y', 'C') THEN
2648: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Table/View doesnt exist');
2649: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Continue as normal');
2650: END IF;
2651: return;
2652: ELSE
2645: WHEN OTHERS THEN
2646: IF (SQLCODE = -942) THEN
2647: IF PG_DEBUG in ('Y', 'C') THEN
2648: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Table/View doesnt exist');
2649: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Continue as normal');
2650: END IF;
2651: return;
2652: ELSE
2653: IF PG_DEBUG in ('Y', 'C') THEN
2650: END IF;
2651: return;
2652: ELSE
2653: IF PG_DEBUG in ('Y', 'C') THEN
2654: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'sqlcode : ' || sqlcode || ' : ' || sqlerrm);
2655: msc_sch_wb.atp_debug('sqlcode : ' || sqlcode || ' : ' || sqlerrm);
2656: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Error for Customer with customer_site_id : ' || p_customer_site_id);
2657: END IF;
2658: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2651: return;
2652: ELSE
2653: IF PG_DEBUG in ('Y', 'C') THEN
2654: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'sqlcode : ' || sqlcode || ' : ' || sqlerrm);
2655: msc_sch_wb.atp_debug('sqlcode : ' || sqlcode || ' : ' || sqlerrm);
2656: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Error for Customer with customer_site_id : ' || p_customer_site_id);
2657: END IF;
2658: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2659:
2652: ELSE
2653: IF PG_DEBUG in ('Y', 'C') THEN
2654: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'sqlcode : ' || sqlcode || ' : ' || sqlerrm);
2655: msc_sch_wb.atp_debug('sqlcode : ' || sqlcode || ' : ' || sqlerrm);
2656: msc_sch_wb.atp_debug('Get_Regions_Shipping: ' || 'Error for Customer with customer_site_id : ' || p_customer_site_id);
2657: END IF;
2658: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2659:
2660: --bug 3425497: delete data from local table
2712:
2713: BEGIN
2714:
2715: IF PG_DEBUG in ('Y', 'C') THEN
2716: msc_sch_wb.atp_debug('********** get_src_transit_time **********');
2717: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'org from: ' || p_from_org_id ||
2718: ' to: ' || p_to_org_id);
2719: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'loc from: ' || p_from_loc_id ||
2720: ' to: ' || p_to_loc_id);
2713: BEGIN
2714:
2715: IF PG_DEBUG in ('Y', 'C') THEN
2716: msc_sch_wb.atp_debug('********** get_src_transit_time **********');
2717: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'org from: ' || p_from_org_id ||
2718: ' to: ' || p_to_org_id);
2719: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'loc from: ' || p_from_loc_id ||
2720: ' to: ' || p_to_loc_id);
2721: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'session_id: ' || p_session_id);
2715: IF PG_DEBUG in ('Y', 'C') THEN
2716: msc_sch_wb.atp_debug('********** get_src_transit_time **********');
2717: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'org from: ' || p_from_org_id ||
2718: ' to: ' || p_to_org_id);
2719: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'loc from: ' || p_from_loc_id ||
2720: ' to: ' || p_to_loc_id);
2721: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'session_id: ' || p_session_id);
2722: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'partner_site: ' || p_partner_site_id);
2723: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'ship method: ' || x_ship_method);
2717: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'org from: ' || p_from_org_id ||
2718: ' to: ' || p_to_org_id);
2719: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'loc from: ' || p_from_loc_id ||
2720: ' to: ' || p_to_loc_id);
2721: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'session_id: ' || p_session_id);
2722: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'partner_site: ' || p_partner_site_id);
2723: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'ship method: ' || x_ship_method);
2724: END IF;
2725:
2718: ' to: ' || p_to_org_id);
2719: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'loc from: ' || p_from_loc_id ||
2720: ' to: ' || p_to_loc_id);
2721: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'session_id: ' || p_session_id);
2722: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'partner_site: ' || p_partner_site_id);
2723: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'ship method: ' || x_ship_method);
2724: END IF;
2725:
2726:
2719: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'loc from: ' || p_from_loc_id ||
2720: ' to: ' || p_to_loc_id);
2721: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'session_id: ' || p_session_id);
2722: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'partner_site: ' || p_partner_site_id);
2723: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'ship method: ' || x_ship_method);
2724: END IF;
2725:
2726:
2727: -- if the receipt org or the ship method is NULL
2747: AND rownum = 1;
2748: END IF;
2749: EXCEPTION WHEN NO_DATA_FOUND THEN
2750: IF PG_DEBUG in ('Y', 'C') THEN
2751: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'Using region level transit times');
2752: END IF;
2753: IF x_ship_method IS NOT NULL THEN
2754: OPEN c_lead_time;
2755: FETCH c_lead_time INTO x_intransit_time, l_level;
2811: END IF;*/
2812: END IF;
2813:
2814: IF PG_DEBUG in ('Y', 'C') THEN
2815: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'transit_time:' || x_intransit_time);
2816: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'ship_method:' || x_ship_method);
2817: END IF;
2818:
2819: END get_src_transit_time;
2812: END IF;
2813:
2814: IF PG_DEBUG in ('Y', 'C') THEN
2815: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'transit_time:' || x_intransit_time);
2816: msc_sch_wb.atp_debug('get_src_transit_time: ' || 'ship_method:' || x_ship_method);
2817: END IF;
2818:
2819: END get_src_transit_time;
2820:
2845:
2846: l_temp_var number;
2847: BEGIN
2848: if PG_DEBUG in ('Y','C') then
2849: msc_sch_wb.atp_debug ('---------------Get Regions..................');
2850: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
2851: msc_sch_wb.atp_debug (' Calling Module : ' || p_calling_module);
2852: msc_sch_wb.atp_debug (' Instance ID : ' || p_instance_id);
2853: msc_sch_wb.atp_debug (' Session ID : ' || p_session_id);
2846: l_temp_var number;
2847: BEGIN
2848: if PG_DEBUG in ('Y','C') then
2849: msc_sch_wb.atp_debug ('---------------Get Regions..................');
2850: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
2851: msc_sch_wb.atp_debug (' Calling Module : ' || p_calling_module);
2852: msc_sch_wb.atp_debug (' Instance ID : ' || p_instance_id);
2853: msc_sch_wb.atp_debug (' Session ID : ' || p_session_id);
2854: msc_sch_wb.atp_debug (' DB Link : ' || p_dblink);
2847: BEGIN
2848: if PG_DEBUG in ('Y','C') then
2849: msc_sch_wb.atp_debug ('---------------Get Regions..................');
2850: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
2851: msc_sch_wb.atp_debug (' Calling Module : ' || p_calling_module);
2852: msc_sch_wb.atp_debug (' Instance ID : ' || p_instance_id);
2853: msc_sch_wb.atp_debug (' Session ID : ' || p_session_id);
2854: msc_sch_wb.atp_debug (' DB Link : ' || p_dblink);
2855: msc_sch_wb.atp_debug (' Location ID : ' || p_location_id);
2848: if PG_DEBUG in ('Y','C') then
2849: msc_sch_wb.atp_debug ('---------------Get Regions..................');
2850: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
2851: msc_sch_wb.atp_debug (' Calling Module : ' || p_calling_module);
2852: msc_sch_wb.atp_debug (' Instance ID : ' || p_instance_id);
2853: msc_sch_wb.atp_debug (' Session ID : ' || p_session_id);
2854: msc_sch_wb.atp_debug (' DB Link : ' || p_dblink);
2855: msc_sch_wb.atp_debug (' Location ID : ' || p_location_id);
2856: msc_sch_wb.atp_debug (' Location source : ' || p_location_source );
2849: msc_sch_wb.atp_debug ('---------------Get Regions..................');
2850: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
2851: msc_sch_wb.atp_debug (' Calling Module : ' || p_calling_module);
2852: msc_sch_wb.atp_debug (' Instance ID : ' || p_instance_id);
2853: msc_sch_wb.atp_debug (' Session ID : ' || p_session_id);
2854: msc_sch_wb.atp_debug (' DB Link : ' || p_dblink);
2855: msc_sch_wb.atp_debug (' Location ID : ' || p_location_id);
2856: msc_sch_wb.atp_debug (' Location source : ' || p_location_source );
2857: end if;
2850: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
2851: msc_sch_wb.atp_debug (' Calling Module : ' || p_calling_module);
2852: msc_sch_wb.atp_debug (' Instance ID : ' || p_instance_id);
2853: msc_sch_wb.atp_debug (' Session ID : ' || p_session_id);
2854: msc_sch_wb.atp_debug (' DB Link : ' || p_dblink);
2855: msc_sch_wb.atp_debug (' Location ID : ' || p_location_id);
2856: msc_sch_wb.atp_debug (' Location source : ' || p_location_source );
2857: end if;
2858:
2851: msc_sch_wb.atp_debug (' Calling Module : ' || p_calling_module);
2852: msc_sch_wb.atp_debug (' Instance ID : ' || p_instance_id);
2853: msc_sch_wb.atp_debug (' Session ID : ' || p_session_id);
2854: msc_sch_wb.atp_debug (' DB Link : ' || p_dblink);
2855: msc_sch_wb.atp_debug (' Location ID : ' || p_location_id);
2856: msc_sch_wb.atp_debug (' Location source : ' || p_location_source );
2857: end if;
2858:
2859: l_api_to_use := 1;
2852: msc_sch_wb.atp_debug (' Instance ID : ' || p_instance_id);
2853: msc_sch_wb.atp_debug (' Session ID : ' || p_session_id);
2854: msc_sch_wb.atp_debug (' DB Link : ' || p_dblink);
2855: msc_sch_wb.atp_debug (' Location ID : ' || p_location_id);
2856: msc_sch_wb.atp_debug (' Location source : ' || p_location_source );
2857: end if;
2858:
2859: l_api_to_use := 1;
2860:
2887: end if;
2888: exception
2889: when others then
2890: IF PG_DEBUG in ('Y', 'C') THEN
2891: msc_sch_wb.atp_debug ('Get_Regions: ' || 'Error Code : ' || sqlerrm);
2892: msc_sch_wb.atp_debug ('Get_REgions API: Unable to get status of msc(wsh)_region_locations');
2893: msc_sch_wb.atp_debug ('Get Regions API: Switching to OLD get_regions');
2894: END IF;
2895: l_api_to_use := 2;
2888: exception
2889: when others then
2890: IF PG_DEBUG in ('Y', 'C') THEN
2891: msc_sch_wb.atp_debug ('Get_Regions: ' || 'Error Code : ' || sqlerrm);
2892: msc_sch_wb.atp_debug ('Get_REgions API: Unable to get status of msc(wsh)_region_locations');
2893: msc_sch_wb.atp_debug ('Get Regions API: Switching to OLD get_regions');
2894: END IF;
2895: l_api_to_use := 2;
2896: end;
2889: when others then
2890: IF PG_DEBUG in ('Y', 'C') THEN
2891: msc_sch_wb.atp_debug ('Get_Regions: ' || 'Error Code : ' || sqlerrm);
2892: msc_sch_wb.atp_debug ('Get_REgions API: Unable to get status of msc(wsh)_region_locations');
2893: msc_sch_wb.atp_debug ('Get Regions API: Switching to OLD get_regions');
2894: END IF;
2895: l_api_to_use := 2;
2896: end;
2897: end if;
2896: end;
2897: end if;
2898:
2899: IF PG_DEBUG in ('Y', 'C') THEN
2900: msc_sch_wb.atp_debug ('Get_Regions API: API to Use : ' || l_api_to_use);
2901: END IF;
2902: if (l_api_to_use = 1) then
2903: MSC_SATP_FUNC.Get_Regions_shipping (
2904: p_customer_site_id,
2955:
2956: BEGIN
2957:
2958: IF PG_DEBUG in ('Y', 'C') THEN
2959: msc_sch_wb.atp_debug('***** Begin New_Extend_Atp Procedure *****');
2960: END IF;
2961:
2962: x_return_status := FND_API.G_RET_STS_SUCCESS;
2963:
3832:
3833: EXCEPTION
3834: when others then
3835: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3836: msc_sch_wb.atp_debug ('Exception in New extend');
3837: msc_sch_wb.atp_debug ('Sqlcode ' || sqlcode);
3838: msc_sch_wb.atp_debug ('Sqlerr ' || sqlerrm);
3839: END new_extend_atp;
3840:
3833: EXCEPTION
3834: when others then
3835: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3836: msc_sch_wb.atp_debug ('Exception in New extend');
3837: msc_sch_wb.atp_debug ('Sqlcode ' || sqlcode);
3838: msc_sch_wb.atp_debug ('Sqlerr ' || sqlerrm);
3839: END new_extend_atp;
3840:
3841: /*--------------------------------------------------------------------------
3834: when others then
3835: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3836: msc_sch_wb.atp_debug ('Exception in New extend');
3837: msc_sch_wb.atp_debug ('Sqlcode ' || sqlcode);
3838: msc_sch_wb.atp_debug ('Sqlerr ' || sqlerrm);
3839: END new_extend_atp;
3840:
3841: /*--------------------------------------------------------------------------
3842: | Begin Functions added for ship_rec_cal project
3856: l_calendar_type VARCHAR2(15); -- Bug 3449812
3857:
3858: BEGIN
3859: IF PG_DEBUG in ('Y','C') THEN
3860: msc_sch_wb.atp_debug ('***** Begin Function Src_Get_Calendar_Code *****');
3861: msc_sch_wb.atp_debug ('________________Input________________');
3862: msc_sch_wb.atp_debug (' Customer ID : ' || p_customer_id );
3863: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
3864: msc_sch_wb.atp_debug (' Organization ID : ' || p_organization_id);
3857:
3858: BEGIN
3859: IF PG_DEBUG in ('Y','C') THEN
3860: msc_sch_wb.atp_debug ('***** Begin Function Src_Get_Calendar_Code *****');
3861: msc_sch_wb.atp_debug ('________________Input________________');
3862: msc_sch_wb.atp_debug (' Customer ID : ' || p_customer_id );
3863: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
3864: msc_sch_wb.atp_debug (' Organization ID : ' || p_organization_id);
3865: msc_sch_wb.atp_debug (' Ship Method Code : ' || p_ship_method_code);
3858: BEGIN
3859: IF PG_DEBUG in ('Y','C') THEN
3860: msc_sch_wb.atp_debug ('***** Begin Function Src_Get_Calendar_Code *****');
3861: msc_sch_wb.atp_debug ('________________Input________________');
3862: msc_sch_wb.atp_debug (' Customer ID : ' || p_customer_id );
3863: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
3864: msc_sch_wb.atp_debug (' Organization ID : ' || p_organization_id);
3865: msc_sch_wb.atp_debug (' Ship Method Code : ' || p_ship_method_code);
3866: msc_sch_wb.atp_debug (' Calendar Type : ' || p_calendar_type);
3859: IF PG_DEBUG in ('Y','C') THEN
3860: msc_sch_wb.atp_debug ('***** Begin Function Src_Get_Calendar_Code *****');
3861: msc_sch_wb.atp_debug ('________________Input________________');
3862: msc_sch_wb.atp_debug (' Customer ID : ' || p_customer_id );
3863: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
3864: msc_sch_wb.atp_debug (' Organization ID : ' || p_organization_id);
3865: msc_sch_wb.atp_debug (' Ship Method Code : ' || p_ship_method_code);
3866: msc_sch_wb.atp_debug (' Calendar Type : ' || p_calendar_type);
3867: msc_sch_wb.atp_debug (' G_USE_SHIP_REC_CAL : ' || MSC_ATP_PVT.G_USE_SHIP_REC_CAL);
3860: msc_sch_wb.atp_debug ('***** Begin Function Src_Get_Calendar_Code *****');
3861: msc_sch_wb.atp_debug ('________________Input________________');
3862: msc_sch_wb.atp_debug (' Customer ID : ' || p_customer_id );
3863: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
3864: msc_sch_wb.atp_debug (' Organization ID : ' || p_organization_id);
3865: msc_sch_wb.atp_debug (' Ship Method Code : ' || p_ship_method_code);
3866: msc_sch_wb.atp_debug (' Calendar Type : ' || p_calendar_type);
3867: msc_sch_wb.atp_debug (' G_USE_SHIP_REC_CAL : ' || MSC_ATP_PVT.G_USE_SHIP_REC_CAL);
3868: msc_sch_wb.atp_debug (' ');
3861: msc_sch_wb.atp_debug ('________________Input________________');
3862: msc_sch_wb.atp_debug (' Customer ID : ' || p_customer_id );
3863: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
3864: msc_sch_wb.atp_debug (' Organization ID : ' || p_organization_id);
3865: msc_sch_wb.atp_debug (' Ship Method Code : ' || p_ship_method_code);
3866: msc_sch_wb.atp_debug (' Calendar Type : ' || p_calendar_type);
3867: msc_sch_wb.atp_debug (' G_USE_SHIP_REC_CAL : ' || MSC_ATP_PVT.G_USE_SHIP_REC_CAL);
3868: msc_sch_wb.atp_debug (' ');
3869: END IF;
3862: msc_sch_wb.atp_debug (' Customer ID : ' || p_customer_id );
3863: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
3864: msc_sch_wb.atp_debug (' Organization ID : ' || p_organization_id);
3865: msc_sch_wb.atp_debug (' Ship Method Code : ' || p_ship_method_code);
3866: msc_sch_wb.atp_debug (' Calendar Type : ' || p_calendar_type);
3867: msc_sch_wb.atp_debug (' G_USE_SHIP_REC_CAL : ' || MSC_ATP_PVT.G_USE_SHIP_REC_CAL);
3868: msc_sch_wb.atp_debug (' ');
3869: END IF;
3870:
3863: msc_sch_wb.atp_debug (' Customer Site ID : ' || p_customer_site_id );
3864: msc_sch_wb.atp_debug (' Organization ID : ' || p_organization_id);
3865: msc_sch_wb.atp_debug (' Ship Method Code : ' || p_ship_method_code);
3866: msc_sch_wb.atp_debug (' Calendar Type : ' || p_calendar_type);
3867: msc_sch_wb.atp_debug (' G_USE_SHIP_REC_CAL : ' || MSC_ATP_PVT.G_USE_SHIP_REC_CAL);
3868: msc_sch_wb.atp_debug (' ');
3869: END IF;
3870:
3871: -- Bug 3647208 - Move the check inside individual "IF"s
3864: msc_sch_wb.atp_debug (' Organization ID : ' || p_organization_id);
3865: msc_sch_wb.atp_debug (' Ship Method Code : ' || p_ship_method_code);
3866: msc_sch_wb.atp_debug (' Calendar Type : ' || p_calendar_type);
3867: msc_sch_wb.atp_debug (' G_USE_SHIP_REC_CAL : ' || MSC_ATP_PVT.G_USE_SHIP_REC_CAL);
3868: msc_sch_wb.atp_debug (' ');
3869: END IF;
3870:
3871: -- Bug 3647208 - Move the check inside individual "IF"s
3872: -- IF MSC_ATP_PVT.G_USE_SHIP_REC_CAL='Y' THEN
3952:
3953: -- Bug 3647208 - For b/w compatibility use OMC instead of ORC/OSC
3954: -- Raise exception so that the OMC query gets executed.
3955: IF PG_DEBUG in ('Y','C') THEN
3956: msc_sch_wb.atp_debug ('Src_Get_Calendar_Code :' || ' Use OMC instead on ORC/OSC');
3957: END IF;
3958: RAISE NO_DATA_FOUND;
3959:
3960: END IF;
3980:
3981: END IF;
3982:
3983: IF PG_DEBUG in ('Y','C') THEN
3984: msc_sch_wb.atp_debug ('________________Output________________');
3985: msc_sch_wb.atp_debug (' Calendar Code : ' || l_calendar_code);
3986: msc_sch_wb.atp_debug (' ');
3987: END IF;
3988:
3981: END IF;
3982:
3983: IF PG_DEBUG in ('Y','C') THEN
3984: msc_sch_wb.atp_debug ('________________Output________________');
3985: msc_sch_wb.atp_debug (' Calendar Code : ' || l_calendar_code);
3986: msc_sch_wb.atp_debug (' ');
3987: END IF;
3988:
3989: RETURN l_calendar_code;
3982:
3983: IF PG_DEBUG in ('Y','C') THEN
3984: msc_sch_wb.atp_debug ('________________Output________________');
3985: msc_sch_wb.atp_debug (' Calendar Code : ' || l_calendar_code);
3986: msc_sch_wb.atp_debug (' ');
3987: END IF;
3988:
3989: RETURN l_calendar_code;
3990:
4000: AND CALENDAR_EXCEPTION_SET_ID = -1;
4001: END IF;
4002:
4003: IF PG_DEBUG in ('Y','C') THEN
4004: msc_sch_wb.atp_debug ('****** No Data Found Exception *******');
4005: msc_sch_wb.atp_debug ('________________Output________________');
4006: msc_sch_wb.atp_debug (' Calendar Code : ' || l_calendar_code);
4007: msc_sch_wb.atp_debug (' ');
4008: END IF;
4001: END IF;
4002:
4003: IF PG_DEBUG in ('Y','C') THEN
4004: msc_sch_wb.atp_debug ('****** No Data Found Exception *******');
4005: msc_sch_wb.atp_debug ('________________Output________________');
4006: msc_sch_wb.atp_debug (' Calendar Code : ' || l_calendar_code);
4007: msc_sch_wb.atp_debug (' ');
4008: END IF;
4009:
4002:
4003: IF PG_DEBUG in ('Y','C') THEN
4004: msc_sch_wb.atp_debug ('****** No Data Found Exception *******');
4005: msc_sch_wb.atp_debug ('________________Output________________');
4006: msc_sch_wb.atp_debug (' Calendar Code : ' || l_calendar_code);
4007: msc_sch_wb.atp_debug (' ');
4008: END IF;
4009:
4010: RETURN l_calendar_code;
4003: IF PG_DEBUG in ('Y','C') THEN
4004: msc_sch_wb.atp_debug ('****** No Data Found Exception *******');
4005: msc_sch_wb.atp_debug ('________________Output________________');
4006: msc_sch_wb.atp_debug (' Calendar Code : ' || l_calendar_code);
4007: msc_sch_wb.atp_debug (' ');
4008: END IF;
4009:
4010: RETURN l_calendar_code;
4011:
4270: l_output_date DATE := NULL;
4271:
4272: BEGIN
4273: IF PG_DEBUG in ('Y','C') THEN
4274: msc_sch_wb.atp_debug ('***** Begin Function THREE_STEP_CAL_OFFSET_DATE *****');
4275: msc_sch_wb.atp_debug ('________________Input________________');
4276: msc_sch_wb.atp_debug (' Input Date : ' || p_input_date );
4277: msc_sch_wb.atp_debug (' First Cal Code : ' || p_first_cal_code );
4278: msc_sch_wb.atp_debug (' Second Cal Code : ' || p_second_cal_code );
4271:
4272: BEGIN
4273: IF PG_DEBUG in ('Y','C') THEN
4274: msc_sch_wb.atp_debug ('***** Begin Function THREE_STEP_CAL_OFFSET_DATE *****');
4275: msc_sch_wb.atp_debug ('________________Input________________');
4276: msc_sch_wb.atp_debug (' Input Date : ' || p_input_date );
4277: msc_sch_wb.atp_debug (' First Cal Code : ' || p_first_cal_code );
4278: msc_sch_wb.atp_debug (' Second Cal Code : ' || p_second_cal_code );
4279: msc_sch_wb.atp_debug (' Third Cal Code : ' || p_third_cal_code );
4272: BEGIN
4273: IF PG_DEBUG in ('Y','C') THEN
4274: msc_sch_wb.atp_debug ('***** Begin Function THREE_STEP_CAL_OFFSET_DATE *****');
4275: msc_sch_wb.atp_debug ('________________Input________________');
4276: msc_sch_wb.atp_debug (' Input Date : ' || p_input_date );
4277: msc_sch_wb.atp_debug (' First Cal Code : ' || p_first_cal_code );
4278: msc_sch_wb.atp_debug (' Second Cal Code : ' || p_second_cal_code );
4279: msc_sch_wb.atp_debug (' Third Cal Code : ' || p_third_cal_code );
4280: msc_sch_wb.atp_debug (' Days Offset : ' || p_offset_days );
4273: IF PG_DEBUG in ('Y','C') THEN
4274: msc_sch_wb.atp_debug ('***** Begin Function THREE_STEP_CAL_OFFSET_DATE *****');
4275: msc_sch_wb.atp_debug ('________________Input________________');
4276: msc_sch_wb.atp_debug (' Input Date : ' || p_input_date );
4277: msc_sch_wb.atp_debug (' First Cal Code : ' || p_first_cal_code );
4278: msc_sch_wb.atp_debug (' Second Cal Code : ' || p_second_cal_code );
4279: msc_sch_wb.atp_debug (' Third Cal Code : ' || p_third_cal_code );
4280: msc_sch_wb.atp_debug (' Days Offset : ' || p_offset_days );
4281: msc_sch_wb.atp_debug (' ');
4274: msc_sch_wb.atp_debug ('***** Begin Function THREE_STEP_CAL_OFFSET_DATE *****');
4275: msc_sch_wb.atp_debug ('________________Input________________');
4276: msc_sch_wb.atp_debug (' Input Date : ' || p_input_date );
4277: msc_sch_wb.atp_debug (' First Cal Code : ' || p_first_cal_code );
4278: msc_sch_wb.atp_debug (' Second Cal Code : ' || p_second_cal_code );
4279: msc_sch_wb.atp_debug (' Third Cal Code : ' || p_third_cal_code );
4280: msc_sch_wb.atp_debug (' Days Offset : ' || p_offset_days );
4281: msc_sch_wb.atp_debug (' ');
4282: END IF;
4275: msc_sch_wb.atp_debug ('________________Input________________');
4276: msc_sch_wb.atp_debug (' Input Date : ' || p_input_date );
4277: msc_sch_wb.atp_debug (' First Cal Code : ' || p_first_cal_code );
4278: msc_sch_wb.atp_debug (' Second Cal Code : ' || p_second_cal_code );
4279: msc_sch_wb.atp_debug (' Third Cal Code : ' || p_third_cal_code );
4280: msc_sch_wb.atp_debug (' Days Offset : ' || p_offset_days );
4281: msc_sch_wb.atp_debug (' ');
4282: END IF;
4283: -- First date is computed using p_input_date, first calendar and its validation_type
4276: msc_sch_wb.atp_debug (' Input Date : ' || p_input_date );
4277: msc_sch_wb.atp_debug (' First Cal Code : ' || p_first_cal_code );
4278: msc_sch_wb.atp_debug (' Second Cal Code : ' || p_second_cal_code );
4279: msc_sch_wb.atp_debug (' Third Cal Code : ' || p_third_cal_code );
4280: msc_sch_wb.atp_debug (' Days Offset : ' || p_offset_days );
4281: msc_sch_wb.atp_debug (' ');
4282: END IF;
4283: -- First date is computed using p_input_date, first calendar and its validation_type
4284: IF p_first_cal_code = MSC_CALENDAR.FOC THEN
4277: msc_sch_wb.atp_debug (' First Cal Code : ' || p_first_cal_code );
4278: msc_sch_wb.atp_debug (' Second Cal Code : ' || p_second_cal_code );
4279: msc_sch_wb.atp_debug (' Third Cal Code : ' || p_third_cal_code );
4280: msc_sch_wb.atp_debug (' Days Offset : ' || p_offset_days );
4281: msc_sch_wb.atp_debug (' ');
4282: END IF;
4283: -- First date is computed using p_input_date, first calendar and its validation_type
4284: IF p_first_cal_code = MSC_CALENDAR.FOC THEN
4285: l_first_date := p_input_date;
4295: l_first_date := p_input_date;
4296: END IF;
4297:
4298: IF PG_DEBUG in ('Y','C') THEN
4299: msc_sch_wb.atp_debug (' Date after validation on first cal: ' || l_first_date );
4300: END IF;
4301:
4302: -- Second date is computed using first date, 2nd calendar and offset days
4303: IF (p_offset_days = 0) and (p_second_cal_code = MSC_CALENDAR.FOC) THEN
4338: l_second_date := l_first_date;
4339: END IF;
4340:
4341: IF PG_DEBUG in ('Y','C') THEN
4342: msc_sch_wb.atp_debug (' Date after offset using second cal: ' || l_second_date );
4343: END IF;
4344:
4345: -- Third date = Output Date is computed using 2nd date, 3rd calendar and validation_type
4346: IF p_third_cal_code = MSC_CALENDAR.FOC THEN
4357: l_output_date := l_second_date;
4358: END IF;
4359:
4360: IF PG_DEBUG in ('Y','C') THEN
4361: msc_sch_wb.atp_debug (' Date after validation on third cal: ' || l_output_date );
4362: END IF;
4363:
4364: RETURN l_output_date;
4365:
4381: IS
4382:
4383: Begin
4384: IF PG_DEBUG in ('Y', 'C') THEN
4385: msc_sch_wb.atp_debug('Begin get_dblink_profile');
4386: END IF;
4387:
4388: x_return_status := FND_API.G_RET_STS_SUCCESS;
4389:
4392: INTO x_instance_id, x_dblink
4393: FROM mrp_ap_apps_instances;
4394:
4395: IF PG_DEBUG in ('Y', 'C') THEN
4396: msc_sch_wb.atp_debug('get_dblink_profile: ' || 'x_instance_id := ' || NVL(x_instance_id, -1));
4397: msc_sch_wb.atp_debug('get_dblink_profile: ' || 'a2m_dblink := ' || NVL(x_dblink,'NULL'));
4398: END IF;
4399: EXCEPTION
4400: WHEN others THEN
4393: FROM mrp_ap_apps_instances;
4394:
4395: IF PG_DEBUG in ('Y', 'C') THEN
4396: msc_sch_wb.atp_debug('get_dblink_profile: ' || 'x_instance_id := ' || NVL(x_instance_id, -1));
4397: msc_sch_wb.atp_debug('get_dblink_profile: ' || 'a2m_dblink := ' || NVL(x_dblink,'NULL'));
4398: END IF;
4399: EXCEPTION
4400: WHEN others THEN
4401: -- something wrong so we want to rollback;
4399: EXCEPTION
4400: WHEN others THEN
4401: -- something wrong so we want to rollback;
4402: IF PG_DEBUG in ('Y', 'C') THEN
4403: msc_sch_wb.atp_debug('Error in mrp_ap_apps_instances : ' || sqlcode);
4404: END IF;
4405: x_return_status := FND_API.G_RET_STS_ERROR;
4406:
4407: End get_dblink_profile;
4433: l_user_id := FND_GLOBAL.USER_ID;
4434: l_count := 10; --optional_fw
4435:
4436: IF PG_DEBUG in ('Y', 'C') THEN
4437: msc_sch_wb.atp_debug('enter put_src_to_dstn_profiles');
4438: msc_sch_wb.atp_debug('put_src_to_dstn_profiles: ' || 'p_session_id := ' || p_session_id);
4439: msc_sch_wb.atp_debug('put_src_to_dstn_profiles: ' || 'l_user_id := ' || l_user_id);
4440: END IF;
4441:
4434: l_count := 10; --optional_fw
4435:
4436: IF PG_DEBUG in ('Y', 'C') THEN
4437: msc_sch_wb.atp_debug('enter put_src_to_dstn_profiles');
4438: msc_sch_wb.atp_debug('put_src_to_dstn_profiles: ' || 'p_session_id := ' || p_session_id);
4439: msc_sch_wb.atp_debug('put_src_to_dstn_profiles: ' || 'l_user_id := ' || l_user_id);
4440: END IF;
4441:
4442: -- Delete records from msc_atp_src_profile_temp in case there are any records
4435:
4436: IF PG_DEBUG in ('Y', 'C') THEN
4437: msc_sch_wb.atp_debug('enter put_src_to_dstn_profiles');
4438: msc_sch_wb.atp_debug('put_src_to_dstn_profiles: ' || 'p_session_id := ' || p_session_id);
4439: msc_sch_wb.atp_debug('put_src_to_dstn_profiles: ' || 'l_user_id := ' || l_user_id);
4440: END IF;
4441:
4442: -- Delete records from msc_atp_src_profile_temp in case there are any records
4443: -- with similar session id.
4443: -- with similar session id.
4444: Delete from msc_atp_src_profile_temp where session_id = p_session_id;
4445:
4446: IF PG_DEBUG in ('Y', 'C') THEN
4447: msc_sch_wb.atp_debug('***** After Deleting data for old session ****');
4448: msc_sch_wb.atp_debug('put_src_to_dstn_profiles: ' || 'Number of rows deleted ' || SQL%ROWCOUNT);
4449: END IF;
4450:
4451: l_profile_name.extend(l_count);
4444: Delete from msc_atp_src_profile_temp where session_id = p_session_id;
4445:
4446: IF PG_DEBUG in ('Y', 'C') THEN
4447: msc_sch_wb.atp_debug('***** After Deleting data for old session ****');
4448: msc_sch_wb.atp_debug('put_src_to_dstn_profiles: ' || 'Number of rows deleted ' || SQL%ROWCOUNT);
4449: END IF;
4450:
4451: l_profile_name.extend(l_count);
4452: l_profile_name(1) := 'MSC_ALLOCATION_METHOD';
4484: );
4485: END LOOP;
4486:
4487: IF PG_DEBUG in ('Y', 'C') THEN
4488: msc_sch_wb.atp_debug('put_src_to_dstn_profiles: ' || 'Rows inserted ' || SQL%ROWCOUNT );
4489: END IF;
4490:
4491: EXCEPTION
4492: WHEN OTHERS THEN
4490:
4491: EXCEPTION
4492: WHEN OTHERS THEN
4493: IF PG_DEBUG in ('Y', 'C') THEN
4494: msc_sch_wb.atp_debug(' Error in put_src_to_dstn_profiles '||substr(sqlerrm,1,100));
4495: END IF;
4496: x_return_status := FND_API.G_RET_STS_ERROR;
4497: END put_src_to_dstn_profiles;
4498: /*--------------------------------------------------------------------------
4521: -- initialize API returm status to success
4522: x_return_status := FND_API.G_RET_STS_SUCCESS;
4523:
4524: IF PG_DEBUG in ('Y', 'C') THEN
4525: msc_sch_wb.atp_debug('enter get_src_to_dstn_profiles');
4526: msc_sch_wb.atp_debug('get_src_to_dstn_profiles: ' || 'p_session_id := ' || p_session_id);
4527: msc_sch_wb.atp_debug('get_src_to_dstn_profiles ' || 'p_dblink := ' || NVL(p_dblink,'NULL'));
4528: END IF;
4529:
4522: x_return_status := FND_API.G_RET_STS_SUCCESS;
4523:
4524: IF PG_DEBUG in ('Y', 'C') THEN
4525: msc_sch_wb.atp_debug('enter get_src_to_dstn_profiles');
4526: msc_sch_wb.atp_debug('get_src_to_dstn_profiles: ' || 'p_session_id := ' || p_session_id);
4527: msc_sch_wb.atp_debug('get_src_to_dstn_profiles ' || 'p_dblink := ' || NVL(p_dblink,'NULL'));
4528: END IF;
4529:
4530: l_dynstring := '@'||p_dblink;
4523:
4524: IF PG_DEBUG in ('Y', 'C') THEN
4525: msc_sch_wb.atp_debug('enter get_src_to_dstn_profiles');
4526: msc_sch_wb.atp_debug('get_src_to_dstn_profiles: ' || 'p_session_id := ' || p_session_id);
4527: msc_sch_wb.atp_debug('get_src_to_dstn_profiles ' || 'p_dblink := ' || NVL(p_dblink,'NULL'));
4528: END IF;
4529:
4530: l_dynstring := '@'||p_dblink;
4531: l_user_id := FND_GLOBAL.USER_ID;
4534: -- with similar session id.
4535: Delete from msc_atp_src_profile_temp where session_id = p_session_id;
4536:
4537: IF PG_DEBUG in ('Y', 'C') THEN
4538: msc_sch_wb.atp_debug('***** After Deleting data for old session ****');
4539: msc_sch_wb.atp_debug('get_src_to_dstn_profiles: ' || 'Number of rows deleted ' || SQL%ROWCOUNT);
4540: END IF;
4541:
4542: l_sql_stmt :=
4535: Delete from msc_atp_src_profile_temp where session_id = p_session_id;
4536:
4537: IF PG_DEBUG in ('Y', 'C') THEN
4538: msc_sch_wb.atp_debug('***** After Deleting data for old session ****');
4539: msc_sch_wb.atp_debug('get_src_to_dstn_profiles: ' || 'Number of rows deleted ' || SQL%ROWCOUNT);
4540: END IF;
4541:
4542: l_sql_stmt :=
4543: 'Insert into msc_atp_src_profile_temp
4566:
4567: EXECUTE IMMEDIATE l_sql_stmt USING p_session_id;
4568:
4569: IF PG_DEBUG in ('Y', 'C') THEN
4570: msc_sch_wb.atp_debug('After Inserting the profiles in msc_atp_src_profile_temp');
4571: msc_sch_wb.atp_debug('l_sql_stmt= ' || l_sql_stmt);
4572: msc_sch_wb.atp_debug('rows inserted = ' || SQL%ROWCOUNT);
4573: END IF;
4574:
4567: EXECUTE IMMEDIATE l_sql_stmt USING p_session_id;
4568:
4569: IF PG_DEBUG in ('Y', 'C') THEN
4570: msc_sch_wb.atp_debug('After Inserting the profiles in msc_atp_src_profile_temp');
4571: msc_sch_wb.atp_debug('l_sql_stmt= ' || l_sql_stmt);
4572: msc_sch_wb.atp_debug('rows inserted = ' || SQL%ROWCOUNT);
4573: END IF;
4574:
4575: EXCEPTION
4568:
4569: IF PG_DEBUG in ('Y', 'C') THEN
4570: msc_sch_wb.atp_debug('After Inserting the profiles in msc_atp_src_profile_temp');
4571: msc_sch_wb.atp_debug('l_sql_stmt= ' || l_sql_stmt);
4572: msc_sch_wb.atp_debug('rows inserted = ' || SQL%ROWCOUNT);
4573: END IF;
4574:
4575: EXCEPTION
4576: WHEN OTHERS THEN
4574:
4575: EXCEPTION
4576: WHEN OTHERS THEN
4577: IF PG_DEBUG in ('Y', 'C') THEN
4578: msc_sch_wb.atp_debug(' Error in get_src_to_dstn_profiles '||substr(sqlerrm,1,100));
4579: END IF;
4580: x_return_status := FND_API.G_RET_STS_ERROR;
4581: END get_src_to_dstn_profiles;
4582: /*--------------------------------------------------------------------------