[Home] [Help]
8: rt_item_id NUMBER,
9: rt_category_id NUMBER);
10:
11: TYPE tTemplateItemRecord IS RECORD (
12: template_id ICX_CAT_ITEM_PRICES.template_id%TYPE,
13: rt_item_id NUMBER,
14: hash_value NUMBER);
15:
16: TYPE tTemplateItemCache IS TABLE OF tTemplateItemRecord
56: -- Global PL/SQL tables for template headers of ICX_CAT_CATEGORY_ITEMS
57: gCIRtItemIds DBMS_SQL.NUMBER_TABLE;
58: gCITemplateIds DBMS_SQL.VARCHAR2_TABLE;
59:
60: -- Global PL/SQL tables for ICX_CAT_ITEM_PRICES
61: -- Extracted price records
62: gEPRtItemIds DBMS_SQL.NUMBER_TABLE;
63: gEPActiveFlags DBMS_SQL.VARCHAR2_TABLE;
64: gEPOrgIds DBMS_SQL.NUMBER_TABLE;
1385: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, xMode));
1386: raise ICX_POR_EXT_UTL.gException;
1387: END createTempCategoryItems;
1388:
1389: -- Move data into ICX_CAT_ITEM_PRICES from ICX_POR_ORACLE_ITEM_SUBTABLE
1390: PROCEDURE moveExtractedPrices IS
1391: xErrLoc PLS_INTEGER;
1392: xReturnErr VARCHAR2(2000);
1393: xMode VARCHAR2(20) := 'EXTRACTED_PRICE';
1405: END IF;
1406:
1407: xErrLoc := 100;
1408: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
1409: 'ICX_CAT_ITEM_PRICES from ICX_POR_ORACLE_ITEM_SUBTABLE');
1410:
1411: FORALL i IN 1..gEPRtItemIds.COUNT
1412: INSERT INTO ICX_CAT_ITEM_PRICES
1413: (rt_item_id, price_type,
1408: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
1409: 'ICX_CAT_ITEM_PRICES from ICX_POR_ORACLE_ITEM_SUBTABLE');
1410:
1411: FORALL i IN 1..gEPRtItemIds.COUNT
1412: INSERT INTO ICX_CAT_ITEM_PRICES
1413: (rt_item_id, price_type,
1414: active_flag, object_version_number,
1415: asl_id, supplier_site_id,
1416: contract_id, contract_line_id,
1472: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, xMode));
1473: raise ICX_POR_EXT_UTL.gException;
1474: END moveExtractedPrices;
1475:
1476: -- Move data into ICX_CAT_ITEM_PRICES from ICX_POR_PRICE_LIST_LINES
1477: PROCEDURE moveBulkloadedPrices IS
1478: xErrLoc PLS_INTEGER;
1479: xReturnErr VARCHAR2(2000);
1480: xMode VARCHAR2(20) := 'BULKLOADED_PRICE';
1492: END LOOP;
1493: END IF;
1494:
1495: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
1496: 'ICX_CAT_ITEM_PRICES from ICX_POR_PRICE_LIST_LINES');
1497:
1498: xErrLoc := 200;
1499: FORALL i IN 1..gBPRtItemIds.COUNT
1500: INSERT INTO ICX_CAT_ITEM_PRICES
1496: 'ICX_CAT_ITEM_PRICES from ICX_POR_PRICE_LIST_LINES');
1497:
1498: xErrLoc := 200;
1499: FORALL i IN 1..gBPRtItemIds.COUNT
1500: INSERT INTO ICX_CAT_ITEM_PRICES
1501: (rt_item_id, price_type,
1502: active_flag, object_version_number,
1503: asl_id, supplier_site_id,
1504: contract_id, contract_line_id,
1734: raise ICX_POR_EXT_UTL.gException;
1735: END updateExtItemsTLP;
1736:
1737: -- Create unextracted internal item price record
1738: -- Only need to create row in icx_cat_item_prices
1739: PROCEDURE createInternalItemPrices IS
1740: CURSOR cInternalItemPrices IS
1741: SELECT p.rowid
1742: FROM icx_cat_item_prices p
1738: -- Only need to create row in icx_cat_item_prices
1739: PROCEDURE createInternalItemPrices IS
1740: CURSOR cInternalItemPrices IS
1741: SELECT p.rowid
1742: FROM icx_cat_item_prices p
1743: WHERE p.price_type = 'INTERNAL_TEMPLATE'
1744: AND NOT EXISTS (SELECT 'already upgraded'
1745: FROM icx_cat_item_prices p2
1746: WHERE p2.rt_item_id = p.rt_item_id
1741: SELECT p.rowid
1742: FROM icx_cat_item_prices p
1743: WHERE p.price_type = 'INTERNAL_TEMPLATE'
1744: AND NOT EXISTS (SELECT 'already upgraded'
1745: FROM icx_cat_item_prices p2
1746: WHERE p2.rt_item_id = p.rt_item_id
1747: AND p2.price_type = 'INTERNAL_ITEM');
1748: xErrLoc PLS_INTEGER;
1749: xReturnErr VARCHAR2(2000);
1764: EXIT WHEN xRowIds.COUNT = 0;
1765:
1766: xErrLoc := 160;
1767: FORALL i IN 1..xRowIds.COUNT
1768: INSERT INTO ICX_CAT_ITEM_PRICES
1769: (rt_item_id, price_type,
1770: active_flag, object_version_number,
1771: asl_id, supplier_site_id,
1772: contract_id, contract_line_id,
1797: NULL, NULL, NULL, NULL,
1798: gUpgradeUserId, gUpgradeUserId, sysdate,
1799: gUpgradeUserId, sysdate, gUpgradeUserId,
1800: gUpgradeUserId, gUpgradeUserId, sysdate
1801: FROM icx_cat_item_prices p,
1802: mtl_system_items_kfv mi,
1803: gl_sets_of_books gsb,
1804: financials_system_params_all fsp,
1805: mtl_units_of_measure_tl muom
1833:
1834: -- Create unextracted purchasing item price record
1835: -- If this item has internal part, will reuse the internal rt_item_id
1836: -- This procedure has a cursor on item_prices and also modifies the
1837: -- icx_cat_item_prices. This will cause snapshot too old error.
1838: -- To avoid this, insert into item_prices with request_id=-20 and
1839: -- make the cursor not pick these request ids(I.e. dont select the
1840: -- rows which have been inserted by this phase)
1841: PROCEDURE createPurchasingItemPrices IS
1848: i.internal_item_id inventory_item_id,
1849: i.org_id org_id,
1850: getPrimaryCategoryId(i.rt_item_id) rt_category_id
1851: FROM icx_cat_items_b i,
1852: icx_cat_item_prices p
1853: WHERE i.internal_item_id IS NOT NULL
1854: AND p.request_id <> gUpgradePhaseId
1855: AND EXISTS (SELECT 'supplier sourced documents'
1856: FROM icx_cat_item_prices p2
1852: icx_cat_item_prices p
1853: WHERE i.internal_item_id IS NOT NULL
1854: AND p.request_id <> gUpgradePhaseId
1855: AND EXISTS (SELECT 'supplier sourced documents'
1856: FROM icx_cat_item_prices p2
1857: WHERE p2.inventory_item_id = i.internal_item_id
1858: AND p2.org_id = i.org_id
1859: AND p2.price_type IN ('BLANKET', 'QUOTATION',
1860: 'TEMPLATE', 'ASL'))
1861: AND i.internal_item_id = p.inventory_item_id (+)
1862: AND i.org_id = p.org_id (+)
1863: AND p.price_type(+) = 'INTERNAL_ITEM'
1864: AND NOT EXISTS (SELECT 'already upgraded'
1865: FROM icx_cat_item_prices p2
1866: WHERE p2.rt_item_id = i.internal_item_id
1867: AND p2.org_id = i.org_id
1868: AND p2.price_type = 'PURCHASING_ITEM');
1869: xErrLoc PLS_INTEGER;
1915: EXIT WHEN xRtItemIds.COUNT = 0;
1916:
1917: xErrLoc := 160;
1918: FORALL i IN 1..xRtItemIds.COUNT
1919: INSERT INTO ICX_CAT_ITEM_PRICES
1920: (rt_item_id, price_type,
1921: active_flag, object_version_number,
1922: asl_id, supplier_site_id,
1923: contract_id, contract_line_id,
2033: raise ICX_POR_EXT_UTL.gException;
2034: END createPurchasingItemPrices;
2035:
2036:
2037: --update the request_id of icx_cat_item_prices from -20 to -9
2038: -- (-20) is the phase of create unextracted purchasing items
2039: --
2040: PROCEDURE updateRequestId IS
2041:
2044: xReturnErr VARCHAR2(2000);
2045:
2046: CURSOR cRequestId IS
2047: SELECT p.rt_item_id
2048: FROM icx_cat_item_prices p
2049: WHERE p.request_id = CREATE_PURCHASING_PHASE;
2050:
2051: BEGIN
2052: xErrLoc := 710;
2064: EXIT WHEN xRtItemIds.COUNT = 0;
2065:
2066: xErrLoc := 740;
2067: FORALL i IN 1..xRtItemIds.COUNT
2068: UPDATE ICX_CAT_ITEM_PRICES
2069: SET request_id = gUpgradeUserId
2070: WHERE rt_item_id = xRtItemIds(i);
2071: COMMIT;
2072:
2355: xErrLoc := 120;
2356: IF favorite.price_list_id IS NULL THEN
2357: OPEN cMatchRtItemIds FOR
2358: SELECT distinct rt_item_id
2359: FROM icx_cat_item_prices
2360: WHERE contract_id = favorite.contract_id
2361: AND contract_line_id = favorite.contract_line_id
2362: AND asl_id = favorite.asl_id
2363: AND template_id = favorite.template_id
2366: AND price_list_id IS NULL;
2367: ELSE
2368: OPEN cMatchRtItemIds FOR
2369: SELECT distinct p.rt_item_id
2370: FROM icx_cat_item_prices p,
2371: icx_cat_items_b i,
2372: icx_por_items oi
2373: WHERE p.price_list_id = favorite.price_list_id
2374: AND p.rt_item_id = i.rt_item_id
2548: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' ||
2549: xIcxSchema || '.icx_cat_category_items';
2550:
2551: xErrLoc := 500;
2552: -- ICX_CAT_ITEM_PRICES
2553: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' ||
2554: xIcxSchema || '.icx_cat_item_prices';
2555:
2556: xErrLoc := 600;
2550:
2551: xErrLoc := 500;
2552: -- ICX_CAT_ITEM_PRICES
2553: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' ||
2554: xIcxSchema || '.icx_cat_item_prices';
2555:
2556: xErrLoc := 600;
2557: -- ICX_CAT_ITEM_PRICES
2558: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' ||
2553: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' ||
2554: xIcxSchema || '.icx_cat_item_prices';
2555:
2556: xErrLoc := 600;
2557: -- ICX_CAT_ITEM_PRICES
2558: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' ||
2559: xIcxSchema || '.icx_cat_price_lists';
2560:
2561: xErrLoc := 700;