2076: WriteToLog('Inserted rows into mtl_descr_element_values:: '||sql%rowcount,2);
2077:
2078:
2079: /*--------------------------------------+
2080: Insert into mtl_item_categories
2081: Do not insert into CTO category if passed
2082: +--------------------------------------*/
2083: lStmtNumber := 120;
2084:
2090:
2091: --FP bugfix 4861996
2092: --added condition ic1.category_set_id = ic.category_set_id
2093:
2094: insert into MTL_ITEM_CATEGORIES
2095: (inventory_item_id,
2096: category_set_id,
2097: category_id,
2098: last_update_date,
2121: NULL, -- program_id
2122: SYSDATE, -- program_update_date
2123: ic.organization_id
2124: from
2125: mtl_item_categories ic,
2126: bom_cto_src_orgs bcso,
2127: bom_cto_order_lines_upg bcolu
2128: where bcolu.config_item_id is not null
2129: and bcolu.status = 'BCSO'
2133: and bcso.line_id = bcolu.line_id
2134: and CTO_CUSTOM_CATEGORY_PK.Copy_Category (ic.category_set_id , ic.organization_id) = 1
2135: and NOT EXISTS
2136: (select NULL
2137: from MTL_ITEM_CATEGORIES ic1
2138: where ic1.inventory_item_id = bcolu.config_item_id
2139: and ic1.organization_id = bcso.organization_id
2140: and ic1.category_set_id = ic.category_set_id
2141: );
2139: and ic1.organization_id = bcso.organization_id
2140: and ic1.category_set_id = ic.category_set_id
2141: );
2142:
2143: WriteToLog('Inserted rows into mtl_item_categories:: '||sql%rowcount,2);
2144: lStmtNumber := 124;
2145: insert into MTL_ITEM_CATEGORIES
2146: (inventory_item_id,
2147: category_set_id,
2141: );
2142:
2143: WriteToLog('Inserted rows into mtl_item_categories:: '||sql%rowcount,2);
2144: lStmtNumber := 124;
2145: insert into MTL_ITEM_CATEGORIES
2146: (inventory_item_id,
2147: category_set_id,
2148: category_id,
2149: last_update_date,
2172: NULL, -- program_id
2173: SYSDATE, -- program_update_date
2174: ic.organization_id
2175: from
2176: mtl_item_categories ic,
2177: mtl_category_sets_b mcsb,
2178: mtl_default_category_sets mdcs,
2179: bom_cto_src_orgs bcso,
2180: bom_cto_order_lines_upg bcolu
2187: and mcsb.category_set_id = mdcs.category_set_id
2188: and mdcs.functional_area_id = 2
2189: and NOT EXISTS
2190: ( select NULL
2191: from MTL_ITEM_CATEGORIES
2192: where inventory_item_id = bcolu.config_item_id
2193: and organization_id = bcso.organization_id
2194: and category_set_id = mcsb.category_set_id
2195: );
2193: and organization_id = bcso.organization_id
2194: and category_set_id = mcsb.category_set_id
2195: );
2196:
2197: WriteToLog('Inserted rows into mtl_item_categories for default categories:: '||sql%rowcount,2);
2198:
2199: ELSE /* p_cat_id is passed */
2200:
2201: lStmtNumber := 126;
2201: lStmtNumber := 126;
2202:
2203: --FP bugfix 4861996
2204: --added condition ic1.category_set_id = ic.category_set_id
2205: insert into MTL_ITEM_CATEGORIES
2206: (inventory_item_id,
2207: category_set_id,
2208: category_id,
2209: last_update_date,
2232: NULL, -- program_id
2233: SYSDATE, -- program_update_date
2234: ic.organization_id
2235: from
2236: mtl_item_categories ic,
2237: bom_cto_src_orgs bcso,
2238: bom_cto_order_lines_upg bcolu
2239: where bcolu.config_item_id is not null
2240: and bcolu.status = 'BCSO'
2245: and bcso.line_id = bcolu.line_id
2246: and CTO_CUSTOM_CATEGORY_PK.Copy_Category (ic.category_set_id , ic.organization_id) = 1
2247: and NOT EXISTS
2248: (select NULL
2249: from MTL_ITEM_CATEGORIES ic1
2250: where ic1.inventory_item_id = bcolu.config_item_id
2251: and ic1.organization_id = bcso.organization_id
2252: and ic1.category_set_id = ic.category_set_id
2253: );
2251: and ic1.organization_id = bcso.organization_id
2252: and ic1.category_set_id = ic.category_set_id
2253: );
2254:
2255: WriteToLog('Inserted rows into mtl_item_categories:: '||sql%rowcount,2);
2256: lStmtNumber := 128;
2257: insert into MTL_ITEM_CATEGORIES
2258: (inventory_item_id,
2259: category_set_id,
2253: );
2254:
2255: WriteToLog('Inserted rows into mtl_item_categories:: '||sql%rowcount,2);
2256: lStmtNumber := 128;
2257: insert into MTL_ITEM_CATEGORIES
2258: (inventory_item_id,
2259: category_set_id,
2260: category_id,
2261: last_update_date,
2284: NULL, -- program_id
2285: SYSDATE, -- program_update_date
2286: ic.organization_id
2287: from
2288: mtl_item_categories ic,
2289: mtl_category_sets_b mcsb,
2290: mtl_default_category_sets mdcs,
2291: bom_cto_src_orgs bcso,
2292: bom_cto_order_lines_upg bcolu
2300: and mcsb.category_set_id = mdcs.category_set_id
2301: and mdcs.functional_area_id = 2
2302: and NOT EXISTS
2303: ( select NULL
2304: from MTL_ITEM_CATEGORIES
2305: where inventory_item_id = bcolu.config_item_id
2306: and organization_id = bcso.organization_id
2307: and category_set_id = mcsb.category_set_id
2308: );
2306: and organization_id = bcso.organization_id
2307: and category_set_id = mcsb.category_set_id
2308: );
2309:
2310: WriteToLog('Inserted rows into mtl_item_categories for default categories:: '||sql%rowcount,2);
2311:
2312: END IF; /* p_cat_id = -99 */
2313:
2314: