54: p_sub_component_rec.New_Revised_Item_Revision IS NULL OR
55: p_sub_component_rec.New_Revised_Item_Revision =
56: FND_API.G_MISS_CHAR
57: ) AND
58: Bom_Globals.Get_Bo_Identifier = Bom_Globals.G_ECO_BO
59: )
60: THEN
61: x_return_status := FND_API.G_RET_STS_ERROR;
62: Error_Handler.Add_Error_Token
152: EXCEPTION
153: WHEN OTHERS THEN
154: NULL;
155: END;
156: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Bill SequenceId : ' || to_char(l_rec_BSI)); END IF;
157: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Assembly Type : ' || to_char(l_rec_AST)); END IF;
158: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Comp SequenceId : ' || to_char(p_Sub_Comp_Unexp_Rec.component_sequence_id)); END IF;
159:
160: if bom_globals.get_debug = 'Y' then Error_Handler.write_debug('Sub Comp: Checking for editable common bill...'); END IF;
153: WHEN OTHERS THEN
154: NULL;
155: END;
156: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Bill SequenceId : ' || to_char(l_rec_BSI)); END IF;
157: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Assembly Type : ' || to_char(l_rec_AST)); END IF;
158: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Comp SequenceId : ' || to_char(p_Sub_Comp_Unexp_Rec.component_sequence_id)); END IF;
159:
160: if bom_globals.get_debug = 'Y' then Error_Handler.write_debug('Sub Comp: Checking for editable common bill...'); END IF;
161:
154: NULL;
155: END;
156: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Bill SequenceId : ' || to_char(l_rec_BSI)); END IF;
157: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Assembly Type : ' || to_char(l_rec_AST)); END IF;
158: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Comp SequenceId : ' || to_char(p_Sub_Comp_Unexp_Rec.component_sequence_id)); END IF;
159:
160: if bom_globals.get_debug = 'Y' then Error_Handler.write_debug('Sub Comp: Checking for editable common bill...'); END IF;
161:
162: BEGIN
156: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Bill SequenceId : ' || to_char(l_rec_BSI)); END IF;
157: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Assembly Type : ' || to_char(l_rec_AST)); END IF;
158: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Comp SequenceId : ' || to_char(p_Sub_Comp_Unexp_Rec.component_sequence_id)); END IF;
159:
160: if bom_globals.get_debug = 'Y' then Error_Handler.write_debug('Sub Comp: Checking for editable common bill...'); END IF;
161:
162: BEGIN
163: SELECT 1
164: INTO l_dummy
183: WHERE bbom.bill_sequence_id = l_rec_BSI
184: AND bbom.assembly_item_id = msi.inventory_item_id
185: AND bbom.organization_id = msi.organization_id;
186:
187: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Assy Bom Enabled flag : ' || l_assy_bom_enabled); END IF;
188:
189: IF l_assy_bom_enabled <> 'Y'
190: THEN
191: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
211: -- added. Planning bills cannot have sub comps esgs and also |
212: -- components which are not Standard cannot have sub comps. This |
213: -- OR so even if either exists sub comp cannot be added. |
214: ---------------------------------------------------------------------
215: IF p_sub_component_rec.Transaction_Type = Bom_Globals.G_OPR_CREATE THEN
216:
217: BEGIN
218: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Checking for planning bill or non-std. component . . . '); END IF;
219:
214: ---------------------------------------------------------------------
215: IF p_sub_component_rec.Transaction_Type = Bom_Globals.G_OPR_CREATE THEN
216:
217: BEGIN
218: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Checking for planning bill or non-std. component . . . '); END IF;
219:
220: IF l_rec_bit IN (1, 2, 3, 5)
221: THEN
222: l_err_text := 'BOM_SBC_NON_STD_PARENT';
279: -- 'Approval approved') we should change status to not submitted |
280: -- for Approval |
281: ------------------------------------------------------------------
282: stmt_num := 2;
283: IF (p_sub_component_rec.Transaction_Type = Bom_Globals.G_OPR_UPDATE OR
284: p_sub_component_rec.Transaction_Type = Bom_Globals.G_OPR_CREATE)
285: AND
286: Bom_Globals.Get_Bo_Identifier = Bom_Globals.G_ECO_BO
287: THEN
280: -- for Approval |
281: ------------------------------------------------------------------
282: stmt_num := 2;
283: IF (p_sub_component_rec.Transaction_Type = Bom_Globals.G_OPR_UPDATE OR
284: p_sub_component_rec.Transaction_Type = Bom_Globals.G_OPR_CREATE)
285: AND
286: Bom_Globals.Get_Bo_Identifier = Bom_Globals.G_ECO_BO
287: THEN
288: Bom_Globals.Check_Approved_For_Process
282: stmt_num := 2;
283: IF (p_sub_component_rec.Transaction_Type = Bom_Globals.G_OPR_UPDATE OR
284: p_sub_component_rec.Transaction_Type = Bom_Globals.G_OPR_CREATE)
285: AND
286: Bom_Globals.Get_Bo_Identifier = Bom_Globals.G_ECO_BO
287: THEN
288: Bom_Globals.Check_Approved_For_Process
289: ( p_change_notice => p_sub_component_rec.Eco_Name
290: , p_organization_id => p_Sub_Comp_Unexp_Rec.Organization_Id
284: p_sub_component_rec.Transaction_Type = Bom_Globals.G_OPR_CREATE)
285: AND
286: Bom_Globals.Get_Bo_Identifier = Bom_Globals.G_ECO_BO
287: THEN
288: Bom_Globals.Check_Approved_For_Process
289: ( p_change_notice => p_sub_component_rec.Eco_Name
290: , p_organization_id => p_Sub_Comp_Unexp_Rec.Organization_Id
291: , x_processed =>l_processed
292: , x_err_text =>l_err_text
291: , x_processed =>l_processed
292: , x_err_text =>l_err_text
293: );
294: IF (l_processed) THEN
295: Bom_Globals.Set_Request_For_Approval(
296: p_change_notice => p_sub_component_rec.Eco_Name
297: ,p_organization_id => p_Sub_Comp_Unexp_Rec.Organization_Id
298: ,x_err_text => l_err_text);
299: END IF;
305: -----------------------------------------------------------------------
306:
307: stmt_num := 7;
308: BEGIN
309: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Verify sub. comp. exists in MTL_System_Item with correct attributes . . .'); END IF;
310:
311: SELECT bom_item_type, bom_enabled_flag, eng_item_flag ,tracking_quantity_ind
312: INTO l_sbc_item_type, l_sbc_bom_enabled_flag, l_sbc_eng_item_flag,l_sbc_tracking_qty_ind
313: FROM mtl_system_items
384: -- Component Item exists in those orgs |
385: -------------------------------------------------------------------
386: stmt_num := 8;
387: BEGIN
388: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Verfying component for other common orgs . . . '); END IF;
389:
390: SELECT 1
391: INTO l_dummy
392: FROM bom_bill_of_materials bbom
434: ---------------------------------------------------------
435: -- Verify sub comp is not the same as bill or component |
436: ---------------------------------------------------------
437: stmt_num := 9;
438: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Verifying sub. comp not same as parent . . . '); END IF;
439:
440: IF (p_Sub_Component_Rec.Transaction_Type = Bom_Globals.G_OPR_UPDATE AND
441: p_Sub_Comp_Unexp_Rec.New_Substitute_Component_Id IN
442: (l_rec_AII, l_rec_CII))
436: ---------------------------------------------------------
437: stmt_num := 9;
438: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Verifying sub. comp not same as parent . . . '); END IF;
439:
440: IF (p_Sub_Component_Rec.Transaction_Type = Bom_Globals.G_OPR_UPDATE AND
441: p_Sub_Comp_Unexp_Rec.New_Substitute_Component_Id IN
442: (l_rec_AII, l_rec_CII))
443: OR
444: (p_Sub_Component_Rec.Transaction_Type = Bom_Globals.G_OPR_CREATE AND
440: IF (p_Sub_Component_Rec.Transaction_Type = Bom_Globals.G_OPR_UPDATE AND
441: p_Sub_Comp_Unexp_Rec.New_Substitute_Component_Id IN
442: (l_rec_AII, l_rec_CII))
443: OR
444: (p_Sub_Component_Rec.Transaction_Type = Bom_Globals.G_OPR_CREATE AND
445: p_Sub_Comp_Unexp_Rec.Substitute_Component_Id IN
446: (l_rec_AII,l_rec_CII))
447: THEN
448: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
472: --
473: -- Peform this set of validations only if the ECO BO is calling the
474: -- validation package
475: --
476: IF Bom_Globals.Get_Bo_Identifier = Bom_Globals.G_ECO_BO
477: THEN
478: IF l_parent_acd_type = 3 THEN
479: l_return_status := FND_API.G_RET_STS_ERROR;
480: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
510: ------------------------------------------------------------------------
511: stmt_num := 13;
512: /*
513: IF p_sub_component_rec.acd_type <> 3
514: AND ( p_Sub_Component_Rec.Transaction_Type = Bom_Globals.G_OPR_CREATE OR
515: p_Sub_Component_Rec.Transaction_Type = Bom_Globals.G_OPR_UPDATE
516: )
517: THEN
518:
511: stmt_num := 13;
512: /*
513: IF p_sub_component_rec.acd_type <> 3
514: AND ( p_Sub_Component_Rec.Transaction_Type = Bom_Globals.G_OPR_CREATE OR
515: p_Sub_Component_Rec.Transaction_Type = Bom_Globals.G_OPR_UPDATE
516: )
517: THEN
518:
519:
531: -------------------------------------------------------------------------
532:
533: IF p_sub_component_rec.acd_type = 3 THEN
534: BEGIN
535: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Verifying if component is not disable type . . . '); END IF;
536:
537: SELECT count(*)
538: INTO l_dummy
539: FROM bom_substitute_components sub_comp,
544: rev_comp.old_component_Sequence_id
545: AND sub_comp.Substitute_Component_Id =
546: p_Sub_Comp_Unexp_Rec.Substitute_Component_Id;
547:
548: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
549: ( 'Sub Components found: ' || l_dummy);
550: END IF;
551:
552: IF (l_dummy = 0)
588: New Substitute Component does not exists already */
589:
590: IF ( p_Sub_Comp_Unexp_Rec.new_substitute_component_id is not null
591: and p_Sub_Comp_Unexp_Rec.new_substitute_component_id <> FND_API.G_MISS_NUM
592: and p_sub_component_rec.transaction_type = Bom_Globals.G_OPR_UPDATE) THEN
593:
594: select count(*) into l_temp_var
595: FROM BOM_SUBSTITUTE_COMPONENTS
596: WHERE substitute_component_id = p_Sub_Comp_Unexp_Rec.new_substitute_component_id
615: RAISE FND_API.G_EXC_ERROR;
616: END IF;
617: END IF;
618:
619: IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug('Verified New Substitute Component ...'); END IF;
620:
621:
622:
623: EXCEPTION
827: ELSE
828: Error_Handler.Write_Debug('In SCOMP Check Exist...'||p_sub_component_rec.transaction_type);
829: END IF;
830:
831: IF l_return_status = Bom_Globals.G_RECORD_FOUND AND
832: p_sub_component_rec.transaction_type = Bom_Globals.G_OPR_CREATE
833: THEN
834: Error_Handler.Add_Error_Token
835: ( x_Mesg_token_tbl => l_Mesg_Token_Tbl
828: Error_Handler.Write_Debug('In SCOMP Check Exist...'||p_sub_component_rec.transaction_type);
829: END IF;
830:
831: IF l_return_status = Bom_Globals.G_RECORD_FOUND AND
832: p_sub_component_rec.transaction_type = Bom_Globals.G_OPR_CREATE
833: THEN
834: Error_Handler.Add_Error_Token
835: ( x_Mesg_token_tbl => l_Mesg_Token_Tbl
836: , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
837: , p_message_name => 'BOM_SUB_COMP_ALREADY_EXISTS'
838: , p_token_tbl => l_token_tbl
839: );
840: l_return_status := FND_API.G_RET_STS_ERROR;
841: ELSIF l_return_status = Bom_Globals.G_RECORD_NOT_FOUND AND
842: p_sub_component_rec.transaction_type IN
843: (Bom_Globals.G_OPR_UPDATE, Bom_Globals.G_OPR_DELETE)
844: THEN
845: Error_Handler.Add_Error_Token
839: );
840: l_return_status := FND_API.G_RET_STS_ERROR;
841: ELSIF l_return_status = Bom_Globals.G_RECORD_NOT_FOUND AND
842: p_sub_component_rec.transaction_type IN
843: (Bom_Globals.G_OPR_UPDATE, Bom_Globals.G_OPR_DELETE)
844: THEN
845: Error_Handler.Add_Error_Token
846: ( x_Mesg_token_tbl => l_Mesg_Token_Tbl
847: , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
865:
866: /* Assign the relevant transaction type for SYNC operations */
867:
868: IF p_sub_component_rec.transaction_type = 'SYNC' THEN
869: IF l_return_status = Bom_Globals.G_RECORD_FOUND THEN
870: x_old_sub_component_rec.transaction_type :=
871: Bom_Globals.G_OPR_UPDATE;
872: ELSE
873: x_old_sub_component_rec.transaction_type :=
867:
868: IF p_sub_component_rec.transaction_type = 'SYNC' THEN
869: IF l_return_status = Bom_Globals.G_RECORD_FOUND THEN
870: x_old_sub_component_rec.transaction_type :=
871: Bom_Globals.G_OPR_UPDATE;
872: ELSE
873: x_old_sub_component_rec.transaction_type :=
874: Bom_Globals.G_OPR_CREATE;
875: END IF;
870: x_old_sub_component_rec.transaction_type :=
871: Bom_Globals.G_OPR_UPDATE;
872: ELSE
873: x_old_sub_component_rec.transaction_type :=
874: Bom_Globals.G_OPR_CREATE;
875: END IF;
876: END IF;
877: l_return_status := FND_API.G_RET_STS_SUCCESS;
878: END IF;
987:
988: /* Validations for OPM Convergence Project
989: Model/Option class items are not allowed in OPM organizations*/
990:
991: IF (l_OPM_org='Y' and SubCompType.bom_item_type in ( Bom_Globals.G_MODEL, Bom_Globals.G_OPTION_CLASS))THEN
992: Error_Handler.Add_Error_Token
993: ( p_Message_name => 'BOM_OPM_ORG_MODEL_OC'
994: , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
995: , x_mesg_token_tbl => l_mesg_token_tbl
994: , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
995: , x_mesg_token_tbl => l_mesg_token_tbl
996: );
997: l_return_status := FND_API.G_RET_STS_ERROR;
998: ELSIF SubCompType.bom_item_type = Bom_Globals.G_PRODUCT_FAMILY
999: THEN
1000: Error_Handler.Add_Error_Token
1001: ( p_Message_Name => 'BOM_SUB_COMP_PF'
1002: , p_mesg_token_tbl => l_mesg_token_tbl
1004: , p_token_tbl => l_token_tbl
1005: );
1006: l_return_status := FND_API.G_RET_STS_ERROR;
1007: ELSIF SubCompType.bom_item_type NOT IN
1008: (NVL(Bom_Globals.Get_MDL_Item_Access,0),
1009: NVL(Bom_Globals.Get_OC_Item_Access,0),
1010: NVL(Bom_Globals.Get_PLN_Item_Access,0),
1011: NVL(Bom_Globals.Get_STD_Item_Access,0)
1012: )
1005: );
1006: l_return_status := FND_API.G_RET_STS_ERROR;
1007: ELSIF SubCompType.bom_item_type NOT IN
1008: (NVL(Bom_Globals.Get_MDL_Item_Access,0),
1009: NVL(Bom_Globals.Get_OC_Item_Access,0),
1010: NVL(Bom_Globals.Get_PLN_Item_Access,0),
1011: NVL(Bom_Globals.Get_STD_Item_Access,0)
1012: )
1013: THEN
1006: l_return_status := FND_API.G_RET_STS_ERROR;
1007: ELSIF SubCompType.bom_item_type NOT IN
1008: (NVL(Bom_Globals.Get_MDL_Item_Access,0),
1009: NVL(Bom_Globals.Get_OC_Item_Access,0),
1010: NVL(Bom_Globals.Get_PLN_Item_Access,0),
1011: NVL(Bom_Globals.Get_STD_Item_Access,0)
1012: )
1013: THEN
1014: l_token_tbl(1).token_name := 'REV_COMP';
1007: ELSIF SubCompType.bom_item_type NOT IN
1008: (NVL(Bom_Globals.Get_MDL_Item_Access,0),
1009: NVL(Bom_Globals.Get_OC_Item_Access,0),
1010: NVL(Bom_Globals.Get_PLN_Item_Access,0),
1011: NVL(Bom_Globals.Get_STD_Item_Access,0)
1012: )
1013: THEN
1014: l_token_tbl(1).token_name := 'REV_COMP';
1015: l_token_tbl(1).token_value :=