7343: END IF;
7344:
7345:
7346: /*--------------------------------------+
7347: Insert into mtl_item_categories
7348: +--------------------------------------*/
7349:
7350: lStmtNumber := 260;
7351:
7351:
7352: --bugfix 4861996
7353: --added ic1.category_set_id = ic.category_set_id condition
7354:
7355: insert into MTL_ITEM_CATEGORIES
7356: (inventory_item_id,
7357: category_set_id,
7358: category_id,
7359: last_update_date,
7381: NULL, -- program_id
7382: SYSDATE, -- program_update_date
7383: ic.organization_id
7384: from
7385: mtl_item_categories ic,
7386: bom_cto_src_orgs bcso
7387: where ic.inventory_item_id = pModelId --bugfix 2706981: swapped the positions
7388: and ic.organization_id = bcso.organization_id
7389: and bcso.model_item_id = ic.inventory_item_id --bugfix 2706981: replaced pModelId with col join
7400: -- end bugfix 2619501:
7401: --
7402: and NOT EXISTS
7403: (select NULL
7404: from MTL_ITEM_CATEGORIES ic1 -- bugfix 2706981: added alias
7405: where ic1.inventory_item_id = pConfigId
7406: and ic1.organization_id = bcso.organization_id
7407: and ic1.category_set_id = ic.category_set_id
7408: );
7413:
7414:
7415:
7416: IF PG_DEBUG <> 0 THEN
7417: oe_debug_pub.add('Create_Item: ' || 'after insert: MTL_ITEM_CATEGORIES',2);
7418: END IF;
7419:
7420: -- Start Bugfix 2197842
7421:
7420: -- Start Bugfix 2197842
7421:
7422: lStmtNumber := 261;
7423:
7424: insert into MTL_ITEM_CATEGORIES
7425: (inventory_item_id,
7426: category_set_id,
7427: category_id,
7428: last_update_date,
7450: NULL, -- program_id
7451: SYSDATE, -- program_update_date
7452: ic.organization_id
7453: from
7454: mtl_item_categories ic,
7455: mtl_category_sets_b mcsb,
7456: mtl_default_category_sets mdcs,
7457: bom_cto_src_orgs bcso
7458: where pModelId = ic.inventory_item_id
7463: and mdcs.functional_area_id = 2
7464: and NOT EXISTS
7465: (
7466: select NULL
7467: from MTL_ITEM_CATEGORIES
7468: where inventory_item_id = pConfigId
7469: and organization_id = bcso.organization_id
7470: and category_set_id = mcsb.category_set_id
7471: );
7474:
7475:
7476:
7477: IF PG_DEBUG <> 0 THEN
7478: oe_debug_pub.add('Create_Item: ' || 'after insert: MTL_ITEM_CATEGORIES FOR DEFAULT CATEGORIES',2);
7479: END IF;
7480:
7481: -- End Bugfix 2197842
7482: