DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_VALIDATE_LOT_SERIAL

Source


1 PACKAGE BODY OE_Validate_Lot_Serial AS
2 /* $Header: OEXLSRLB.pls 120.5 2010/11/18 08:55:29 kbavadek ship $ */
3 
4 --  Global constant holding the package name
5 
6 G_PKG_NAME                    CONSTANT VARCHAR2(30) := 'OE_Validate_Lot_Serial';
7 
8 --  Procedure Entity
9 
10 PROCEDURE Entity
11 ( x_return_status OUT NOCOPY VARCHAR2
12 
13 ,   p_Lot_Serial_rec                IN  OE_Order_PUB.Lot_Serial_Rec_Type
14 ,   p_old_Lot_Serial_rec            IN  OE_Order_PUB.Lot_Serial_Rec_Type :=
15                                         OE_Order_PUB.G_MISS_LOT_SERIAL_REC
16 )
17 IS
18 l_return_status               VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
19 --Removed because not used after changes for bug 5155914(validation removal)
20 --l_ordered_qty                 NUMBER := 0;
21 --l_total_qty                   NUMBER := 0;
22 x_prefix                      VARCHAR2(80);
23 x_quantity                    VARCHAR2(80);
24 x_from_number                 VARCHAR2(80);
25 x_to_number                   VARCHAR2(80);
26 x_error_code                  NUMBER;
27 
28 -- OPM 3494420
29 CURSOR c_lines ( p_line_id IN NUMBER ) IS
30 
31 		SELECT inventory_item_id,  ship_from_org_id, order_quantity_uom, ordered_quantity_uom2
32 	        FROM OE_ORDER_LINES
33 	       	WHERE line_id = p_line_id;
34 
35 CURSOR c_item ( discrete_org_id  IN NUMBER         -- INVCONV
36               , discrete_item_id IN NUMBER) IS
37        SELECT lot_control_code,
38               tracking_quantity_ind,
39               secondary_uom_code,
40               serial_number_control_code,
41               secondary_default_ind,
42               primary_uom_code                --Bug 10021098
43          	FROM mtl_system_items
44      		WHERE organization_id   = discrete_org_id
45          	AND   inventory_item_id = discrete_item_id;
46 
47 /*CURSOR c_opm_item ( discrete_org_id  IN NUMBER   INVCONV
48                   , discrete_item_id IN NUMBER) IS
49        SELECT item_id
50        	    , item_no
51             , lot_ctl
52             --, sublot_ctl INVCONV
53             , dualum_ind
54             , item_um2
55        FROM  ic_item_mst
56        WHERE delete_mark = 0
57        AND   item_no in (SELECT segment1
58          	FROM mtl_system_items
59      	WHERE organization_id   = discrete_org_id
60           AND   inventory_item_id = discrete_item_id); */
61 
62 CURSOR c_lot1 ( p_inventory_item_id in number, --  INVCONV 			bug 4099604
63 		    p_lot_number in varchar2,
64 		    p_organization_id in number )
65 		   IS
66       Select lot_number
67       from mtl_lot_numbers
68 			where inventory_item_id = p_inventory_item_id
69 			and lot_number =  p_lot_number
70 			and organization_id = p_organization_id;
71 
72 /*CURSOR c_opm_lot1 ( opm_item_id in number, -- OPM 3494420
73 		    lot_number in varchar2)  IS
74                     Select lot_id
75 			from ic_lots_mst a where a.lot_id <> 0 and a.delete_mark = 0
76 			and a.item_id = opm_item_id
77 			and a.lot_no =  lot_number; */
78 
79 CURSOR c_rcv_parameter ( org_id   IN NUMBER ) IS  -- INVCONV
80             SELECT enforce_rma_lot_num
81             FROM rcv_parameters
82      	    WHERE organization_id   = org_id;
83 
84 /*CURSOR c_opm_lot2 ( opm_item_id in number, -- OPM 3494420
85 		    lot_number in varchar2 ) is
86 		   -- sublot_number in varchar2)  IS --INVCONV
87                     Select lot_id
88 			from ic_lots_mst a where a.lot_id <> 0 and a.delete_mark = 0
89 			and a.item_id = opm_item_id
90 			and a.lot_no =  lot_number;
91 			-- and a.sublot_no = sublot_number;  */ --INVCONV
92 
93     l_RMA_LOT_RESTRICT varchar2(1) := 'U'; -- INVCONV
94     --l_opm_rma_profile        VARCHAR2(30)   := nvl(fnd_profile.value('GMI_RMA_LOT_RESTRICT'), 'UNRESTRICTED'); -- invconv
95     l_ship_from_org_id       NUMBER;
96     l_inventory_item_id      NUMBER;
97     l_order_quantity_uom     VARCHAR2(3);
98     l_ordered_quantity_uom2  VARCHAR2(3);
99     --l_item_um2               VARCHAR2(4); -- OPM um  INVCONV
100     --l_OPM_UOM                VARCHAR2(4); -- OPM um  INVCONV
101     l_status                 VARCHAR2(1);
102     l_msg_count              NUMBER;
103     l_msg_data               VARCHAR2(240);
104     l_lot_ctl                NUMBER(5):= 1; -- INVCONV;  1 =no 2 = yes
105     l_serial_number_control_code number(5):= 1;  -- INVCONV
106     l_tracking_quantity_ind       VARCHAR2(30); -- INVCONV
107     l_secondary_default_ind       VARCHAR2(30); -- INVCONV
108     l_secondary_uom_code varchar2(3) := NULL; -- INVCONV
109     l_lot_number VARCHAR2(80); -- INVCONV
110     l_buffer                  VARCHAR2(2000); -- INVCONV
111     TOLERANCE_ERROR EXCEPTION;             -- INVCONV
112 
113     --l_sublot_ctl             NUMBER; INVCONV
114     --l_dualum_ind             NUMBER; INVCONV
115     --l_lot_id                 NUMBER;
116     --l_item_no                VARCHAR2(32);
117     --l_item_id	   	     NUMBER; INVCONV
118     l_return	   	     NUMBER;
119     l_quantity               NUMBER;
120     l_quantity2               NUMBER;
121     --l_item_rec             OE_ORDER_CACHE.item_rec_type;    INVCONV
122  -- OPM 3494420
123     l_primary_uom_code       varchar2(3) := NULL; --Bug 10021098
124 
125 --
126 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
127 --
128 BEGIN
129 
130     IF l_debug_level  > 0 THEN
131         oe_debug_pub.add(  'ENTERING OE_VALIDATE_LOT_SERIAL.ENTITY' , 1 ) ;
132     END IF;
133     --  Check required attributes.
134 
135     IF  p_Lot_Serial_rec.lot_serial_id IS NULL
136     THEN
137 
138         l_return_status := FND_API.G_RET_STS_ERROR;
139         FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
140         FND_MESSAGE.SET_TOKEN('ATTRIBUTE','Lot Serial ID');
141         OE_MSG_PUB.Add;
142 
143     END IF;
144 
145     --
146     --  Check rest of required attributes here.
147     --
148 
149     IF  p_Lot_Serial_rec.quantity IS NULL
150     THEN
151 
152         l_return_status := FND_API.G_RET_STS_ERROR;
153         FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
154         FND_MESSAGE.SET_TOKEN('ATTRIBUTE','Quantity');
155         OE_MSG_PUB.Add;
156 
157     END IF;
158 
159     --  Return Error if a required attribute is missing.
160 
161     IF l_return_status = FND_API.G_RET_STS_ERROR THEN
162 
163         RAISE FND_API.G_EXC_ERROR;
164 
165     END IF;
166 
167     --
168     --  Check conditionally required attributes here.
169     --
170 
171 
172   IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL < '110510' THEN -- OPM new
173 
174     IF  p_Lot_Serial_rec.lot_number IS NULL AND
175 	   p_Lot_Serial_rec.from_serial_number IS NULL
176     THEN
177         l_return_status := FND_API.G_RET_STS_ERROR;
178         FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
179         FND_MESSAGE.SET_TOKEN('ATTRIBUTE','Lot Number/From Serial Number');
180         OE_MSG_PUB.Add;
181 
182     END IF;
183  END IF;   -- OPM new
184 
185     IF  p_Lot_Serial_rec.quantity > 1 AND
186 	   p_Lot_Serial_rec.from_serial_number IS NOT NULL AND
187 	   p_Lot_Serial_rec.to_serial_number IS NULL
188     THEN
189 
190         l_return_status := FND_API.G_RET_STS_ERROR;
191         FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
192         FND_MESSAGE.SET_TOKEN('ATTRIBUTE','To Serial Number');
193         OE_MSG_PUB.Add;
194 
195     END IF;
196 
197     IF l_debug_level  > 0 THEN
198         oe_debug_pub.add(  'THE QUANTITY IS '||TO_CHAR ( P_LOT_SERIAL_REC.QUANTITY ) , 1 ) ;
199     END IF;
200     IF l_debug_level  > 0 THEN
201         oe_debug_pub.add(  'THE OLD QUANTITY IS '||TO_CHAR ( P_OLD_LOT_SERIAL_REC.QUANTITY ) , 1 ) ;
202     END IF;
203 
204 
205     -- We should not validate the quantity field on oe_lot_serial_numbers table as
206     -- the UOM on this record may not match the ordered_quantity_UOM. Unless we
207     -- start capturing UOMs for the lot_serial records, we should not validate the
208     -- quantity totals with ordered_quantity.
209     -- Removing the validation for bug 5155914.
210 
211     /*
212 
213     IF NOT OE_GLOBALS.Equal(p_Lot_Serial_rec.quantity,
214 					   p_old_Lot_Serial_rec.quantity)
215     THEN
216 	   IF p_Lot_Serial_rec.line_set_id IS NOT NULL THEN
217     IF l_debug_level  > 0 THEN
218         oe_debug_pub.add(  'QUERYING FOR LINE_SET_ID' , 1 ) ;
219     END IF;
220 	       SELECT NVL(SUM(ORDERED_QUANTITY),0)
221 	       INTO l_ordered_qty
222 	       FROM OE_ORDER_LINES
223 	       WHERE line_set_id = p_Lot_Serial_rec.line_set_id;
224 
225 	       SELECT NVL(SUM(quantity),0)
226 	       INTO l_total_qty
227 	       FROM OE_LOT_SERIAL_NUMBERS
228 	       WHERE line_set_id = p_Lot_Serial_rec.line_set_id
229 	       AND lot_serial_id <> p_Lot_Serial_rec.lot_serial_id;
230         ELSE
231     IF l_debug_level  > 0 THEN
232         oe_debug_pub.add(  'QUERYING FOR LINE_ID' , 1 ) ;
233     END IF;
234 	       SELECT NVL(ORDERED_QUANTITY,0)
235 	       INTO l_ordered_qty
236 	       FROM OE_ORDER_LINES
237 	       WHERE line_id = p_Lot_Serial_rec.line_id;
238 
239 	       SELECT NVL(SUM(quantity),0)
240 	       INTO l_total_qty
241 	       FROM OE_LOT_SERIAL_NUMBERS
242 	       WHERE line_id = p_Lot_Serial_rec.line_id
243 	       AND lot_serial_id <> p_Lot_Serial_rec.lot_serial_id;
244 
245 	   END IF;
246 
247         IF p_Lot_Serial_rec.quantity > (l_ordered_qty - l_total_qty)
248 	   THEN
249             l_return_status := FND_API.G_RET_STS_ERROR;
250             FND_MESSAGE.SET_NAME('ONT','OE_TOO_MANY_LOT_SERIAL');
251             OE_MSG_PUB.Add;
252 
253         END IF;
254     END IF;
255     */
256     --
257     --  Validate attribute dependencies here.
258     --
259     IF l_debug_level  > 0 THEN
260         oe_debug_pub.add(  'QUANTITY IS '||TO_CHAR ( P_LOT_SERIAL_REC.QUANTITY ) , 1 ) ;
261     END IF;
262     IF l_debug_level  > 0 THEN
263         oe_debug_pub.add(  'FROM IS '||P_LOT_SERIAL_REC.FROM_SERIAL_NUMBER , 1 ) ;
264     END IF;
265     IF l_debug_level  > 0 THEN
266         oe_debug_pub.add(  'TO IS '||P_LOT_SERIAL_REC.TO_SERIAL_NUMBER , 1 ) ;
267     END IF;
268     IF  p_Lot_Serial_rec.quantity IS NOT NULL AND
269         p_Lot_Serial_rec.from_serial_number IS NOT NULL AND
270 	  (NOT OE_GLOBALS.Equal(p_Lot_Serial_rec.quantity,
271 					   p_old_Lot_Serial_rec.quantity) OR
272        NOT OE_GLOBALS.Equal(p_Lot_Serial_rec.from_serial_number,
273 					   p_old_Lot_Serial_rec.from_serial_number) OR
274        NOT OE_GLOBALS.Equal(p_Lot_Serial_rec.to_serial_number,
275 					   p_old_Lot_Serial_rec.to_serial_number))
276     THEN
277         IF NOT MTL_SERIAL_CHECK.INV_SERIAL_INFO(
278                         p_Lot_Serial_rec.from_serial_number,
279                         p_Lot_Serial_rec.to_serial_number,
280                         x_prefix,
281                         x_quantity,
282                         x_from_number,
283                         x_to_number,
284                         x_error_code)
285         THEN
286           l_return_status := FND_API.G_RET_STS_ERROR;
287           FND_MESSAGE.Set_Name('ONT','OE_NOT_KNOW_QUANTITY');
288           OE_MSG_PUB.Add;
289     IF l_debug_level  > 0 THEN
290         oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY 2' , 1 ) ;
291     END IF;
292         ELSE
293             IF p_Lot_Serial_rec.quantity <> x_quantity THEN
294                 l_return_status := FND_API.G_RET_STS_ERROR;
295                 FND_MESSAGE.Set_Name('ONT','OE_QUANTITY_MISMATCH');
296                 OE_MSG_PUB.Add;
297     		IF l_debug_level  > 0 THEN
298         		oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY 3' , 1 ) ;
299     		END IF;
300             END IF;
301         END IF;
302 
303     END IF;
304 
305 -- OPM 3494420 start
306 	If OE_CODE_CONTROL.GET_CODE_RELEASE_LEVEL >= '110510'
307 	and OE_GLOBALS.G_UI_FLAG = FALSE
308 	 Then
309 
310 		IF l_debug_level  > 0 THEN
311         		oe_debug_pub.add(  'RMA lot serial QUERYING FOR LINE_ID' , 1 ) ; -- INVCONV
312     		END IF;
313 
314     		begin
315     		OPEN c_lines( p_Lot_Serial_rec.line_id );
316 	               FETCH c_lines
317 	                INTO l_inventory_item_id, l_ship_from_org_id, l_order_quantity_uom, l_ordered_quantity_uom2;
318 
319 	        	IF c_lines%NOTFOUND THEN
320 	                	l_inventory_item_id := 0;
321 	                	l_ship_from_org_id := 0;
322 	                	l_order_quantity_uom := NULL;
323 	                	l_ordered_quantity_uom2 := NULL;
324 			END IF;
325 		 close c_lines;
326     		 end;
327 
328                OPEN c_rcv_parameter( l_ship_from_org_id );
329 
330                FETCH c_rcv_parameter
331                 INTO l_RMA_LOT_RESTRICT
332 	             ;
333 
334 
335                IF c_rcv_parameter%NOTFOUND THEN
336 									l_RMA_LOT_RESTRICT := 'U';
337                END IF;
338 
339    	       Close c_rcv_parameter;
340 
341 
342                OPEN c_item( l_ship_from_org_id,
343                    l_inventory_item_id
344                               );
345                FETCH c_item
346                 INTO   l_lot_ctl,
347 	               l_tracking_quantity_ind,
348                        l_secondary_uom_code ,
349                        l_serial_number_control_code,
350                        l_secondary_default_ind,
351                        l_primary_uom_code
352 	               ;
353 
354 
355                IF c_item%NOTFOUND THEN
356 		    l_lot_ctl := 1;
357             	    l_tracking_quantity_ind := 'P';
358 	            l_secondary_uom_code := NULL;
359 	            l_serial_number_control_code := NULL;
360 	            l_secondary_default_ind := null;
361 
362 	       END IF;
363 
364 	       Close c_item;
365 
366          IF l_debug_level  > 0 THEN
367        			oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY - l_secondary_uom_code = ' || l_secondary_uom_code, 1 ) ;
368        			oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY - l_tracking_quantity_ind  = ' || l_tracking_quantity_ind , 1 ) ;
369        			oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY - l_RMA_LOT_RESTRICT = ' || l_RMA_LOT_RESTRICT, 1 ) ;
370        			oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY - l_serial_number_control_code = ' || l_serial_number_control_code, 1 ) ;
371        			oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY - l_secondary_default_ind = ' || l_secondary_default_ind, 1 ) ;
372        			oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY - l_lot_ctl = ' || l_lot_ctl, 1 ) ;
373 						oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY - l_ship_from_org_id = ' || l_ship_from_org_id, 1 ) ;
374 						oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY - l_inventory_item_id = ' || l_inventory_item_id, 1 ) ;
375     		 		oe_debug_pub.add(  'IN OE_VALIDATE_LOT_SERIAL.ENTITY - p_Lot_Serial_rec.lot_number, = ' || p_Lot_Serial_rec.lot_number, 1 ) ;
376     		 END IF;
377 
378 
379 		/*IF oe_line_util.Process_Characteristics INVCONV
380   			(l_inventory_item_id,l_ship_from_org_id,l_item_rec)
381   	  	Then
382 
383 			IF l_debug_level  > 0 THEN
384         			oe_debug_pub.add(  'OPM RMA - OPM item' , 1 ) ;
385     			END IF;
386 
387                         begin
388     			OPEN c_opm_item( l_ship_from_org_id,
389                    			 l_inventory_item_id
390                               );
391 	               FETCH c_opm_item
392 	                INTO l_item_id,
393 	                       l_item_no,
394 		               l_lot_ctl,
395 		             --  l_sublot_ctl, INVCONV
396 		               l_dualum_ind,
397 		               l_item_um2
398 		                ;
399 
400 	               IF c_opm_item%NOTFOUND THEN
401 			l_item_id := 0;
402 	                l_lot_ctl := 0;
403 		         l_dualum_ind := NULL;
404 		        l_item_um2 := NULL;
405 
406 		       END IF;
407 
408 		       Close c_opm_item;
409 
410     		 	end; */
411 
412 
413 
414      -- lot validation
415      			IF l_lot_ctl <> 2 and  -- INVCONV
416        			( p_Lot_Serial_rec.lot_number <> FND_API.G_MISS_CHAR
417        				and p_Lot_Serial_rec.lot_number IS NOT NULL ) then
418          			IF l_debug_level  > 0 THEN
419 	    				 oe_debug_pub.add(  'INVALID LINE LOT SERIALS LOT NUMBER...' ) ;
420 	 			END IF;
421 	 			FND_MESSAGE.SET_NAME('INV','INV_NO_LOT_CONTROL');
422          			OE_MSG_PUB.Add;
423 	 			l_return_status := FND_API.G_RET_STS_ERROR;
424       			END IF;
425 
426      		/*	IF l_sublot_ctl <> 1 and  INVCONV
427        			( p_Lot_Serial_rec.sublot_number <> FND_API.G_MISS_CHAR
428        			and p_Lot_Serial_rec.sublot_number IS NOT NULL ) then
429          			IF l_debug_level  > 0 THEN
430 	     				oe_debug_pub.add(  'OPM INVALID LINE LOT SERIALS SUBLOT NUMBER...' ) ;
431 	 			END IF;
432 	 			FND_MESSAGE.SET_NAME('GMI','IC_SUBLOTNO');
433          			OE_MSG_PUB.Add;
434 	 			l_return_status := FND_API.G_RET_STS_ERROR;
435       			END IF; */
436 
437 		       /* IF l_sublot_ctl = 1 and
438 		        (  p_Lot_Serial_rec.sublot_number <> FND_API.G_MISS_CHAR
439 		       	and p_Lot_Serial_rec.sublot_number IS NOT NULL )
440 		       	and
441 		        (  p_Lot_Serial_rec.lot_number = FND_API.G_MISS_CHAR
442 		        or p_Lot_Serial_rec.lot_number IS NULL ) then
443 
444 		         	IF l_debug_level  > 0 THEN
445 			     		oe_debug_pub.add(  'OPM INVALID LINE LOT SERIALS NO LOT NUMBER...' ) ;
446 			 	END IF;
447 				 FND_MESSAGE.SET_NAME('INV','INV_MISSING_LOT');
448 		         	OE_MSG_PUB.Add;
449 			 	l_return_status := FND_API.G_RET_STS_ERROR;
450 		        END IF; */
451 
452 
453 		        IF ( l_RMA_LOT_RESTRICT = 'R' OR -- INVCONV
454 		          l_RMA_LOT_RESTRICT = 'W' )   -- RESTRICTED_WITH_WARNING'  -- INVCONV
455 		          and l_lot_ctl = 2 -- (YES)     INVCONV
456 		          and ( p_Lot_Serial_rec.lot_number <> FND_API.G_MISS_CHAR
457 		                and p_Lot_Serial_rec.lot_number IS NOT NULL )
458 		          then
459 		                begin
460 
461 		                OPEN c_lot1( l_inventory_item_id,
462                                           p_Lot_Serial_rec.lot_number,     -- INVCONV
463                                           l_ship_from_org_id );
464 
465 
466                			FETCH c_lot1 into l_lot_number;  --  l_sublot_number INVCONV ;
467 
468                			IF c_lot1%NOTFOUND THEN
469                         IF l_debug_level  > 0 THEN
470 		             							oe_debug_pub.add(  'NO_DATA_FOUND WHEN checking RMA attribute lot number' ) ;
471 		             				END IF;
472 		             				FND_MESSAGE.SET_NAME('INV','INV_CHECK_LOT_ENTRY'); -- INVCONV PLSE ENTER A VALID LOT NUMBER
473 		          					OE_MSG_PUB.Add;
474 		          					l_return_status := FND_API.G_RET_STS_ERROR;
475 
476 	       						END IF;
477 
478 
479 	             		Close c_lot1;
480 
481 
482 
483 		               /* OPEN c_opm_lot1( l_item_rec.opm_item_id ,
484                                           p_Lot_Serial_rec.lot_number );
485 
486                			FETCH c_opm_lot1 into l_lot_id;
487 
488                			IF c_opm_lot1%NOTFOUND THEN
489 					IF l_debug_level  > 0 THEN
490 		             			oe_debug_pub.add(  'NO_DATA_FOUND WHEN checking RMA attribute lot number' ) ;
491 		             		END IF;
492 		             		l_lot_id := 0;
493 		             		FND_MESSAGE.SET_NAME('INV','INV_CHECK_LOT_ENTRY'); -- INVCONV PLSE ENTER A VALID LOT NUMBER
494 		          		OE_MSG_PUB.Add;
495 		          		l_return_status := FND_API.G_RET_STS_ERROR;
496 
497 	       			END IF;
498 
499 	      			Close c_opm_lot1; */
500 
501 		           end;
502 
503 		         END IF; --  IF ( l_RMA_LOT_RESTRICT = 'R' OR -- INVCONV
504 
505 			/* IF ( l_opm_rma_profile = 'RESTRICTED' OR --INVCONV
506 		          l_opm_rma_profile = 'RESTRICTED_WITH_WARNING' )
507 		          -- and l_sublot_ctl = 1 INVCONV
508 		          and ( p_Lot_Serial_rec.sublot_number <> FND_API.G_MISS_CHAR
509 		                and p_Lot_Serial_rec.sublot_number IS NOT NULL )
510 		          then
511 		              begin
512 		              OPEN c_opm_lot2( l_item_rec.opm_item_id ,
513                                           p_lot_serial_rec.lot_number,
514                                           p_lot_serial_rec.sublot_number
515                                            );
516 
517                			FETCH c_opm_lot2 into l_lot_id;
518 
519 		               IF c_opm_lot2%NOTFOUND THEN
520 		            	IF l_debug_level  > 0 THEN
521 		             			oe_debug_pub.add(  'OPM NO_DATA_FOUND WHEN checking OPM RMA attribute sublot number' ) ;
522 		             	END IF;
523 		             	l_lot_id := 0;
524 		             	FND_MESSAGE.SET_NAME('GMI','IC_SUBLOTNO');
525 		          	OE_MSG_PUB.Add;
526 		          	l_return_status := FND_API.G_RET_STS_ERROR;
527 
528 			       END IF;
529 
530 	      		      Close c_opm_lot2;
531 		              end;
532 	               END IF; -- IF ( l_opm_rma_profile = 'RESTRICTED' OR */
533 
534 
535 -- validate quantity2
536 -- added from pre process
537 		       IF l_debug_level  > 0 THEN
538 		     		oe_debug_pub.add(  'OE_VALIDATE_LOT_SERIAL.ENTITY - validating QUANTITY2...' ) ;
539 		       END IF;
540 		       IF l_tracking_quantity_ind = 'P'  and  --    INVCONV l_dualum_ind < 1 and
541 		       ( p_lot_serial_rec.quantity2 <> FND_API.G_MISS_NUM
542 		       and p_lot_serial_rec.quantity2 IS NOT NULL
543 		       and p_lot_serial_rec.quantity2 <> 0) then           -- Bug 9408981
544 
545 		         IF l_debug_level  > 0 THEN
546 			     oe_debug_pub.add(  'INVALID LINE LOT SERIALS QUANTITY2...' ) ; -- INVCONV
547 			 END IF;
548 			 FND_MESSAGE.SET_NAME('INV','INV_SECONDARY_QTY_NOT_REQUIRED'); --INVCONV
549 			 --FND_MESSAGE.SET_TOKEN('ITEM_NO',L_ITEM_NO); INVCONV
550 			 --FND_MESSAGE.SET_TOKEN('LOT_NO',p_lot_serial_rec.lot_number); INVCONV
551 			 --FND_MESSAGE.SET_TOKEN('SUBLOT_NO',p_lot_serial_rec.sublot_number); INVCONV
552 			 OE_MSG_PUB.Add;
553 			 l_return_status := FND_API.G_RET_STS_ERROR;
554 		      END IF;
555 
556 		 	IF l_debug_level  > 0 THEN
557 			     oe_debug_pub.add(  'OE_VALIDATE_LOT_SERIAL.ENTITY -  validating QUANTITY2 negative ...' ) ;
558 			END IF;
559 		/*       If quantity2 is present and negative,  then error */
560 
561 		  	IF nvl(p_lot_serial_rec.quantity2, 0) < 0 then
562 
563 		      		FND_MESSAGE.SET_NAME('ONT','SO_PR_NEGATIVE_AMOUNT');
564 		      		OE_MSG_PUB.Add;
565 			 	l_return_status := FND_API.G_RET_STS_ERROR;
566 		      		IF l_debug_level  > 0 THEN
567 		        		oe_debug_pub.add ('INVALID LINE LOT SERIALS QUANTITY2 - negative....');
568 		      		END IF;
569 		      	END IF;
570 -- added from pre process end
571 
572 
573 		/* check deviations and defaulting */
574 		/*  for type 3, check both qty and qty2 are populated */
575 
576 		        IF l_secondary_default_ind = 'N' then
577 			--IF  l_dualum_ind = 3 then
578 
579 				IF l_debug_level  > 0 THEN
580 			    		 oe_debug_pub.add(  'OE_Validate_Lot_Serial.entity - validating No default dual QUANTITYs...' ) ;
581 		      		 END IF;
582 				IF  (NVL(p_Lot_Serial_rec.quantity2,0) = 0 )
583           			OR (NVL(p_Lot_Serial_rec.quantity,0 ) = 0 ) THEN
584           				FND_MESSAGE.SET_NAME('ONT','OE_BULK_OPM_NULL_QTY');
585 		      			OE_MSG_PUB.Add;
586 			 	 	l_return_status := FND_API.G_RET_STS_ERROR;
587 		      			IF l_debug_level  > 0 THEN
588 		        			oe_debug_pub.add ('INVALID LINE LOT SERIALS -  one qty is blank for type No Default..');
589 		      			END IF;
590          			END IF;
591 			END IF; -- IF l_secondary_default_ind = 'N' then
592 
593 			-- tolerance check for Default and No Default items   (old type 2,3)
594 
595 			--IF  l_dualum_ind in(2,3)
596 			IF l_secondary_default_ind in ('N','D')
597 			and ( p_Lot_Serial_rec.quantity <> FND_API.G_MISS_NUM and
598 			      NVL(p_Lot_Serial_rec.quantity,0) <> 0 )
599 			and ( p_Lot_Serial_rec.quantity2 <> FND_API.G_MISS_NUM and
600 			      NVL(p_Lot_Serial_rec.quantity2,0) <> 0 )
601 			      then
602 
603 				l_quantity := p_Lot_Serial_rec.quantity;
604 				l_quantity2 := p_Lot_Serial_rec.quantity2;
605 			  l_lot_number := p_Lot_Serial_rec.LOT_NUMBER; -- 4260166 INVCONV
606 
607 
608 				IF l_debug_level  > 0 THEN
609 			     		oe_debug_pub.add(  'OE_Validate_Lot_Serial.entity - tolerance check for type Default and No Default  ..' ) ;
610 		       		END IF;
611 
612 				/* IF  l_lot_ctl = 2  -- INVCONV PAL bug fix for lot number  -- 4260166
613 		          	and ( p_Lot_Serial_rec.lot_number <> FND_API.G_MISS_CHAR
614 		                and p_Lot_Serial_rec.lot_number IS NOT NULL )
615 		          	then
616 		          		begin
617 
618 		                        OPEN c_lot1( l_inventory_item_id,
619                                           p_Lot_Serial_rec.lot_number,     -- INVCONV
620                                           l_ship_from_org_id );
621 
622 
623                				FETCH c_lot1 into l_lot_number;  --  l_sublot_number INVCONV ;
624 
625                				IF c_lot1%NOTFOUND THEN
626 
627                				  IF l_debug_level  > 0 THEN
628 			             			oe_debug_pub.add(  'NO_DATA_FOUND for type Default and No default checking lot number' ) ;
629 			             	 END IF;
630                                         END IF;
631 		                        Close c_lot1;
632 			                end;
633 
634 		         	end if; -- IF  l_lot_ctl = 2  -- INVCONV PAL bug fix for lot_number -- 4260166
635 
636 		     */
637 
638 				/*   IF l_sublot_ctl = 1 -- INVCONV
639 			          and ( p_Lot_Serial_rec.sublot_number <> FND_API.G_MISS_CHAR
640 			                and p_Lot_Serial_rec.sublot_number IS NOT NULL )
641 			          then
642 			               begin
643 		              		OPEN c_opm_lot2( l_item_rec.opm_item_id ,
644                                           p_lot_serial_rec.lot_number,
645                                           p_lot_serial_rec.sublot_number
646                                            );
647 
648 	               			FETCH c_opm_lot2 into l_lot_id;
649 
650 			               IF c_opm_lot2%NOTFOUND THEN
651 			                 IF l_debug_level  > 0 THEN
652 			             			oe_debug_pub.add(  'OPM NO_DATA_FOUND for type 2,3 tolerance check checking sublot number' ) ;
653 			             	 END IF;
654 			             	 l_lot_id := 0;
655 			               END IF;
656 
657 		      		      Close c_opm_lot2;
658 			              end;
659 
660 				end if; */
661 
662 			/*-- get opm um from apps um
663 				GMI_Reservation_Util.Get_OPMUOM_from_AppsUOM
664 				 (p_Apps_UOM       => l_order_quantity_uom
665 				 ,x_OPM_UOM        => l_OPM_UOM
666 				 ,x_return_status  => l_status
667 				 ,x_msg_count      => l_msg_count
668 				 ,x_msg_data       => l_msg_data);    	 */
669 
670 	                     -- check the deviation and error out
671 	                     --Bug 10021098. Passing primary_uom_code to parameter p_uom_code1 because l_quantity is in primary UOM.
672 			       l_return := INV_CONVERT.Within_Deviation  -- INVCONV
673 			                       ( p_organization_id   => l_ship_from_org_id
674 			                       , p_inventory_item_id => l_inventory_item_id
675 			                       , p_lot_number        => l_lot_number
676 			                       , p_precision         => 5
677 			                       , p_quantity          => l_quantity
678 			                         /* , p_uom_code1         => l_order_quantity_uom -- INVCONV */
679 			                       , p_uom_code1         => l_primary_uom_code  --Bug 10021098
680 			                       , p_quantity2         => l_quantity2
681 			                       , p_uom_code2         => l_secondary_uom_code );
682 
683 			      IF l_return = 0
684 			      	then
685 			      	    IF l_debug_level  > 0 THEN
686 			    	  			oe_debug_pub.add('OE_Validate_Lot_Serial.entity - tolerance error 1' ,1);
687 			    	    END IF;
688 
689 			    	    l_buffer          := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST, -- INVCONV
690 			                                         p_encoded => 'F');
691 			            oe_msg_pub.add_text(p_message_text => l_buffer);
692 			            IF l_debug_level  > 0 THEN
693 			              oe_debug_pub.add(l_buffer,1);
694 			    	    END IF;
695 			    	    RAISE TOLERANCE_ERROR ;
696 
697 			     else
698 			      	    IF l_debug_level  > 0 THEN
699 			    	  	oe_debug_pub.add('OE_Validate_Lot_Serial.entity - No tolerance error so return ',1);
700 			    	    END IF;
701 			    	    x_return_status := 0;
702 			     	    -- RETURN; INVCONV bug 4099604
703 			     END IF; -- IF l_return = 0
704 
705 
706 
707 
708          			/* check the deviation and error out
709       				l_return := GMICVAL.dev_validation(l_item_id
710                                      	 ,nvl(l_lot_id, 0)
711                                      	 ,l_quantity
712                                      	 ,l_OPM_UOM
713                                       	,l_quantity2
714                                       	,l_item_um2
715                                       	,0);
716 
717       				IF (l_return = -68 ) THEN
718          				l_return_status := FND_API.G_RET_STS_ERROR;
719          				FND_MESSAGE.set_name('GMI','IC_DEVIATION_HI_ERR');
720          				OE_MSG_PUB.Add;
721       				ELSIF(l_return = -69 ) THEN
722          				 l_return_status := FND_API.G_RET_STS_ERROR;
723          				FND_MESSAGE.set_name('GMI','IC_DEVIATION_LO_ERR');
724          				OE_MSG_PUB.Add;
725       				END IF;
726       				IF l_return <> 0
727       				  THEN
728       				     l_return_status := FND_API.G_RET_STS_ERROR;
729 
730       				END IF;   */
731 
732 			        IF l_debug_level  > 0 THEN
733 			     		oe_debug_pub.add(  'OE_Validate_Lot_Serial.entity - after tolerance check for type Default and No default. l_return = ' || l_return  ) ;
734 		       	        END IF;
735 
736 
737 			END IF; -- IF l_secondary_default_ind in ('N','D')   invconv IF  l_dualum_ind in (2,3)  then
738 
739 		-- END IF; -- IF oe_line_util.Process_Characteristics (l_inventory_item_id,l_ship_from_org_id,l_item_rec)  INVCONV
740 
741 	end if;  -- If OE_CODE_CONTROL.GET_CODE_RELEASE_LEVEL >= '110510' and OE_GLOBALS.G_UI_FLAG = FALSE Then
742 -- OPM 3494420 end
743 
744     --  Done validating entity
745 
746     x_return_status := l_return_status;
747     IF l_debug_level  > 0 THEN
748         oe_debug_pub.add(  'EXITING OE_VALIDATE_LOT_SERIAL.ENTITY return status = ' || x_return_status  , 1 ) ;
749     END IF;
750 
751 EXCEPTION
752 
753     WHEN FND_API.G_EXC_ERROR THEN
754 
755         x_return_status := FND_API.G_RET_STS_ERROR;
756 
757     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
758 
759         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
760 
761     WHEN TOLERANCE_ERROR THEN -- INVCONV
762 				oe_debug_pub.add('Exception handling: TOLERANCE_ERROR in OE_VALIDATE_LOT_SERIAL.ENTITY', 1);
763  				 x_return_status := -1;
764 
765     WHEN OTHERS THEN
766 
767         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
768 
769         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
770         THEN
771             OE_MSG_PUB.Add_Exc_Msg
772             (   G_PKG_NAME
773             ,   'Entity'
774             );
775         END IF;
776 IF l_debug_level  > 0 THEN
777         oe_debug_pub.add(  'EXITING OE_VALIDATE_LOT_SERIAL.ENTITY return status = ' || x_return_status  , 1 ) ;
778     END IF;
779 END Entity;
780 
781 --  Procedure Attributes
782 
783 PROCEDURE Attributes
784 ( x_return_status OUT NOCOPY VARCHAR2
785 
786 ,   p_Lot_Serial_rec                IN  OE_Order_PUB.Lot_Serial_Rec_Type
787 ,   p_old_Lot_Serial_rec            IN  OE_Order_PUB.Lot_Serial_Rec_Type :=
788                                         OE_Order_PUB.G_MISS_LOT_SERIAL_REC
789 )
790 IS
791 --
792 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
793 --
794 BEGIN
795 
796     IF l_debug_level  > 0 THEN
797         oe_debug_pub.add(  'ENTERING OE_VALIDATE_LOT_SERIAL.ATTRIBUTES' , 1 ) ;
798     END IF;
799     x_return_status := FND_API.G_RET_STS_SUCCESS;
800 
801     --  Validate Lot_Serial attributes
802 
803     IF  p_Lot_Serial_rec.created_by IS NOT NULL AND
804         (   p_Lot_Serial_rec.created_by <>
805             p_old_Lot_Serial_rec.created_by OR
806             p_old_Lot_Serial_rec.created_by IS NULL )
807     THEN
808         IF NOT OE_Validate.Created_By(p_Lot_Serial_rec.created_by) THEN
809             x_return_status := FND_API.G_RET_STS_ERROR;
810         END IF;
811     END IF;
812 
813     IF  p_Lot_Serial_rec.creation_date IS NOT NULL AND
814         (   p_Lot_Serial_rec.creation_date <>
815             p_old_Lot_Serial_rec.creation_date OR
816             p_old_Lot_Serial_rec.creation_date IS NULL )
817     THEN
818         IF NOT OE_Validate.Creation_Date(p_Lot_Serial_rec.creation_date) THEN
819             x_return_status := FND_API.G_RET_STS_ERROR;
820         END IF;
821     END IF;
822 
823     IF  p_Lot_Serial_rec.from_serial_number IS NOT NULL AND
824         (   p_Lot_Serial_rec.from_serial_number <>
825             p_old_Lot_Serial_rec.from_serial_number OR
826             p_old_Lot_Serial_rec.from_serial_number IS NULL )
827     THEN
828         IF NOT OE_Validate.From_Serial_Number(p_Lot_Serial_rec.from_serial_number) THEN
829             x_return_status := FND_API.G_RET_STS_ERROR;
830         END IF;
831     END IF;
832 
833     IF  p_Lot_Serial_rec.last_updated_by IS NOT NULL AND
834         (   p_Lot_Serial_rec.last_updated_by <>
835             p_old_Lot_Serial_rec.last_updated_by OR
836             p_old_Lot_Serial_rec.last_updated_by IS NULL )
837     THEN
838         IF NOT OE_Validate.Last_Updated_By(p_Lot_Serial_rec.last_updated_by) THEN
839             x_return_status := FND_API.G_RET_STS_ERROR;
840         END IF;
841     END IF;
842 
843     IF  p_Lot_Serial_rec.last_update_date IS NOT NULL AND
844         (   p_Lot_Serial_rec.last_update_date <>
845             p_old_Lot_Serial_rec.last_update_date OR
846             p_old_Lot_Serial_rec.last_update_date IS NULL )
847     THEN
848         IF NOT OE_Validate.Last_Update_Date(p_Lot_Serial_rec.last_update_date) THEN
849             x_return_status := FND_API.G_RET_STS_ERROR;
850         END IF;
851     END IF;
852 
853     IF  p_Lot_Serial_rec.last_update_login IS NOT NULL AND
854         (   p_Lot_Serial_rec.last_update_login <>
855             p_old_Lot_Serial_rec.last_update_login OR
856             p_old_Lot_Serial_rec.last_update_login IS NULL )
857     THEN
858         IF NOT OE_Validate.Last_Update_Login(p_Lot_Serial_rec.last_update_login) THEN
859             x_return_status := FND_API.G_RET_STS_ERROR;
860         END IF;
861     END IF;
862 
863     IF  p_Lot_Serial_rec.line_id IS NOT NULL AND
864         (   p_Lot_Serial_rec.line_id <>
865             p_old_Lot_Serial_rec.line_id OR
866             p_old_Lot_Serial_rec.line_id IS NULL )
867     THEN
868         IF NOT OE_Validate.Line(p_Lot_Serial_rec.line_id) THEN
869             x_return_status := FND_API.G_RET_STS_ERROR;
870         END IF;
871     END IF;
872 
873     IF  p_Lot_Serial_rec.line_set_id IS NOT NULL AND
874         (   p_Lot_Serial_rec.line_set_id <>
875             p_old_Lot_Serial_rec.line_set_id OR
876             p_old_Lot_Serial_rec.line_set_id IS NULL )
877     THEN
878         IF NOT OE_Validate.Line_Set(p_Lot_Serial_rec.line_set_id) THEN
879             x_return_status := FND_API.G_RET_STS_ERROR;
880         END IF;
881     END IF;
882 
883     IF  p_Lot_Serial_rec.lot_number IS NOT NULL AND
884         (   p_Lot_Serial_rec.lot_number <>
885             p_old_Lot_Serial_rec.lot_number OR
886             p_old_Lot_Serial_rec.lot_number IS NULL )
887     THEN
888         IF NOT OE_Validate.Lot_Number(p_Lot_Serial_rec.lot_number) THEN
889             x_return_status := FND_API.G_RET_STS_ERROR;
890         END IF;
891     END IF;
892 
893 
894     /*IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510' THEN
895 
896     	IF  p_Lot_Serial_rec.sublot_number IS NOT NULL AND   --OPM 2380194 INVCONV
897         	(   p_Lot_Serial_rec.sublot_number <>
898             	p_old_Lot_Serial_rec.sublot_number OR
899             	p_old_Lot_Serial_rec.sublot_number IS NULL )
900     	THEN
901         	IF NOT OE_Validate.Sublot_Number(p_Lot_Serial_rec.sublot_number) THEN
902             	x_return_status := FND_API.G_RET_STS_ERROR;
903         	END IF;
904     	END IF;
905 
906     END IF; */
907 
908     IF  p_Lot_Serial_rec.lot_serial_id IS NOT NULL AND
909         (   p_Lot_Serial_rec.lot_serial_id <>
910             p_old_Lot_Serial_rec.lot_serial_id OR
911             p_old_Lot_Serial_rec.lot_serial_id IS NULL )
912     THEN
913         IF NOT OE_Validate.Lot_Serial(p_Lot_Serial_rec.lot_serial_id) THEN
914             x_return_status := FND_API.G_RET_STS_ERROR;
915         END IF;
916     END IF;
917 
918     IF  p_Lot_Serial_rec.quantity IS NOT NULL AND
919         (   p_Lot_Serial_rec.quantity <>
920             p_old_Lot_Serial_rec.quantity OR
921             p_old_Lot_Serial_rec.quantity IS NULL )
922     THEN
923         IF NOT OE_Validate.Quantity(p_Lot_Serial_rec.quantity) THEN
924             x_return_status := FND_API.G_RET_STS_ERROR;
925         END IF;
926     END IF;
927 
928     IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510' THEN
929 
930     	IF  p_Lot_Serial_rec.quantity2 IS NOT NULL AND --OPM 2380194
931         	(   p_Lot_Serial_rec.quantity2 <>
932         	    p_old_Lot_Serial_rec.quantity2 OR
933             	    p_old_Lot_Serial_rec.quantity2 IS NULL )
934     	THEN
935 
936         	IF NOT OE_Validate.Quantity2(p_Lot_Serial_rec.quantity2) THEN
937         	        x_return_status := FND_API.G_RET_STS_ERROR;
938         	END IF;
939     	END IF;
940 
941     END IF;
942 
943     IF  p_Lot_Serial_rec.to_serial_number IS NOT NULL AND
944         (   p_Lot_Serial_rec.to_serial_number <>
945             p_old_Lot_Serial_rec.to_serial_number OR
946             p_old_Lot_Serial_rec.to_serial_number IS NULL )
947     THEN
948         IF NOT OE_Validate.To_Serial_Number(p_Lot_Serial_rec.to_serial_number) THEN
949             x_return_status := FND_API.G_RET_STS_ERROR;
950         END IF;
951     END IF;
952 
953     IF  (p_Lot_Serial_rec.attribute1 IS NOT NULL AND
954         (   p_Lot_Serial_rec.attribute1 <>
955             p_old_Lot_Serial_rec.attribute1 OR
956             p_old_Lot_Serial_rec.attribute1 IS NULL ))
957     OR  (p_Lot_Serial_rec.attribute10 IS NOT NULL AND
958         (   p_Lot_Serial_rec.attribute10 <>
959             p_old_Lot_Serial_rec.attribute10 OR
960             p_old_Lot_Serial_rec.attribute10 IS NULL ))
961     OR  (p_Lot_Serial_rec.attribute11 IS NOT NULL AND
962         (   p_Lot_Serial_rec.attribute11 <>
963             p_old_Lot_Serial_rec.attribute11 OR
964             p_old_Lot_Serial_rec.attribute11 IS NULL ))
965     OR  (p_Lot_Serial_rec.attribute12 IS NOT NULL AND
966         (   p_Lot_Serial_rec.attribute12 <>
967             p_old_Lot_Serial_rec.attribute12 OR
968             p_old_Lot_Serial_rec.attribute12 IS NULL ))
969     OR  (p_Lot_Serial_rec.attribute13 IS NOT NULL AND
970         (   p_Lot_Serial_rec.attribute13 <>
971             p_old_Lot_Serial_rec.attribute13 OR
972             p_old_Lot_Serial_rec.attribute13 IS NULL ))
973     OR  (p_Lot_Serial_rec.attribute14 IS NOT NULL AND
974         (   p_Lot_Serial_rec.attribute14 <>
975             p_old_Lot_Serial_rec.attribute14 OR
976             p_old_Lot_Serial_rec.attribute14 IS NULL ))
977     OR  (p_Lot_Serial_rec.attribute15 IS NOT NULL AND
978         (   p_Lot_Serial_rec.attribute15 <>
979             p_old_Lot_Serial_rec.attribute15 OR
980             p_old_Lot_Serial_rec.attribute15 IS NULL ))
981     OR  (p_Lot_Serial_rec.attribute2 IS NOT NULL AND
982         (   p_Lot_Serial_rec.attribute2 <>
983             p_old_Lot_Serial_rec.attribute2 OR
984             p_old_Lot_Serial_rec.attribute2 IS NULL ))
985     OR  (p_Lot_Serial_rec.attribute3 IS NOT NULL AND
986         (   p_Lot_Serial_rec.attribute3 <>
987             p_old_Lot_Serial_rec.attribute3 OR
988             p_old_Lot_Serial_rec.attribute3 IS NULL ))
989     OR  (p_Lot_Serial_rec.attribute4 IS NOT NULL AND
990         (   p_Lot_Serial_rec.attribute4 <>
991             p_old_Lot_Serial_rec.attribute4 OR
992             p_old_Lot_Serial_rec.attribute4 IS NULL ))
993     OR  (p_Lot_Serial_rec.attribute5 IS NOT NULL AND
994         (   p_Lot_Serial_rec.attribute5 <>
995             p_old_Lot_Serial_rec.attribute5 OR
996             p_old_Lot_Serial_rec.attribute5 IS NULL ))
997     OR  (p_Lot_Serial_rec.attribute6 IS NOT NULL AND
998         (   p_Lot_Serial_rec.attribute6 <>
999             p_old_Lot_Serial_rec.attribute6 OR
1000             p_old_Lot_Serial_rec.attribute6 IS NULL ))
1001     OR  (p_Lot_Serial_rec.attribute7 IS NOT NULL AND
1002         (   p_Lot_Serial_rec.attribute7 <>
1003             p_old_Lot_Serial_rec.attribute7 OR
1004             p_old_Lot_Serial_rec.attribute7 IS NULL ))
1005     OR  (p_Lot_Serial_rec.attribute8 IS NOT NULL AND
1006         (   p_Lot_Serial_rec.attribute8 <>
1007             p_old_Lot_Serial_rec.attribute8 OR
1008             p_old_Lot_Serial_rec.attribute8 IS NULL ))
1009     OR  (p_Lot_Serial_rec.attribute9 IS NOT NULL AND
1010         (   p_Lot_Serial_rec.attribute9 <>
1011             p_old_Lot_Serial_rec.attribute9 OR
1012             p_old_Lot_Serial_rec.attribute9 IS NULL ))
1013     OR  (p_Lot_Serial_rec.context IS NOT NULL AND
1014         (   p_Lot_Serial_rec.context <>
1015             p_old_Lot_Serial_rec.context OR
1016             p_old_Lot_Serial_rec.context IS NULL ))
1017     THEN
1018 
1019     --  These calls are temporarily commented out
1020 
1021 /*
1022         FND_FLEX_DESC_VAL.Set_Column_Value
1023         (   column_name                   => 'ATTRIBUTE1'
1024         ,   column_value                  => p_Lot_Serial_rec.attribute1
1025         );
1026         FND_FLEX_DESC_VAL.Set_Column_Value
1027         (   column_name                   => 'ATTRIBUTE10'
1028         ,   column_value                  => p_Lot_Serial_rec.attribute10
1029         );
1030         FND_FLEX_DESC_VAL.Set_Column_Value
1031         (   column_name                   => 'ATTRIBUTE11'
1032         ,   column_value                  => p_Lot_Serial_rec.attribute11
1033         );
1034         FND_FLEX_DESC_VAL.Set_Column_Value
1035         (   column_name                   => 'ATTRIBUTE12'
1036         ,   column_value                  => p_Lot_Serial_rec.attribute12
1037         );
1038         FND_FLEX_DESC_VAL.Set_Column_Value
1039         (   column_name                   => 'ATTRIBUTE13'
1040         ,   column_value                  => p_Lot_Serial_rec.attribute13
1041         );
1042         FND_FLEX_DESC_VAL.Set_Column_Value
1043         (   column_name                   => 'ATTRIBUTE14'
1044         ,   column_value                  => p_Lot_Serial_rec.attribute14
1045         );
1046         FND_FLEX_DESC_VAL.Set_Column_Value
1047         (   column_name                   => 'ATTRIBUTE15'
1048         ,   column_value                  => p_Lot_Serial_rec.attribute15
1049         );
1050         FND_FLEX_DESC_VAL.Set_Column_Value
1051         (   column_name                   => 'ATTRIBUTE2'
1052         ,   column_value                  => p_Lot_Serial_rec.attribute2
1053         );
1054         FND_FLEX_DESC_VAL.Set_Column_Value
1055         (   column_name                   => 'ATTRIBUTE3'
1056         ,   column_value                  => p_Lot_Serial_rec.attribute3
1057         );
1058         FND_FLEX_DESC_VAL.Set_Column_Value
1059         (   column_name                   => 'ATTRIBUTE4'
1060         ,   column_value                  => p_Lot_Serial_rec.attribute4
1061         );
1062         FND_FLEX_DESC_VAL.Set_Column_Value
1063         (   column_name                   => 'ATTRIBUTE5'
1064         ,   column_value                  => p_Lot_Serial_rec.attribute5
1065         );
1066         FND_FLEX_DESC_VAL.Set_Column_Value
1067         (   column_name                   => 'ATTRIBUTE6'
1068         ,   column_value                  => p_Lot_Serial_rec.attribute6
1069         );
1070         FND_FLEX_DESC_VAL.Set_Column_Value
1071         (   column_name                   => 'ATTRIBUTE7'
1072         ,   column_value                  => p_Lot_Serial_rec.attribute7
1073         );
1074         FND_FLEX_DESC_VAL.Set_Column_Value
1075         (   column_name                   => 'ATTRIBUTE8'
1076         ,   column_value                  => p_Lot_Serial_rec.attribute8
1077         );
1078         FND_FLEX_DESC_VAL.Set_Column_Value
1079         (   column_name                   => 'ATTRIBUTE9'
1080         ,   column_value                  => p_Lot_Serial_rec.attribute9
1081         );
1082         FND_FLEX_DESC_VAL.Set_Column_Value
1083         (   column_name                   => 'CONTEXT'
1084         ,   column_value                  => p_Lot_Serial_rec.context
1085         );
1086 
1087 
1088         --  Validate descriptive flexfield.
1089 
1090         IF NOT OE_Validate.Desc_Flex( 'LOT_SERIAL' ) THEN
1091             x_return_status := FND_API.G_RET_STS_ERROR;
1092         END IF;
1093 */
1094     NULL;
1095     END IF;
1096 
1097     --  Done validating attributes
1098     IF l_debug_level  > 0 THEN
1099         oe_debug_pub.add(  'EXITING OE_VALIDATE_LOT_SERIAL.ATTRIBUTES' , 1 ) ;
1100     END IF;
1101 
1102 EXCEPTION
1103 
1104     WHEN FND_API.G_EXC_ERROR THEN
1105 
1106         x_return_status := FND_API.G_RET_STS_ERROR;
1107 
1108     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1109 
1110         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1111 
1112     WHEN OTHERS THEN
1113 
1114         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1115 
1116         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1117         THEN
1118             OE_MSG_PUB.Add_Exc_Msg
1119             (   G_PKG_NAME
1120             ,   'Attributes'
1121             );
1122         END IF;
1123 
1124 END Attributes;
1125 
1126 --  Procedure Entity_Delete
1127 
1128 PROCEDURE Entity_Delete
1129 ( x_return_status OUT NOCOPY VARCHAR2
1130 
1131 ,   p_Lot_Serial_rec                IN  OE_Order_PUB.Lot_Serial_Rec_Type
1132 )
1133 IS
1134 l_return_status               VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
1135 --
1136 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1137 --
1138 BEGIN
1139 
1140     --  Validate entity delete.
1141 
1142     NULL;
1143 
1144     --  Done.
1145 
1146     x_return_status := l_return_status;
1147 
1148 EXCEPTION
1149 
1150     WHEN FND_API.G_EXC_ERROR THEN
1151 
1152         x_return_status := FND_API.G_RET_STS_ERROR;
1153 
1154     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1155 
1156         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1157 
1158     WHEN OTHERS THEN
1159 
1160         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1161 
1162         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1163         THEN
1164             OE_MSG_PUB.Add_Exc_Msg
1165             (   G_PKG_NAME
1166             ,   'Entity_Delete'
1167             );
1168         END IF;
1169 
1170 END Entity_Delete;
1171 
1172 PROCEDURE Validate_Lock_Serial_Quantity
1173 ( x_return_status OUT NOCOPY VARCHAR2
1174 
1175 ,   p_x_Lot_Serial_rec              IN  OE_Order_PUB.Lot_Serial_Rec_Type
1176 ) IS
1177 l_return_status               VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
1178 --
1179 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1180 --
1181 BEGIN
1182 NULL;
1183 EXCEPTION
1184 
1185     WHEN FND_API.G_EXC_ERROR THEN
1186 
1187         x_return_status := FND_API.G_RET_STS_ERROR;
1188 
1189     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1190 
1191         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1192 
1193     WHEN OTHERS THEN
1194 
1195         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1196 
1197         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1198         THEN
1199             OE_MSG_PUB.Add_Exc_Msg
1200             (   G_PKG_NAME
1201             ,   'Entity_Delete'
1202             );
1203         END IF;
1204 
1205 END Validate_Lock_Serial_Quantity;
1206 
1207 
1208 END OE_Validate_Lot_Serial;