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