[Home] [Help]
PACKAGE BODY: APPS.INV_ITEM_VALIDATION
Source
1 PACKAGE BODY INV_Item_Validation AS
2 /* $Header: INVVIVAB.pls 120.2 2005/06/21 05:54:35 appldev ship $ */
3
4 -- ------------------------------------------------------------
5 -- -------------- Global variables and constants --------------
6 -- ------------------------------------------------------------
7
8 G_PKG_NAME CONSTANT VARCHAR2(30) := 'INV_Item_Validation';
9
10
11 -- ==========================================================================
12 -- API Name: Attribute_Dependency
13 -- ==========================================================================
14
15 PROCEDURE Attribute_Dependency
16 (
17 p_Item_rec IN INV_Item_API.Item_rec_type
18 , x_return_status OUT NOCOPY VARCHAR2
19 )
20 IS
21 BEGIN
22
23 x_return_status := fnd_api.g_RET_STS_SUCCESS ;
24
25 if (p_Item_rec.inventory_item_flag ='N' AND
26 p_Item_rec.stock_enabled_flag ='Y' ) THEN
27 fnd_message.SET_NAME('INV', 'INVALID_INV_STK_FLAG_COMB');
28 fnd_msg_pub.Add;
29 x_return_status := fnd_api.g_RET_STS_ERROR ;
30 RETURN;
31 END IF;
32
33 IF (p_Item_rec.stock_enabled_flag ='N' AND
34 p_Item_rec.mtl_transactions_enabled_flag ='Y' )THEN
35 fnd_message.SET_NAME('INV', 'INVALID_STK_TRX_FLAG_COMB');
36 fnd_msg_pub.Add;
37 x_return_status := fnd_api.g_RET_STS_ERROR ;
38 RETURN;
39 END IF;
40
41 IF (p_Item_rec.purchasing_item_flag ='N' AND
42 p_Item_rec.purchasing_enabled_flag ='Y' )THEN
43 fnd_message.SET_NAME('INV', 'INVALID_PI_PE_FLAG_COMB');
44 fnd_msg_pub.Add;
45 x_return_status := fnd_api.g_RET_STS_ERROR ;
46 RETURN;
47 END IF;
48
49 IF (p_Item_rec.customer_order_flag ='N' AND
50 p_Item_rec.customer_order_enabled_flag ='Y' )THEN
51 fnd_message.SET_NAME('INV', 'INVALID_CO_COE_FLAG_COMB');
52 fnd_msg_pub.Add;
53 x_return_status := fnd_api.g_RET_STS_ERROR ;
54 RETURN;
55 END IF;
56
57 IF (p_Item_rec.internal_order_flag ='N' AND
58 p_Item_rec.internal_order_enabled_flag ='Y' )THEN
59 fnd_message.SET_NAME('INV', 'INVALID_IO_IOE_FLAG_COMB');
60 fnd_msg_pub.Add;
61 x_return_status := fnd_api.g_RET_STS_ERROR ;
62 RETURN;
63 END IF;
64
65 /* Bug 1461892 */
66
67 /* Changed due to introduction of Contract_Item_Type_Code attribute
68 (bugs 1755412, 1960366). */
69
70 ------------------------------------------------------------------------------
71 -- BOM Allowed flag can be enabled only for Inventory Item or Contract Items.
72 ------------------------------------------------------------------------------
73
74 IF ( p_Item_rec.inventory_item_flag = 'N'
75 AND p_Item_rec.contract_item_type_code IS NULL
76 AND p_Item_rec.bom_enabled_flag = 'Y' )
77 THEN
78 FND_MESSAGE.Set_Name ('INV', 'INV_ITEM_MASTER_CTRL_ATTR_ERR');
79 FND_MESSAGE.Set_Token ('ERROR_MESSAGE_NAME', 'INV_BOM_ENABLED', TRUE);
80 FND_MSG_PUB.Add;
81 x_return_status := FND_API.g_RET_STS_ERROR;
82 RETURN;
83 END IF;
84
85 ------------------------------------------------------------------------------
86 --
87 ------------------------------------------------------------------------------
88
89 IF ( ( p_item_rec.inventory_item_flag = 'N' OR p_item_rec.bom_item_type <> 4 )
90 AND p_Item_rec.build_in_wip_flag ='Y' )
91 THEN
92
93 -- To get a message from the server to Client.
94 -- fnd_message.set_name('INV', 'IIF, BIT, BIWF '|| p_item_rec.inventory_item_flag||', '||to_char(p_item_rec.bom_item_type)||', '||p_item_rec.build_in_wip_flag);
95 -- fnd_message.RAISE_ERROR;
96
97 FND_MESSAGE.Set_Name ('INV', 'INVALID_INV_WIP_FLAG_COMB');
98 FND_MSG_PUB.Add;
99 x_return_status := fnd_api.g_RET_STS_ERROR;
100 RETURN;
101 END IF;
102
103 END Attribute_Dependency;
104
105
106 -- ==========================================================================
107 -- API Name: Effectivity_Control
108 -- ==========================================================================
109
110 PROCEDURE Effectivity_Control
111 (
112 p_Item_rec IN INV_Item_API.Item_rec_type
113 , x_return_status OUT NOCOPY VARCHAR2
114 )
115 IS
116 BEGIN
117
118 x_return_status := fnd_api.g_RET_STS_SUCCESS ;
119
120 ---------------------------------------------------------------------------
121 -- Serial Number Generation atrribute must be 'At Recept' or 'Predefined',
122 -- if Effectivity Control is 'Model/Unit Number'.
123 ---------------------------------------------------------------------------
124
125 IF ( p_Item_rec.EFFECTIVITY_CONTROL = 2 ) AND
126 ( p_Item_rec.SERIAL_NUMBER_CONTROL_CODE NOT IN (2, 5) )
127 THEN
128 -- fnd_message.SET_NAME('INV', 'ITM-EFFC-Invalid Serial Ctrl');
129 fnd_message.SET_NAME('INV', 'ITM-EFFC-INVALID SERIAL CTRL-2');
130 fnd_msg_pub.Add;
131 x_return_status := fnd_api.g_RET_STS_ERROR ;
132 RETURN;
133 END IF;
134
135 END Effectivity_Control;
136
137
138 END INV_Item_Validation;