[Home] [Help]
PACKAGE BODY: APPS.WSH_DETAILS_VALIDATIONS
Source
1 PACKAGE BODY WSH_DETAILS_VALIDATIONS as
2 /* $Header: WSHDDVLB.pls 120.60.12020000.4 2013/04/08 10:50:49 suppal ship $ */
3
4
5 --
6 G_PKG_NAME CONSTANT VARCHAR2(50) := 'WSH_DETAILS_VALIDATIONS';
7 -- Global Variable added for bug 4399278, 4418754
8 G_SUBINVENTORY WSH_DELIVERY_DETAILS.Subinventory%TYPE;
9 --
10 -- muom
11 CURSOR C_DETAIL_INFO(p_detail_id IN number) IS
12 SELECT SOURCE_CODE,
13 SOURCE_LINE_ID
14 FROM WSH_DELIVERY_DETAILS
15 WHERE DELIVERY_DETAIL_ID = p_detail_id;
16
17 --public api changes
18 PROCEDURE user_non_updatable_columns
19 (p_user_in_rec IN wsh_glbl_var_strct_grp.delivery_details_rec_type,
20 p_out_rec IN wsh_glbl_var_strct_grp.delivery_details_rec_type,
21 p_in_rec IN wsh_glbl_var_strct_grp.detailInRecType,
22 x_return_status OUT NOCOPY VARCHAR2);
23
24
25
26
27 g_bad_header_ids wsh_util_core.id_tab_type;
28 g_good_header_ids wsh_util_core.id_tab_type;
29
30 -- 2467416
31 -- Description:
32 -- PL/SQL table g_passed_crd_Tab: caches the line_ids that passed Credit Check
33 -- PL/SQL table g_failed_crd_Tab: caches the line_ids that failed Credit Check
34 -- Both these table above helps in maintaining the latest record in the table
35 -- and deleting the oldest record (Caching).
36 -- 3481194/3492870 modified logic to hash index on g_passed_crd_tab and g_failed_crd_tab
37 -- to avoid linear scans on pl/sql lists by calling function get_table_index..
38
39
40 g_passed_crd_Tab wsh_util_core.id_tab_type;
41 g_failed_crd_Tab wsh_util_core.id_tab_type;
42
43 PROCEDURE Insert_PR_Header_Holds (
44 p_header_id IN NUMBER,
45 p_status IN VARCHAR2)
46 IS
47
48 PRAGMA AUTONOMOUS_TRANSACTION;
49
50 BEGIN
51
52 INSERT INTO WSH_PR_HEADER_HOLDS (
53 batch_id,
54 header_id,
55 status )
56 VALUES (
57 WSH_PICK_LIST.G_BATCH_ID,
58 p_header_id,
59 p_status );
60
61 COMMIT;
62
63 EXCEPTION
64 WHEN OTHERS THEN
65 ROLLBACK;
66
67 END Insert_PR_Header_Holds;
68 -----------------------------------------------------------------------------
69 --
70 -- FUNCTION: get_table_index
71 -- Parameters: p_entity_id entity_id to map to index
72 -- p_alt_index optional alternate index to reuse
73 -- x_table list of ids to map index
74 -- Returns: number
75 -- Description: Created to fix performance bug 3481194
76 -- It returns the hashed index to map p_entity_id,
77 -- so that x_table(index) = p_entity or
78 -- x_table(index) does not exist (without hash collusion):
79 -- index is always given; the caller should
80 -- validate x_table.exists(index) is true or false.
81 -- The caller should add index to the table if appropriate.
82 --
83 -- NOTE: For performance reason, there is no debug logic in this API.
84 -----------------------------------------------------------------------------
85 function get_table_index(p_entity_id IN NUMBER,
86 p_alt_index IN NUMBER DEFAULT NULL,
87 x_table IN OUT NOCOPY wsh_util_core.id_tab_type)
88 RETURN NUMBER
89 IS
90 c_hash_base CONSTANT NUMBER := 1;
91 c_hash_size CONSTANT NUMBER := power(2, 25);
92
93 l_hash_string VARCHAR2(1000) := NULL;
94 l_index NUMBER;
95 l_hash_exists BOOLEAN := FALSE;
96
97 BEGIN
98
99 IF p_alt_index IS NOT NULL THEN
100 -- check if we can reuse the hashed index.
101 IF x_table.EXISTS(p_alt_index) THEN
102 IF x_table(p_alt_index) = p_entity_id THEN
103 l_hash_exists := TRUE;
104 l_index := p_alt_index;
105 END IF;
106 END IF;
107 END IF;
108
109 IF NOT l_hash_exists THEN
110 -- need to hash this index
111 l_hash_string := to_char(p_entity_id);
112
113 l_index := dbms_utility.get_hash_value (
114 name => l_hash_string,
115 base => c_hash_base,
116 hash_size => c_hash_size );
117
118 WHILE NOT l_hash_exists LOOP
119 IF x_table.EXISTS(l_index) THEN
120 IF (x_table(l_index) = p_entity_id) THEN
121 EXIT;
122 ELSE
123 -- Index exists but p_entity_id does not match this table element.
124 -- Bump l_index till p_entity_id matches
125 -- or table element does not exist
126 l_index := l_index + 1;
127 END IF;
128 ELSE
129 -- Table element does not exist, so the caller can use this new index.
130 l_hash_exists := TRUE;
131 END IF;
132 END LOOP;
133 END IF;
134
135 RETURN l_index;
136
137 END get_table_index;
138
139
140 -----------------------------------------------------------------------------
141 --
142 -- FUNCTION: Trx_ID
143 -- Parameters: p_mode, p_source_line_id, p_source_document_type_id
144 -- Returns: number
145 -- Trx_ID: It reurns the trx_id depending on the given mode, source
146 -- line id and source_document_type_id
147 -----------------------------------------------------------------------------
148
149 FUNCTION trx_id(
150 p_mode varchar2,
151 p_source_line_id number,
152 p_source_document_type_id number) return number is
153 l_dest_type varchar2(30);
154 l_from_org number;
155 l_to_org number;
156 --
157 l_debug_on BOOLEAN;
158 --
159 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'TRX_ID';
160 --
161 begin
162 --
163 -- Debug Statements
164 --
165 --
166 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
167 --
168 IF l_debug_on IS NULL
169 THEN
170 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
171 END IF;
172 --
173 IF l_debug_on THEN
174 WSH_DEBUG_SV.push(l_module_name);
175 --
176 WSH_DEBUG_SV.log(l_module_name,'P_MODE',P_MODE);
177 WSH_DEBUG_SV.log(l_module_name,'P_SOURCE_LINE_ID',P_SOURCE_LINE_ID);
178 WSH_DEBUG_SV.log(l_module_name,'P_SOURCE_DOCUMENT_TYPE_ID',P_SOURCE_DOCUMENT_TYPE_ID);
179 END IF;
180 --
181 if (p_source_document_type_id <> 10) then /* regular order */
182 if (p_mode = 'TRX_ACTION_ID') then
183 --
184 -- Debug Statements
185 --
186 IF l_debug_on THEN
187 WSH_DEBUG_SV.pop(l_module_name);
188 END IF;
189 --
190 return(1); /* 1 = Issue */
191 elsif (p_mode = 'TRX_TYPE_ID') then
192 --
193 -- Debug Statements
194 --
195 IF l_debug_on THEN
196 WSH_DEBUG_SV.pop(l_module_name);
197 END IF;
198 --
199 return(33); /* 33 = Sales Order Issue */
200 end if;
201
202 elsif (p_source_document_type_id = 10) then
203 SELECT nvl(destination_type_code,'@'),source_organization_id,
204 destination_organization_id
205 INTO l_Dest_Type,l_From_Org,l_To_Org
206 FROM po_requisition_lines_all pl,
207 oe_order_lines_all ol
208 WHERE pl.line_num = to_number(ol.orig_sys_line_ref)
209 AND pl.requisition_header_id = ol.source_document_id
210 AND pl.requisition_line_id = ol.source_document_line_id
211 AND ol.line_id = p_source_line_id;
212 If (p_Mode = 'TRX_TYPE_ID') then
213 If (l_Dest_Type = 'EXPENSE') then
214 --
215 -- Debug Statements
216 --
217 IF l_debug_on THEN
218 WSH_DEBUG_SV.pop(l_module_name);
219 END IF;
220 --
221 Return(34); /* 34 = Stores Issue */
222 Elsif (l_From_Org = l_To_Org) then
223 --
224 -- Debug Statements
225 --
226 IF l_debug_on THEN
227 WSH_DEBUG_SV.pop(l_module_name);
228 END IF;
229 --
230 Return(50); /* 50 = */
231 Elsif (l_From_Org <> l_To_Org) then
232 --
233 -- Debug Statements
234 --
235 IF l_debug_on THEN
236 WSH_DEBUG_SV.pop(l_module_name);
237 END IF;
238 --
239 Return(62); /* 62 = Transit Shipment */
240 End If;
241 Elsif (p_Mode = 'TRX_ACTION_ID') then
242 If (l_Dest_Type = 'EXPENSE') then
243 --
244 -- Debug Statements
245 --
246 IF l_debug_on THEN
247 WSH_DEBUG_SV.pop(l_module_name);
248 END IF;
249 --
250 Return(1); /* 1 = Issue */
251 Elsif (l_From_Org = l_To_Org) then
252 --
253 -- Debug Statements
254 --
255 IF l_debug_on THEN
256 WSH_DEBUG_SV.pop(l_module_name);
257 END IF;
258 --
259 Return(2); /* 2 = Subinv transfer*/
260 Elsif (l_From_Org <> l_To_Org) then
261 --
262 -- Debug Statements
263 --
264 IF l_debug_on THEN
265 WSH_DEBUG_SV.pop(l_module_name);
266 END IF;
267 --
268 Return(21); /* 62 = Interorg Transfer */
269 End If;
270 End If;
271 end if;
272 EXCEPTION
273 WHEN NO_DATA_FOUND THEN
274 -- Debug Statements
275 --
276 IF l_debug_on THEN
277 WSH_DEBUG_SV.logmsg(l_module_name,'NO_DATA_FOUND exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
278 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:NO_DATA_FOUND');
279 END IF;
280 --
281 Return(0);
282 WHEN OTHERS THEN
283 --
284 -- Debug Statements
285 --
286 IF l_debug_on THEN
287 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
288 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
289 END IF;
290 --
291 Return(0);
292 END;
293
294 --
295 -- Function: serial_num_ctl_req
296 -- Parameters: p_inventory_item_id
297 -- p_org_id
298 -- Description: This function returns a boolean value to
299 -- indicate if the inventory item in that org is
300 -- requires a serial number or not
301 --
302
303
304 FUNCTION serial_num_ctl_req(p_inventory_item_id number, p_org_id number)
305 RETURN BOOLEAN IS
306 serial_num_ctl_code number;
307 cursor c_serial_ctl_info is
308 select serial_number_control_code
309 from mtl_system_items
310 where inventory_item_id = p_inventory_item_id
311 and organization_id = p_org_id;
312 l_serial_ctl_info c_serial_ctl_info%ROWTYPE;
313 --
314 l_debug_on BOOLEAN;
315 --
316 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'SERIAL_NUM_CTL_REQ';
317 --
318 begin
319 --
320 -- Debug Statements
321 --
322 --
323 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
324 --
325 IF l_debug_on IS NULL
326 THEN
327 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
328 END IF;
329 --
330 IF l_debug_on THEN
331 WSH_DEBUG_SV.push(l_module_name);
332 --
333 WSH_DEBUG_SV.log(l_module_name,'P_INVENTORY_ITEM_ID',P_INVENTORY_ITEM_ID);
334 WSH_DEBUG_SV.log(l_module_name,'P_ORG_ID',P_ORG_ID);
335 END IF;
336 --
337 serial_num_ctl_code := l_serial_ctl_info.serial_number_control_code;
338 IF ( serial_num_ctl_code = 2 OR serial_num_ctl_code = 5 OR
339 serial_num_ctl_code = 6) THEN
340 -- 2 : predefined serial numbers
341 -- 5 : dynamic entry at inventory receipt
342 -- 6 : dynamic entry at sales order issue
343 --
344 -- Debug Statements
345 --
346 IF l_debug_on THEN
347 WSH_DEBUG_SV.pop(l_module_name);
348 END IF;
349 --
350 RETURN TRUE;
351 ELSE -- serial_num_ctl_code = 1
352 -- No serial number control
353 --
354 -- Debug Statements
355 --
356 IF l_debug_on THEN
357 WSH_DEBUG_SV.pop(l_module_name);
358 END IF;
359 --
360 RETURN FALSE;
361 END IF;
362
363 end serial_num_ctl_req;
364
365
366 -- 2467416
367 -- Purges the bad/good Header id Table followed by
368 -- passed/failed line_id tables
369 PROCEDURE purge_crd_chk_tab IS
370 --
371 l_debug_on BOOLEAN;
372 --
373 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'PURGE_CRD_CHK_TAB';
374 --
375 begin
376
377 --
378 -- Debug Statements
379 --
380 --
381 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
382 --
383 IF l_debug_on IS NULL
384 THEN
385 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
386 END IF;
387 --
388 IF l_debug_on THEN
389 WSH_DEBUG_SV.push(l_module_name);
390 END IF;
391 --
392 g_bad_header_ids.delete;
393 g_good_header_ids.delete;
394
395 g_passed_crd_Tab.delete;
396 g_failed_crd_Tab.delete;
397
398 --
399 -- Debug Statements
400 --
401 IF l_debug_on THEN
402 WSH_DEBUG_SV.pop(l_module_name);
403 END IF;
404 --
405 end purge_crd_chk_tab;
406
407 --
408 -- Procedure: Check_Shipped_Quantity
409 -- Parameters: p_ship_above_tolerance number,
410 -- p_requested_quantity number,
411 -- p_picked_quantity number,
412 -- p_shipped_quantity number,
413 -- p_cycle_count_quantity number,
414 -- p_fulfill_base varchar2,
415 -- x_return_status OUT VARCHAR2
416 -- Description: This procedure validates the entered shipped quantity
417
418
419 PROCEDURE check_shipped_quantity(
420 p_ship_above_tolerance IN number,
421 p_requested_quantity IN number,
422 p_picked_quantity IN NUMBER,
423 p_shipped_quantity IN number,
424 p_cycle_count_quantity IN number,
425 -- muom
426 p_fulfill_base IN varchar2,
427 x_return_status OUT NOCOPY VARCHAR2) IS
428 l_attempt_over_percent number;
429 --
430 l_debug_on BOOLEAN;
431 --
432 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CHECK_SHIPPED_QUANTITY';
433 --
434 begin
435
436 --
437 -- Debug Statements
438 --
439 --
440 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
441 --
442 IF l_debug_on IS NULL
443 THEN
444 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
445 END IF;
446 --
447 IF l_debug_on THEN
448 WSH_DEBUG_SV.push(l_module_name);
449 --
450 WSH_DEBUG_SV.log(l_module_name,'P_SHIP_ABOVE_TOLERANCE',P_SHIP_ABOVE_TOLERANCE);
451 WSH_DEBUG_SV.log(l_module_name,'P_REQUESTED_QUANTITY',P_REQUESTED_QUANTITY);
452 WSH_DEBUG_SV.log(l_module_name,'P_PICKED_QUANTITY',P_PICKED_QUANTITY);
453 WSH_DEBUG_SV.log(l_module_name,'P_SHIPPED_QUANTITY',P_SHIPPED_QUANTITY);
454 WSH_DEBUG_SV.log(l_module_name,'P_CYCLE_COUNT_QUANTITY',P_CYCLE_COUNT_QUANTITY);
455 -- muom
456 WSH_DEBUG_SV.log(l_module_name,'P_FULFILL_BASE',P_FULFILL_BASE);
457 END IF;
458 --
459 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
460
461 IF p_picked_quantity > p_requested_quantity THEN
462 -- overpick scenario
463 IF ( p_cycle_count_quantity > 0
464 AND p_shipped_quantity > p_requested_quantity - p_cycle_count_quantity) THEN
465 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
466 -- muom
467 IF p_fulfill_base = 'S' THEN
468 fnd_message.set_name('WSH', 'WSH_OVERPICK_SH_QTY2_EXCEED');
469 ELSE
470 fnd_message.set_name('WSH', 'WSH_OVERPICK_SH_QTY_EXCEED');
471 END IF;
472 fnd_message.set_token('MAX_QTY', (p_requested_quantity - p_cycle_count_quantity));
473 wsh_util_core.add_message(x_return_status);
474 ELSIF (p_shipped_quantity > p_picked_quantity) THEN -- Bug 2111939: Removed the check on tolerance here.
475 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
476 -- muom
477 IF p_fulfill_base = 'S' THEN
478 fnd_message.set_name('WSH', 'WSH_SH_QTY2_ABOVE_PICKED');
479 ELSE
480 fnd_message.set_name('WSH', 'WSH_SH_QTY_ABOVE_PICKED');
481 END IF;
482 wsh_util_core.add_message(x_return_status);
483 END IF;
484
485 ELSE
486 -- normal scenario
487 -- for bug 1305066. When requested_quantity = 0, ie. cancelled line,
488 -- return false
489 IF (p_requested_quantity = 0) THEN
490 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
491 -- muom
492 IF p_fulfill_base = 'S' THEN
493 fnd_message.set_name('WSH', 'WSH_UI_SHIP_QTY2_ABOVE_TOL');
494 ELSE
495 fnd_message.set_name('WSH', 'WSH_UI_SHIP_QTY_ABOVE_TOL');
496 END IF;
497 wsh_util_core.add_message(x_return_status);
498 END IF;
499 END IF;
500
501 --
502 -- Debug Statements
503 --
504 IF l_debug_on THEN
505 WSH_DEBUG_SV.pop(l_module_name);
506 END IF;
507 --
508 exception
509 when others then
510 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
511 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.Check_Shipped_Quantity');
512 --
513 -- Debug Statements
514 --
515 IF l_debug_on THEN
516 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
517 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
518 END IF;
519 --
520 END check_shipped_quantity;
521
522
523
524 --
525 -- Procedure: Check_Cycle_Count_Quantity
526 -- Parameters: p_ship_above_tolerance number,
527 -- p_requested_quantity number,
528 -- p_picked_quantity number,
529 -- p_shipped_quantity number,
530 -- p_cycle_count_quantity number,
531 -- p_fulfill_base varchar2,
532 -- x_return_status OUT VARCHAR2
533 -- Description: This procedure validates the entered cycle count quantity
534
535 PROCEDURE check_cycle_count_quantity(
536 p_ship_above_tolerance IN number,
537 p_requested_quantity IN number,
538 p_picked_quantity IN NUMBER,
539 p_shipped_quantity IN number,
540 p_cycle_count_quantity IN number,
541 -- muom
542 p_fulfill_base IN varchar2,
543 x_return_status OUT NOCOPY VARCHAR2) IS
544 max_qty_to_bo NUMBER;
545 --
546 l_debug_on BOOLEAN;
547 --
548 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CHECK_CYCLE_COUNT_QUANTITY';
549 --
550 BEGIN
551
552 --
553 -- Debug Statements
554 --
555 --
556 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
557 --
558 IF l_debug_on IS NULL
559 THEN
560 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
561 END IF;
562 --
563 IF l_debug_on THEN
564 WSH_DEBUG_SV.push(l_module_name);
565 --
566 WSH_DEBUG_SV.log(l_module_name,'P_SHIP_ABOVE_TOLERANCE',P_SHIP_ABOVE_TOLERANCE);
567 WSH_DEBUG_SV.log(l_module_name,'P_REQUESTED_QUANTITY',P_REQUESTED_QUANTITY);
568 WSH_DEBUG_SV.log(l_module_name,'P_PICKED_QUANTITY',P_PICKED_QUANTITY);
569 WSH_DEBUG_SV.log(l_module_name,'P_SHIPPED_QUANTITY',P_SHIPPED_QUANTITY);
570 WSH_DEBUG_SV.log(l_module_name,'P_CYCLE_COUNT_QUANTITY',P_CYCLE_COUNT_QUANTITY);
571 -- muom
572 WSH_DEBUG_SV.log(l_module_name,'P_FULFILL_BASE',P_FULFILL_BASE);
573 END IF;
574 --
575 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
576
577 max_qty_to_bo := p_requested_quantity - NVL(p_shipped_quantity, 0);
578 IF max_qty_to_bo < 0 THEN
579 max_qty_to_bo := 0;
580 END IF;
581
582 IF p_cycle_count_quantity > max_qty_to_bo THEN
583 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
584 -- muom
585 IF p_fulfill_base = 'S' THEN
586 fnd_message.set_name('WSH', 'WSH_UI_CYCLE_QTY2_ABOVE_TOL');
587 ELSE
588 fnd_message.set_name('WSH', 'WSH_UI_CYCLE_QTY_ABOVE_TOL');
589 END IF;
590 wsh_util_core.add_message(x_return_status);
591 END IF;
592
593 --
594 -- Debug Statements
595 --
596 IF l_debug_on THEN
597 WSH_DEBUG_SV.pop(l_module_name);
598 END IF;
599 --
600 EXCEPTION
601 WHEN OTHERS THEN
602 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
603 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.Check_Cycle_Count_Quantity');
604 --
605 -- Debug Statements
606 --
607 IF l_debug_on THEN
608 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
609 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
610 END IF;
611 --
612 END check_cycle_count_quantity;
613
614
615
616
617 /* Validates and returns the quantity in this manner (the caller does not need
618 to adjust the result):
619 This routine checks to make sure that the input quantity precision does
620 not exceed the decimal precision. Max Precision is: 10 digits before the
621 decimall point and 9 digits after the decimal point.
622 The routine also makes sure that if the item is serial number controlled,
623 the the quantity in primary UOM is an integer number.
624 The routine also makes sure that if the item's indivisible_flag is set
625 to yes, then the item quantity is an integer in the primary UOM
626 The routine also checks if the profile, INV:DETECT TRUNCATION, is set
627 to yes, the item quantity in primary UOM also obeys max precision and that
628 it is not zero.
629 The procedure retruns a correct output quantity in the transaction UOM,
630 returns the primary quantity and returns a status of success, failure, or
631 warning.
632
633 The parameter p_max_decimal_digits has been added to determine the max precision
634 that should be applied to the quantity after the decimal point. */
635 PROCEDURE check_decimal_quantity(
636 p_item_id number,
637 p_organization_id number,
638 p_input_quantity number,
639 p_uom_code varchar2,
640 x_output_quantity out NOCOPY number,
641 x_return_status out NOCOPY varchar2,
642 p_top_model_line_id number,
643 p_max_decimal_digits IN NUMBER DEFAULT NULL) IS -- RV DEC_QTY
644
645 l_primary_quantity number;
646 l_return_status varchar2(30);
647
648 others EXCEPTION;
649 --
650 -- RV DEC_QTY
651 l_max_decimal_digits NUMBER := p_max_decimal_digits ;
652 l_max_real_digits CONSTANT NUMBER := WSH_UTIL_CORE.C_MAX_REAL_DIGITS;
653 -- HW OPMCONV - Noneed for OPM variables
654
655 -- RV DEC_QTY
656 --
657 l_debug_on BOOLEAN;
658 --
659 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CHECK_DECIMAL_QUANTITY';
660 --
661
662 begin
663 --
664 -- Debug Statements
665 --
666 --
667 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
668 --
669 IF l_debug_on IS NULL
670 THEN
671 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
672 END IF;
673 --
674 --
675 --
676
677 IF l_debug_on THEN
678 WSH_DEBUG_SV.push(l_module_name);
679 --
680 WSH_DEBUG_SV.log(l_module_name,'P_ITEM_ID',P_ITEM_ID);
681 WSH_DEBUG_SV.log(l_module_name,'P_ORGANIZATION_ID',P_ORGANIZATION_ID);
682 WSH_DEBUG_SV.log(l_module_name,'P_INPUT_QUANTITY',P_INPUT_QUANTITY);
683 WSH_DEBUG_SV.log(l_module_name,'P_UOM_CODE',P_UOM_CODE);
684 WSH_DEBUG_SV.log(l_module_name,'P_TOP_MODEL_LINE_ID',P_TOP_MODEL_LINE_ID);
685 END IF;
686 --
687 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
688 /* Bug 2177410, skip validate quantity to avoid error for non-item delivery details */
689
690 -- BUG 3376504
691 --
692 -- RV DEC_QTY
693 -- HW OPMCONV - No need to check for process_org
694
695 IF (l_max_decimal_digits IS NULL) THEN
696 --{
697 -- HW OPMCONV - Re-arranged code to avoid branching
698
699 l_max_decimal_digits := WSH_UTIL_CORE.C_MAX_DECIMAL_DIGITS_INV;
700
701 --}
702 END IF;
703 --
704 -- RV DEC_QTY
705 -- BUG 3376504
706 if p_item_id is not NULL then -- {
707 if ( p_top_model_line_id is not null and p_input_quantity <> trunc ( p_input_quantity ) ) then --{
708 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
709 fnd_message.set_name('WSH', 'WSH_CONFIG_NO_DECIMALS');
710 wsh_util_core.add_message(x_return_status);
711 else
712 --
713 -- Debug Statements
714 --
715 IF l_debug_on THEN
716 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit INV_DECIMALS_PUB.VALIDATE_QUANTITY',WSH_DEBUG_SV.C_PROC_LEVEL);
717 END IF;
718 --
719 inv_decimals_pub.validate_quantity(
720 p_item_id,
721 p_organization_id,
722 p_input_quantity,
723 p_uom_code,
724 x_output_quantity,
725 l_primary_quantity,
726 x_return_status);
727
728 -- RV DEC_QTY
729 IF l_debug_on THEN
730 WSH_DEBUG_SV.log(l_module_name,'x_return_status',x_return_status);
731 END IF;
732 -- HW OPMCONV - No need to fork the code
733
734
735 --{
736 -- Using the same message as inventory because this is the message set
737 -- by INV when the number of decimal digits entered by user are greater than 9.
738 -- This condition is for taking care of setting a message when the number
739 -- of decimals are between 5 and 9.
740 -- This should not cause any duplicate messages even when INV starts rounding
741 -- off to 5 digits of decimal.
742 -- HW OPMCOMV - Changed the precision from OPM to INV which is 5
743 IF (p_input_quantity = round(p_input_quantity,WSH_UTIL_CORE.C_MAX_DECIMAL_DIGITS_INV)
744 AND x_output_quantity <> round(x_output_quantity,l_max_decimal_digits))
745 THEN
746 --{
747 fnd_message.set_name('INV', 'MAX_DECIMAL_LENGTH');
748 x_return_status := wsh_util_core.g_ret_sts_warning;
749 WSH_UTIL_CORE.ADD_MESSAGE(x_return_status,l_module_name);
750 --}
751 END IF;
752 x_output_quantity := round(x_output_quantity,l_max_decimal_digits);
753 --}
754
755 -- RV DEC_QTY
756 --
757 end if; --}
758
759 else --} {
760
761 if ( p_input_quantity <> ROUND(p_input_quantity, l_max_decimal_digits)) then
762 IF l_debug_on THEN
763 WSH_DEBUG_SV.logmsg(l_module_name,'decimal digits exceed ');
764 END IF;
765 x_output_quantity := ROUND(p_input_quantity, l_max_decimal_digits);
766 else
767 if (x_output_quantity IS NULL) then
768 x_output_quantity := p_input_quantity;
769 end if;
770 end if;
771
772
773 if ( trunc(abs(p_input_quantity)) > (POWER(10,l_max_real_digits) - 1) ) then
774 IF l_debug_on THEN
775 WSH_DEBUG_SV.logmsg(l_module_name,'real part of number fail');
776 END IF;
777
778 raise others;
779 end if;
780
781 end if; --}
782 --
783 -- Debug Statements
784 --
785 IF l_debug_on THEN
786 WSH_DEBUG_SV.log(l_module_name,'x_output_quantity',x_output_quantity);
787 WSH_DEBUG_SV.pop(l_module_name);
788 END IF;
789 --
790 exception
791 when others then
792 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
793 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.Check_Decimal_Quantity');
794 --
795 -- Debug Statements
796 --
797 IF l_debug_on THEN
798 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
799 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
800 END IF;
801 --
802 end check_decimal_quantity;
803
804
805 PROCEDURE check_unassign_from_delivery(
806 p_detail_rows IN wsh_util_core.id_tab_type,
807 x_return_status OUT NOCOPY VARCHAR2) IS
808
809 cursor check_unassign (detail_id IN NUMBER) is
810 select da.parent_delivery_detail_id , da.delivery_id ,
811 dd.container_name , dd.container_flag
812 from wsh_delivery_assignments da,
813 wsh_delivery_Details dd
814 where da.delivery_detail_id = detail_id
815 and nvl(da.type,'S') in ('S', 'C')
816 and da.parent_Delivery_Detail_id = dd.delivery_Detail_id (+);
817
818 l_parent_delivery_detail_id NUMBER ;
819 l_delivery_id NUMBER ;
820 l_container_name VARCHAR2(30) ;
821 l_container_flag VARCHAR2(1) ;
822
823 others EXCEPTION;
824
825 --
826 l_debug_on BOOLEAN;
827 --
828 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CHECK_UNASSIGN_FROM_DELIVERY';
829 --
830 BEGIN
831
832 --
833 -- Debug Statements
834 --
835 --
836 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
837 --
838 IF l_debug_on IS NULL
839 THEN
840 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
841 END IF;
842 --
843 IF l_debug_on THEN
844 WSH_DEBUG_SV.push(l_module_name);
845 END IF;
846 --
847 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
848
849 IF (p_detail_rows.count = 0) THEN
850 raise others;
851 END IF;
852
853 FOR i IN 1..p_detail_rows.count LOOP
854
855 OPEN check_unassign (p_detail_rows(i));
856
857 FETCH check_unassign INTO l_parent_delivery_detail_id , l_delivery_id ,
858 l_container_name , l_container_flag ;
859
860 IF check_unassign%NOTFOUND THEN
861
862 raise others ;
863 CLOSE check_unassign;
864 END IF ;
865
866 IF l_parent_delivery_Detail_id IS NOT NULL THEN
867 if ( l_container_flag IN ('Y', 'C' )) then
868 FND_MESSAGE.SET_NAME('WSH','WSH_PK_DET_UNASSIGN_DEL');
869 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
870 wsh_util_core.add_message(x_return_status);
871
872 --
873 -- Debug Statements
874 --
875 IF l_debug_on THEN
876 WSH_DEBUG_SV.pop(l_module_name);
877 END IF;
878 --
879 RETURN;
880 else
881 -- in the unlikely event that a delivery_detail's parent is
882 -- NOT a container.
883 raise others ;
884 end if ;
885
886 END IF ;
887
888 CLOSE check_unassign;
889
890 END LOOP;
891
892 --
893 -- Debug Statements
894 --
895 IF l_debug_on THEN
896 WSH_DEBUG_SV.pop(l_module_name);
897 END IF;
898 --
899 EXCEPTION
900 WHEN others THEN
901 IF check_unassign%ISOPEN THEN
902 CLOSE check_unassign;
903 END IF;
904 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.CHECK_UNASSIGN_FROM_DELIVERY');
905 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
906
907 --
908 -- Debug Statements
909 --
910 IF l_debug_on THEN
911 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
912 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
913 END IF;
914 --
915 END check_unassign_from_delivery ;
916
917
918 PROCEDURE check_assign_del_multi(
919 p_detail_rows IN wsh_util_core.id_tab_type,
920 x_del_params OUT NOCOPY wsh_delivery_autocreate.grp_attr_rec_type,
921 x_return_status OUT NOCOPY VARCHAR2) IS
922
923 l_del_rows wsh_util_core.id_tab_type;
924 l_group_rows wsh_util_core.id_tab_type;
925
926 l_detail_org_id NUMBER;
927 l_delivery_id NUMBER;
928
929 cursor check_assign (detail_id IN NUMBER) is
930 select delivery_id
931 from wsh_delivery_assignments_v
932 where delivery_detail_id = detail_id
933 and delivery_id IS NOT NULL;
934
935 l_attr_tab wsh_delivery_autocreate.grp_attr_tab_type;
936 l_group_tab wsh_delivery_autocreate.grp_attr_tab_type;
937 l_action_rec wsh_delivery_autocreate.action_rec_type;
938 l_target_rec wsh_delivery_autocreate.grp_attr_rec_type;
939 l_matched_entities wsh_util_core.id_tab_type;
940 l_out_rec wsh_delivery_autocreate.out_rec_type;
941 l_generic_flag varchar2(1);
942
943
944
945 others EXCEPTION;
946 assign_error EXCEPTION;
947
948 --
949 l_debug_on BOOLEAN;
950 --
951 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CHECK_ASSIGN_DEL_MULTI';
952 --
953 BEGIN
954
955 --
956 -- Debug Statements
957 --
958 --
959 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
960 --
961 IF l_debug_on IS NULL
962 THEN
963 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
964 END IF;
965 --
966 IF l_debug_on THEN
967 WSH_DEBUG_SV.push(l_module_name);
968 END IF;
969 --
970 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
971
972 IF (p_detail_rows.count = 0) THEN
973 raise others;
974 END IF;
975
976 FOR i IN 1..p_detail_rows.count LOOP
977
978 OPEN check_assign (p_detail_rows(i));
979
980 FETCH check_assign INTO l_delivery_id;
981
982 IF check_assign%FOUND THEN
983
984 CLOSE check_assign;
985 FND_MESSAGE.SET_NAME('WSH','WSH_DET_ASSIGNED_DEL');
986 FND_MESSAGE.SET_TOKEN('DET_NAME', p_detail_rows(i));
987 FND_MESSAGE.SET_TOKEN('DEL_NAME',l_delivery_id);
988 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
989 wsh_util_core.add_message(x_return_status);
990
991 --
992 -- Debug Statements
993 --
994 IF l_debug_on THEN
995 WSH_DEBUG_SV.pop(l_module_name);
996 END IF;
997 --
998 RETURN;
999
1000 ELSE
1001
1002 CLOSE check_assign;
1003
1004 END IF;
1005
1006 END LOOP;
1007
1008
1009
1010
1011 -- Call autocreate deliveries to group details together. Check if the
1012 -- number of deliveries created is 1. Use the wsh_delivery_autocreate
1013 -- package to return a list of matching delivery parameters and then
1014 -- delete these tables so that subsequent calls are not effected.
1015 --p_init_flag should be N (if it is Y, all the tables get deleted at
1016 --the end of the call to autocreate_deliveries which should not
1017 --happen in this case
1018
1019 --
1020 -- Debug Statements
1021 --
1022 IF l_debug_on THEN
1023 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_AUTOCREATE.AUTOCREATE_DELIVERIES',WSH_DEBUG_SV.C_PROC_LEVEL);
1024 END IF;
1025 --
1026 FOR i in 1..p_detail_rows.count LOOP
1027
1028 l_attr_tab(i).entity_id := p_detail_rows(i);
1029 l_attr_tab(i).entity_type := 'DELIVERY_DETAIL';
1030
1031 END LOOP;
1032
1033 l_action_rec.action := 'MATCH_GROUPS';
1034 -- l_action_rec.check_single_grp := 'Y';
1035
1036
1037 WSH_DELIVERY_AUTOCREATE.Find_Matching_Groups(p_attr_tab => l_attr_tab,
1038 p_action_rec => l_action_rec,
1039 p_target_rec => l_target_rec,
1040 p_group_tab => l_group_tab,
1041 x_matched_entities => l_matched_entities,
1042 x_out_rec => l_out_rec,
1043 x_return_status => x_return_status);
1044 --
1045 IF l_debug_on THEN
1046 --
1047 WSH_DEBUG_SV.log(l_module_name, 'Return status from autocreate_deliveries: '|| x_return_status);
1048 --
1049 END IF;
1050 --
1051 -- Bug 2734531 (handle return status correctly)
1052 --
1053 IF (x_return_status IN (WSH_UTIL_CORE.G_RET_STS_ERROR, WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR)) THEN
1054 RAISE assign_error;
1055 END IF;
1056 --
1057 --
1058 --
1059 x_del_params := l_group_tab(l_group_tab.FIRST);
1060
1061
1062 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
1063 IF l_debug_on THEN
1064 --
1065 WSH_DEBUG_SV.log(l_module_name, 'Done check_assign_del_multi '|| x_return_status);
1066 --
1067 END IF;
1068 --
1069 -- Debug Statements
1070 --
1071 IF l_debug_on THEN
1072 WSH_DEBUG_SV.pop(l_module_name);
1073 END IF;
1074 --
1075 EXCEPTION
1076 WHEN assign_error THEN
1077 FND_MESSAGE.SET_NAME('WSH','WSH_DET_GROUP_ERROR');
1078 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1079 wsh_util_core.add_message(x_return_status);
1080 --
1081 -- Debug Statements
1082 --
1083 IF l_debug_on THEN
1084 WSH_DEBUG_SV.logmsg(l_module_name,'ASSIGN_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
1085 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:ASSIGN_ERROR');
1086 END IF;
1087 --
1088 WHEN others THEN
1089 IF check_assign%ISOPEN THEN
1090 CLOSE check_assign;
1091 END IF;
1092 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.CHECK_ASSIGN_DEL_MULTI');
1093 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
1094
1095 --
1096 -- Debug Statements
1097 --
1098 IF l_debug_on THEN
1099 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
1100 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
1101 END IF;
1102 --
1103 END check_assign_del_multi;
1104
1105 -----------------------------------------------------------------------------
1106 --
1107 -- Procedure: check_credit_holds
1108 -- Parameters: p_detail_id - delivery detail id
1109 -- Bug 14620571: Added SB_PICK
1110 -- p_activity_type - 'PICK','PACK','SHIP','SB_PICK' (ShipmentBatch)
1111 -- p_source_line_id - optional
1112 -- p_source_header_id - optional
1113 -- p_init_flag - 'Y' initializes the table of bad header ids
1114 -- x_return_status
1115 -- Description: Checks if there are any credit checks or holds on a line.
1116 -- Returns a status of FND_API.G_RET_STS_SUCCESS if no such
1117 -- checks or holds exist
1118 --
1119 -----------------------------------------------------------------------------
1120
1121 PROCEDURE check_credit_holds(
1122 p_detail_id IN NUMBER,
1123 p_activity_type IN VARCHAR2,
1124 p_source_line_id IN NUMBER,
1125 p_source_header_id IN NUMBER,
1126 p_source_code IN VARCHAR2,
1127 p_init_flag IN VARCHAR2,
1128 x_return_status OUT NOCOPY VARCHAR2) IS
1129
1130 -- BUG#:1549665 hwahdani retrieve ship_from_location_id,order_number,line number
1131 CURSOR get_source_info IS
1132 SELECT source_header_id, source_line_id,ship_from_location_id,
1133 source_header_number, source_line_number, org_id, container_flag, source_code -- RTV Changes
1134 FROM wsh_delivery_details
1135 WHERE delivery_detail_id = p_detail_id;
1136
1137 -- BUG#:1549665 hwahdani get order information
1138 --Bug 1697471: added source_line_id in the where clause
1139 CURSOR get_order_info IS
1140 SELECT ship_from_location_id,source_header_number, source_line_number, org_id, container_flag
1141 FROM wsh_delivery_details
1142 WHERE source_header_id = p_source_header_id
1143 AND source_code = p_source_code
1144 AND source_line_id = p_source_line_id;
1145
1146 CURSOR get_pr_credit_cache IS
1147 SELECT status
1148 FROM wsh_pr_header_holds
1149 WHERE header_id = p_source_header_id
1150 AND batch_id = WSH_PICK_LIST.G_BATCH_ID;
1151
1152 l_header_id NUMBER := p_source_header_id;
1153 l_line_id NUMBER := p_source_line_id;
1154 -- BUG#: 1549665 hwahdani variable to hold ship_from_location_id
1155 l_ship_from_location_id NUMBER;
1156 l_skip_header_flag VARCHAR2(1) := 'N';
1157 l_cache_status VARCHAR2(1) ;
1158
1159 l_result_out VARCHAR2(1);
1160 l_msg_count NUMBER;
1161 l_msg_data VARCHAR2(2000);
1162 -- BUG#:1549665 hwahdani variables for log_exception;
1163 l_request_id NUMBER;
1164 l_exception_return_status VARCHAR2(30);
1165 l_exception_msg_count NUMBER;
1166 l_exception_msg_data VARCHAR2(4000) := NULL;
1167 l_exception_assignment_id NUMBER;
1168 l_exception_error_message VARCHAR2(2000) := NULL;
1169 l_exception_location_id NUMBER;
1170 l_dummy_exception_id NUMBER;
1171 l_dummy_detail_id NUMBER;
1172 l_order_number VARCHAR2(150);
1173 l_container_flag VARCHAR2(3);
1174 l_line_number VARCHAR2(150);
1175 l_org_id NUMBER;
1176 l_msg VARCHAR2(2000):= NULL;
1177 l_source_code VARCHAR2(30); -- RTV Changes
1178
1179 -- 3481194/3492870: add index variables to hash lists of headers and lines
1180 l_bad_index NUMBER;
1181 l_good_index NUMBER;
1182 l_passed_index NUMBER;
1183 l_failed_index NUMBER;
1184
1185 -- bug 2429004
1186 l_activity_type VARCHAR2(30);
1187 --Bug 14620571
1188 l_line_activity_type VARCHAR2(30);
1189
1190 credit_hold_error EXCEPTION;
1191 header_hold_error EXCEPTION;
1192 line_hold_error EXCEPTION;
1193
1194 -- 2467416
1195 l_exists_flag VARCHAR2(1):= 'N';
1196 l_counter NUMBER := 0;
1197
1198 --
1199 l_debug_on BOOLEAN;
1200 --
1201 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CHECK_CREDIT_HOLDS';
1202 --
1203 BEGIN
1204
1205 --
1206 -- Debug Statements
1207 --
1208 --
1209 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
1210 --
1211 IF l_debug_on IS NULL
1212 THEN
1213 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
1214 END IF;
1215 --
1216 IF l_debug_on THEN
1217 WSH_DEBUG_SV.push(l_module_name);
1218 --
1219 WSH_DEBUG_SV.log(l_module_name,'P_DETAIL_ID',P_DETAIL_ID);
1220 WSH_DEBUG_SV.log(l_module_name,'P_ACTIVITY_TYPE',P_ACTIVITY_TYPE);
1221 WSH_DEBUG_SV.log(l_module_name,'P_SOURCE_LINE_ID',P_SOURCE_LINE_ID);
1222 WSH_DEBUG_SV.log(l_module_name,'P_SOURCE_HEADER_ID',P_SOURCE_HEADER_ID);
1223 WSH_DEBUG_SV.log(l_module_name,'P_SOURCE_CODE',P_SOURCE_CODE);
1224 WSH_DEBUG_SV.log(l_module_name,'P_INIT_FLAG',P_INIT_FLAG);
1225 END IF;
1226 --
1227 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
1228
1229 IF p_source_code <> 'OE' THEN
1230 --
1231 -- Debug Statements
1232 --
1233 IF l_debug_on THEN
1234 WSH_DEBUG_SV.pop(l_module_name);
1235 END IF;
1236 --
1237 return;
1238 END IF;
1239
1240 -- 2467416: In this check to include purge of the line_id tables also
1241 IF (p_init_flag = 'Y') THEN
1242 g_bad_header_ids.delete;
1243 g_good_header_ids.delete;
1244
1245 g_passed_crd_Tab.delete;
1246 g_failed_crd_Tab.delete;
1247
1248 END IF;
1249
1250 IF (l_header_id IS NULL) OR (l_line_id IS NULL) THEN
1251
1252 -- BUG#: 1549665 hwahdani - added ship_from_location_id
1253 -- order_number and line number
1254 OPEN get_source_info;
1255 FETCH get_source_info INTO l_header_id, l_line_id,
1256 l_ship_from_location_id,l_order_number, l_line_number, l_org_id, l_container_flag, l_source_code; -- RTV Changes
1257 CLOSE get_source_info;
1258
1259 -- RTV Changes
1260 IF l_source_code <> 'OE' THEN
1261 IF l_debug_on THEN
1262 WSH_DEBUG_SV.pop(l_module_name);
1263 END IF;
1264 return;
1265 END IF;
1266
1267 -- BUG#:1549665 hwahdani added else
1268 ELSE
1269 OPEN get_order_info;
1270 FETCH get_order_info into l_ship_from_location_id,
1271 l_order_number,l_line_number, l_org_id, l_container_flag;
1272 CLOSE get_order_info ;
1273 END IF;
1274
1275 IF l_container_flag = 'Y'
1276 THEN
1277 --
1278 -- Debug Statements
1279 --
1280 IF l_debug_on THEN
1281 WSH_DEBUG_SV.pop(l_module_name);
1282 END IF;
1283 --
1284 return;
1285 END IF;
1286
1287 l_bad_index := get_table_index(p_entity_id=>l_header_id, x_table=>g_bad_header_ids);
1288 IF g_bad_header_ids.EXISTS(l_bad_index) THEN
1289 --
1290 -- Debug Statements
1291 --
1292 IF l_debug_on THEN
1293 WSH_DEBUG_SV.logmsg(l_module_name, 'ORDER HEADER '||TO_CHAR ( L_HEADER_ID ) ||' FAILED CREDIT CHECK OR IS ON HOLD' );
1294 END IF;
1295 --
1296 raise credit_hold_error;
1297 END IF;
1298
1299 l_good_index := get_table_index(p_entity_id=>l_header_id, p_alt_index=>l_bad_index, x_table=>g_good_header_ids);
1300 IF g_good_header_ids.EXISTS(l_good_index) THEN
1301 l_skip_header_flag := 'Y';
1302 END IF;
1303
1304 -- Check if Header exists in WSH_PR_HEADER_HOLDS Table for Pick Release process
1305 IF (l_skip_header_flag = 'N') AND (p_activity_type = 'PICK') AND (WSH_PICK_LIST.G_BATCH_ID IS NOT NULL)
1306 AND (WSH_PICK_LIST.G_PICK_REL_PARALLEL) THEN
1307 OPEN get_pr_credit_cache;
1308 FETCH get_pr_credit_cache INTO l_cache_status;
1309 IF get_pr_credit_cache%NOTFOUND THEN
1310 l_cache_status := 'N'; -- not present in cache
1311 END IF;
1312 CLOSE get_pr_credit_cache;
1313 IF l_cache_status = 'F' THEN
1314 g_bad_header_ids(l_bad_index) := l_header_id;
1315 IF l_debug_on THEN
1316 WSH_DEBUG_SV.logmsg(l_module_name, 'ORDER HEADER '||TO_CHAR ( L_HEADER_ID )
1317 ||' FAILED CREDIT CHECK OR IS ON HOLD' );
1318 END IF;
1319 RAISE credit_hold_error;
1320 ELSIF l_cache_status = 'P' THEN
1321 l_skip_header_flag := 'Y';
1322 g_good_header_ids(l_good_index) := l_header_id;
1323 END IF;
1324 END IF;
1325
1326 -- Bug: 1580603
1327 --
1328
1329 IF (l_skip_header_flag = 'N') THEN
1330
1331 IF l_org_id IS NULL THEN
1332 SELECT ORG_ID
1333 INTO l_org_id
1334 FROM OE_ORDER_HEADERS_ALL
1335 WHERE HEADER_ID = l_header_id;
1336 END IF;
1337
1338 IF l_debug_on THEN
1339 WSH_DEBUG_SV.logmsg(l_module_name, 'SETTING THE POLICY CONTEXT FOR ORG_ID:' || TO_CHAR ( L_ORG_ID ) );
1340 END IF;
1341 --
1342 MO_GLOBAL.set_policy_context('S', l_org_id);
1343
1344
1345 -- bug 2429004
1346 --Bug 14620571: Added 'SB_PICK'
1347 IF (p_activity_type in ( 'PICK','SB_PICK' )) THEN
1348 l_activity_type := 'PICKING';
1349 ELSIF (p_activity_type = 'PACK') THEN
1350 l_activity_type := 'PACKING';
1351 ELSE
1352 l_activity_type := 'SHIPPING';
1353 END IF;
1354 -- end bug 2429004
1355
1356 -- Check header level credit
1357
1358 --
1359 -- Debug Statements
1360 --
1361 IF l_debug_on THEN
1362 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit OE_VERIFY_PAYMENT_PUB.VERIFY_PAYMENT',WSH_DEBUG_SV.C_PROC_LEVEL);
1363 END IF;
1364 --
1365 oe_verify_payment_pub.verify_payment(
1366 p_header_id => l_header_id,
1367 p_calling_action => l_activity_type, -- bug 2429004 - passing the corresponding activity type.
1368 p_msg_count => l_msg_count,
1369 p_msg_data => l_msg_data,
1370 p_return_status => x_return_status);
1371
1372 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
1373 g_bad_header_ids(l_bad_index) := l_header_id;
1374 IF (p_activity_type = 'PICK') AND (WSH_PICK_LIST.G_BATCH_ID IS NOT NULL)
1375 AND (WSH_PICK_LIST.G_PICK_REL_PARALLEL) THEN
1376 Insert_PR_Header_Holds (p_header_id => l_header_id, p_status => 'F');
1377 END IF;
1378 --
1379 -- Debug Statements
1380 --
1381 IF l_debug_on THEN
1382 WSH_DEBUG_SV.logmsg(l_module_name, 'ORDER HEADER '||TO_CHAR ( L_HEADER_ID ) ||' FAILED CREDIT CHECK' );
1383 END IF;
1384 --
1385 raise credit_hold_error;
1386 END IF;
1387
1388
1389 -- Check generic header holds
1390
1391 --
1392 -- Debug Statements
1393 --
1394 IF l_debug_on THEN
1395 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit OE_HOLDS_PUB.CHECK_HOLDS',WSH_DEBUG_SV.C_PROC_LEVEL);
1396 END IF;
1397 --
1398 oe_holds_pub.check_holds(
1399 p_api_version => 1.0,
1400 p_header_id => l_header_id,
1401 p_wf_item => NULL,
1402 p_wf_activity => NULL,
1403 x_result_out => l_result_out,
1404 x_return_status => x_return_status,
1405 x_msg_count => l_msg_count,
1406 x_msg_data => l_msg_data);
1407
1408 -- If hold is found return back
1409
1410 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) OR (l_result_out = FND_API.G_TRUE) THEN
1411 g_bad_header_ids(l_bad_index) := l_header_id;
1412 IF (p_activity_type = 'PICK') AND (WSH_PICK_LIST.G_BATCH_ID IS NOT NULL)
1413 AND (WSH_PICK_LIST.G_PICK_REL_PARALLEL) THEN
1414 Insert_PR_Header_Holds (p_header_id => l_header_id, p_status => 'F');
1415 END IF;
1416 --
1417 -- Debug Statements
1418 --
1419 IF l_debug_on THEN
1420 WSH_DEBUG_SV.logmsg(l_module_name, 'ORDER HEADER '||TO_CHAR ( L_HEADER_ID ) ||' IS ON HOLD' );
1421 END IF;
1422 --
1423 --BUG#:1549665 hwahdani - check if process was run from conc. request and get id
1424 -- and log exception if order is on hold
1425 l_request_id := fnd_global.conc_request_id;
1426 -- 1729516
1427 IF l_debug_on THEN
1428 WSH_DEBUG_SV.log(l_module_name,'l_request_id', l_request_id );
1429 WSH_DEBUG_SV.log(l_module_name,'WSH_PICK_LIST.G_BATCH_ID', WSH_PICK_LIST.G_BATCH_ID );
1430 END IF;
1431
1432 --Bug 14620571: Exception needs to be logged only for PickRelease process
1433 IF ( p_activity_type <> 'PICK' ) THEN
1434 raise header_hold_error;
1435 ELSE
1436 FND_MESSAGE.SET_NAME('WSH','WSH_PICK_HOLD');
1437 FND_MESSAGE.SET_TOKEN('ORDER',l_order_number);
1438 l_msg := FND_MESSAGE.GET;
1439 --
1440 -- Debug Statements
1441 --
1442 IF l_debug_on THEN
1443 WSH_DEBUG_SV.logmsg(l_module_name, L_MSG );
1444 END IF;
1445 --
1446
1447 l_dummy_exception_id :=null;
1448 --
1449 -- Debug Statements
1450 --
1451 IF l_debug_on THEN
1452 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_XC_UTIL.LOG_EXCEPTION',WSH_DEBUG_SV.C_PROC_LEVEL);
1453 END IF;
1454 --
1455 wsh_xc_util.log_exception(
1456 p_api_version => 1.0,
1457 x_return_status => l_exception_return_status,
1458 x_msg_count => l_exception_msg_count,
1459 x_msg_data => l_exception_msg_data,
1460 x_exception_id => l_dummy_exception_id ,
1461 p_logged_at_location_id => l_ship_from_location_id,
1462 p_exception_location_id => l_ship_from_location_id,
1463 p_logging_entity => 'SHIPPER',
1464 p_logging_entity_id => FND_GLOBAL.USER_ID,
1465 p_exception_name => 'WSH_PICK_HOLD',
1466 p_message => l_msg,
1467 p_error_message => l_exception_error_message,
1468 p_request_id => l_request_id,
1469 p_batch_id => WSH_PICK_LIST.g_batch_id -- Bug: 1729516
1470 );
1471
1472 IF (l_exception_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
1473 --
1474 -- Debug Statements
1475 --
1476 IF l_debug_on THEN
1477 WSH_DEBUG_SV.logmsg(l_module_name, 'WSH_XC_UTIL.LOG_EXCEPTION DID NOT RETURN SUCCESS' );
1478 END IF;
1479 --
1480 END IF;
1481 --Bug: 1573703 Return status needs to be set to 'E'
1482 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1483 raise header_hold_error; --bugfix 6263535
1484
1485 END IF;
1486 END IF;
1487
1488 g_good_header_ids(l_good_index) := l_header_id;
1489 IF (p_activity_type = 'PICK') AND (WSH_PICK_LIST.G_BATCH_ID IS NOT NULL)
1490 AND (WSH_PICK_LIST.G_PICK_REL_PARALLEL) THEN
1491 Insert_PR_Header_Holds (p_header_id => l_header_id, p_status => 'P');
1492 END IF;
1493
1494 END IF;
1495
1496 -- 2467416 changes Begin
1497 -- First Check in g_passed_crd_Tab, then in the g_failed_crd_Tab
1498 -- 3481194/3492870: hash indexes; if this is a new line,
1499 -- both l_passed_index and l_failed_index will be populated
1500
1501 l_passed_index := get_table_index(p_entity_id=>l_line_id, x_table=>g_passed_crd_tab);
1502 IF g_passed_crd_Tab.exists(l_passed_index) THEN
1503 l_exists_flag := 'Y';
1504 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
1505 END IF;
1506
1507 IF (l_exists_flag = 'N') THEN
1508 l_failed_index := get_table_index(p_entity_id=>l_line_id, p_alt_index=>l_passed_index, x_table=>g_failed_crd_tab);
1509 IF g_failed_crd_Tab.exists(l_failed_index) THEN
1510 l_exists_flag := 'Y';
1511 RAISE line_hold_error;
1512 END IF;
1513 END IF;
1514
1515 -- 2467416 changes End
1516
1517 -- Check line holds, only if the incoming line_id doesn't exists in the either passed/failed tables
1518
1519 IF l_exists_flag = 'N' THEN
1520 --Bug 14620571
1521 l_line_activity_type := p_activity_type;
1522 IF p_activity_type = 'SB_PICK' THEN
1523 l_line_activity_type := 'PICK';
1524 END IF;
1525
1526 --
1527 -- Debug Statements
1528 --
1529 IF l_debug_on THEN
1530 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit OE_HOLDS_PUB.CHECK_HOLDS',WSH_DEBUG_SV.C_PROC_LEVEL);
1531 END IF;
1532 --
1533 oe_holds_pub.check_holds(
1534 p_api_version => 1.0,
1535 p_line_id => l_line_id,
1536 p_wf_item => 'OEOL',
1537 p_wf_activity => l_line_activity_type||'_LINE', --Bug 14620571
1538 x_result_out => l_result_out,
1539 x_return_status => x_return_status,
1540 x_msg_count => l_msg_count,
1541 x_msg_data => l_msg_data);
1542
1543 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) OR (l_result_out = FND_API.G_TRUE) THEN
1544 --
1545 -- Debug Statements
1546 --
1547 IF l_debug_on THEN
1548 WSH_DEBUG_SV.logmsg(l_module_name, 'ORDER LINE '||TO_CHAR ( L_LINE_ID ) ||' IS ON HOLD' );
1549 END IF;
1550 --
1551
1552 -- BUG#: 1549665 hwahdani - check if process was run from conc. request and
1553 -- and log exception
1554
1555 -- 2467416
1556 g_failed_crd_Tab(l_failed_index) := l_line_id;
1557
1558 l_request_id := fnd_global.conc_request_id;
1559
1560 -- 1729516
1561 --Bug 14620571: Exception needs to be logged only for PickRelease process
1562 IF ( p_activity_type <> 'PICK' ) THEN
1563 --IF ( l_request_id = -1 AND WSH_PICK_LIST.G_BATCH_ID IS NULL ) THEN
1564 raise line_hold_error;
1565 ELSE
1566 FND_MESSAGE.SET_NAME('WSH','WSH_PICK_ORDER_LINE_HOLD');
1567 FND_MESSAGE.SET_TOKEN('ORDER',l_order_number);
1568 FND_MESSAGE.SET_TOKEN('LINE',l_line_number);
1569 l_msg := FND_MESSAGE.GET;
1570 --
1571 -- Debug Statements
1572 --
1573 IF l_debug_on THEN
1574 WSH_DEBUG_SV.logmsg(l_module_name, L_MSG );
1575 END IF;
1576 --
1577
1578 l_dummy_exception_id :=null;
1579 --
1580 -- Debug Statements
1581 --
1582 IF l_debug_on THEN
1583 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_XC_UTIL.LOG_EXCEPTION',WSH_DEBUG_SV.C_PROC_LEVEL);
1584 END IF;
1585 --
1586 wsh_xc_util.log_exception(
1587 p_api_version => 1.0,
1588 x_return_status => l_exception_return_status,
1589 x_msg_count => l_exception_msg_count,
1590 x_msg_data => l_exception_msg_data,
1591 x_exception_id => l_dummy_exception_id ,
1592 p_logged_at_location_id => l_ship_from_location_id,
1593 p_exception_location_id => l_ship_from_location_id,
1594 p_logging_entity => 'SHIPPER',
1595 p_logging_entity_id => FND_GLOBAL.USER_ID,
1596 p_exception_name => 'WSH_PICK_HOLD',
1597 p_message => l_msg ,
1598 p_error_message => l_exception_error_message,
1599 p_request_id => l_request_id,
1600 p_batch_id => WSH_PICK_LIST.g_batch_id -- Bug: 1729516
1601 );
1602
1603 IF (l_exception_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
1604 --
1605 -- Debug Statements
1606 --
1607 IF l_debug_on THEN
1608 WSH_DEBUG_SV.logmsg(l_module_name, 'WSH_XC_UTIL.LOG_EXCEPTION DID NOT RETURN SUCCESS' );
1609 END IF;
1610 --
1611 END IF;
1612 --Bug: 1573703 Return status needs to be set to 'E'
1613 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1614 -- bug 2882720: set message in case the concurrent program rolls back so that the exception is gone.
1615 IF p_activity_type = 'PICK' THEN
1616 FND_MESSAGE.SET_NAME('WSH','WSH_PICK_LINE_HOLD_ERROR');
1617 FND_MESSAGE.SET_TOKEN('DET_NAME',p_detail_id);
1618 ELSIF p_activity_type = 'PACK' THEN
1619 FND_MESSAGE.SET_NAME('WSH','WSH_PACK_LINE_HOLD_ERROR');
1620 FND_MESSAGE.SET_TOKEN('DET_NAME',p_detail_id);
1621 --Bug 14620571
1622 ELSIF p_activity_type = 'SB_PICK' THEN
1623 FND_MESSAGE.SET_NAME('WSH','WSH_BATCH_LINE_HOLD_ERROR');
1624 FND_MESSAGE.SET_TOKEN('DET_NAME',p_detail_id);
1625 ELSE
1626 FND_MESSAGE.SET_NAME('WSH','WSH_SHIP_LINE_HOLD_ERROR');
1627 FND_MESSAGE.SET_TOKEN('DET_NAME',p_detail_id);
1628 END IF;
1629 wsh_util_core.add_message(x_return_status);
1630 -- bug 2882720 change end
1631
1632 END IF; /* 1729516 */
1633
1634 ELSE
1635 -- /* i.e. When HOLD is FALSE , No Hold on the Line */
1636 -- 2467416
1637 g_passed_crd_Tab(l_passed_index) := l_line_id;
1638
1639 END IF; /* if HOLD is TRUE */
1640 END IF; /* if l_exists_flag = N */
1641
1642 --
1643 -- Debug Statements
1644 --
1645 IF l_debug_on THEN
1646 WSH_DEBUG_SV.pop(l_module_name);
1647 END IF;
1648 --
1649 EXCEPTION
1650 WHEN header_hold_error THEN
1651 FND_MESSAGE.SET_NAME('WSH','WSH_HEADER_HOLD_ERROR');
1652 FND_MESSAGE.SET_TOKEN('DET_NAME',p_detail_id);
1653 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1654 wsh_util_core.add_message(x_return_status);
1655 --
1656 -- Debug Statements
1657 --
1658 IF l_debug_on THEN
1659 WSH_DEBUG_SV.logmsg(l_module_name,'HEADER_HOLD_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
1660 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:HEADER_HOLD_ERROR');
1661 END IF;
1662
1663 WHEN line_hold_error THEN
1664 IF p_activity_type = 'PICK' THEN
1665 FND_MESSAGE.SET_NAME('WSH','WSH_PICK_LINE_HOLD_ERROR');
1666 FND_MESSAGE.SET_TOKEN('DET_NAME',p_detail_id);
1667 ELSIF p_activity_type = 'PACK' THEN
1668 FND_MESSAGE.SET_NAME('WSH','WSH_PACK_LINE_HOLD_ERROR');
1669 FND_MESSAGE.SET_TOKEN('DET_NAME',p_detail_id);
1670 --Bug 14620571
1671 ELSIF p_activity_type = 'SB_PICK' THEN
1672 FND_MESSAGE.SET_NAME('WSH','WSH_BATCH_LINE_HOLD_ERROR');
1673 FND_MESSAGE.SET_TOKEN('DET_NAME',p_detail_id);
1674 ELSE
1675 FND_MESSAGE.SET_NAME('WSH','WSH_SHIP_LINE_HOLD_ERROR');
1676 FND_MESSAGE.SET_TOKEN('DET_NAME',p_detail_id);
1677 END IF;
1678 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1679 wsh_util_core.add_message(x_return_status);
1680 --
1681 -- Debug Statements
1682 --
1683 IF l_debug_on THEN
1684 WSH_DEBUG_SV.logmsg(l_module_name, p_activity_type ||'_LINE_HOLD_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
1685 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:LINE_HOLD_ERROR');
1686 END IF;
1687
1688 WHEN credit_hold_error THEN
1689 FND_MESSAGE.SET_NAME('WSH','WSH_DET_CREDIT_HOLD_ERROR');
1690 FND_MESSAGE.SET_TOKEN('DET_NAME',p_detail_id);
1691 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1692 wsh_util_core.add_message(x_return_status);
1693 --
1694 -- Debug Statements
1695 --
1696 IF l_debug_on THEN
1697 WSH_DEBUG_SV.logmsg(l_module_name,'CREDIT_HOLD_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
1698 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:CREDIT_HOLD_ERROR');
1699 END IF;
1700 --
1701 WHEN others THEN
1702 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.Check_Credit_Holds');
1703 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
1704
1705 --
1706 -- Debug Statements
1707 --
1708 IF l_debug_on THEN
1709 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
1710 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
1711 END IF;
1712 --
1713 END check_credit_holds;
1714
1715
1716
1717 -----------------------------------------------------------------------------
1718 --
1719 -- Procedure: check_quantity_to_pick
1720 -- Parameters: p_order_line_id, - order line being picked
1721 -- p_quantity_to_pick - quantity to transact that
1722 -- will be checked
1723 -- x_allowed_flag - 'Y' = allowed, 'N' = not allowed
1724 -- x_max_quantity_allowed - maximum quantity
1725 -- that can be picked
1726 -- x_avail_req_quantity - req quantity not yet staged
1727 -- x_return_status
1728 -- Description: Checks if the quantity to pick is within overshipment
1729 -- tolerance, based on the quantities requested and
1730 -- staged and assignments to deliveries or containers.
1731 -- Also returns the maximum quantity allowed to pick.
1732 -- History: HW Added Qty2 for OPM and changed procedure parameters
1733 -----------------------------------------------------------------------------
1734
1735 PROCEDURE check_quantity_to_pick(
1736 p_order_line_id IN NUMBER,
1737 p_quantity_to_pick IN NUMBER,
1738 p_quantity2_to_pick IN NUMBER,
1739 x_allowed_flag OUT NOCOPY VARCHAR2,
1740 x_max_quantity_allowed OUT NOCOPY NUMBER,
1741 x_max_quantity2_allowed OUT NOCOPY NUMBER,
1742 x_avail_req_quantity OUT NOCOPY NUMBER,
1743 x_avail_req_quantity2 OUT NOCOPY NUMBER,
1744 x_return_status OUT NOCOPY VARCHAR2) IS
1745
1746
1747 -- HW OPM retrieve uom2
1748 CURSOR c_detail_info(x_source_line_id IN NUMBER) IS
1749 SELECT inventory_item_id,
1750 organization_id,
1751 requested_quantity_uom,
1752 requested_quantity_uom2,
1753 ship_tolerance_above,
1754 ship_tolerance_below, -- 2181132 added following fields
1755 source_header_id,
1756 source_line_set_id,
1757 source_code
1758 FROM wsh_delivery_details
1759 WHERE source_line_id = x_source_line_id
1760 AND source_code = 'OE' -- pick confirm supports only OE lines
1761 AND container_flag = 'N'
1762 AND released_status <> 'D'
1763 AND rownum = 1;
1764
1765
1766 -- HW OPM added qty2
1767 -- along with Bug 2181132
1768 -- change the cursor because it was not looking at shipped
1769 -- quantity and there can be cases where shipped quantity is not
1770 -- the same as picked quantity for a shipped delivery line
1771 CURSOR c_detail_staged_quantities(x_source_line_id IN NUMBER) IS
1772 SELECT NVL(SUM(requested_quantity), 0) net_requested_qty,
1773 NVL(SUM(decode (released_status,'C',nvl(shipped_quantity,0),
1774 NVL(picked_quantity, requested_quantity))
1775 ), 0) net_staged_qty,
1776 --NVL(SUM(NVL(picked_quantity, requested_quantity)), 0) net_staged_qty,
1777 NVL(SUM(NVL(requested_quantity2,0)), 0) net_requested_qty2,
1778 NVL(SUM(NVL(picked_quantity2, requested_quantity2)), 0) net_staged_qty2
1779 FROM wsh_delivery_details
1780 WHERE source_line_id = x_source_line_id
1781 AND source_code = 'OE'
1782 AND container_flag = 'N'
1783 AND released_status IN ('X', 'Y', 'C');
1784
1785 -- HW OPMCONV -Retrieve Qty2 and UOM2
1786
1787 CURSOR c_ordered_quantity(x_source_line_id IN NUMBER,
1788 x_item_id IN NUMBER,
1789 x_primary_uom IN VARCHAR2) IS
1790 SELECT WSH_WV_UTILS.CONVERT_UOM(order_quantity_uom,
1791 x_primary_uom,
1792 ordered_quantity,
1793 x_item_id) quantity ,
1794 order_quantity_uom,
1795 ordered_quantity2,
1796 ordered_quantity_uom2
1797 FROM oe_order_lines_all
1798 WHERE line_id = x_source_line_id;
1799
1800
1801 l_found_flag BOOLEAN;
1802 l_detail_info c_detail_info%ROWTYPE;
1803 l_staged_info c_detail_staged_quantities%ROWTYPE;
1804 l_order_line c_ordered_quantity%ROWTYPE;
1805 --HW OPM variable for OPM cursor
1806 -- HW OPMCONV - No need for OPM specific cursor
1807
1808 quantity NUMBER;
1809 l_max_quantity2 NUMBER;
1810 l_min_quantity2 NUMBER;
1811 l_max_quantity NUMBER;
1812 l_min_quantity NUMBER;
1813 l_msg_count NUMBER;
1814 l_msg_data VARCHAR2(2000);
1815 l_return_status varchar2(30);
1816
1817 l_apps_uom_ordered_quantity NUMBER := 0; -- Bug 2922649
1818
1819 l_req_qty_left NUMBER;
1820 others EXCEPTION;
1821
1822 -- HW OPM new varibales
1823 -- HW OPMCONV - No need for OPM local variables
1824
1825 l_req_qty2_left NUMBER;
1826
1827 -- 2181132
1828 l_minmaxinrectype MinMaxInRecType;
1829 l_minmaxinoutrectype MinMaxInOutRecType;
1830 l_minmaxoutrectype MinMaxOutRecType;
1831 l_quantity_uom WSH_DELIVERY_DETAILS.requested_quantity_uom%TYPE;
1832 l_quantity_uom2 WSH_DELIVERY_DETAILS.requested_quantity_uom2%TYPE;
1833
1834 --
1835 l_debug_on BOOLEAN;
1836 --
1837 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CHECK_QUANTITY_TO_PICK';
1838 --
1839 BEGIN
1840
1841 --
1842 -- Debug Statements
1843 --
1844 --
1845 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
1846 --
1847 IF l_debug_on IS NULL
1848 THEN
1849 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
1850 END IF;
1851 --
1852 IF l_debug_on THEN
1853 WSH_DEBUG_SV.push(l_module_name);
1854 --
1855 WSH_DEBUG_SV.log(l_module_name,'P_ORDER_LINE_ID',P_ORDER_LINE_ID);
1856 WSH_DEBUG_SV.log(l_module_name,'P_QUANTITY_TO_PICK',P_QUANTITY_TO_PICK);
1857 WSH_DEBUG_SV.log(l_module_name,'P_QUANTITY2_TO_PICK',P_QUANTITY2_TO_PICK);
1858 END IF;
1859 --
1860 OPEN c_detail_info(p_order_line_id);
1861 FETCH c_detail_info INTO l_detail_info;
1862 l_found_flag := c_detail_info%FOUND;
1863 CLOSE c_detail_info;
1864
1865 -- HW OPM Added qty2
1866 IF NOT l_found_flag THEN
1867 FND_MESSAGE.SET_NAME('WSH','NO_DATA_FOUND');
1868 x_allowed_flag := 'N';
1869 x_max_quantity_allowed := NULL;
1870 x_avail_req_quantity := NULL;
1871 x_max_quantity2_allowed := NULL;
1872 x_avail_req_quantity2 := NULL;
1873
1874 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1875 --
1876 -- Debug Statements
1877 --
1878 IF l_debug_on THEN
1879 WSH_DEBUG_SV.pop(l_module_name);
1880 END IF;
1881 --
1882 RETURN;
1883 END IF;
1884
1885 -- HW OPM Need to check the org for forking
1886 --
1887 -- Debug Statements
1888 --
1889
1890
1891 OPEN c_detail_staged_quantities(p_order_line_id);
1892 FETCH c_detail_staged_quantities INTO l_staged_info;
1893 l_found_flag := c_detail_staged_quantities%FOUND;
1894 CLOSE c_detail_staged_quantities;
1895
1896 -- HW OPM Added qty2
1897 IF NOT l_found_flag THEN
1898 FND_MESSAGE.SET_NAME('WSH','NO_DATA_FOUND');
1899 x_allowed_flag := 'N';
1900 x_max_quantity_allowed := NULL;
1901 x_avail_req_quantity := NULL;
1902 x_max_quantity2_allowed := NULL;
1903 x_avail_req_quantity2 := NULL;
1904 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1905 --
1906 -- Debug Statements
1907 --
1908 IF l_debug_on THEN
1909 WSH_DEBUG_SV.pop(l_module_name);
1910 END IF;
1911 --
1912 RETURN;
1913 END IF;
1914
1915 -- HW OPMCONV - No need to branch code
1916 -- HW OPM for debugging puproses. Print values
1917 -- HW OPM Need to branch
1918
1919 OPEN c_ordered_quantity(p_order_line_id,
1920 l_detail_info.inventory_item_id,
1921 l_detail_info.requested_quantity_uom);
1922 FETCH c_ordered_quantity INTO l_order_line;
1923 l_found_flag := c_ordered_quantity%FOUND;
1924 CLOSE c_ordered_quantity;
1925
1926 -- HW OPM Added qty2
1927 IF NOT l_found_flag THEN
1928 FND_MESSAGE.SET_NAME('WSH','NO_DATA_FOUND');
1929 x_allowed_flag := 'N';
1930 x_max_quantity_allowed := NULL;
1931 x_avail_req_quantity := NULL;
1932 x_max_quantity2_allowed := NULL;
1933 x_avail_req_quantity2 := NULL;
1934 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1935 --
1936 -- Debug Statements
1937 --
1938 IF l_debug_on THEN
1939 WSH_DEBUG_SV.pop(l_module_name);
1940 END IF;
1941 --
1942 RETURN;
1943 END IF;
1944
1945 -- Debug Statements
1946 --
1947 IF l_debug_on THEN
1948 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_INTEGRATION.GET_MIN_MAX_TOLERANCE_QUANTITY',WSH_DEBUG_SV.C_PROC_LEVEL);
1949 END IF;
1950 --
1951 -- Bug 2181132
1952
1953 -- in attributes
1954
1955 l_minmaxinrectype.source_code := l_detail_info.source_code;
1956 l_minmaxinrectype.line_id := p_order_line_id;
1957 l_minmaxinrectype.source_header_id := l_detail_info.source_header_id;
1958 l_minmaxinrectype.source_line_set_id := l_detail_info.source_line_set_id;
1959 l_minmaxinrectype.ship_tolerance_above := l_detail_info.ship_tolerance_above;
1960 l_minmaxinrectype.ship_tolerance_below := l_detail_info.ship_tolerance_below;
1961 l_minmaxinrectype.action_flag := 'P'; -- pick confirm
1962 l_minmaxinrectype.lock_flag := 'N';
1963 l_minmaxinrectype.quantity_uom := l_detail_info.requested_quantity_uom;
1964 l_minmaxinrectype.quantity_uom2 := l_detail_info.requested_quantity_uom2;
1965
1966 WSH_DETAILS_VALIDATIONS.get_min_max_tolerance_quantity
1967 (p_in_attributes => l_minmaxinrectype,
1968 x_out_attributes => l_minmaxoutrectype,
1969 p_inout_attributes => l_minmaxinoutrectype,
1970 x_return_status => l_return_status,
1971 x_msg_count => l_msg_count,
1972 x_msg_data => l_msg_data
1973 );
1974
1975 l_quantity_uom := l_minmaxoutrectype.quantity_uom;
1976 l_min_quantity := l_minmaxoutrectype.min_remaining_quantity;
1977 l_max_quantity := l_minmaxoutrectype.max_remaining_quantity;
1978 l_quantity_uom2 := l_minmaxoutrectype.quantity2_uom;
1979 l_min_quantity2 := l_minmaxoutrectype.min_remaining_quantity2;
1980 l_max_quantity2 := l_minmaxoutrectype.max_remaining_quantity2;
1981
1982
1983 IF l_debug_on THEN
1984 WSH_DEBUG_SV.log(l_module_name,'Return Status'||l_return_status);
1985 WSH_DEBUG_SV.log(l_module_name,'Max Qty'||l_max_quantity);
1986 WSH_DEBUG_SV.log(l_module_name,'Min Qty'||l_min_quantity);
1987 WSH_DEBUG_SV.log(l_module_name,'Qty UOM'||l_quantity_uom);
1988 END IF;
1989
1990 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1991 raise others ;
1992 END IF;
1993
1994
1995
1996 -- HW OPMCONV - Need to branch
1997
1998 --
1999 -- Debug Statements
2000 --
2001 IF l_debug_on THEN
2002 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_WV_UTILS.CONVERT_UOM',WSH_DEBUG_SV.C_PROC_LEVEL);
2003 END IF;
2004 --
2005 l_max_quantity := l_max_quantity
2006 - l_staged_info.net_staged_qty;
2007
2008
2009 l_req_qty_left := GREATEST(0,
2010 (l_order_line.quantity
2011 - l_staged_info.net_requested_qty)
2012 );
2013
2014
2015 l_max_quantity2 := nvl(l_max_quantity2,0) - nvl(l_staged_info.net_staged_qty2,0);
2016
2017 l_req_qty2_left := GREATEST(0,
2018 (l_order_line.ordered_quantity2
2019 - l_staged_info.net_requested_qty2)
2020 );
2021
2022 -- HW added for debugging purposes
2023 -- HW OPMCONV - No need to branch
2024 -- muom
2025 IF NVL(p_quantity_to_pick,0) < 0 and NVL(p_quantity2_to_pick,0) < 0 THEN
2026 x_allowed_flag := 'N';
2027 ELSIF (WSH_UTIL_CORE.Get_Line_Fulfillment_Base('OE',p_order_line_id) = 'S') THEN
2028 IF (p_quantity2_to_pick > l_max_quantity2) THEN
2029 x_allowed_flag := 'N';
2030 ELSE
2031 x_allowed_flag := 'Y';
2032 END IF;
2033 ELSIF (p_quantity_to_pick > l_max_quantity) THEN
2034 x_allowed_flag := 'N';
2035 ELSE
2036 x_allowed_flag := 'Y';
2037 END IF;
2038
2039 x_max_quantity_allowed := l_max_quantity;
2040 x_avail_req_quantity := l_req_qty_left;
2041 -- HW OPM added qty2
2042 x_max_quantity2_allowed := l_max_quantity2;
2043 x_avail_req_quantity2 := l_req_qty2_left;
2044
2045 -- HW OPMCONV _ Removed print statements
2046 -- HW for debugging purposes, print values
2047
2048 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
2049
2050
2051 --
2052 -- Debug Statements
2053 --
2054 IF l_debug_on THEN
2055 WSH_DEBUG_SV.pop(l_module_name);
2056 END IF;
2057 --
2058 EXCEPTION
2059 WHEN others THEN
2060 IF c_detail_info%ISOPEN THEN
2061 CLOSE c_detail_info;
2062 END IF;
2063 IF c_detail_staged_quantities%ISOPEN THEN
2064 CLOSE c_detail_staged_quantities;
2065 END IF;
2066 IF c_ordered_quantity%ISOPEN THEN
2067 CLOSE c_ordered_quantity;
2068 END IF;
2069 -- HW closing OPM cursor
2070
2071 x_allowed_flag := 'N';
2072 x_max_quantity_allowed := NULL;
2073 x_avail_req_quantity := NULL;
2074 -- HW Added for OPM
2075 x_max_quantity2_allowed := NULL;
2076 x_avail_req_quantity2 := NULL;
2077 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
2078 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.check_quantity_to_pick');
2079
2080 --
2081 -- Debug Statements
2082 --
2083 IF l_debug_on THEN
2084 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
2085 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
2086 END IF;
2087 --
2088 END check_quantity_to_pick;
2089
2090 -- Overloaded check_quantity_to_pick
2091 -- Same as above procedure but is w/o
2092 -- the quantity2's in the signature
2093
2094
2095 PROCEDURE check_quantity_to_pick(
2096 p_order_line_id IN NUMBER,
2097 p_quantity_to_pick IN NUMBER,
2098 x_allowed_flag OUT NOCOPY VARCHAR2,
2099 x_max_quantity_allowed OUT NOCOPY NUMBER,
2100 x_avail_req_quantity OUT NOCOPY NUMBER,
2101 x_return_status OUT NOCOPY VARCHAR2) IS
2102
2103 l_dummy_quantity2_to_pick NUMBER;
2104 l_dummy_max_quantity2_allowed NUMBER;
2105 l_dummy_avail_req_quantity2 NUMBER;
2106
2107
2108 --
2109 l_debug_on BOOLEAN;
2110 --
2111 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CHECK_QUANTITY_TO_PICK';
2112 --
2113 BEGIN
2114
2115 --
2116 -- Debug Statements
2117 --
2118 --
2119 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
2120 --
2121 IF l_debug_on IS NULL
2122 THEN
2123 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
2124 END IF;
2125 --
2126 IF l_debug_on THEN
2127 WSH_DEBUG_SV.push(l_module_name);
2128 --
2129 WSH_DEBUG_SV.log(l_module_name,'P_ORDER_LINE_ID',P_ORDER_LINE_ID);
2130 WSH_DEBUG_SV.log(l_module_name,'P_QUANTITY_TO_PICK',P_QUANTITY_TO_PICK);
2131 END IF;
2132 --
2133 --
2134 -- Debug Statements
2135 --
2136 IF l_debug_on THEN
2137 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DETAILS_VALIDATIONS.CHECK_QUANTITY_TO_PICK',WSH_DEBUG_SV.C_PROC_LEVEL);
2138 END IF;
2139 --
2140 wsh_details_validations.check_quantity_to_pick(
2141 p_order_line_id => p_order_line_id,
2142 p_quantity_to_pick => p_quantity_to_pick,
2143 p_quantity2_to_pick => l_dummy_quantity2_to_pick,
2144 x_allowed_flag => x_allowed_flag,
2145 x_max_quantity_allowed => x_max_quantity_allowed,
2146 x_max_quantity2_allowed => l_dummy_max_quantity2_allowed,
2147 x_avail_req_quantity => x_avail_req_quantity,
2148 x_avail_req_quantity2 => l_dummy_avail_req_quantity2,
2149 x_return_status => x_return_status);
2150
2151 --
2152 -- Debug Statements
2153 --
2154 IF l_debug_on THEN
2155 WSH_DEBUG_SV.pop(l_module_name);
2156 END IF;
2157 --
2158 EXCEPTION
2159 WHEN OTHERS THEN
2160 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
2161 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.check_quantity_to_pick');
2162
2163 --
2164 -- Debug Statements
2165 --
2166 IF l_debug_on THEN
2167 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
2168 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
2169 END IF;
2170 --
2171 END check_quantity_to_pick;
2172
2173
2174 -----------------------------------------------------------------------------
2175 --
2176 -- Procedure: check_zero_req_confirm
2177 -- Parameters: p_delivery_id - delivery being confirmed
2178 -- x_return_status
2179 -- Description: Ensure that delivery details with zero requested
2180 -- quantities will not be alone after Ship Confirm.
2181 --
2182 -----------------------------------------------------------------------------
2183
2184 PROCEDURE check_zero_req_confirm(
2185 p_delivery_id IN NUMBER,
2186 x_return_status OUT NOCOPY VARCHAR2) IS
2187
2188 -- muom
2189 CURSOR c_check_qty_inside_del (del_id IN NUMBER) IS
2190 select sum(wdd.requested_quantity), wdd.source_code, wdd.source_line_id,
2191 decode(wdd.requested_quantity_uom2,null,'P',WSH_UTIL_CORE.Get_Line_Fulfillment_Base(wdd.source_code,wdd.source_line_id)) fulfill_base
2192 from wsh_delivery_details wdd, wsh_delivery_assignments_v wda
2193 where wdd.delivery_detail_id = wda.delivery_detail_id
2194 and wda.delivery_id is not null
2195 and wda.delivery_id = del_id
2196 and wdd.released_status <> 'D'
2197 group by source_line_id, source_code, decode(wdd.requested_quantity_uom2,null,'P',WSH_UTIL_CORE.Get_Line_Fulfillment_Base(wdd.source_code, wdd.source_line_id))
2198 having sum(decode( decode(wdd.requested_quantity_uom2,null,'P',WSH_UTIL_CORE.Get_Line_Fulfillment_Base(wdd.source_code,wdd.source_line_id)),'P',wdd.requested_quantity,'S',wdd.requested_quantity2)) = 0;
2199
2200
2201 CURSOR c_source_info IS
2202 -- muom
2203 select distinct wdd.source_line_id, wdd.source_code,
2204 decode(wdd.requested_quantity_uom2,null,'P',WSH_UTIL_CORE.Get_Line_Fulfillment_Base(wdd.source_code,wdd.source_line_id)) fulfill_base
2205 from wsh_delivery_details wdd, wsh_delivery_assignments_v wda
2206 where wdd.delivery_detail_id = wda.delivery_detail_id
2207 and wdd.released_status <> 'D'
2208 and wda.delivery_id is not null
2209 and wda.delivery_id = p_delivery_id;
2210
2211 l_req_qty NUMBER;
2212 l_source_code VARCHAR2(3);
2213 l_source_line_id NUMBER;
2214
2215 req_qty_zero EXCEPTION;
2216
2217 -- muom
2218 l_fulfill_base varchar2(1);
2219
2220 --
2221 l_debug_on BOOLEAN;
2222 --
2223 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CHECK_ZERO_REQ_CONFIRM';
2224 --
2225 BEGIN
2226 --
2227 -- Debug Statements
2228 --
2229 --
2230 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
2231 --
2232 IF l_debug_on IS NULL
2233 THEN
2234 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
2235 END IF;
2236 --
2237 IF l_debug_on THEN
2238 WSH_DEBUG_SV.push(l_module_name);
2239 --
2240 WSH_DEBUG_SV.log(l_module_name,'P_DELIVERY_ID',P_DELIVERY_ID);
2241 END IF;
2242 --
2243 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
2244
2245
2246 open c_check_qty_inside_del (p_delivery_id);
2247 fetch c_check_qty_inside_del into l_req_qty, l_source_code, l_source_line_id,l_fulfill_base;
2248 IF c_check_qty_inside_del%FOUND THEN
2249 IF l_fulfill_base = 'P' THEN
2250 FND_MESSAGE.SET_NAME('WSH','WSH_REQ_ZERO_INSIDE_ERROR');
2251 --muom
2252 ELSE
2253 FND_MESSAGE.SET_NAME('WSH','WSH_REQ2_ZERO_INSIDE_ERROR');
2254 END IF;
2255 close c_check_qty_inside_del;
2256 raise req_qty_zero;
2257 END IF;
2258 close c_check_qty_inside_del;
2259
2260 FOR source_rec IN c_source_info LOOP
2261 -- muom
2262 IF source_rec.fulfill_base = 'P' THEN
2263 BEGIN
2264 select sum(wdd.requested_quantity)
2265 into l_req_qty
2266 from wsh_delivery_details wdd, wsh_delivery_assignments_v wda, wsh_new_deliveries wnd
2267 where wdd.delivery_detail_id = wda.delivery_detail_id
2268 and wnd.delivery_id(+) = wda.delivery_id
2269 and (wda.delivery_id <> p_delivery_id or wda.delivery_id is NULL)
2270 and wdd.released_status not in ('C', 'D')
2271 and NVL(wnd.status_code,'OP') <> 'CO'
2272 and wdd.source_line_id = source_rec.source_line_id
2273 and wdd.source_code = source_rec.source_code
2274 having sum(wdd.requested_quantity) = 0;
2275 EXCEPTION
2276 WHEN NO_DATA_FOUND THEN
2277 l_req_qty := 99;
2278 END;
2279
2280 IF l_req_qty = 0 THEN
2281 FND_MESSAGE.SET_NAME('WSH','WSH_REQ_ZERO_OUTSIDE_ERROR');
2282 l_source_line_id := source_rec.source_line_id;
2283 l_source_code := source_rec.source_code;
2284 raise req_qty_zero;
2285 END IF;
2286 ELSE
2287 BEGIN
2288 select sum(wdd.requested_quantity2)
2289 into l_req_qty
2290 from wsh_delivery_details wdd, wsh_delivery_assignments_v wda, wsh_new_deliveries wnd
2291 where wdd.delivery_detail_id = wda.delivery_detail_id
2292 and wnd.delivery_id(+) = wda.delivery_id
2293 and (wda.delivery_id <> p_delivery_id or wda.delivery_id is NULL)
2294 and wdd.released_status not in ('C', 'D')
2295 and NVL(wnd.status_code,'OP') <> 'CO'
2296 and wdd.source_line_id = source_rec.source_line_id
2297 and wdd.source_code = source_rec.source_code
2298 having sum(wdd.requested_quantity2) = 0;
2299 EXCEPTION
2300 WHEN NO_DATA_FOUND THEN
2301 l_req_qty := 99;
2302 END;
2303
2304 IF l_req_qty = 0 THEN
2305 FND_MESSAGE.SET_NAME('WSH','WSH_REQ2_ZERO_OUTSIDE_ERROR');
2306 l_source_line_id := source_rec.source_line_id;
2307 l_source_code := source_rec.source_code;
2308 raise req_qty_zero;
2309 END IF;
2310 END IF;
2311 END LOOP;
2312
2313 --
2314 -- Debug Statements
2315 --
2316 IF l_debug_on THEN
2317 WSH_DEBUG_SV.pop(l_module_name);
2318 END IF;
2319 --
2320 EXCEPTION
2321
2322 WHEN req_qty_zero THEN
2323 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2324 FND_MESSAGE.SET_TOKEN('DELIVERY', p_delivery_id);
2325 FND_MESSAGE.SET_TOKEN('SOURCE_CODE', l_source_code);
2326 FND_MESSAGE.SET_TOKEN('SOURCE_LINE', l_source_line_id);
2327 wsh_util_core.add_message(x_return_status);
2328
2329 --
2330 -- Debug Statements
2331 --
2332 IF l_debug_on THEN
2333 WSH_DEBUG_SV.logmsg(l_module_name,'REQ_QTY_ZERO exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
2334 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:REQ_QTY_ZERO');
2335 END IF;
2336 --
2337 WHEN others THEN
2338 IF c_check_qty_inside_del%ISOPEN THEN
2339 close c_check_qty_inside_del;
2340 END IF;
2341 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
2342 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.check_zero_req_confirm');
2343
2344 --
2345 -- Debug Statements
2346 --
2347 IF l_debug_on THEN
2348 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
2349 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
2350 END IF;
2351 --
2352 END check_zero_req_confirm;
2353
2354
2355 --
2356 -- Procedure: Get_Disabled_List
2357 --
2358 -- Parameters: p_detail_id -- ID for delivery detail
2359 -- p_delivery_id -- delivery the detail is assigned to
2360 -- p_list_type -- 'FORM', will return list of form field names
2361 -- 'TABLE', will return list of table column names
2362 -- x_return_status -- return status for execution of this API
2363 -- x_msg_count -- number of error message
2364 -- x_msg_data -- error message if API failed
2365 --
2366 PROCEDURE Get_Disabled_List(
2367 p_delivery_detail_id IN NUMBER
2368 , p_delivery_id IN NUMBER
2369 , p_list_type IN VARCHAR2
2370 , x_return_status OUT NOCOPY VARCHAR2
2371 , x_disabled_list OUT NOCOPY WSH_UTIL_CORE.column_tab_type
2372 , x_msg_count OUT NOCOPY NUMBER
2373 , x_msg_data OUT NOCOPY VARCHAR2
2374 , p_caller IN VARCHAR2 -- DEFAULT NULL, --public api changes
2375 )
2376 IS
2377
2378 CURSOR get_delivery_status
2379 IS
2380 SELECT status_code
2381 FROM wsh_new_deliveries
2382 WHERE delivery_id = p_delivery_id;
2383
2384 -- OPM 09/11/00
2385 CURSOR dd_info
2386 IS
2387 SELECT requested_quantity_uom2,
2388 nvl(inspection_flag,'N'),
2389 released_status,
2390 picked_quantity,
2391 container_flag,
2392 organization_id,
2393 inventory_item_id,
2394 pickable_flag,
2395 subinventory,
2396 source_code,
2397 inventory_item_id,
2398 nvl(line_direction,'O') line_direction -- J-IB-NPARIKH
2399 FROM wsh_delivery_details
2400 WHERE delivery_detail_id = p_delivery_detail_id;
2401
2402 -- end of OPM 09/11/00
2403
2404 l_status_code VARCHAR2(2);
2405 -- OPM 09/11/00 variables to hold value of qty_uom2
2406 l_qty_uom2 VARCHAR2(3);
2407 -- end of OPM 09/11/00
2408 i NUMBER := 0;
2409 WSH_DP_NO_ENTITY EXCEPTION;
2410 WSH_DEL_NOT_EXIST EXCEPTION; -- Bug fix 2650464
2411 WSH_INV_LIST_TYPE EXCEPTION;
2412 l_msg_summary VARCHAR2(2000) := NULL;
2413 l_msg_details VARCHAR2(4000) := NULL;
2414 l_inspection_flag VARCHAR2(1) := NULL;
2415 l_released_status VARCHAR2(1) := NULL;
2416 l_picked_quantity NUMBER;
2417 l_container_flag VARCHAR2(1) := 'N';
2418 l_organization_id NUMBER;
2419 l_item_id NUMBER;
2420 l_pickable_flag VARCHAR2(1);
2421 l_subinventory VARCHAR2(30);
2422 l_line_direction VARCHAR2(30);
2423 l_inv_controls WSH_DELIVERY_DETAILS_INV.inv_control_flag_rec;
2424 -- BUG FIX 2887330
2425 l_inventory_item_id NUMBER;
2426 l_reservable_flag VARCHAR2(1);
2427 l_source_code VARCHAR2(30);
2428 l_delivery_detail_id NUMBER;
2429 l_delivery_id NUMBER;
2430 l_debug_on BOOLEAN;
2431
2432 e_all_disabled EXCEPTION ; --public api changes
2433
2434 --
2435 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'GET_DISABLED_LIST';
2436 --
2437 BEGIN
2438 --
2439 -- Debug Statements
2440 --
2441 --
2442 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
2443 --
2444 IF l_debug_on IS NULL
2445 THEN
2446 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
2447 END IF;
2448 --
2449 IF l_debug_on THEN
2450 WSH_DEBUG_SV.push(l_module_name);
2451 --
2452 WSH_DEBUG_SV.log(l_module_name,'P_DELIVERY_DETAIL_ID',P_DELIVERY_DETAIL_ID);
2453 WSH_DEBUG_SV.log(l_module_name,'P_DELIVERY_ID',P_DELIVERY_ID);
2454 WSH_DEBUG_SV.log(l_module_name,'P_LIST_TYPE',P_LIST_TYPE);
2455 END IF;
2456 --
2457 x_return_status := FND_API.G_RET_STS_SUCCESS;
2458 -- clear the disabled list first
2459 x_disabled_list.delete;
2460 -- OPM 09/11/00
2461 OPEN dd_info;
2462 FETCH dd_info
2463 INTO l_qty_uom2,
2464 l_inspection_flag,
2465 l_released_status,
2466 l_picked_quantity,
2467 l_container_flag,l_organization_id,
2468 l_item_id, l_pickable_flag, l_subinventory,
2469 l_source_code, l_inventory_item_id, l_line_direction;
2470
2471 IF (dd_info%NOTFOUND) THEN
2472 CLOSE dd_info ;
2473 RAISE wsh_dp_no_entity;
2474 END IF;
2475 CLOSE dd_info ;
2476 --
2477 -- J-IB-NPARIKH-{
2478 --
2479 IF l_line_direction NOT IN ('O','IO')
2480 THEN
2481 --{
2482 --
2483 i:=i+1; x_disabled_list(i) := 'FULL';
2484 --
2485 IF l_released_status = 'X'
2486 THEN
2487 --{
2488 i:=i+1; x_disabled_list(i) := 'DESC_FLEX';
2489 i:=i+1; x_disabled_list(i) := 'TP_FLEXFIELD';
2490 i:=i+1; x_disabled_list(i) := 'SHIPPING_INSTRUCTIONS';
2491 i:=i+1; x_disabled_list(i) := 'PACKING_INSTRUCTIONS';
2492 i:=i+1; x_disabled_list(i) := 'TRACKING_NUMBER';
2493 i:=i+1; x_disabled_list(i) := 'GROSS_WEIGHT';
2494 i:=i+1; x_disabled_list(i) := 'TARE_WEIGHT';
2495 i:=i+1; x_disabled_list(i) := 'NET_WEIGHT';
2496 i:=i+1; x_disabled_list(i) := 'VOLUME';
2497 --}
2498 ELSIF l_released_status IN ('C','L','P')
2499 THEN
2500 --{
2501 i:=i+1; x_disabled_list(i) := 'DESC_FLEX';
2502 i:=i+1; x_disabled_list(i) := 'TP_FLEXFIELD';
2503 i:=i+1; x_disabled_list(i) := 'GROSS_WEIGHT';
2504 i:=i+1; x_disabled_list(i) := 'TARE_WEIGHT';
2505 i:=i+1; x_disabled_list(i) := 'NET_WEIGHT';
2506 i:=i+1; x_disabled_list(i) := 'VOLUME';
2507 --
2508 IF l_released_status = 'C'
2509 THEN
2510 i:=i+1; x_disabled_list(i) := 'TRACKING_NUMBER';
2511 END IF;
2512 --}
2513 END IF;
2514 --
2515 IF l_debug_on THEN
2516 WSH_DEBUG_SV.pop(l_module_name);
2517 END IF;
2518 --
2519 RETURN;
2520 --}
2521 END IF;
2522 --
2523 -- J-IB-NPARIKH-}
2524 --
2525
2526 IF l_debug_on THEN
2527 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_DETAILS_INV.GET_RESERVABLE_FLAG',WSH_DEBUG_SV.C_PROC_LEVEL);
2528 END IF;
2529
2530 l_reservable_flag := WSH_DELIVERY_DETAILS_INV.get_reservable_flag(
2531 x_item_id => l_inventory_item_id,
2532 x_organization_id => l_organization_id,
2533 x_pickable_flag => l_pickable_flag);
2534 if l_debug_on then
2535 wsh_debug_sv.log(l_module_name, 'l_reservable_flag', l_reservable_flag);
2536 wsh_debug_sv.log(l_module_name, 'l_pickable_flag', l_pickable_flag);
2537 wsh_debug_sv.log(l_module_name, 'l_source_code', l_source_code);
2538 end if;
2539
2540 -- If delivery line is released to warehouse, shipped, or deleted,
2541 -- disable its fields.
2542 -- :Bug #2586286 : Enabled the DESC_FLEX even when relead_status 'C' or 'D'
2543 IF (l_released_status IN ('S', 'C', 'D')) THEN
2544 i:=i+1; x_disabled_list(i) := 'FULL';
2545 i:=i+1; x_disabled_list(i) := 'DESC_FLEX';
2546 if l_debug_on then
2547 wsh_debug_sv.log(l_module_name, 'l_released_status', l_released_status);
2548 wsh_debug_sv.log(l_module_name, 'l_picked_quantity', l_picked_quantity);
2549 end if;
2550 IF ( l_released_status = 'S'
2551 AND l_picked_quantity IS NULL) THEN
2552 -- can update some fields if the delivery line
2553 -- is released to warehouse and is not pending overpick.
2554 i:=i+1; x_disabled_list(i) := 'TP_FLEXFIELD';
2555 --i:=i+1; x_disabled_list(i) := 'DESC_FLEX';
2556 i:=i+1; x_disabled_list(i) := 'SHIPPING_INSTRUCTIONS';
2557 i:=i+1; x_disabled_list(i) := 'PACKING_INSTRUCTIONS';
2558 i:=i+1; x_disabled_list(i) := 'TRACKING_NUMBER';
2559 i:=i+1; x_disabled_list(i) := 'SEAL_CODE';
2560 --X-dock change, allow update from WMS for X-dock lines
2561 IF p_caller like 'WMS_XDOCK%' THEN
2562 i:=i+1; x_disabled_list(i) := 'RELEASED_STATUS';
2563 END IF;
2564 END IF;
2565 --
2566 -- Debug Statements
2567 --
2568 IF l_debug_on THEN
2569 WSH_DEBUG_SV.pop(l_module_name);
2570 END IF;
2571 --
2572 RETURN;
2573
2574 END IF;
2575
2576 IF p_delivery_id is NOT NULL THEN
2577
2578 OPEN get_delivery_status;
2579 FETCH get_delivery_status INTO l_status_code;
2580 IF (get_delivery_status%NOTFOUND) THEN
2581 CLOSE get_delivery_status;
2582 -- Bug fix 2650464
2583 RAISE WSH_DEL_NOT_EXIST;
2584 END IF;
2585 CLOSE get_delivery_status;
2586
2587 END IF;
2588
2589
2590 -- OPM 09/11/00 if line is not assigned, need to add OPM attributes to list
2591 IF (p_delivery_id IS NULL) OR (l_status_code IN ('OP','PA', 'SA')) THEN
2592
2593 -- disabling the gross and tare weights for non-container items
2594 -- bug fix 2061295
2595
2596 -- commenting the gross weight to make it enable for non-container items
2597 -- for the bug #2554087
2598 -- Commenting the Tare Weight Field to make it enable for
2599 -- non-container items for bug 2890559
2600 /*
2601 IF (l_container_flag = 'N') THEN
2602 -- i := i+1; x_disabled_list(i) := 'GROSS_WEIGHT';
2603 i := i+1; x_disabled_list(i) := 'TARE_WEIGHT';
2604 END IF;
2605 */
2606
2607 IF (l_released_status NOT IN ('X', 'Y')) THEN
2608
2609 i:=i+1; x_disabled_list(i) := 'SHIPPED_QUANTITY';
2610 i:=i+1; x_disabled_list(i) := 'SHIPPED_QUANTITY2';
2611
2612 END IF; -- if l_released_status...
2613
2614 IF (l_source_code NOT IN ('OE','WSH','OKE')) THEN --RTV changes
2615 i:=i+1; x_disabled_list(i) := 'REVISION';
2616 i:=i+1; x_disabled_list(i) := 'LOT_NUMBER';
2617 i:=i+1; x_disabled_list(i) := 'SUBINVENTORY';
2618 i:=i+1; x_disabled_list(i) := 'LOCATOR_NAME';
2619 END IF;
2620
2621 IF (l_qty_uom2 is NULL) THEN
2622 i:=i+1; x_disabled_list(i) := 'SHIPPED_QUANTITY2';
2623 i:=i+1; x_disabled_list(i) := 'CANCELLED_QUANTITY2';
2624 i:=i+1; x_disabled_list(i) := 'DELIVERED_QUANTITY2';
2625 i:=i+1; x_disabled_list(i) := 'CYCLE_COUNT_QUANTITY2';
2626 END IF;
2627
2628 IF (l_inspection_flag = 'N') THEN
2629 i:=i+1; x_disabled_list(i) := 'INSPECTION_FLAG';
2630 END IF;
2631
2632 -- LPN sync-up
2633 IF (l_container_flag = 'N') THEN
2634 i:=i+1; x_disabled_list(i) := 'CONTAINER_NAME';
2635 i:=i+1; x_disabled_list(i) := 'LPN_ID';
2636 END IF;
2637
2638 -- R12 MDC
2639 IF l_container_flag = 'C' and NVL(p_caller, 'WSH_FSTRX') not like 'WMS%' THEN
2640 i:=i+1; x_disabled_list(i) := 'NET_WEIGHT';
2641 END IF;
2642 --
2643
2644 ELSIF p_delivery_id is not NULL THEN
2645
2646 IF (l_status_code = 'PA') THEN
2647 i:=i+1; x_disabled_list(i) := 'CONTAINER_NAME';
2648 -- LPN sync-up
2649 IF (l_container_flag = 'N') THEN
2650 i:=i+1; x_disabled_list(i) := 'LPN_ID';
2651 END IF;
2652
2653 IF NVL(p_caller,'!!!') LIKE 'FTE%' THEN --public api changes
2654 i:=i+1; x_disabled_list(i) := 'MASTER_CONTAINER_ITEM_ID';
2655 i:=i+1; x_disabled_list(i) := 'DETAIL_CONTAINER_ITEM_ID';
2656 ELSE
2657 i:=i+1; x_disabled_list(i) := 'MASTER_CONTAINER_ITEM_NAME';
2658 i:=i+1; x_disabled_list(i) := 'DETAIL_CONTAINER_ITEM_NAME';
2659 END IF;
2660 i:=i+1; x_disabled_list(i) := 'LOAD_SEQ_NUMBER';
2661
2662 /* H integration: 940 data protection wrudge */
2663 ELSIF (l_status_code IN ('SR', 'SC')) THEN
2664 i:=i+1; x_disabled_list(i) := 'FULL';
2665 i:=i+1; x_disabled_list(i) := 'TP_FLEXFIELD';
2666 i:=i+1; x_disabled_list(i) := 'DESC_FLEX';
2667 i:=i+1; x_disabled_list(i) := 'SHIPPING_INSTRUCTIONS';
2668 i:=i+1; x_disabled_list(i) := 'PACKING_INSTRUCTIONS';
2669 i:=i+1; x_disabled_list(i) := 'TRACKING_NUMBER';
2670 i:=i+1; x_disabled_list(i) := 'SEAL_CODE';
2671 ELSIF (l_status_code IN ('CO', 'IT', 'CL')) THEN
2672 i:=i+1; x_disabled_list(i) := 'FULL';
2673 i:=i+1; x_disabled_list(i) := 'TP_FLEXFIELD';
2674 i:=i+1; x_disabled_list(i) := 'DESC_FLEX';
2675 IF (l_status_code = 'IT') THEN
2676 i:=i+1; x_disabled_list(i) := 'DELIVERED_QUANTITY';
2677 -- LPN sync-up
2678 IF (nvl(l_container_flag, 'N') = 'N') THEN
2679 i:=i+1; x_disabled_list(i) := 'CANCELLED_QUANTITY';
2680 END IF;
2681
2682 -- OPM 09/11/00
2683 -- if process_org, then add the following to the list
2684 IF (l_qty_uom2 is NOT NULL) THEN
2685 -- LPN sync-up
2686 IF (nvl(l_container_flag, 'N') = 'N') THEN
2687 i:=i+1; x_disabled_list(i) := 'DELIVERED_QUANTITY2';
2688 i:=i+1; x_disabled_list(i) := 'CANCELLED_QUANTITY2';
2689 END IF;
2690 END IF;
2691
2692 ELSIF (l_status_code = 'CO') THEN
2693 i:=i+1; x_disabled_list(i) := 'DELIVERED_QUANTITY';
2694 -- LPN sync-up
2695 IF (nvl(l_container_flag, 'N') = 'N') THEN
2696 i:=i+1; x_disabled_list(i) := 'CANCELLED_QUANTITY';
2697 END IF;
2698 i:=i+1; x_disabled_list(i) := 'SHIPPING_INSTRUCTIONS';
2699 i:=i+1; x_disabled_list(i) := 'TRACKING_NUMBER';
2700 i:=i+1; x_disabled_list(i) := 'SEAL_CODE';
2701 IF (l_qty_uom2 is NOT NULL) THEN
2702 -- LPN sync-up
2703 IF (nvl(l_container_flag, 'N') = 'N') THEN
2704 i:=i+1; x_disabled_list(i) := 'DELIVERED_QUANTITY2';
2705 i:=i+1; x_disabled_list(i) := 'CANCELLED_QUANTITY2';
2706 END IF;
2707 END IF;
2708 -- OPM 09/11/00
2709 END IF;
2710 END IF; -- (l_status_code = 'PA')
2711
2712 END IF; -- assigned to delviery
2713
2714 -- bug 2263249 - added SHIPPED_QUANTITY, SHIPPED_QUANTITY2, CYCLE_COUNT_QUANTITY, and CYCLE_COUNT_QUANTITY2
2715 -- to disable_list when organization is wms enabled.
2716 IF ((i = 0) OR (i > 0 AND x_disabled_list(1) <> 'FULL') ) THEN
2717 --
2718 -- Debug Statements
2719 --
2720 IF l_debug_on THEN
2721 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.CHECK_WMS_ORG',WSH_DEBUG_SV.C_PROC_LEVEL);
2722 END IF;
2723 --
2724 IF (wsh_util_validate.Check_Wms_Org(l_organization_id)='Y') THEN
2725 -- Bug fix 2887330
2726 -- Disable shipped qty only if item is reservable, transactable and has source code = OM
2727 -- Or in otherwords, shipped qty should be enabled if item is
2728 -- non-reservable OR item is non-transactable OR has source code <> OM
2729
2730 IF l_pickable_flag = 'Y' AND
2731 l_reservable_flag = 'Y' AND
2732 l_source_code = 'OE'
2733 THEN
2734 i:=i+1; x_disabled_list(i) := 'SHIPPED_QUANTITY';
2735 END IF;
2736 i:=i+1; x_disabled_list(i) := 'SHIPPED_QUANTITY2';
2737 i:=i+1; x_disabled_list(i) := 'CYCLE_COUNT_QUANTITY';
2738 i:=i+1; x_disabled_list(i) := 'CYCLE_COUNT_QUANTITY2';
2739 -- LPN sync-up
2740 IF (nvl(l_container_flag, 'N') IN ('Y','C')) THEN
2741 i:=i+1; x_disabled_list(i) := 'CONTAINER_NAME';
2742 END IF;
2743
2744 END IF;
2745 -- J: W/V Changes
2746 IF l_container_flag = 'N' THEN
2747 i:=i+1; x_disabled_list(i) := 'FILLED_VOLUME';
2748 i:=i+1; x_disabled_list(i) := 'FILL_PERCENT';
2749 END IF;
2750
2751 END IF;
2752
2753 -- LPN sync-up
2754 IF ((i = 0) OR (i > 0 AND x_disabled_list(1) <> 'FULL') ) THEN
2755 i := x_disabled_list.COUNT;
2756 IF (nvl(l_container_flag, 'N') IN ('Y','C')) THEN
2757 i:=i+1; x_disabled_list(i) := 'PREFERED_GRADE';
2758 i:=i+1; x_disabled_list(i) := 'SRC_REQUESTED_QUANTITY2';
2759 i:=i+1; x_disabled_list(i) := 'SRC_REQUESTED_QUANTITY_UOM2';
2760 i:=i+1; x_disabled_list(i) := 'REQUESTED_QUANTITY2';
2761 i:=i+1; x_disabled_list(i) := 'SHIPPED_QUANTITY2';
2762 i:=i+1; x_disabled_list(i) := 'DELIVERED_QUANTITY2';
2763 i:=i+1; x_disabled_list(i) := 'CANCELLED_QUANTITY2';
2764 i:=i+1; x_disabled_list(i) := 'QUALITY_CONTROL_QUANTITY2';
2765 i:=i+1; x_disabled_list(i) := 'CYCLE_COUNT_QUANTITY2';
2766 i:=i+1; x_disabled_list(i) := 'REQUESTED_QUANTITY_UOM2';
2767 i:=i+1; x_disabled_list(i) := 'SUBLOT_NUMBER';
2768 i:=i+1; x_disabled_list(i) := 'RETURNED_QUANTITY2';
2769 i:=i+1; x_disabled_list(i) := 'RECEIVED_QUANTITY2';
2770 i:=i+1; x_disabled_list(i) := 'PICKED_QUANTITY2';
2771 i:=i+1; x_disabled_list(i) := 'TO_SERIAL_NUMBER';
2772 i:=i+1; x_disabled_list(i) := 'TRANSACTION_TEMP_ID';
2773 i:=i+1; x_disabled_list(i) := 'SHIPPED_QUANTITY';
2774 i:=i+1; x_disabled_list(i) := 'CANCELLED_QUANTITY';
2775 i:=i+1; x_disabled_list(i) := 'CYCLE_COUNT_QUANTITY';
2776 i:=i+1; x_disabled_list(i) := 'REQUESTED_QUANTITY_UOM';
2777 i:=i+1; x_disabled_list(i) := 'REVISION';
2778 i:=i+1; x_disabled_list(i) := 'LOT_NUMBER';
2779 i:=i+1; x_disabled_list(i) := 'SUBINVENTORY';
2780 i:=i+1; x_disabled_list(i) := 'SERIAL_NUMBER';
2781
2782 IF nvl(p_caller, '!!!') LIKE 'FTE%' THEN
2783 i:=i+1; x_disabled_list(i) := 'LOCATOR_ID';
2784 ELSE
2785 i:=i+1; x_disabled_list(i) := 'LOCATOR_NAME';
2786 END IF;
2787 END IF;
2788
2789 END IF;
2790 -- end bug 2263249
2791
2792 -- J-IB-NPARIKH-{
2793 -- public api changes
2794 --
2795 -- Update on inbound/drop-ship lines are allowed only if caller
2796 -- starts with one of the following:
2797 -- - FTE
2798 -- - WSH_IB
2799 -- - WSH_PUB
2800 -- - WSH_TP_RELEASE
2801 --
2802 IF NVL(l_line_direction,'O') NOT IN ('O','IO')
2803 AND NVL(p_caller, '!!!') NOT LIKE 'FTE%'
2804 AND NVL(p_caller, '!!!') NOT LIKE 'WSH_PUB%'
2805 AND NVL(p_caller, '!!!') NOT LIKE 'WSH_IB%'
2806 AND NVL(p_caller, '!!!') NOT LIKE 'WSH_TP_RELEASE%'
2807 THEN
2808 RAISE e_all_disabled;
2809 END IF;
2810 --
2811 -- J-IB-NPARIKH-}
2812
2813 IF l_debug_on THEN
2814 WSH_DEBUG_SV.log(l_module_name,'count of x_disabled_list', x_disabled_list.COUNT);
2815 END IF;
2816 -- public api changes
2817 IF (x_disabled_list.COUNT = 0) or (x_disabled_list(1) <> 'FULL') THEN
2818 i := x_disabled_list.COUNT;
2819
2820 IF (l_released_status = 'Y') THEN
2821
2822 IF (WSH_DELIVERY_DETAILS_INV.get_reservable_flag(x_item_id => l_item_id,
2823 x_organization_id => l_organization_id,
2824 x_pickable_flag => l_pickable_flag) = 'Y')
2825 THEN
2826
2827 i:=i+1; x_disabled_list(i) := 'SUBINVENTORY';
2828 i:=i+1; x_disabled_list(i) := 'REVISION';
2829 IF NVL(p_caller,'!!!') LIKE 'FTE%' THEN --public api changes
2830 i:=i+1; x_disabled_list(i) := 'LOCATOR_ID';
2831 ELSE
2832 i:=i+1; x_disabled_list(i) := 'LOCATOR_NAME';
2833 END IF;
2834 i:=i+1; x_disabled_list(i) := 'LOT_NUMBER';
2835
2836 ELSE
2837 -- Added for bug 4399278, 4418754
2838 -- Copy Subinventory passed from public API
2839 IF ( G_SUBINVENTORY is not null ) THEN
2840 l_subinventory := G_SUBINVENTORY;
2841 G_SUBINVENTORY := NULL;
2842 END IF;
2843
2844
2845 WSH_DELIVERY_DETAILS_INV.Fetch_Inv_Controls(p_delivery_detail_id => p_delivery_detail_id,
2846 p_inventory_item_id => l_item_id,
2847 p_organization_id => l_organization_id,
2848 p_subinventory => l_subinventory,
2849 x_inv_controls_rec => l_inv_controls,
2850 x_return_status => x_return_status);
2851
2852 IF l_inv_controls.rev_flag = 'N' THEN
2853
2854 i:=i+1; x_disabled_list(i) := 'REVISION';
2855
2856 END IF;
2857 IF l_inv_controls.loc_flag = 'N' THEN
2858
2859 IF NVL(p_caller,'!!!') LIKE 'FTE%' THEN --public api changes
2860 i:=i+1; x_disabled_list(i) := 'LOCATOR_ID';
2861 ELSE
2862 i:=i+1; x_disabled_list(i) := 'LOCATOR_NAME';
2863 END IF;
2864
2865
2866 END IF;
2867 IF l_inv_controls.lot_flag = 'N' THEN
2868
2869 i:=i+1; x_disabled_list(i) := 'LOT_NUMBER';
2870
2871 END IF;
2872
2873 END IF;
2874
2875 END IF; -- if l_released_status...
2876
2877 END IF;
2878
2879 --
2880 -- Debug Statements
2881 --
2882 IF l_debug_on THEN
2883 WSH_DEBUG_SV.pop(l_module_name);
2884 END IF;
2885 --
2886 EXCEPTION
2887 WHEN e_all_disabled THEN --public api changes
2888 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2889 FND_MESSAGE.SET_NAME('WSH','WSH_ALL_COLS_DISABLED');
2890 FND_MESSAGE.Set_Token('ENTITY_ID',p_delivery_detail_id);
2891 wsh_util_core.add_message(x_return_status,l_module_name);
2892 IF l_debug_on THEN
2893 -- Nothing is updateable
2894 WSH_DEBUG_SV.pop(l_module_name,'e_all_disabled');
2895 END IF;
2896
2897 WHEN wsh_dp_no_entity THEN
2898 x_return_status := FND_API.G_RET_STS_ERROR;
2899 -- Bug fix 2650464
2900 -- new message for invalid delivery details
2901 FND_MESSAGE.SET_NAME('WSH', 'WSH_DETAIL_NOT_EXIST');
2902 IF p_delivery_detail_id = FND_API.G_MISS_NUM THEN
2903 l_delivery_detail_id := NULL;
2904 ELSE
2905 l_delivery_detail_id := p_delivery_detail_id;
2906 END IF;
2907 FND_MESSAGE.SET_TOKEN('DETAIL_ID', l_delivery_detail_id);
2908 WSH_UTIL_CORE.ADD_MESSAGE(x_return_status);
2909 WSH_UTIL_CORE.get_messages('Y', l_msg_summary, l_msg_details, x_msg_count);
2910 IF x_msg_count > 1 then
2911 x_msg_data := l_msg_summary || l_msg_details;
2912 ELSE
2913 x_msg_data := l_msg_summary;
2914 END IF;
2915
2916 --
2917 -- Debug Statements
2918 --
2919 IF l_debug_on THEN
2920 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_DP_NO_ENTITY exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
2921 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_DP_NO_ENTITY');
2922 END IF;
2923 --
2924 WHEN wsh_del_not_exist THEN -- Bug fix 2650464
2925 x_return_status := FND_API.G_RET_STS_ERROR;
2926 FND_MESSAGE.SET_NAME('WSH', 'WSH_DELIVERY_NOT_EXIST');
2927 IF p_delivery_id = FND_API.G_MISS_NUM THEN
2928 l_delivery_id := NULL;
2929 ELSE
2930 l_delivery_id := p_delivery_id;
2931 END IF;
2932 FND_MESSAGE.SET_TOKEN('DELIVERY_NAME', l_delivery_id);
2933 WSH_UTIL_CORE.ADD_MESSAGE(x_return_status);
2934 WSH_UTIL_CORE.get_messages('Y', l_msg_summary, l_msg_details, x_msg_count);
2935 IF x_msg_count > 1 then
2936 x_msg_data := l_msg_summary || l_msg_details;
2937 ELSE
2938 x_msg_data := l_msg_summary;
2939 END IF;
2940 --
2941 IF l_debug_on THEN
2942 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_DEL_NOT_EXIST exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
2943 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_DP_NO_ENTITY');
2944 END IF;
2945
2946 WHEN wsh_inv_list_type THEN
2947 x_return_status := FND_API.G_RET_STS_ERROR;
2948 FND_MESSAGE.SET_NAME('WSH', 'WSH_INV_LIST_TYPE');
2949 WSH_UTIL_CORE.ADD_MESSAGE(x_return_status);
2950 WSH_UTIL_CORE.get_messages('Y', l_msg_summary, l_msg_details, x_msg_count);
2951 IF x_msg_count > 1 then
2952 x_msg_data := l_msg_summary || l_msg_details;
2953 ELSE
2954 x_msg_data := l_msg_summary;
2955 END IF;
2956
2957 --
2958 -- Debug Statements
2959 --
2960 IF l_debug_on THEN
2961 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_INV_LIST_TYPE exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
2962 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_INV_LIST_TYPE');
2963 END IF;
2964 --
2965 WHEN others THEN
2966 IF (get_delivery_status%ISOPEN) THEN
2967 CLOSE get_delivery_status;
2968 END IF;
2969 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.get_disabled_list');
2970 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
2971
2972
2973 --
2974 -- Debug Statements
2975 --
2976 IF l_debug_on THEN
2977 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
2978 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
2979 END IF;
2980 --
2981 END Get_Disabled_list;
2982
2983
2984 --
2985 -- PROCEDURE - Get_Min_Max_Tolerance_Quantity
2986 -- Bug 2181132
2987 --
2988 -- Description - This API is created to take owner ship of Tolerance from OM
2989 -- Parameters are
2990 -- p_in_attributes - In record of type MinMaxInRecType
2991 -- action_flag values:
2992 -- 'P' - Pick confirm (always populate ship_tolerance_above etc.)
2993 -- 'S' - Ship confirm (always populate ship_tolerance_above etc.)
2994 -- 'C' - CTO / call from WSH_INTEGRATION API
2995 -- 'I' - call from OM Interface (check_tolerance)
2996 -- x_out_attributes - Out record of type MinMaxOutRecType
2997 -- p_inout_attributes - In Out record of type MinMaxInOutRecType
2998 -- x_return_status - return status
2999 -- x_msg_count - Message Count
3000 -- x_msg_data - Message Data
3001 --
3002
3003 PROCEDURE Get_Min_Max_Tolerance_Quantity
3004 ( p_in_attributes IN MinMaxInRecType,
3005 x_out_attributes OUT NOCOPY MinMaxOutRecType,
3006 p_inout_attributes IN OUT NOCOPY MinMaxInOutRecType,
3007 x_return_status OUT NOCOPY VARCHAR2,
3008 x_msg_count OUT NOCOPY NUMBER,
3009 x_msg_data OUT NOCOPY VARCHAR2
3010 )
3011 IS
3012 l_quantity_uom VARCHAR2(3);
3013 l_min_remaining_quantity NUMBER;
3014 l_max_remaining_quantity NUMBER;
3015 l_quantity2_uom VARCHAR2(3);
3016 l_min_remaining_quantity2 NUMBER;
3017 l_max_remaining_quantity2 NUMBER;
3018 l_shipped_quantity NUMBER;
3019 l_shipped_quantity2 NUMBER;
3020
3021 -- cannot combine Cursor 1 and 2 because of <> line_id clause
3022 -- Get the sum within line set id
3023 -- HW added requested_quantity2
3024 CURSOR c_sum_ordered_qty(x_header_id IN NUMBER, x_line_set_id IN NUMBER) IS
3025 SELECT SUM(requested_quantity),
3026 SUM(NVL(requested_quantity2,0))
3027 FROM wsh_delivery_details
3028 WHERE source_line_set_id = x_line_set_id
3029 AND source_code = p_in_attributes.source_code
3030 AND container_flag = 'N'
3031 AND released_status <> 'D'
3032 AND source_header_id = x_header_id;
3033
3034 -- Get the sum within line set id for staged and shipped lines
3035 -- but with different source_line_id
3036 -- same for shipped or picked lines
3037 -- HW added qty2
3038 CURSOR c_sum_picked_qty(x_header_id IN NUMBER, x_line_set_id IN NUMBER) IS
3039 SELECT nvl(SUM(GREATEST(nvl(shipped_quantity,0),
3040 nvl(picked_quantity,requested_quantity))),0),
3041 nvl(SUM(GREATEST(nvl(shipped_quantity2,0),
3042 nvl(picked_quantity2,requested_quantity2))),0)
3043 FROM wsh_delivery_details
3044 WHERE source_line_set_id = x_line_set_id
3045 AND released_status <> 'D'
3046 AND source_line_id <> p_in_attributes.line_id
3047 AND source_code = p_in_attributes.source_code
3048 AND container_flag = 'N'
3049 AND source_header_id = x_header_id;
3050
3051 -- bug 4319050: CTO can call before the line actually gets interfaced.
3052 -- get the total quantity that has left the warehouse.
3053 -- oe_interfaced_flag is not checked because we are looking
3054 -- at the single line; if it were interfaced at this time,
3055 -- the line would not be split (since line_set_id has to be NULL
3056 -- to use this cursor) and therefore the source line is fulfilled.
3057 CURSOR c_sum_line_shp_qty IS
3058 SELECT NVL(SUM(shipped_quantity), 0),
3059 NVL(SUM(shipped_quantity2), 0) --Bug#9437761
3060 FROM wsh_delivery_details
3061 WHERE source_line_id = p_in_attributes.line_id
3062 AND released_status = 'C'
3063 AND source_code = p_in_attributes.source_code
3064 AND container_flag = 'N';
3065
3066
3067 -- this is a line set version of c_sum_line_shp_qty
3068 -- sum the current line's shipped quantities
3069 -- and those of only the interfaced lines in the set.
3070 CURSOR c_sum_line_set_shp_qty(x_header_id IN NUMBER,
3071 x_line_set_id IN NUMBER) IS
3072 SELECT NVL(SUM(shipped_quantity), 0),
3073 NVL(SUM(shipped_quantity2), 0) --Bug#9437761
3074 FROM wsh_delivery_details
3075 WHERE source_code = p_in_attributes.source_code
3076 AND released_status = 'C'
3077 AND (
3078 source_line_id = p_in_attributes.line_id
3079 OR oe_interfaced_flag = 'Y'
3080 )
3081 AND container_flag = 'N'
3082 AND source_header_id = x_header_id
3083 AND source_line_set_id = x_line_set_id;
3084
3085
3086 -- bug 5196082: ITS needs to recognize the full quantity shipped
3087 -- regardless of oe_interfaced_flag value.
3088 -- this cursor is copied from c_sum_line_set_shp_qty
3089 -- and modified to total all shipped details in the line set.
3090 CURSOR c_sum_line_set_shp_qty_ITS(x_header_id IN NUMBER,
3091 x_line_set_id IN NUMBER) IS
3092 SELECT NVL(SUM(shipped_quantity), 0),
3093 NVL(SUM(shipped_quantity2), 0) --Bug#9437761
3094 FROM wsh_delivery_details
3095 WHERE source_code = p_in_attributes.source_code
3096 AND released_status = 'C'
3097 AND container_flag = 'N'
3098 AND source_header_id = x_header_id
3099 AND source_line_set_id = x_line_set_id;
3100
3101
3102 -- get delivery details information for CTO which will pass
3103 -- source_line_id and source_code
3104 CURSOR c_get_details_CTO IS
3105 SELECT ship_tolerance_below,
3106 ship_tolerance_above,
3107 source_line_set_id,
3108 source_header_id,
3109 src_requested_quantity_uom,
3110 inventory_item_id,
3111 requested_quantity_uom
3112 FROM wsh_delivery_details
3113 WHERE source_line_id = p_in_attributes.line_id
3114 AND container_flag = 'N'
3115 AND released_status <> 'D'
3116 AND source_code = p_in_attributes.source_code
3117 AND rownum = 1;
3118
3119 -- Get the total ordered quantity, when the line set id is NULL
3120
3121 -- HW added requested_quantity2
3122
3123 CURSOR c_sum_ordered_qty1(x_header_id number) IS
3124 SELECT SUM(requested_quantity),
3125 SUM(NVL(requested_quantity2,0))
3126 FROM wsh_delivery_details
3127 WHERE source_line_id =p_in_attributes.line_id
3128 AND source_code = p_in_attributes.source_code
3129 AND container_flag = 'N'
3130 AND released_status <> 'D'
3131 AND source_header_id = x_header_id;
3132
3133 -- Lock the Delivery Details within a line set
3134 CURSOR c_lock_delivery_det(x_header_id IN NUMBER,
3135 x_line_set_id IN NUMBER) IS
3136 SELECT delivery_detail_id
3137 FROM wsh_delivery_details
3138 WHERE source_line_set_id = x_line_set_id
3139 AND source_code = p_in_attributes.source_code
3140 AND source_header_id = x_header_id
3141 FOR UPDATE;
3142
3143 -- Lock the Delivery Details within a source line id
3144 CURSOR c_lock_delivery_det1 IS
3145 SELECT delivery_detail_id
3146 FROM wsh_delivery_details
3147 WHERE source_line_id = p_in_attributes.line_id
3148 FOR UPDATE;
3149
3150 l_ship_tolerance_above NUMBER;
3151 l_ship_tolerance_below NUMBER;
3152 l_source_line_set_id NUMBER;
3153 l_source_header_id NUMBER;
3154 l_req_quantity_uom VARCHAR2(3);
3155 l_req_quantity_uom2 VARCHAR2(3);
3156 l_shipping_quantity_uom VARCHAR2(3);
3157 l_del_shipping_quantity NUMBER;
3158 -- HW added l_del_shipping_quantity2
3159 l_del_shipping_quantity2 NUMBER;
3160 l_OPM_shipped_quantity NUMBER(19,9);
3161 l_OPM_shipping_quantity_uom VARCHAR2(4);
3162 l_OPM_order_quantity_uom VARCHAR2(4);
3163 l_inventory_item_id NUMBER;
3164 l_delivery_detail_id NUMBER;
3165 l_total_ordered_quantity NUMBER;
3166 l_total_ordered_quantity2 NUMBER;
3167 l_tolerance_quantity_below NUMBER;
3168 l_tolerance_quantity_above NUMBER;
3169 l_tolerance_quantity_below2 NUMBER;
3170 l_tolerance_quantity_above2 NUMBER;
3171 -- csun max_tol chnage
3172 l_ordered_quantity_uom wsh_delivery_details.SRC_REQUESTED_QUANTITY_UOM%TYPE;
3173 l_requested_quantity_uom wsh_delivery_details.REQUESTED_QUANTITY_UOM%TYPE;
3174 l_requested_quantity_uom2 wsh_delivery_details.REQUESTED_QUANTITY_UOM2%TYPE;
3175 --
3176 l_debug_on BOOLEAN;
3177 --
3178 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'GET_MIN_MAX_TOLERANCE_QUANTITY';
3179 --
3180 BEGIN
3181 -- Bug 2181132
3182 --
3183 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
3184 --
3185 IF l_debug_on IS NULL
3186 THEN
3187 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
3188 END IF;
3189 --
3190 x_return_status := FND_API.G_RET_STS_SUCCESS;
3191
3192 l_del_shipping_quantity := 0;
3193 l_del_shipping_quantity2 := 0;
3194
3195 IF l_debug_on THEN
3196 WSH_DEBUG_SV.push(l_module_name);
3197 WSH_DEBUG_SV.log(l_module_name,'api_version_number',p_in_attributes.api_version_number);
3198 WSH_DEBUG_SV.log(l_module_name,'source_code',p_in_attributes.source_code);
3199 WSH_DEBUG_SV.log(l_module_name,'line_id',p_in_attributes.line_id);
3200 WSH_DEBUG_SV.log(l_module_name,'dummy_quantity',p_inout_attributes.dummy_quantity);
3201 WSH_DEBUG_SV.logmsg(l_module_name, 'Action flag-'||p_in_attributes.action_flag);
3202 WSH_DEBUG_SV.logmsg(l_module_name, 'SHP TOL ABOVE-'||p_in_attributes.ship_tolerance_above);
3203 END IF;
3204
3205 IF ( p_in_attributes.source_code IS NULL ) THEN
3206 x_msg_count := 1;
3207 x_msg_data := 'INVALID SOURCE_CODE';
3208 x_return_status := FND_API.G_RET_STS_ERROR;
3209 END IF;
3210
3211 IF p_in_attributes.ship_tolerance_above IS NULL OR
3212 p_in_attributes.action_flag IN ('C', 'I') THEN
3213
3214 IF l_debug_on THEN
3215 WSH_DEBUG_SV.logmsg(l_module_name, 'Looking up details');
3216 END IF;
3217
3218 -- fetch the values for CTO and OM Interface
3219 OPEN c_get_details_CTO;
3220 FETCH c_get_details_CTO
3221 INTO l_ship_tolerance_below,
3222 l_ship_tolerance_above,
3223 l_source_line_set_id,
3224 l_source_header_id,
3225 l_ordered_quantity_uom,
3226 l_inventory_item_id,
3227 l_requested_quantity_uom;
3228 CLOSE c_get_details_CTO;
3229 ELSE
3230 -- these values will be passed from Pick Confirm and Ship Confirm
3231 -- because this is delivery line information and should be
3232 -- available without extra SELECT
3233 l_ship_tolerance_below := p_in_attributes.ship_tolerance_below;
3234 l_ship_tolerance_above := p_in_attributes.ship_tolerance_above;
3235 l_source_line_set_id := p_in_attributes.source_line_set_id;
3236 l_source_header_id := p_in_attributes.source_header_id;
3237 l_requested_quantity_uom := p_in_attributes.quantity_uom;
3238 l_requested_quantity_uom2 := p_in_attributes.quantity_uom2;
3239
3240 END IF;
3241
3242 IF l_debug_on THEN
3243 WSH_DEBUG_SV.log(l_module_name, 'l_source_header_id', l_source_header_id);
3244 WSH_DEBUG_SV.log(l_module_name, 'l_source_line_set_id', l_source_line_set_id);
3245 WSH_DEBUG_SV.log(l_module_name, 'SHP TOL ABOVE',l_ship_tolerance_above);
3246 WSH_DEBUG_SV.log(l_module_name, 'SHP TOL BELOW',l_ship_tolerance_below);
3247 END IF;
3248
3249
3250 -- bug 3511424
3251 -- Locking the delivery lines within a line set or source line id
3252 -- if not done already by calling API
3253 IF (p_in_attributes.lock_flag = 'Y') THEN
3254 IF (l_source_line_set_id IS NOT NULL) THEN
3255
3256 FOR rec in c_lock_delivery_det(l_source_header_id, l_source_line_set_id)
3257 LOOP
3258 l_delivery_detail_id := rec.delivery_detail_id;
3259 END LOOP;
3260 ELSIF (p_in_attributes.line_id IS NOT NULL) THEN
3261 FOR rec in c_lock_delivery_det1
3262 LOOP
3263 l_delivery_detail_id := rec.delivery_detail_id;
3264 END LOOP;
3265 END IF;
3266 END IF;
3267
3268 --Line set Id is not null
3269 IF l_source_line_set_id IS NOT NULL THEN
3270 OPEN c_sum_ordered_qty(l_source_header_id, l_source_line_set_id);
3271 FETCH c_sum_ordered_qty
3272 INTO l_total_ordered_quantity,
3273 l_total_ordered_quantity2;
3274 CLOSE c_sum_ordered_qty;
3275
3276 IF l_debug_on THEN
3277 WSH_DEBUG_SV.logmsg(l_module_name, 'Ordered_qty-'||l_total_ordered_quantity);
3278 WSH_DEBUG_SV.logmsg(l_module_name, 'Ordered_qty2-'||l_total_ordered_quantity2);
3279 END IF;
3280
3281 IF p_in_attributes.ship_tolerance_above IS NOT NULL THEN -- Pick Confirm
3282 x_out_attributes.min_remaining_quantity := 0;
3283
3284 OPEN c_sum_picked_qty(l_source_header_id, l_source_line_set_id);
3285 FETCH c_sum_picked_qty
3286 INTO l_del_shipping_quantity,
3287 l_del_shipping_quantity2;
3288 CLOSE c_sum_picked_qty;
3289
3290 IF l_debug_on THEN
3291 WSH_DEBUG_SV.logmsg(l_module_name, 'l_del_shipping_qty-'||l_del_shipping_quantity);
3292 WSH_DEBUG_SV.logmsg(l_module_name, 'l_del_shipping_qty2-'||l_del_shipping_quantity2);
3293 END IF;
3294
3295 END IF;
3296
3297 ELSE --if source line set id is not null
3298 -- HW added l_total_ordered_quantity2
3299 OPEN c_sum_ordered_qty1(l_source_header_id);
3300 FETCH c_sum_ordered_qty1
3301 INTO l_total_ordered_quantity,
3302 l_total_ordered_quantity2;
3303 CLOSE c_sum_ordered_qty1;
3304
3305 END IF; --source_line set id is not null
3306
3307 IF p_in_attributes.action_flag IN ('C', 'I') THEN
3308 -- CTO/Integration API
3309 IF l_source_line_set_id IS NOT NULL THEN
3310 IF p_in_attributes.action_flag = 'I' THEN
3311 OPEN c_sum_line_set_shp_qty_ITS(l_source_header_id,
3312 l_source_line_set_id);
3313 FETCH c_sum_line_set_shp_qty_ITS
3314 INTO l_del_shipping_quantity,
3315 l_del_shipping_quantity2; --Bug#9437761
3316 CLOSE c_sum_line_set_shp_qty_ITS;
3317 ELSE
3318 OPEN c_sum_line_set_shp_qty(l_source_header_id,
3319 l_source_line_set_id);
3320 FETCH c_sum_line_set_shp_qty
3321 INTO l_del_shipping_quantity,
3322 l_del_shipping_quantity2; --Bug#9437761
3323 CLOSE c_sum_line_set_shp_qty;
3324 END IF;
3325 ELSE
3326 OPEN c_sum_line_shp_qty;
3327 FETCH c_sum_line_shp_qty
3328 INTO l_del_shipping_quantity,
3329 l_del_shipping_quantity2; --Bug#9437761
3330 CLOSE c_sum_line_shp_qty;
3331 END IF;
3332
3333 IF l_debug_on THEN
3334 WSH_DEBUG_SV.log(l_module_name, 'CTO/Interface: l_del_shipping_quantity',
3335 l_del_shipping_quantity);
3336 END IF;
3337
3338 END IF;
3339
3340
3341 l_shipped_quantity := l_del_shipping_quantity;
3342 l_shipped_quantity2 := l_del_shipping_quantity2;
3343
3344 l_tolerance_quantity_below := l_total_ordered_quantity*nvl(l_ship_tolerance_below,0)/100;
3345 l_tolerance_quantity_above := l_total_ordered_quantity*nvl(l_ship_tolerance_above,0)/100;
3346
3347 l_tolerance_quantity_below2 := l_total_ordered_quantity2*nvl(l_ship_tolerance_below,0)/100;
3348 l_tolerance_quantity_above2 := l_total_ordered_quantity2*nvl(l_ship_tolerance_above,0)/100;
3349
3350
3351 l_min_remaining_quantity := GREATEST(l_total_ordered_quantity - l_shipped_quantity -
3352 l_tolerance_quantity_below,0);
3353
3354 l_max_remaining_quantity := (l_total_ordered_quantity - l_shipped_quantity +
3355 l_tolerance_quantity_above);
3356 IF (p_in_attributes.action_flag <> 'I') THEN
3357 l_max_remaining_quantity := GREATEST(l_max_remaining_quantity, 0);
3358 END IF;
3359
3360
3361 -- HW OPMCONV - Let's treat qty2 similar to qty1
3362 l_min_remaining_quantity2 := GREATEST(l_total_ordered_quantity2 - l_shipped_quantity2 -
3363 l_tolerance_quantity_below2,0);
3364 l_max_remaining_quantity2 := GREATEST(l_total_ordered_quantity2 - l_shipped_quantity2 +
3365 l_tolerance_quantity_above2,0);
3366
3367 -- HW OPMCONV - No need to branch
3368 -- bug 3511424
3369
3370 --{
3371 --
3372 IF l_debug_on THEN
3373 WSH_DEBUG_SV.log(l_module_name, 'l_max_remaining_quantity before the modification',l_max_remaining_quantity);
3374 WSH_DEBUG_SV.log(l_module_name, 'l_min_remaining_quantity before the modification',l_min_remaining_quantity);
3375 END IF;
3376 --
3377 l_max_remaining_quantity := trunc(l_max_remaining_quantity, wsh_util_core.c_max_decimal_digits_inv);
3378 IF (round(l_min_remaining_quantity,wsh_util_core.c_max_decimal_digits_inv) < l_min_remaining_quantity) THEN
3379 --{
3380 l_min_remaining_quantity := round(l_min_remaining_quantity + 0.000005, wsh_util_core.c_max_decimal_digits_inv);
3381 --}
3382 ELSE
3383 --{
3384 l_min_remaining_quantity := round(l_min_remaining_quantity, wsh_util_core.c_max_decimal_digits_inv);
3385 --}
3386 END IF;
3387 --
3388 IF l_debug_on THEN
3389 WSH_DEBUG_SV.log(l_module_name, 'l_max_remaining_quantity after the modification',l_max_remaining_quantity);
3390 WSH_DEBUG_SV.log(l_module_name, 'l_min_remaining_quantity after the modification',l_min_remaining_quantity);
3391 END IF;
3392 --
3393 --}
3394
3395 -- bug 3511424
3396 -- HW Get min and max qty2 for OPM
3397
3398 --In WSH, there can be multiple lines with same source_line_id, so
3399 --OPM needs to look and calculate secondary quantities accordingly
3400 -- HW OPM.
3401
3402 -- HW OPMCONV - Let's treat Qtys similar to Qty1
3403
3404 IF l_debug_on THEN
3405 WSH_DEBUG_SV.log(l_module_name, 'l_max_remaining_quantity2 before the modification',l_max_remaining_quantity2);
3406 WSH_DEBUG_SV.log(l_module_name, 'l_min_remaining_quantity2 before the modification',l_min_remaining_quantity2);
3407 END IF;
3408 --
3409 l_max_remaining_quantity2 := trunc(l_max_remaining_quantity2, wsh_util_core.c_max_decimal_digits_inv);
3410 IF (round(l_min_remaining_quantity2,wsh_util_core.c_max_decimal_digits_inv) < l_min_remaining_quantity2) THEN
3411 --{
3412 l_min_remaining_quantity2 := round(l_min_remaining_quantity2 + 0.000005, wsh_util_core.c_max_decimal_digits_inv);
3413 --}
3414 ELSE
3415 --{
3416 l_min_remaining_quantity2 := round(l_min_remaining_quantity2, wsh_util_core.c_max_decimal_digits_inv);
3417 --}
3418 END IF;
3419 --
3420 IF l_debug_on THEN
3421 WSH_DEBUG_SV.log(l_module_name, 'l_max_remaining_quantity2 after the modification',l_max_remaining_quantity2);
3422 WSH_DEBUG_SV.log(l_module_name, 'l_min_remaining_quantity2 after the modification',l_min_remaining_quantity2);
3423 END IF;
3424
3425
3426
3427
3428 x_out_attributes.min_remaining_quantity := l_min_remaining_quantity;
3429 x_out_attributes.max_remaining_quantity := l_max_remaining_quantity;
3430
3431
3432 -- HW added qty2 for OPM
3433 x_out_attributes.min_remaining_quantity2 := l_min_remaining_quantity2;
3434 x_out_attributes.max_remaining_quantity2 := l_max_remaining_quantity2;
3435 -- ADD RETURN VALUES FOR UOM and UOM2
3436 x_out_attributes.quantity_uom := l_requested_quantity_uom;
3437 x_out_attributes.quantity2_uom := l_requested_quantity_uom2;
3438
3439 -- csun max_tol, convert shipping quantity to order quantity for CTO
3440 IF p_in_attributes.action_flag = 'C' THEN
3441 -- convert to order line UOM
3442 IF l_ordered_quantity_uom <> l_requested_quantity_uom THEN
3443
3444 IF l_min_remaining_quantity > 0 THEN
3445 x_out_attributes.min_remaining_quantity := WSH_WV_UTILS.convert_uom(
3446 from_uom => l_requested_quantity_uom,
3447 to_uom => l_ordered_quantity_uom,
3448 quantity => l_min_remaining_quantity,
3449 item_id => l_inventory_item_id);
3450 END IF;
3451 IF l_max_remaining_quantity > 0 THEN
3452 x_out_attributes.max_remaining_quantity := WSH_WV_UTILS.convert_uom(
3453 from_uom => l_requested_quantity_uom,
3454 to_uom => l_ordered_quantity_uom,
3455 quantity => l_max_remaining_quantity,
3456 item_id => l_inventory_item_id);
3457 END IF;
3458 x_out_attributes.quantity_uom := l_ordered_quantity_uom;
3459
3460 END IF;
3461
3462 END IF;
3463
3464
3465 IF l_debug_on THEN
3466 WSH_DEBUG_SV.log(l_module_name,'x_out_attributes.quantity_uom', x_out_attributes.quantity_uom);
3467 WSH_DEBUG_SV.log(l_module_name,'x_out_attributes.min_remaining_quantity',x_out_attributes.min_remaining_quantity);
3468 WSH_DEBUG_SV.log(l_module_name,'x_out_attributes.max_remaining_quantity',x_out_attributes.max_remaining_quantity);
3469 WSH_DEBUG_SV.log(l_module_name,'x_out_attributes.quantity2_uom', x_out_attributes.quantity2_uom);
3470 WSH_DEBUG_SV.log(l_module_name,'x_out_attributes.min_remaining_quantity2',x_out_attributes.min_remaining_quantity2);
3471 WSH_DEBUG_SV.log(l_module_name,'x_out_attributes.max_remaining_quantity2',x_out_attributes.max_remaining_quantity2);
3472 WSH_DEBUG_SV.pop(l_module_name);
3473 END IF;
3474
3475 EXCEPTION
3476 WHEN OTHERS THEN
3477 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
3478 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.get_min_max_tolerance_quantity',
3479 l_module_name);
3480
3481 x_out_attributes.min_remaining_quantity := 0;
3482 x_out_attributes.max_remaining_quantity := 0;
3483 x_out_attributes.min_remaining_quantity2 := 0;
3484 x_out_attributes.max_remaining_quantity2 := 0;
3485 x_out_attributes.quantity_uom := NULL;
3486 x_out_attributes.quantity2_uom := NULL;
3487
3488 IF c_sum_ordered_qty1%ISOPEN THEN
3489 CLOSE c_sum_ordered_qty1;
3490 END IF;
3491 IF c_sum_line_shp_qty%ISOPEN THEN
3492 CLOSE c_sum_line_shp_qty;
3493 END IF;
3494 IF c_sum_line_set_shp_qty%ISOPEN THEN
3495 CLOSE c_sum_line_set_shp_qty;
3496 END IF;
3497 IF c_sum_line_set_shp_qty_ITS%ISOPEN THEN
3498 CLOSE c_sum_line_set_shp_qty_ITS;
3499 END IF;
3500 IF c_sum_picked_qty%ISOPEN THEN
3501 CLOSE c_sum_picked_qty;
3502 END IF;
3503 IF c_sum_ordered_qty%ISOPEN THEN
3504 CLOSE c_sum_ordered_qty;
3505 END IF;
3506 IF c_get_details_CTO%ISOPEN THEN
3507 CLOSE c_get_details_CTO;
3508 END IF;
3509
3510 IF l_debug_on THEN
3511 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured.Oracle error Message is '||SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
3512 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
3513 END IF;
3514
3515 END Get_Min_Max_Tolerance_Quantity;
3516
3517
3518 --Harmonization Project I
3519 PROCEDURE Is_Action_Enabled(
3520 p_del_detail_rec_tab IN detail_rec_tab_type,
3521 p_action IN VARCHAR2,
3522 p_caller IN VARCHAR2,
3523 p_deliveryid IN NUMBER DEFAULT null,
3524 x_return_status OUT NOCOPY VARCHAR2,
3525 x_valid_ids OUT NOCOPY wsh_util_core.id_tab_type,
3526 x_error_ids OUT NOCOPY wsh_util_core.id_tab_type,
3527 x_valid_index_tab OUT NOCOPY wsh_util_core.id_tab_type
3528 ) IS
3529
3530 cursor det_to_del_cur( p_del_det_id IN NUMBER ) is
3531 select wnd.organization_id,
3532 wnd.status_code,
3533 wnd.planned_flag,
3534 wnd.delivery_id,
3535 nvl(wnd.shipment_direction, 'O'), -- J inbound logistics jckwok
3536 nvl(wnd.ignore_for_planning, 'N'), -- OTM R12 : WSHDEVLS record
3537 nvl(wnd.tms_interface_flag, WSH_NEW_DELIVERIES_PVT.C_TMS_NOT_TO_BE_SENT) -- OTM R12 : WSHDEVLS record
3538 from wsh_new_deliveries wnd,
3539 wsh_delivery_assignments_v wda
3540 where wnd.delivery_id = wda.delivery_id
3541 and wda.delivery_detail_id = p_del_det_id;
3542
3543 -- frontport bug 5478065 of 11i10 performance bug 5439331:
3544 -- this cursor is tuned to check for existence.
3545 CURSOR c_staged_content( p_container_id IN NUMBER) IS
3546 SELECT 1 FROM DUAL
3547 WHERE EXISTS
3548 ( SELECT wdd.delivery_detail_id
3549 FROM wsh_delivery_details wdd
3550 WHERE wdd.delivery_detail_id IN
3551 (SELECT wda.delivery_detail_id
3552 FROM wsh_delivery_assignments_v wda
3553 START WITH parent_delivery_detail_id = p_container_id
3554 CONNECT BY prior delivery_detail_id = parent_delivery_detail_id)
3555 AND wdd.container_flag = 'N'
3556 AND wdd.released_status = 'Y' );
3557
3558 CURSOR c_isdelfirm(p_deliveryid IN NUMBER) IS
3559 SELECT 'Y'
3560 FROM wsh_new_deliveries wnd
3561 WHERE wnd.delivery_id=p_deliveryid
3562 AND wnd.planned_flag='F';
3563
3564 CURSOR c_isvalidtpdel(p_detid IN NUMBER, p_deliveryid IN NUMBER) IS
3565 SELECT 'Y'
3566 FROM wsh_new_deliveries wnd
3567 WHERE wnd.delivery_id=p_deliveryid
3568 AND (nvl(wnd.ignore_for_planning, 'N') <>
3569 (select nvl(ignore_for_planning,'N') from wsh_delivery_details where delivery_detail_id=p_detid)
3570 );
3571
3572 -- Added cursor for TPW - Distributed Organization Changes
3573 CURSOR c_del_details ( c_del_det_id IN NUMBER ) is
3574 select shipment_batch_id
3575 from wsh_delivery_details
3576 where delivery_detail_id = c_del_det_id;
3577
3578 l_shipment_batch_id WSH_DELIVERY_DETAILS.Shipment_Batch_Id%TYPE;
3579 -- TPW - Distributed Organization Changes - End
3580
3581 l_content_id NUMBER := NULL;
3582
3583
3584 l_detail_actions_tab DetailActionsTabType;
3585 l_valid_ids wsh_util_core.id_tab_type;
3586 l_error_ids wsh_util_core.id_tab_type;
3587 l_valid_index_tab wsh_util_core.id_tab_type;
3588 l_dlvy_rec_tab WSH_DELIVERY_VALIDATIONS.dlvy_rec_tab_type;
3589
3590 l_pass_section_a VARCHAR2(1):='Y';
3591 l_organization_id NUMBER;
3592 l_delivery_id NUMBER;
3593 l_delivery_detail_id NUMBER;
3594 l_planned_flag VARCHAR2(1);
3595 l_status_code VARCHAR2(2);
3596 l_shipment_direction VARCHAR(30); -- J inbound logistics jckwok
3597 l_source_code VARCHAR2(30);
3598 l_released_status VARCHAR2(30);
3599 l_ship_from_location_id NUMBER;
3600 l_cnt_flag VARCHAR2(2);
3601 l_counter NUMBER;
3602 l_wh_type VARCHAR2(30);
3603 l_return_status VARCHAR2(1);
3604 -- Bug fix: 2644558 Harmonization Project Patchset I.
3605 l_wms_installed VARCHAR2(1);
3606
3607 l_org_type VARCHAR2(30);
3608 l_wms_org_type VARCHAR2(30);
3609 l_wms_org_id NUMBER;
3610 l_non_wms_org_id NUMBER;
3611
3612 l_caller VARCHAR2(50);
3613
3614 error_in_init_actions EXCEPTION;
3615 e_record_ineligible EXCEPTION;
3616 e_wms_record_ineligible EXCEPTION;
3617 e_tp_record_ineligible EXCEPTION;
3618
3619 -- OTM R12 : due to record changes in WSHDEVLS
3620 l_ignore WSH_NEW_DELIVERIES.IGNORE_FOR_PLANNING%TYPE;
3621 l_tms_interface_flag WSH_NEW_DELIVERIES.TMS_INTERFACE_FLAG%TYPE;
3622 -- OTM R12-Org specific -Bug 5399341
3623 l_param_info WSH_SHIPPING_PARAMS_PVT.Parameter_Rec_Typ;
3624 -- End of OTM R12 : due to record changes in WSHDEVLS
3625
3626
3627 l_debug_on BOOLEAN;
3628 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'IS_ACTION_ENABLED';
3629 l_wms_table WMS_SHIPPING_INTERFACE_GRP.g_delivery_detail_tbl;
3630
3631
3632 l_msg_count NUMBER := 0;
3633 l_msg_data VARCHAR2(2000);
3634 BEGIN
3635 --
3636 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
3637 --
3638 IF l_debug_on IS NULL
3639 THEN
3640 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
3641 END IF;
3642 --
3643 IF l_debug_on THEN
3644 WSH_DEBUG_SV.push(l_module_name);
3645 --
3646 WSH_DEBUG_SV.log(l_module_name,'p_action',p_action);
3647 WSH_DEBUG_SV.log(l_module_name,'p_caller',p_caller);
3648 END IF;
3649
3650 Init_Detail_Actions_Tbl(
3651 p_action => p_action,
3652 x_detail_actions_tab => l_detail_actions_tab,
3653 x_return_status => x_return_status);
3654
3655 IF l_debug_on THEN
3656 WSH_DEBUG_SV.log(l_module_name,'Init_Detail_Actions_Tbl x_return_status',x_return_status);
3657 END IF;
3658
3659 IF (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS ) THEN
3660 raise error_in_init_actions;
3661 END IF;
3662
3663 -- Loop through the given table
3664 For j IN p_del_detail_rec_tab.FIRST..p_del_detail_rec_tab.LAST LOOP
3665
3666 BEGIN
3667
3668 l_source_code := p_del_detail_rec_tab(j).source_code;
3669
3670 l_wms_org_type := NULL;
3671 --
3672 IF (p_caller NOT LIKE 'WMS%') THEN
3673
3674 if l_debug_on then
3675 wsh_debug_sv.log(l_module_name, 'Organization Id', p_del_detail_rec_tab(j).organization_id);
3676 wsh_debug_sv.log(l_module_name, 'WMS Organization Id', l_wms_org_id);
3677 wsh_debug_sv.log(l_module_name, 'Non WMS Organization Id', l_non_wms_org_id);
3678 end if;
3679
3680 IF p_del_detail_rec_tab(j).organization_id = l_wms_org_id THEN
3681 l_wms_org_type := 'WMS';
3682 ELSIF p_del_detail_rec_tab(j).organization_id = l_non_wms_org_id THEN
3683 l_wms_org_type := NULL;
3684 ELSE
3685 IF l_debug_on THEN
3686 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.GET_ORG_TYPE',WSH_DEBUG_SV.C_PROC_LEVEL);
3687 END IF;
3688
3689 l_org_type := wsh_util_validate.get_org_type(
3690 p_organization_id => p_del_detail_rec_tab(j).organization_id,
3691 p_delivery_detail_id => p_del_detail_rec_tab(j).delivery_detail_id,
3692 p_msg_display => 'N', -- Bug# 3332656
3693 x_return_status => l_return_status );
3694 IF l_debug_on THEN
3695 wsh_debug_sv.log(l_module_name, 'Return status after wsh_util_validate.get_org_type', l_return_status);
3696 END IF;
3697 IF l_return_status = wsh_util_core.g_ret_sts_unexp_error THEN
3698 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3699 ELSIF l_return_status = wsh_util_core.g_ret_sts_error THEN
3700 raise e_record_ineligible;
3701 exit;
3702 END IF;
3703
3704 IF l_org_type IS NOT NULL THEN
3705 l_wms_org_type := substrb(l_org_type, instrb(l_org_type, 'WMS'),3);
3706 IF nvl(l_wms_org_type,'!') = 'WMS' THEN
3707 l_wms_org_id := p_del_detail_rec_tab(j).organization_id;
3708 ELSE
3709 l_non_wms_org_id := p_del_detail_rec_tab(j).organization_id;
3710 END IF;
3711 END IF;
3712 END IF;
3713
3714
3715 END IF;
3716 --
3717 IF l_debug_on THEN
3718 wsh_debug_sv.log(l_module_name, 'l_wms_org_type', l_wms_org_type);
3719 wsh_debug_sv.log(l_module_name, 'l_detail_actions_tab.Count', l_detail_actions_tab.count);
3720 END IF;
3721 -- OTM R12 - Bug 5399341: Get shipping params to figure if the org is OTM enabled.
3722
3723 WSH_SHIPPING_PARAMS_PVT.Get(
3724 p_organization_id => p_del_detail_rec_tab(j).organization_id,
3725 p_client_id => p_del_detail_rec_tab(j).client_id, -- LSP PROJECT : Client defaults should be considered.
3726 x_param_info => l_param_info,
3727 x_return_status => x_return_status
3728 );
3729 --
3730 -- R12, X-dock
3731 -- The piece of code which determines if split is not to be allowed for 'Released to Warehouse'
3732 -- line has been commented in WSHDDVLB.init_details_action_tbl
3733 -- As per the requirement, Split should be allowed if
3734 -- if caller = WMS_XDOCK%
3735 -- and action = SPLIT-LINE
3736 -- and released_status for the detail = 'S'
3737 -- and a) Move order line id is null(Planned X-dock line) OR
3738 -- b) Move order line id is not null and move_order_type = 'PUTAWAY' (Planned X-dock line progressed)
3739 -- c) Move order line id is not null and move_order_type = 'PICK_WAVE' (Priotize Inventory case)
3740 IF p_action = 'SPLIT-LINE' AND
3741 p_del_detail_rec_tab(j).released_status = WSH_DELIVERY_DETAILS_PKG.C_RELEASED_TO_WAREHOUSE THEN
3742
3743 IF l_debug_on THEN
3744 wsh_debug_sv.log(l_module_name, 'Released_status', p_del_detail_rec_tab(j).released_status);
3745 wsh_debug_sv.log(l_module_name, 'Caller',p_caller );
3746 END IF;
3747 IF p_caller like 'WMS_XDOCK%' THEN
3748 null; -- allow action
3749 ELSE
3750 -- Else Split should not be allowed
3751 -- Same as the condition which existed before in WSHDDVLB.init_details_action_tbl
3752 raise e_record_ineligible;
3753 END IF;
3754 END IF;
3755 --
3756 -- End of R12, X-dock
3757 --
3758 -- Section A
3759 l_pass_section_a :='Y';
3760 IF (l_DETAIL_actions_tab.COUNT > 0) THEN
3761 For k in l_DETAIL_actions_tab.FIRST..l_DETAIL_actions_tab.LAST LOOP
3762
3763 -- J-IB-NPARIKH-{
3764 l_released_status := p_del_detail_rec_tab(j).released_status;
3765 l_ship_from_location_id := p_del_detail_rec_tab(j).ship_from_location_id;
3766 l_caller := p_caller;
3767 --
3768 --
3769 --
3770 IF l_debug_on THEN
3771 wsh_debug_sv.log(l_module_name, 'l_released_status', l_released_status);
3772 wsh_debug_sv.log(l_module_name, 'l_ship_from_location_id', l_ship_from_location_id);
3773 wsh_debug_sv.log(l_module_name, 'l_caller', l_caller);
3774 END IF;
3775 --
3776 --
3777 -- Actions on inbound/drop-ship lines are allowed only if caller
3778 -- starts with one of the following:
3779 -- - FTE
3780 -- - WSH_IB
3781 -- - WSH_PUB
3782 -- - WSH_TP_RELEASE
3783 -- For any other callers, set l_caller to WSH_FSTRX
3784 -- Since for caller, WSH_FSTRX, all actions are disabled
3785 -- on inbound/drop-ship lines
3786 --
3787 --
3788 IF nvl(p_del_detail_rec_tab(j).line_direction,'O') NOT IN ('O','IO') -- Inbound/Drop-ship
3789 THEN
3790 --{
3791 IF l_caller LIKE 'FTE%'
3792 OR l_caller LIKE 'WSH_PUB%'
3793 OR l_caller LIKE 'WSH_IB%'
3794 OR l_caller LIKE 'WSH_TP_RELEASE%'
3795 THEN
3796 NULL;
3797 ELSE
3798 l_caller := 'WSH_FSTRX';
3799 END IF;
3800 --}
3801 END IF;
3802 --
3803 IF nvl(p_del_detail_rec_tab(j).line_direction,'O') NOT IN ('O','IO') -- Inbound/Drop-ship
3804 AND l_released_status IN ('C','L','P') -- Shipped/Closed
3805 AND l_ship_from_location_id = WSH_UTIL_CORE.C_NULL_SF_LOCN_ID
3806 -- Supplier-managed freight (/Buyer-RReq. not recvd)
3807 THEN
3808 --{
3809 /*
3810 IF p_action = 'SPLIT-LINE'
3811 THEN
3812 l_released_status := 'X';
3813 ELSIF p_action IN ( 'AUTOCREATE-DEL', 'UNASSIGN' )
3814 THEN
3815 --{
3816 IF p_caller like '%' || WSH_UTIL_CORE.C_SPLIT_DLVY_SUFFIX
3817 THEN
3818 --{
3819 l_released_status := 'X';
3820 l_ship_from_location_id := WSH_UTIL_CORE.C_NOTNULL_SF_LOCN_ID;
3821 --}
3822 END IF;
3823 --}
3824 END IF;
3825 */
3826 --
3827 --
3828 --
3829 IF l_debug_on THEN
3830 wsh_debug_sv.logmsg(l_module_name, 'After Inbound Checks');
3831 wsh_debug_sv.log(l_module_name, 'l_released_status', l_released_status);
3832 wsh_debug_sv.log(l_module_name, 'l_ship_from_location_id', l_ship_from_location_id);
3833 wsh_debug_sv.log(l_module_name, 'l_caller', l_caller);
3834 END IF;
3835 --
3836 --}
3837 END IF;
3838 --
3839 --
3840 -- J-IB-NPARIKH-}
3841 --
3842 IF( nvl(l_detail_actions_tab(k).released_status,l_released_status) =
3843 l_released_status --p_del_detail_rec_tab(j).released_status -- J-IB-NPARIKH
3844 AND nvl(l_detail_actions_tab(k).ship_from_location_id,l_ship_from_location_id)
3845 = l_ship_from_location_id -- J-IB-NPARIKH
3846 AND nvl(l_detail_actions_tab(k).container_flag,p_del_detail_rec_tab(j).container_flag) =
3847 p_del_detail_rec_tab(j).container_flag
3848 AND nvl(l_detail_actions_tab(k).source_code,l_source_code) = l_source_code
3849 AND nvl(l_detail_actions_tab(k).caller,l_caller) = l_caller -- J-IB-NPARIKH
3850 AND nvl(l_detail_actions_tab(k).org_type,nvl(l_wms_org_type,'!')) = nvl(l_wms_org_type,'!')
3851 AND l_detail_actions_tab(k).action_not_allowed = p_action
3852 /* J new condition to check line_direction jckwok */
3853 AND nvl(l_detail_actions_tab(k).line_direction,
3854 nvl(p_del_detail_rec_tab(j).line_direction, 'O'))
3855 = nvl(p_del_detail_rec_tab(j).line_direction, 'O')
3856 AND nvl(l_detail_actions_tab(k).otm_enabled, nvl(l_param_info.otm_enabled, 'N'))
3857 = nvl(l_param_info.otm_enabled, 'N')
3858 ) THEN
3859 l_pass_section_a :='N';
3860 IF l_detail_actions_tab(k).message_name IS NOT NULL THEN
3861 IF l_debug_on THEN
3862 wsh_debug_sv.log(l_module_name, 'Message Name is', l_detail_actions_tab(k).message_name);
3863 END IF;
3864 FND_MESSAGE.SET_NAME('WSH',l_detail_actions_tab(k).message_name);
3865 wsh_util_core.add_message(wsh_util_core.g_ret_sts_error);
3866 END IF;
3867 raise e_record_ineligible;
3868 exit;
3869 END IF;
3870 END LOOP;
3871 END IF;
3872
3873 IF l_debug_on THEN
3874 WSH_DEBUG_SV.log(l_module_name,'l_pass_section_a ',l_pass_section_a);
3875 END IF;
3876 -- Section B
3877 IF (l_pass_section_a = 'Y' ) THEN
3878 -- TPW - Distributed Organization Changes - Start
3879 IF ( p_action IN ( 'AUTOCREATE-DEL', 'ASSIGN' ) ) THEN
3880 --
3881 IF l_debug_on THEN
3882 WSH_DEBUG_SV.logmsg(l_module_name, 'Calling WSH_EXTERNAL_INTERFACE_SV.Get_Warehouse_Type', WSH_DEBUG_SV.C_PROC_LEVEL);
3883 END IF;
3884 --
3885 l_wh_type := WSH_EXTERNAL_INTERFACE_SV.Get_Warehouse_Type(
3886 p_organization_id => p_del_detail_rec_tab(j).organization_id,
3887 x_return_status => l_return_status );
3888 --
3889 IF l_debug_on THEN
3890 WSH_DEBUG_SV.log(l_module_name, 'l_wh_type,l_return_status',l_wh_type||','||l_return_status);
3891 END IF;
3892 --
3893
3894 IF nvl(l_wh_type, FND_API.G_MISS_CHAR) = 'TW2' THEN
3895 --
3896 IF l_debug_on THEN
3897 WSH_DEBUG_SV.logmsg(l_module_name, 'Error: Cannot perform action Auto-create Deliveries/Assign to Delivery in Distributed Enabled Organization');
3898 END IF;
3899 --
3900 RAISE e_record_ineligible;
3901 END IF;
3902 END IF;
3903 -- TPW - Distributed Organization Changes - End
3904
3905 open det_to_del_cur(p_del_detail_rec_tab(j).delivery_detail_id);
3906 Fetch det_to_del_cur into l_organization_id, l_status_code, l_planned_flag,
3907 l_delivery_id, l_shipment_direction,
3908 l_ignore, l_tms_interface_flag; -- OTM R12
3909
3910 IF ( p_action IN ('CYCLE-COUNT','PICK-RELEASE','AUTO-PACK','AUTO-PACK-MASTER',
3911 'PACK','UNPACK','PACKING-WORKBENCH') ) THEN
3912 IF ( det_to_del_cur%NOTFOUND ) THEN
3913 close det_to_del_cur;
3914
3915 l_wh_type := WSH_EXTERNAL_INTERFACE_SV.Get_Warehouse_Type
3916 (p_organization_id => p_del_detail_rec_tab(j).organization_id,
3917 x_return_status => l_return_status,
3918 p_delivery_id => l_delivery_id,
3919 p_delivery_detail_id => p_del_detail_rec_tab(j).delivery_detail_id,
3920 p_msg_display => 'N');
3921
3922 IF l_debug_on THEN
3923 WSH_DEBUG_SV.log(l_module_name,'Get_Warehouse_Type l_wh_type,l_return_status',l_wh_type||l_return_status);
3924 END IF;
3925
3926 -- TPW - Distributed Organization Changes
3927 --IF ( nvl(l_wh_type, FND_API.G_MISS_CHAR) = 'TPW' ) THEN
3928 IF ( nvl(l_wh_type, FND_API.G_MISS_CHAR) in ( 'TPW', 'TW2' ) ) THEN
3929 IF ( p_del_detail_rec_tab(j).source_code = 'WSH' and p_del_detail_rec_tab(j).container_flag = 'N' ) THEN
3930 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
3931 x_valid_index_tab(j) := j;
3932 ELSE
3933 raise e_record_ineligible;
3934 END IF;
3935 ELSE
3936 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
3937 x_valid_index_tab(j) := j;
3938 END IF;
3939 ELSE
3940 l_dlvy_rec_tab(1).delivery_id := l_delivery_id;
3941 l_dlvy_rec_tab(1).organization_id := l_organization_id;
3942 l_dlvy_rec_tab(1).status_code := l_status_code;
3943 l_dlvy_rec_tab(1).planned_flag := l_planned_flag;
3944 l_dlvy_rec_tab(1).shipment_direction := l_shipment_direction; -- J inbound logistics jckwok
3945 -- OTM R12 : due to record changes in WSHDEVLS
3946 l_dlvy_rec_tab(1).ignore_for_planning := l_ignore;
3947 l_dlvy_rec_tab(1).tms_interface_flag := l_tms_interface_flag;
3948 -- End of OTM R12 : due to record changes in WSHDEVLS
3949
3950
3951 WSH_DELIVERY_VALIDATIONS.Is_Action_Enabled(
3952 p_dlvy_rec_tab => l_dlvy_rec_tab,
3953 p_action => p_action,
3954 p_caller => p_caller,
3955 x_return_status => l_return_status,
3956 x_valid_ids => l_valid_ids,
3957 x_error_ids => l_error_ids,
3958 x_valid_index_tab => l_valid_index_tab);
3959
3960 IF l_debug_on THEN
3961 WSH_DEBUG_SV.log(l_module_name,'WSH_DELIVERY_VALIDATIONS.Is_Action_Enabled l_return_status',
3962 l_return_status);
3963 END IF;
3964
3965 IF (l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS)
3966 AND (l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING) THEN
3967 raise e_record_ineligible;
3968 ELSE
3969 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
3970 x_valid_index_tab(j) := j;
3971 END IF;
3972 END IF; -- IF ( det_to_del_cur%
3973
3974 ELSIF ( p_action = 'SPLIT-LINE') THEN
3975 IF ( det_to_del_cur%NOTFOUND ) THEN
3976 close det_to_del_cur;
3977 -- TPW - Distributed Organization Changes -- Start
3978 -- Do not allow delivery line split if its assigned to a Shipment Batch
3979 l_shipment_batch_id := null;
3980 open c_del_details(p_del_detail_rec_tab(j).delivery_detail_id);
3981 fetch c_del_details into l_shipment_batch_id;
3982 close c_del_details;
3983 IF l_shipment_batch_id is not null THEN
3984 raise e_record_ineligible;
3985 ELSE
3986 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
3987 x_valid_index_tab(j) := j;
3988 End if;
3989 -- TPW - Distributed Organization Changes -- End
3990 ELSE
3991 l_dlvy_rec_tab(1).delivery_id := l_delivery_id;
3992 l_dlvy_rec_tab(1).organization_id := l_organization_id;
3993 l_dlvy_rec_tab(1).status_code := l_status_code;
3994 l_dlvy_rec_tab(1).planned_flag := l_planned_flag;
3995 l_dlvy_rec_tab(1).shipment_direction := l_shipment_direction; -- jckwok
3996 -- OTM R12 : due to record changes in WSHDEVLS
3997 l_dlvy_rec_tab(1).ignore_for_planning := l_ignore;
3998 l_dlvy_rec_tab(1).tms_interface_flag := l_tms_interface_flag;
3999 -- End of OTM R12 : due to record changes in WSHDEVLS
4000
4001 WSH_DELIVERY_VALIDATIONS.Is_Action_Enabled(
4002 p_dlvy_rec_tab => l_dlvy_rec_tab,
4003 p_action => p_action,
4004 p_caller => p_caller,
4005 x_return_status => l_return_status,
4006 x_valid_ids => l_valid_ids,
4007 x_error_ids => l_error_ids,
4008 x_valid_index_tab => l_valid_index_tab);
4009
4010 IF l_debug_on THEN
4011 WSH_DEBUG_SV.log(l_module_name,'WSH_DELIVERY_VALIDATIONS.Is_Action_Enabled l_return_status',
4012 l_return_status);
4013 END IF;
4014
4015 IF (l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS)
4016 AND (l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING) THEN
4017 raise e_record_ineligible;
4018 ELSE
4019 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4020 x_valid_index_tab(j) := j;
4021 END IF;
4022 END IF;
4023
4024 ELSIF ( p_action = 'UNASSIGN') THEN
4025 IF ( det_to_del_cur%NOTFOUND ) THEN
4026 close det_to_del_cur;
4027 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4028 x_valid_index_tab(j) := j;
4029 ELSE
4030 l_dlvy_rec_tab(1).delivery_id := l_delivery_id;
4031 l_dlvy_rec_tab(1).organization_id := l_organization_id;
4032 l_dlvy_rec_tab(1).status_code := l_status_code;
4033 l_dlvy_rec_tab(1).planned_flag := l_planned_flag;
4034 l_dlvy_rec_tab(1).shipment_direction := l_shipment_direction; -- jckwok
4035 -- OTM R12 : due to record changes in WSHDEVLS
4036 l_dlvy_rec_tab(1).ignore_for_planning := l_ignore;
4037 l_dlvy_rec_tab(1).tms_interface_flag := l_tms_interface_flag;
4038 -- End of OTM R12 : due to record changes in WSHDEVLS
4039
4040 l_wms_installed := wsh_util_validate.check_wms_org(p_del_detail_rec_tab(j).organization_id);
4041 -- bug 2750960: call WMS only if record is a container that contains a staged line
4042 IF l_wms_installed = 'Y'
4043 AND p_del_detail_rec_tab(j).container_flag in ('Y', 'C')
4044 THEN
4045
4046 OPEN c_staged_content(p_del_detail_rec_tab(j).delivery_detail_id);
4047 FETCH c_staged_content INTO l_content_id;
4048 IF c_staged_content%NOTFOUND THEN
4049 l_content_id := NULL;
4050 END IF;
4051 CLOSE c_staged_content;
4052
4053 IF l_content_id IS NOT NULL THEN
4054
4055 l_wms_table(1).delivery_detail_id := p_del_detail_rec_tab(j).delivery_detail_id;
4056 l_wms_table(1).organization_id := p_del_detail_rec_tab(j).organization_id;
4057 l_wms_table(1).released_status := p_del_detail_rec_tab(j).released_status;
4058 l_wms_table(1).container_flag := p_del_detail_rec_tab(j).container_flag;
4059 l_wms_table(1).source_code := p_del_detail_rec_tab(j).source_code;
4060 l_wms_table(1).lpn_id := p_del_detail_rec_tab(j).lpn_id;
4061
4062 WMS_SHIPPING_INTERFACE_GRP.process_delivery_details (
4063 p_api_version => 1.0,
4064 p_action => WMS_SHIPPING_INTERFACE_GRP.g_action_unassign_delivery,
4065 p_delivery_detail_tbl => l_wms_table,
4066 x_return_status => l_return_status,
4067 x_msg_count => l_msg_count,
4068 x_msg_data => l_msg_data);
4069
4070
4071 IF l_debug_on THEN
4072 WSH_DEBUG_SV.log(l_module_name,'WMS_SHIPPING_INTERFACE_GRP.process_delivery_details l_wms_table(1).return_status',
4073 l_wms_table(1).return_status);
4074 END IF;
4075
4076 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS OR l_wms_table(1).return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS THEN
4077 raise e_wms_record_ineligible;
4078 END IF;
4079 END IF; -- l_content_id IS NOT NULL
4080 END IF;--l_wms_installed
4081
4082 WSH_DELIVERY_VALIDATIONS.Is_Action_Enabled(
4083 p_dlvy_rec_tab => l_dlvy_rec_tab,
4084 p_action => p_action,
4085 p_caller => p_caller,
4086 x_return_status => l_return_status,
4087 x_valid_ids => l_valid_ids,
4088 x_error_ids => l_error_ids,
4089 x_valid_index_tab => l_valid_index_tab);
4090
4091 IF l_debug_on THEN
4092 WSH_DEBUG_SV.log(l_module_name,'WSH_DELIVERY_VALIDATIONS.Is_Action_Enabled l_return_status',
4093 l_return_status);
4094 END IF;
4095
4096 IF (l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS)
4097 AND (l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING) THEN
4098 raise e_record_ineligible;
4099 ELSE
4100 IF (p_del_detail_rec_tab(j).source_code = 'WSH' and p_del_detail_rec_tab(j).container_flag = 'N' ) THEN
4101 raise e_record_ineligible;
4102 END IF;
4103 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4104 x_valid_index_tab(j) := j;
4105 END IF;
4106 END IF;
4107
4108 ELSIF (p_caller<>'TP_RELEASE' AND p_action='ASSIGN') THEN
4109 FOR cur IN c_isdelfirm(p_deliveryid) LOOP
4110 raise e_record_ineligible;
4111 END LOOP;
4112 FOR cur IN c_isvalidtpdel(p_del_detail_rec_tab(j).delivery_detail_id, p_deliveryid) LOOP
4113 raise e_tp_record_ineligible;
4114 END LOOP;
4115 -- TKT
4116 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4117 x_valid_index_tab(j) := j;
4118
4119 ELSIF ( p_action IN ('IGNORE_PLAN','INCLUDE_PLAN')) THEN
4120 l_wms_installed := wsh_util_validate.check_wms_org(p_del_detail_rec_tab(j).organization_id);
4121
4122 IF l_wms_installed='Y' AND p_del_detail_rec_tab(j).released_status='S' THEN
4123 raise e_wms_record_ineligible;
4124 ELSE
4125 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4126 x_valid_index_tab(j) := j;
4127 END IF;
4128
4129 ELSIF ( p_action = 'AUTOCREATE-TRIP') THEN
4130 IF ( det_to_del_cur%NOTFOUND ) THEN
4131 close det_to_del_cur;
4132
4133 l_wh_type := WSH_EXTERNAL_INTERFACE_SV.Get_Warehouse_Type
4134 (p_organization_id => p_del_detail_rec_tab(j).organization_id,
4135 x_return_status => l_return_status,
4136 p_delivery_id => l_delivery_id,
4137 p_delivery_detail_id => p_del_detail_rec_tab(j).delivery_detail_id,
4138 p_msg_display => 'N');
4139
4140 IF l_debug_on THEN
4141 WSH_DEBUG_SV.log(l_module_name,'Get_Warehouse_Type l_wh_type,l_return_status',l_wh_type||l_return_status);
4142 END IF;
4143
4144 -- TPW - Distributed Organization Changes
4145 --IF ( nvl(l_wh_type, FND_API.G_MISS_CHAR) in ('CMS','TPW')) THEN
4146 IF ( nvl(l_wh_type, FND_API.G_MISS_CHAR) in ('CMS','TPW','TW2')) THEN
4147 IF (p_del_detail_rec_tab(j).source_code = 'WSH' and p_del_detail_rec_tab(j).container_flag = 'N' ) THEN
4148 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4149 x_valid_index_tab(j) := j;
4150 ELSE
4151 raise e_record_ineligible;
4152 END IF;
4153 ELSE
4154 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4155 x_valid_index_tab(j) := j;
4156 END IF;
4157 ELSE
4158 raise e_record_ineligible;
4159 END IF;
4160
4161
4162 ELSE
4163 x_valid_ids(x_valid_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4164 x_valid_index_tab(j) := j;
4165 END IF;
4166
4167 IF ( det_to_del_cur%ISOPEN ) THEN
4168 close det_to_del_cur;
4169 END IF;
4170
4171 END IF; --pass section a
4172 EXCEPTION -- for the local BEGIN
4173 WHEN e_record_ineligible THEN
4174 IF det_to_del_cur%ISOPEN THEN
4175 CLOSE det_to_del_cur;
4176 END IF;
4177
4178 IF l_debug_on THEN
4179 wsh_debug_sv.log(l_module_name, 'Error Id', p_del_detail_rec_tab(j).delivery_detail_id);
4180 END IF;
4181 x_error_ids(x_error_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4182 IF nvl(p_caller, FND_API.G_MISS_CHAR) = 'WSH_PUB'
4183 OR p_caller like 'FTE%' THEN
4184 FND_MESSAGE.SET_NAME('WSH', 'WSH_DETAIL_ACTION_INELIGIBLE');
4185 FND_MESSAGE.SET_TOKEN('DETAIL_ID', p_del_detail_rec_tab(j).delivery_detail_id);
4186 FND_MESSAGE.SET_TOKEN('ACTION', wsh_util_core.get_action_meaning('DLVB',p_action));
4187 wsh_util_core.add_message(wsh_util_core.g_ret_sts_error, l_module_name);
4188 END IF;
4189
4190 WHEN e_wms_record_ineligible THEN
4191 IF det_to_del_cur%ISOPEN THEN
4192 CLOSE det_to_del_cur;
4193 END IF;
4194 IF l_debug_on THEN
4195 wsh_debug_sv.log(l_module_name, 'Error Id', p_del_detail_rec_tab(j).delivery_detail_id);
4196 END IF;
4197 x_error_ids(x_error_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4198 IF nvl(p_caller, FND_API.G_MISS_CHAR) = 'WSH_PUB'
4199 OR p_caller like 'FTE%' THEN
4200 FND_MESSAGE.SET_NAME('WSH', 'WSH_DETAIL_ACTION_INELIGIBLE');
4201 FND_MESSAGE.SET_TOKEN('DETAIL_ID', p_del_detail_rec_tab(j).delivery_detail_id);
4202 FND_MESSAGE.SET_TOKEN('ACTION', wsh_util_core.get_action_meaning('DLVB',p_action));
4203 wsh_util_core.add_message(wsh_util_core.g_ret_sts_error, l_module_name);
4204 END IF;
4205
4206 WHEN e_tp_record_ineligible THEN
4207 IF det_to_del_cur%ISOPEN THEN
4208 CLOSE det_to_del_cur;
4209 END IF;
4210 IF l_debug_on THEN
4211 wsh_debug_sv.log(l_module_name, 'Error Id', p_del_detail_rec_tab(j).delivery_detail_id);
4212 END IF;
4213 x_error_ids(x_error_ids.COUNT + 1) := p_del_detail_rec_tab(j).delivery_detail_id;
4214 IF nvl(p_caller, FND_API.G_MISS_CHAR) = 'WSH_PUB'
4215 OR p_caller like 'FTE%' THEN
4216 FND_MESSAGE.SET_NAME('WSH', 'WSH_DET_ASSIGN_FIRMDEL_ERROR');
4217 FND_MESSAGE.SET_TOKEN('DETAIL_ID', p_del_detail_rec_tab(j).delivery_detail_id);
4218 FND_MESSAGE.SET_TOKEN('DEL_NAME', wsh_new_deliveries_pvt.get_name(p_deliveryid));
4219 wsh_util_core.add_message(wsh_util_core.g_ret_sts_error, l_module_name);
4220 END IF;
4221
4222 WHEN others THEN
4223 IF det_to_del_cur%ISOPEN THEN
4224 CLOSE det_to_del_cur;
4225 END IF;
4226 raise FND_API.G_EXC_UNEXPECTED_ERROR;
4227 END; -- Local BEGIN
4228
4229 END LOOP;
4230
4231 IF (x_valid_ids.COUNT = 0 ) THEN
4232 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
4233 --
4234 IF NOT (l_caller LIKE 'FTE%' OR l_caller = 'WSH_PUB') THEN
4235 FND_MESSAGE.SET_NAME('WSH','WSH_ACTION_ENABLED');
4236 wsh_util_core.add_message(x_return_status,l_module_name);
4237 END IF;
4238 --
4239 ELSIF (x_valid_ids.COUNT = p_del_detail_rec_tab.COUNT) THEN
4240 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
4241 ELSIF (x_valid_ids.COUNT < p_del_detail_rec_tab.COUNT ) THEN
4242 x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
4243 --
4244 IF NOT (l_caller LIKE 'FTE%' OR l_caller = 'WSH_PUB') THEN
4245 FND_MESSAGE.SET_NAME('WSH','WSH_ACTION_ENABLED_WARN');
4246 wsh_util_core.add_message(x_return_status,l_module_name);
4247 END IF;
4248 --
4249 ELSE
4250 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
4251 --
4252 IF NOT (l_caller LIKE 'FTE%' OR l_caller = 'WSH_PUB') THEN
4253 FND_MESSAGE.SET_NAME('WSH','WSH_ACTION_ENABLED');
4254 wsh_util_core.add_message(x_return_status,l_module_name);
4255 END IF;
4256 --
4257 END IF;
4258
4259 IF l_debug_on THEN
4260 WSH_DEBUG_SV.pop(l_module_name);
4261 END IF;
4262
4263 EXCEPTION
4264 WHEN error_in_init_actions THEN
4265 IF l_debug_on THEN
4266 WSH_DEBUG_SV.logmsg(l_module_name,'error_in_init_actions exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
4267 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:error_in_init_actions');
4268 END IF;
4269
4270 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4271 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
4272 wsh_util_core.add_message(x_return_status, l_module_name);
4273 IF l_debug_on THEN
4274 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_UNEXPECTED_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
4275 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
4276 END IF;
4277 IF c_staged_content%ISOPEN THEN
4278 CLOSE c_staged_content;
4279 END IF;
4280
4281 WHEN OTHERS THEN
4282 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
4283 IF l_debug_on THEN
4284 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '||
4285 SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
4286 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
4287 END IF;
4288 IF c_staged_content%ISOPEN THEN
4289 CLOSE c_staged_content;
4290 END IF;
4291 END Is_Action_Enabled;
4292
4293
4294
4295 PROCEDURE eliminate_displayonly_fields (
4296 p_delivery_detail_rec IN wsh_glbl_var_strct_grp.delivery_details_rec_type
4297 , p_in_rec IN wsh_glbl_var_strct_grp.detailInRecType
4298 , x_delivery_detail_rec IN OUT NOCOPY
4299 wsh_glbl_var_strct_grp.delivery_details_rec_type
4300 )
4301 IS
4302
4303 -- Bug 5728048
4304 CURSOR c_isvalidUOM_Code (p_uom_code VARCHAR2) IS
4305 SELECT uom.uom_code
4306 FROM mtl_uom_conversions conv, mtl_units_of_measure_vl uom
4307 WHERE uom.unit_of_measure = conv.unit_of_measure
4308 AND uom.uom_code = p_uom_code
4309 AND conv.inventory_item_id = 0
4310 AND NVL(uom.disable_date, sysdate+1) > sysdate
4311 AND NVL(conv.disable_date, sysdate+1) > sysdate ;
4312
4313 l_uom_code VARCHAR2(3);
4314
4315 BEGIN
4316
4317 /*
4318 Enable the x_delivery_detail_rec, with the columns that are not
4319 permanently disabled.
4320 */
4321
4322 --
4323 IF p_delivery_detail_rec.container_name <> FND_API.G_MISS_CHAR
4324 OR p_delivery_detail_rec.container_name IS NULL THEN
4325 x_delivery_detail_rec.container_name :=
4326 p_delivery_detail_rec.container_name;
4327 END IF;
4328 IF p_delivery_detail_rec.shipped_quantity <> FND_API.G_MISS_NUM
4329 OR p_delivery_detail_rec.shipped_quantity IS NULL THEN
4330 x_delivery_detail_rec.shipped_quantity :=
4331 p_delivery_detail_rec.shipped_quantity;
4332 END IF;
4333 IF p_delivery_detail_rec.shipped_quantity2 <> FND_API.G_MISS_NUM
4334 OR p_delivery_detail_rec.shipped_quantity2 IS NULL THEN
4335 x_delivery_detail_rec.shipped_quantity2 :=
4336 p_delivery_detail_rec.shipped_quantity2;
4337 END IF;
4338 IF p_delivery_detail_rec.cycle_count_quantity <> FND_API.G_MISS_NUM
4339 OR p_delivery_detail_rec.cycle_count_quantity IS NULL THEN
4340 x_delivery_detail_rec.cycle_count_quantity :=
4341 p_delivery_detail_rec.cycle_count_quantity;
4342 END IF;
4343 IF p_delivery_detail_rec.cycle_count_quantity2 <> FND_API.G_MISS_NUM
4344 OR p_delivery_detail_rec.cycle_count_quantity2 IS NULL THEN
4345 x_delivery_detail_rec.cycle_count_quantity2 :=
4346 p_delivery_detail_rec.cycle_count_quantity2;
4347 END IF;
4348 IF p_delivery_detail_rec.delivered_quantity <> FND_API.G_MISS_NUM
4349 OR p_delivery_detail_rec.delivered_quantity IS NULL THEN
4350 x_delivery_detail_rec.delivered_quantity :=
4351 p_delivery_detail_rec.delivered_quantity;
4352 END IF;
4353 IF p_delivery_detail_rec.delivered_quantity2 <> FND_API.G_MISS_NUM
4354 OR p_delivery_detail_rec.delivered_quantity2 IS NULL THEN
4355 x_delivery_detail_rec.delivered_quantity2 :=
4356 p_delivery_detail_rec.delivered_quantity2;
4357 END IF;
4358 IF p_delivery_detail_rec.cancelled_quantity <> FND_API.G_MISS_NUM
4359 OR p_delivery_detail_rec.cancelled_quantity IS NULL THEN
4360 x_delivery_detail_rec.cancelled_quantity :=
4361 p_delivery_detail_rec.cancelled_quantity;
4362 END IF;
4363 IF p_delivery_detail_rec.cancelled_quantity2 <> FND_API.G_MISS_NUM
4364 OR p_delivery_detail_rec.cancelled_quantity2 IS NULL THEN
4365 x_delivery_detail_rec.cancelled_quantity2 :=
4366 p_delivery_detail_rec.cancelled_quantity2;
4367 END IF;
4368 IF p_delivery_detail_rec.load_seq_number <> FND_API.G_MISS_NUM
4369 OR p_delivery_detail_rec.load_seq_number IS NULL THEN
4370 x_delivery_detail_rec.load_seq_number :=
4371 p_delivery_detail_rec.load_seq_number;
4372 END IF;
4373 IF p_delivery_detail_rec.gross_weight <> FND_API.G_MISS_NUM
4374 OR p_delivery_detail_rec.gross_weight IS NULL THEN
4375 x_delivery_detail_rec.gross_weight :=
4376 p_delivery_detail_rec.gross_weight;
4377 END IF;
4378 IF p_delivery_detail_rec.net_weight <> FND_API.G_MISS_NUM
4379 OR p_delivery_detail_rec.net_weight IS NULL THEN
4380 x_delivery_detail_rec.net_weight :=
4381 p_delivery_detail_rec.net_weight;
4382 END IF;
4383 IF p_delivery_detail_rec.volume <> FND_API.G_MISS_NUM
4384 OR p_delivery_detail_rec.volume IS NULL THEN
4385 x_delivery_detail_rec.volume :=
4386 p_delivery_detail_rec.volume;
4387 END IF;
4388
4389 -- Update of UOM Codes is allowed only if they are Null and new codes are Valid UOM Codes
4390 IF p_in_rec.action_code = 'UPDATE' THEN
4391 IF p_delivery_detail_rec.weight_uom_code <> FND_API.G_MISS_CHAR
4392 AND p_delivery_detail_rec.weight_uom_code IS NOT NULL
4393 AND x_delivery_detail_rec.weight_uom_code IS NULL THEN
4394 OPEN c_isvalidUOM_Code(p_delivery_detail_rec.weight_uom_code);
4395 FETCH c_isvalidUOM_Code INTO l_uom_code;
4396 IF c_isvalidUOM_Code%FOUND THEN
4397 x_delivery_detail_rec.weight_uom_code :=
4398 p_delivery_detail_rec.weight_uom_code;
4399 END IF;
4400 CLOSE c_isvalidUOM_Code;
4401 END IF;
4402 IF p_delivery_detail_rec.volume_uom_code <> FND_API.G_MISS_CHAR
4403 AND p_delivery_detail_rec.volume_uom_code IS NOT NULL
4404 AND x_delivery_detail_rec.volume_uom_code IS NULL THEN
4405 OPEN c_isvalidUOM_Code(p_delivery_detail_rec.volume_uom_code);
4406 FETCH c_isvalidUOM_Code INTO l_uom_code;
4407 IF c_isvalidUOM_Code%FOUND THEN
4408 x_delivery_detail_rec.volume_uom_code :=
4409 p_delivery_detail_rec.volume_uom_code;
4410 END IF;
4411 CLOSE c_isvalidUOM_Code;
4412 END IF;
4413 END IF;
4414
4415 IF p_delivery_detail_rec.fill_percent <> FND_API.G_MISS_NUM
4416 OR p_delivery_detail_rec.fill_percent IS NULL THEN
4417 x_delivery_detail_rec.fill_percent :=
4418 p_delivery_detail_rec.fill_percent;
4419 END IF;
4420 IF p_delivery_detail_rec.master_serial_number <> FND_API.G_MISS_CHAR
4421 OR p_delivery_detail_rec.master_serial_number IS NULL THEN
4422 x_delivery_detail_rec.master_serial_number :=
4423 p_delivery_detail_rec.master_serial_number;
4424 END IF;
4425 IF p_delivery_detail_rec.master_container_item_id <> FND_API.G_MISS_NUM
4426 OR p_delivery_detail_rec.master_container_item_id IS NULL THEN
4427 x_delivery_detail_rec.master_container_item_id :=
4428 p_delivery_detail_rec.master_container_item_id;
4429 END IF;
4430 IF p_delivery_detail_rec.detail_container_item_id <> FND_API.G_MISS_NUM
4431 OR p_delivery_detail_rec.detail_container_item_id IS NULL THEN
4432 x_delivery_detail_rec.detail_container_item_id :=
4433 p_delivery_detail_rec.detail_container_item_id;
4434 END IF;
4435 IF p_delivery_detail_rec.shipping_instructions <> FND_API.G_MISS_CHAR
4436 OR p_delivery_detail_rec.shipping_instructions IS NULL THEN
4437 x_delivery_detail_rec.shipping_instructions :=
4438 p_delivery_detail_rec.shipping_instructions;
4439 END IF;
4440 IF p_delivery_detail_rec.packing_instructions <> FND_API.G_MISS_CHAR
4441 OR p_delivery_detail_rec.packing_instructions IS NULL THEN
4442 x_delivery_detail_rec.packing_instructions :=
4443 p_delivery_detail_rec.packing_instructions;
4444 END IF;
4445 IF p_delivery_detail_rec.revision <> FND_API.G_MISS_CHAR
4446 OR p_delivery_detail_rec.revision IS NULL THEN
4447 x_delivery_detail_rec.revision :=
4448 p_delivery_detail_rec.revision;
4449 END IF;
4450 IF p_delivery_detail_rec.subinventory <> FND_API.G_MISS_CHAR
4451 OR p_delivery_detail_rec.subinventory IS NULL THEN
4452 x_delivery_detail_rec.subinventory :=
4453 p_delivery_detail_rec.subinventory;
4454 END IF;
4455 IF p_delivery_detail_rec.lot_number <> FND_API.G_MISS_CHAR
4456 OR p_delivery_detail_rec.lot_number IS NULL THEN
4457 x_delivery_detail_rec.lot_number :=
4458 p_delivery_detail_rec.lot_number;
4459 END IF;
4460 -- HW OPMCONV - No need for sublot_number
4461
4462 IF p_delivery_detail_rec.locator_id <> FND_API.G_MISS_NUM
4463 OR p_delivery_detail_rec.locator_id IS NULL THEN
4464 x_delivery_detail_rec.locator_id :=
4465 p_delivery_detail_rec.locator_id;
4466 END IF;
4467 IF p_delivery_detail_rec.serial_number <> FND_API.G_MISS_CHAR
4468 OR p_delivery_detail_rec.serial_number IS NULL THEN
4469 x_delivery_detail_rec.serial_number :=
4470 p_delivery_detail_rec.serial_number;
4471 END IF;
4472 -- Bug Fix: 2651882. KVENKATE.
4473 -- Need to enable 'to_serial_number'
4474 IF p_delivery_detail_rec.to_serial_number <> FND_API.G_MISS_CHAR
4475 OR p_delivery_detail_rec.to_serial_number IS NULL THEN
4476 x_delivery_detail_rec.to_serial_number :=
4477 p_delivery_detail_rec.to_serial_number;
4478 END IF;
4479 -- Bug Fix: 2651882. KVENKATE.
4480
4481 IF p_delivery_detail_rec.preferred_grade <> FND_API.G_MISS_CHAR
4482 OR p_delivery_detail_rec.preferred_grade IS NULL THEN
4483 x_delivery_detail_rec.preferred_grade :=
4484 p_delivery_detail_rec.preferred_grade;
4485 END IF;
4486 IF p_delivery_detail_rec.seal_code <> FND_API.G_MISS_CHAR
4487 OR p_delivery_detail_rec.seal_code IS NULL THEN
4488 x_delivery_detail_rec.seal_code :=
4489 p_delivery_detail_rec.seal_code;
4490 END IF;
4491 IF p_delivery_detail_rec.inspection_flag <> FND_API.G_MISS_CHAR
4492 OR p_delivery_detail_rec.inspection_flag IS NULL THEN
4493 x_delivery_detail_rec.inspection_flag :=
4494 p_delivery_detail_rec.inspection_flag;
4495 END IF;
4496 IF p_delivery_detail_rec.transaction_temp_id <> FND_API.G_MISS_NUM
4497 OR p_delivery_detail_rec.transaction_temp_id IS NULL THEN
4498 x_delivery_detail_rec.transaction_temp_id :=
4499 p_delivery_detail_rec.transaction_temp_id;
4500 END IF;
4501
4502
4503 IF p_delivery_detail_rec.tp_attribute1 <> FND_API.G_MISS_CHAR
4504 OR p_delivery_detail_rec.tp_attribute1 IS NULL THEN
4505 x_delivery_detail_rec.tp_attribute1 :=
4506 p_delivery_detail_rec.tp_attribute1;
4507 END IF;
4508 IF p_delivery_detail_rec.tp_attribute2 <> FND_API.G_MISS_CHAR
4509 OR p_delivery_detail_rec.tp_attribute2 IS NULL THEN
4510 x_delivery_detail_rec.tp_attribute2 :=
4511 p_delivery_detail_rec.tp_attribute2;
4512 END IF;
4513 IF p_delivery_detail_rec.tp_attribute3 <> FND_API.G_MISS_CHAR
4514 OR p_delivery_detail_rec.tp_attribute3 IS NULL THEN
4515 x_delivery_detail_rec.tp_attribute3 :=
4516 p_delivery_detail_rec.tp_attribute3;
4517 END IF;
4518 IF p_delivery_detail_rec.tp_attribute4 <> FND_API.G_MISS_CHAR
4519 OR p_delivery_detail_rec.tp_attribute4 IS NULL THEN
4520 x_delivery_detail_rec.tp_attribute4 :=
4521 p_delivery_detail_rec.tp_attribute4;
4522 END IF;
4523 IF p_delivery_detail_rec.tp_attribute5 <> FND_API.G_MISS_CHAR
4524 OR p_delivery_detail_rec.tp_attribute5 IS NULL THEN
4525 x_delivery_detail_rec.tp_attribute5 :=
4526 p_delivery_detail_rec.tp_attribute5;
4527 END IF;
4528 IF p_delivery_detail_rec.tp_attribute6 <> FND_API.G_MISS_CHAR
4529 OR p_delivery_detail_rec.tp_attribute6 IS NULL THEN
4530 x_delivery_detail_rec.tp_attribute6 :=
4531 p_delivery_detail_rec.tp_attribute6;
4532 END IF;
4533 IF p_delivery_detail_rec.tp_attribute7 <> FND_API.G_MISS_CHAR
4534 OR p_delivery_detail_rec.tp_attribute7 IS NULL THEN
4535 x_delivery_detail_rec.tp_attribute7 :=
4536 p_delivery_detail_rec.tp_attribute7;
4537 END IF;
4538 IF p_delivery_detail_rec.tp_attribute8 <> FND_API.G_MISS_CHAR
4539 OR p_delivery_detail_rec.tp_attribute8 IS NULL THEN
4540 x_delivery_detail_rec.tp_attribute8 :=
4541 p_delivery_detail_rec.tp_attribute8;
4542 END IF;
4543 IF p_delivery_detail_rec.tp_attribute9 <> FND_API.G_MISS_CHAR
4544 OR p_delivery_detail_rec.tp_attribute9 IS NULL THEN
4545 x_delivery_detail_rec.tp_attribute9 :=
4546 p_delivery_detail_rec.tp_attribute9;
4547 END IF;
4548 IF p_delivery_detail_rec.tp_attribute10 <> FND_API.G_MISS_CHAR
4549 OR p_delivery_detail_rec.tp_attribute10 IS NULL THEN
4550 x_delivery_detail_rec.tp_attribute10 :=
4551 p_delivery_detail_rec.tp_attribute10;
4552 END IF;
4553 IF p_delivery_detail_rec.tp_attribute11 <> FND_API.G_MISS_CHAR
4554 OR p_delivery_detail_rec.tp_attribute11 IS NULL THEN
4555 x_delivery_detail_rec.tp_attribute11 :=
4556 p_delivery_detail_rec.tp_attribute11;
4557 END IF;
4558 IF p_delivery_detail_rec.tp_attribute12 <> FND_API.G_MISS_CHAR
4559 OR p_delivery_detail_rec.tp_attribute12 IS NULL THEN
4560 x_delivery_detail_rec.tp_attribute12 :=
4561 p_delivery_detail_rec.tp_attribute12;
4562 END IF;
4563 IF p_delivery_detail_rec.tp_attribute13 <> FND_API.G_MISS_CHAR
4564 OR p_delivery_detail_rec.tp_attribute13 IS NULL THEN
4565 x_delivery_detail_rec.tp_attribute13 :=
4566 p_delivery_detail_rec.tp_attribute13;
4567 END IF;
4568 IF p_delivery_detail_rec.tp_attribute14 <> FND_API.G_MISS_CHAR
4569 OR p_delivery_detail_rec.tp_attribute14 IS NULL THEN
4570 x_delivery_detail_rec.tp_attribute14 :=
4571 p_delivery_detail_rec.tp_attribute14;
4572 END IF;
4573 IF p_delivery_detail_rec.tp_attribute15 <> FND_API.G_MISS_CHAR
4574 OR p_delivery_detail_rec.tp_attribute15 IS NULL THEN
4575 x_delivery_detail_rec.tp_attribute15 :=
4576 p_delivery_detail_rec.tp_attribute15;
4577 END IF;
4578 IF p_delivery_detail_rec.tp_attribute_category <> FND_API.G_MISS_CHAR
4579 OR p_delivery_detail_rec.tp_attribute_category IS NULL THEN
4580 x_delivery_detail_rec.tp_attribute_category :=
4581 p_delivery_detail_rec.tp_attribute_category;
4582 END IF;
4583 IF p_delivery_detail_rec.attribute1 <> FND_API.G_MISS_CHAR
4584 OR p_delivery_detail_rec.attribute1 IS NULL THEN
4585
4586 x_delivery_detail_rec.attribute1 :=
4587 p_delivery_detail_rec.attribute1;
4588 END IF;
4589 IF p_delivery_detail_rec.attribute2 <> FND_API.G_MISS_CHAR
4590 OR p_delivery_detail_rec.attribute2 IS NULL THEN
4591 x_delivery_detail_rec.attribute2 :=
4592 p_delivery_detail_rec.attribute2;
4593 END IF;
4594 IF p_delivery_detail_rec.attribute3 <> FND_API.G_MISS_CHAR
4595 OR p_delivery_detail_rec.attribute3 IS NULL THEN
4596 x_delivery_detail_rec.attribute3 :=
4597 p_delivery_detail_rec.attribute3;
4598 END IF;
4599 IF p_delivery_detail_rec.attribute4 <> FND_API.G_MISS_CHAR
4600 OR p_delivery_detail_rec.attribute4 IS NULL THEN
4601 x_delivery_detail_rec.attribute4 :=
4602 p_delivery_detail_rec.attribute4;
4603 END IF;
4604 IF p_delivery_detail_rec.attribute5 <> FND_API.G_MISS_CHAR
4605 OR p_delivery_detail_rec.attribute5 IS NULL THEN
4606 x_delivery_detail_rec.attribute5 :=
4607 p_delivery_detail_rec.attribute5;
4608 END IF;
4609 IF p_delivery_detail_rec.attribute6 <> FND_API.G_MISS_CHAR
4610 OR p_delivery_detail_rec.attribute6 IS NULL THEN
4611 x_delivery_detail_rec.attribute6 :=
4612 p_delivery_detail_rec.attribute6;
4613 END IF;
4614 IF p_delivery_detail_rec.attribute7 <> FND_API.G_MISS_CHAR
4615 OR p_delivery_detail_rec.attribute7 IS NULL THEN
4616 x_delivery_detail_rec.attribute7 :=
4617 p_delivery_detail_rec.attribute7;
4618 END IF;
4619 IF p_delivery_detail_rec.attribute8 <> FND_API.G_MISS_CHAR
4620 OR p_delivery_detail_rec.attribute8 IS NULL THEN
4621 x_delivery_detail_rec.attribute8 :=
4622 p_delivery_detail_rec.attribute8;
4623 END IF;
4624 IF p_delivery_detail_rec.attribute9 <> FND_API.G_MISS_CHAR
4625 OR p_delivery_detail_rec.attribute9 IS NULL THEN
4626 x_delivery_detail_rec.attribute9 :=
4627 p_delivery_detail_rec.attribute9;
4628 END IF;
4629 IF p_delivery_detail_rec.attribute10 <> FND_API.G_MISS_CHAR
4630 OR p_delivery_detail_rec.attribute10 IS NULL THEN
4631 x_delivery_detail_rec.attribute10 :=
4632 p_delivery_detail_rec.attribute10;
4633 END IF;
4634 IF p_delivery_detail_rec.attribute11 <> FND_API.G_MISS_CHAR
4635 OR p_delivery_detail_rec.attribute11 IS NULL THEN
4636 x_delivery_detail_rec.attribute11 :=
4637 p_delivery_detail_rec.attribute11;
4638 END IF;
4639 IF p_delivery_detail_rec.attribute12 <> FND_API.G_MISS_CHAR
4640 OR p_delivery_detail_rec.attribute12 IS NULL THEN
4641 x_delivery_detail_rec.attribute12 :=
4642 p_delivery_detail_rec.attribute12;
4643 END IF;
4644 IF p_delivery_detail_rec.attribute13 <> FND_API.G_MISS_CHAR
4645 OR p_delivery_detail_rec.attribute13 IS NULL THEN
4646 x_delivery_detail_rec.attribute13 :=
4647 p_delivery_detail_rec.attribute13;
4648 END IF;
4649 IF p_delivery_detail_rec.attribute14 <> FND_API.G_MISS_CHAR
4650 OR p_delivery_detail_rec.attribute14 IS NULL THEN
4651 x_delivery_detail_rec.attribute14 :=
4652 p_delivery_detail_rec.attribute14;
4653 END IF;
4654 IF p_delivery_detail_rec.attribute15 <> FND_API.G_MISS_CHAR
4655 OR p_delivery_detail_rec.attribute15 IS NULL THEN
4656 x_delivery_detail_rec.attribute15 :=
4657 p_delivery_detail_rec.attribute15;
4658 END IF;
4659 IF p_delivery_detail_rec.attribute_category <> FND_API.G_MISS_CHAR
4660 OR p_delivery_detail_rec.attribute_category IS NULL THEN
4661 x_delivery_detail_rec.attribute_category :=
4662 p_delivery_detail_rec.attribute_category;
4663 END IF;
4664
4665 -- Need to enable 'Tracking Number'. This is not a permanently disabled field
4666 IF p_delivery_detail_rec.tracking_number <> FND_API.G_MISS_CHAR
4667 OR p_delivery_detail_rec.tracking_number IS NULL THEN
4668 x_delivery_detail_rec.tracking_number :=
4669 p_delivery_detail_rec.tracking_number;
4670 END IF;
4671
4672 -- J: W/V Changes
4673 IF p_delivery_detail_rec.filled_volume <> FND_API.G_MISS_NUM
4674 OR p_delivery_detail_rec.filled_volume IS NULL THEN
4675 x_delivery_detail_rec.filled_volume :=
4676 p_delivery_detail_rec.filled_volume;
4677 END IF;
4678
4679 IF p_in_rec.caller='WSH_TP_RELEASE' THEN
4680 IF p_delivery_detail_rec.tp_delivery_detail_id <> FND_API.G_MISS_NUM
4681 OR p_delivery_detail_rec.tp_delivery_detail_id IS NULL THEN
4682 x_delivery_detail_rec.tp_delivery_detail_id :=
4683 p_delivery_detail_rec.tp_delivery_detail_id;
4684 END IF;
4685 END IF;
4686
4687
4688 END eliminate_displayonly_fields;
4689
4690 /*----------------------------------------------------------
4691 -- Procedure disable_from_list will update the record x_out_rec
4692 -- and disables the field contained in p_disabled_list.
4693 -----------------------------------------------------------*/
4694
4695 PROCEDURE disable_from_list(
4696 p_disabled_list IN WSH_UTIL_CORE.column_tab_type
4697 , p_in_rec IN wsh_glbl_var_strct_grp.delivery_details_rec_type
4698 , x_out_rec IN OUT NOCOPY wsh_glbl_var_strct_grp.delivery_details_rec_type
4699 , x_return_status OUT NOCOPY VARCHAR2
4700 , x_field_name OUT NOCOPY VARCHAR2
4701
4702 ) IS
4703 BEGIN
4704 --
4705 --
4706 FOR i IN 1..p_disabled_list.COUNT
4707 LOOP
4708 IF p_disabled_list(i) = 'CONTAINER_NAME' THEN
4709 x_out_rec.container_name := p_in_rec.container_name ;
4710 ELSIF p_disabled_list(i) = 'CYCLE_COUNT_QUANTITY' THEN
4711 x_out_rec.cycle_count_quantity := p_in_rec.cycle_count_quantity ;
4712 --
4713 ELSIF p_disabled_list(i) = 'PREFERED_GRADE' THEN
4714 x_out_rec.PREFERRED_GRADE := p_in_rec.PREFERRED_GRADE ;
4715 ELSIF p_disabled_list(i) = 'LPN_ID' THEN
4716 x_out_rec.lpn_id := p_in_rec.lpn_id ;
4717 ELSIF p_disabled_list(i) = 'SRC_REQUESTED_QUANTITY2' THEN
4718 x_out_rec.SRC_REQUESTED_QUANTITY2 := p_in_rec.SRC_REQUESTED_QUANTITY2 ;
4719 ELSIF p_disabled_list(i) = 'SRC_REQUESTED_QUANTITY_UOM2' THEN
4720 x_out_rec.SRC_REQUESTED_QUANTITY_UOM2 := p_in_rec.SRC_REQUESTED_QUANTITY_UOM2 ;
4721 ELSIF p_disabled_list(i) = 'REQUESTED_QUANTITY_UOM2' THEN
4722 x_out_rec.REQUESTED_QUANTITY_UOM2 := p_in_rec.REQUESTED_QUANTITY_UOM2 ;
4723 ELSIF p_disabled_list(i) = 'REQUESTED_QUANTITY2' THEN
4724 x_out_rec.REQUESTED_QUANTITY2 := p_in_rec.REQUESTED_QUANTITY2 ;
4725 ELSIF p_disabled_list(i) = 'QUALITY_CONTROL_QUANTITY2' THEN
4726 x_out_rec.QUALITY_CONTROL_QUANTITY2 := p_in_rec.QUALITY_CONTROL_QUANTITY2 ;
4727 ELSIF p_disabled_list(i) = 'SUBLOT_NUMBER' THEN
4728 --x_out_rec.SUBLOT_NUMBER := p_in_rec.SUBLOT_NUMBER ;
4729 NULL;
4730 ELSIF p_disabled_list(i) = 'RETURNED_QUANTITY2' THEN
4731 x_out_rec.RETURNED_QUANTITY2 := p_in_rec.RETURNED_QUANTITY2 ;
4732 ELSIF p_disabled_list(i) = 'RECEIVED_QUANTITY2' THEN
4733 x_out_rec.RECEIVED_QUANTITY2 := p_in_rec.RECEIVED_QUANTITY2 ;
4734 ELSIF p_disabled_list(i) = 'PICKED_QUANTITY2' THEN
4735 x_out_rec.PICKED_QUANTITY2 := p_in_rec.PICKED_QUANTITY2 ;
4736 ELSIF p_disabled_list(i) = 'TO_SERIAL_NUMBER' THEN
4737 x_out_rec.TO_SERIAL_NUMBER := p_in_rec.TO_SERIAL_NUMBER ;
4738 ELSIF p_disabled_list(i) = 'SERIAL_NUMBER' THEN
4739 x_out_rec.SERIAL_NUMBER := p_in_rec.SERIAL_NUMBER ;
4740 ELSIF p_disabled_list(i) = 'TRANSACTION_TEMP_ID' THEN
4741 x_out_rec.TRANSACTION_TEMP_ID := p_in_rec.TRANSACTION_TEMP_ID ;
4742 ELSIF p_disabled_list(i) = 'REVISION' THEN
4743 x_out_rec.REVISION := p_in_rec.REVISION ;
4744 ELSIF p_disabled_list(i) = 'LOT_NUMBER' THEN
4745 x_out_rec.LOT_NUMBER := p_in_rec.LOT_NUMBER ;
4746 ELSIF p_disabled_list(i) = 'REQUESTED_QUANTITY_UOM' THEN
4747 x_out_rec.REQUESTED_QUANTITY_UOM := p_in_rec.REQUESTED_QUANTITY_UOM ;
4748 --
4749 ELSIF p_disabled_list(i) = 'CYCLE_COUNT_QUANTITY2' THEN
4750 x_out_rec.cycle_count_quantity2 := p_in_rec.cycle_count_quantity2 ;
4751 ELSIF p_disabled_list(i) = 'CANCELLED_QUANTITY2' THEN
4752 x_out_rec.cancelled_quantity2 := p_in_rec.cancelled_quantity2 ;
4753 ELSIF p_disabled_list(i) = 'CANCELLED_QUANTITY' THEN
4754 x_out_rec.cancelled_quantity := p_in_rec.cancelled_quantity ;
4755 ELSIF p_disabled_list(i) = 'INSPECTION_FLAG' THEN
4756 x_out_rec.INSPECTION_FLAG := p_in_rec.INSPECTION_FLAG ;
4757 ELSIF p_disabled_list(i) = 'DESC_FLEX' THEN
4758 x_out_rec.attribute1 := p_in_rec.attribute1 ;
4759 x_out_rec.attribute2 := p_in_rec.attribute2 ;
4760 x_out_rec.attribute3 := p_in_rec.attribute3 ;
4761 x_out_rec.attribute4 := p_in_rec.attribute4 ;
4762 x_out_rec.attribute5 := p_in_rec.attribute5 ;
4763 x_out_rec.attribute6 := p_in_rec.attribute6 ;
4764 x_out_rec.attribute7 := p_in_rec.attribute7 ;
4765 x_out_rec.attribute8 := p_in_rec.attribute8 ;
4766 x_out_rec.attribute9 := p_in_rec.attribute9 ;
4767 x_out_rec.attribute10 := p_in_rec.attribute10 ;
4768 x_out_rec.attribute11 := p_in_rec.attribute11 ;
4769 x_out_rec.attribute12 := p_in_rec.attribute12 ;
4770 x_out_rec.attribute13 := p_in_rec.attribute13 ;
4771 x_out_rec.attribute14 := p_in_rec.attribute14 ;
4772 x_out_rec.attribute15 := p_in_rec.attribute15 ;
4773 x_out_rec.attribute_category := p_in_rec.attribute_category ;
4774 ELSIF p_disabled_list(i) = 'SUBINVENTORY' THEN
4775 x_out_rec.subinventory := p_in_rec.subinventory ;
4776 ELSIF p_disabled_list(i) = 'REVISION' THEN
4777 x_out_rec.revision := p_in_rec.revision ;
4778 ELSIF p_disabled_list(i) = 'LOCATOR_NAME' THEN
4779 x_out_rec.locator_id := p_in_rec.locator_id ;
4780 ELSIF p_disabled_list(i) = 'LOT_NUMBER' THEN
4781 x_out_rec.lot_number := p_in_rec.lot_number;
4782 ELSIF p_disabled_list(i) = 'DELIVERED_QUANTITY2' THEN
4783 x_out_rec.delivered_quantity2 := p_in_rec.delivered_quantity2 ;
4784 ELSIF p_disabled_list(i) = 'DELIVERED_QUANTITY' THEN
4785 x_out_rec.delivered_quantity := p_in_rec.delivered_quantity ;
4786 ELSIF p_disabled_list(i) = 'DETAIL_CONTAINER_ITEM_NAME' THEN
4787 x_out_rec.detail_container_item_id := p_in_rec.detail_container_item_id ;
4788 ELSIF p_disabled_list(i) = 'GROSS_WEIGHT' THEN
4789 x_out_rec.gross_weight := p_in_rec.gross_weight ;
4790 ELSIF p_disabled_list(i) = 'TARE_WEIGHT' THEN
4791 null;
4792 -- J-IB-NPARIKH-{ ---I-bug-fix
4793 ELSIF p_disabled_list(i) = 'NET_WEIGHT' THEN
4794 x_out_rec.net_weight := p_in_rec.net_weight ;
4795 ELSIF p_disabled_list(i) = 'VOLUME' THEN
4796 x_out_rec.VOLUME := p_in_rec.VOLUME ;
4797 -- J-IB-NPARIKH-}
4798 -- J: W/V Changes
4799 ELSIF p_disabled_list(i) = 'FILLED_VOLUME' THEN
4800 x_out_rec.FILLED_VOLUME := p_in_rec.FILLED_VOLUME ;
4801 ELSIF p_disabled_list(i) = 'FILL_PERCENT' THEN
4802 x_out_rec.FILLED_VOLUME := p_in_rec.FILL_PERCENT ;
4803
4804 ELSIF p_disabled_list(i) = 'LOAD_SEQ_NUMBER' THEN
4805 x_out_rec.load_seq_number := p_in_rec.load_seq_number ;
4806 ELSIF p_disabled_list(i) = 'MASTER_CONTAINER_ITEM_NAME' THEN
4807 x_out_rec.master_container_item_id := p_in_rec.master_container_item_id ;
4808 ELSIF p_disabled_list(i) = 'PACKING_INSTRUCTIONS' THEN
4809 x_out_rec.PACKING_INSTRUCTIONS := p_in_rec.PACKING_INSTRUCTIONS ;
4810 ELSIF p_disabled_list(i) = 'SHIPPING_INSTRUCTIONS' THEN
4811 x_out_rec.shipping_instructions := p_in_rec.shipping_instructions ;
4812 ELSIF p_disabled_list(i) = 'SHIPPED_QUANTITY' THEN
4813 x_out_rec.shipped_quantity := p_in_rec.shipped_quantity ;
4814 ELSIF p_disabled_list(i) = 'SEAL_CODE' THEN
4815 x_out_rec.seal_code := p_in_rec.seal_code ;
4816 ELSIF p_disabled_list(i) = 'SHIPPED_QUANTITY2' THEN
4817 x_out_rec.shipped_quantity2 := p_in_rec.shipped_quantity2 ;
4818 ELSIF p_disabled_list(i) = 'TP_FLEXFIELD' THEN
4819 x_out_rec.tp_attribute1 := p_in_rec.tp_attribute1 ;
4820 x_out_rec.tp_attribute2 := p_in_rec.tp_attribute2 ;
4821 x_out_rec.tp_attribute3 := p_in_rec.tp_attribute3 ;
4822 x_out_rec.tp_attribute4 := p_in_rec.tp_attribute4 ;
4823 x_out_rec.tp_attribute5 := p_in_rec.tp_attribute5 ;
4824 x_out_rec.tp_attribute6 := p_in_rec.tp_attribute6 ;
4825 x_out_rec.tp_attribute7 := p_in_rec.tp_attribute7 ;
4826 x_out_rec.tp_attribute8 := p_in_rec.tp_attribute8 ;
4827 x_out_rec.tp_attribute9 := p_in_rec.tp_attribute9 ;
4828 x_out_rec.tp_attribute10 := p_in_rec.tp_attribute10 ;
4829 x_out_rec.tp_attribute11 := p_in_rec.tp_attribute11 ;
4830 x_out_rec.tp_attribute12 := p_in_rec.tp_attribute12 ;
4831 x_out_rec.tp_attribute13 := p_in_rec.tp_attribute13 ;
4832 x_out_rec.tp_attribute14 := p_in_rec.tp_attribute14 ;
4833 x_out_rec.tp_attribute15 := p_in_rec.tp_attribute15 ;
4834 x_out_rec.tp_attribute_category := p_in_rec.tp_attribute_category ;
4835 ELSIF p_disabled_list(i) = 'TRACKING_NUMBER' THEN
4836 x_out_rec.tracking_number := p_in_rec.tracking_number ;
4837 -- Commenting out Tare weight Field to make it enable for non-container
4838 -- items for bug 2890559
4839 /* ELSIF p_disabled_list(i) = 'TARE_WEIGHT'
4840 OR p_disabled_list(i) = 'FULL' THEN*/
4841 ELSIF p_disabled_list(i) = 'FULL' THEN
4842 NULL;
4843 ELSE
4844 -- invalid name
4845 x_field_name := p_disabled_list(i);
4846 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
4847 RETURN;
4848 --
4849 END IF;
4850 END LOOP;
4851 END disable_from_list;
4852
4853 /*----------------------------------------------------------
4854 -- Procedure enable_from_list will update the record x_out_rec for the fields
4855 -- included in p_disabled_list and will enable them
4856 -----------------------------------------------------------*/
4857
4858 PROCEDURE enable_from_list(
4859 p_disabled_list IN WSH_UTIL_CORE.column_tab_type
4860 , p_in_rec IN wsh_glbl_var_strct_grp.delivery_details_rec_type
4861 , x_out_rec IN OUT NOCOPY wsh_glbl_var_strct_grp.delivery_details_rec_type
4862 , x_return_status OUT NOCOPY VARCHAR2
4863 , x_field_name OUT NOCOPY VARCHAR2
4864
4865 ) IS
4866 --Added as a part of fix for bug # 6082324 and bug 7165744 added msi.primary_uom_code to cursor
4867 cursor get_MSI_details (p_inventory_item_id NUMBER,p_delivery_detail_id NUMBER) IS
4868 SELECT msi.container_type_code,msi.maximum_load_weight,msi.primary_uom_code
4869 FROM mtl_system_items msi,wsh_delivery_details wdd
4870 WHERE msi.inventory_item_id (+) = p_inventory_item_id
4871 AND msi.organization_id (+) = wdd.organization_id
4872 AND wdd.container_flag = 'Y'
4873 AND wdd.delivery_detail_id = p_delivery_detail_id;
4874
4875 l_container_type_code VARCHAR2(30);
4876 l_maximum_load_weight NUMBER;
4877 l_cursor_opened_flag NUMBER := 0;
4878 -- End of bug # 6082324
4879 l_requested_quantity_uom VARCHAR2(30); --bug 7165744
4880 BEGIN
4881 --
4882 --
4883 FOR i IN 2..p_disabled_list.COUNT
4884 LOOP
4885 IF p_disabled_list(i) = 'CONTAINER_NAME' THEN
4886 IF p_in_rec.CONTAINER_NAME <> FND_API.G_MISS_CHAR
4887 OR p_in_rec.CONTAINER_NAME IS NULL THEN
4888 x_out_rec.container_name := p_in_rec.container_name ;
4889 END IF;
4890 ELSIF p_disabled_list(i) = 'CYCLE_COUNT_QUANTITY' THEN
4891 IF p_in_rec.cycle_count_quantity <> FND_API.G_MISS_NUM
4892 OR p_in_rec.cycle_count_quantity IS NULL THEN
4893 x_out_rec.cycle_count_quantity := p_in_rec.cycle_count_quantity ;
4894 END IF;
4895 ELSIF p_disabled_list(i) = 'INSPECTION_FLAG' THEN
4896 IF p_in_rec.INSPECTION_FLAG <> FND_API.G_MISS_CHAR
4897 OR p_in_rec.INSPECTION_FLAG IS NULL THEN
4898 x_out_rec.INSPECTION_FLAG := p_in_rec.INSPECTION_FLAG ;
4899 END IF;
4900 ELSIF p_disabled_list(i) = 'CYCLE_COUNT_QUANTITY2' THEN
4901 IF p_in_rec.cycle_count_quantity2 <> FND_API.G_MISS_NUM
4902 OR p_in_rec.cycle_count_quantity2 IS NULL THEN
4903 x_out_rec.cycle_count_quantity2 := p_in_rec.cycle_count_quantity2 ;
4904 END IF;
4905 ELSIF p_disabled_list(i) = 'CANCELLED_QUANTITY2' THEN
4906 IF p_in_rec.cancelled_quantity2 <> FND_API.G_MISS_NUM
4907 OR p_in_rec.cancelled_quantity2 IS NULL THEN
4908 x_out_rec.cancelled_quantity2 := p_in_rec.cancelled_quantity2 ;
4909 END IF;
4910 ELSIF p_disabled_list(i) = 'CANCELLED_QUANTITY' THEN
4911 IF p_in_rec.cancelled_quantity <> FND_API.G_MISS_NUM
4912 OR p_in_rec.cancelled_quantity IS NULL THEN
4913 x_out_rec.cancelled_quantity := p_in_rec.cancelled_quantity ;
4914 END IF;
4915 ELSIF p_disabled_list(i) = 'DELIVERED_QUANTITY2' THEN
4916 IF p_in_rec.delivered_quantity2 <> FND_API.G_MISS_NUM
4917 OR p_in_rec.delivered_quantity2 IS NULL THEN
4918 x_out_rec.delivered_quantity2 := p_in_rec.delivered_quantity2 ;
4919 END IF;
4920 ELSIF p_disabled_list(i) = 'DELIVERED_QUANTITY' THEN
4921 IF p_in_rec.delivered_quantity <> FND_API.G_MISS_NUM
4922 OR p_in_rec.delivered_quantity IS NULL THEN
4923 x_out_rec.delivered_quantity := p_in_rec.delivered_quantity ;
4924 END IF;
4925 ELSIF p_disabled_list(i) = 'DETAIL_CONTAINER_ITEM_NAME' THEN
4926 IF p_in_rec.detail_container_item_id <> FND_API.G_MISS_NUM
4927 OR p_in_rec.detail_container_item_id IS NULL THEN
4928 x_out_rec.detail_container_item_id := p_in_rec.detail_container_item_id ;
4929 END IF;
4930 -- for X-dock
4931 ELSIF p_disabled_list(i) = 'RELEASED_STATUS' THEN
4932 IF p_in_rec.released_status <> FND_API.G_MISS_CHAR
4933 OR p_in_rec.released_status IS NULL THEN
4934 x_out_rec.released_status := p_in_rec.released_status;
4935 END IF;
4936 ELSIF p_disabled_list(i) = 'MOVE_ORDER_LINE_ID' THEN
4937 IF p_in_rec.move_order_line_id <> FND_API.G_MISS_NUM
4938 OR p_in_rec.move_order_line_id IS NULL THEN
4939 x_out_rec.move_order_line_id := p_in_rec.move_order_line_id;
4940 END IF;
4941 --bug# 6689448 (replenishment project)
4942 ELSIF p_disabled_list(i) = 'REPLENISHMENT_STATUS' THEN
4943 IF p_in_rec.REPLENISHMENT_STATUS <> FND_API.G_MISS_CHAR
4944 OR p_in_rec. REPLENISHMENT_STATUS IS NULL THEN
4945 x_out_rec.REPLENISHMENT_STATUS:= p_in_rec.REPLENISHMENT_STATUS;
4946 END IF;
4947 ELSIF p_disabled_list(i) = 'BATCH_ID' THEN
4948 IF p_in_rec.batch_id <> FND_API.G_MISS_NUM
4949 OR p_in_rec.batch_id IS NULL THEN
4950 x_out_rec.batch_id := p_in_rec.batch_id;
4951 END IF;
4952 -- end of X-dock changes
4953 ELSIF p_disabled_list(i) = 'GROSS_WEIGHT' THEN
4954 IF p_in_rec.gross_weight <> FND_API.G_MISS_NUM
4955 OR p_in_rec.gross_weight IS NULL THEN
4956 x_out_rec.gross_weight := p_in_rec.gross_weight ;
4957 END IF;
4958 ELSIF p_disabled_list(i) = 'TARE_WEIGHT' THEN
4959 null;
4960 -- J-IB-NPARIKH-{ --I-bug-fix
4961 ELSIF p_disabled_list(i) = 'NET_WEIGHT' THEN
4962 IF p_in_rec.net_weight <> FND_API.G_MISS_NUM
4963 OR p_in_rec.net_weight IS NULL THEN
4964 x_out_rec.net_weight := p_in_rec.net_weight ;
4965 END IF;
4966 ELSIF p_disabled_list(i) = 'VOLUME' THEN
4967 IF p_in_rec.VOLUME <> FND_API.G_MISS_NUM
4968 OR p_in_rec.VOLUME IS NULL THEN
4969 x_out_rec.VOLUME := p_in_rec.VOLUME ;
4970 END IF;
4971 -- J-IB-NPARIKH-}
4972 -- bug 5077108
4973 ELSIF p_disabled_list(i) = 'INVENTORY_ITEM_ID' THEN
4974 IF p_in_rec.inventory_item_id <> FND_API.G_MISS_NUM
4975 OR p_in_rec.inventory_item_id IS NULL THEN
4976 x_out_rec.inventory_item_id := p_in_rec.inventory_item_id ;
4977 END IF;
4978 -- end bug 5077108
4979
4980 --Bug 5212632 Start
4981 ELSIF p_disabled_list(i) = 'CONTAINER_TYPE_CODE' THEN
4982 IF p_in_rec.container_type_code <> FND_API.G_MISS_CHAR
4983 OR p_in_rec.container_type_code IS NULL THEN
4984
4985 x_out_rec.container_type_code := p_in_rec.container_type_code;
4986 ELSIF (p_in_rec.inventory_item_id <> FND_API.G_MISS_NUM ) THEN
4987 IF l_cursor_opened_flag = 1 THEN
4988 x_out_rec.container_type_code:=l_container_type_code;
4989 ELSE
4990 OPEN get_MSI_details (p_in_rec.inventory_item_id,p_in_rec.delivery_detail_id);
4991 FETCH get_MSI_details INTO l_container_type_code,
4992 l_maximum_load_weight,
4993 l_requested_quantity_uom;
4994 x_out_rec.container_type_code:=l_container_type_code;
4995 CLOSE get_MSI_details ;
4996 l_cursor_opened_flag:=1;
4997 END IF;
4998 END IF;
4999 --Bug 5212632 End
5000 --Bug 7165744
5001 --requested_quantity_uom can be updated for WMS LPNs.
5002 ELSIF p_disabled_list(i) = 'REQUESTED_QUANTITY_UOM' THEN
5003 IF (p_in_rec.inventory_item_id <> FND_API.G_MISS_NUM ) THEN
5004 IF l_cursor_opened_flag = 1 THEN
5005 x_out_rec.requested_quantity_uom:=l_requested_quantity_uom;
5006 ELSE
5007 OPEN get_MSI_details (p_in_rec.inventory_item_id,p_in_rec.delivery_detail_id);
5008 FETCH get_MSI_details INTO l_container_type_code,
5009 l_maximum_load_weight,
5010 l_requested_quantity_uom;
5011 x_out_rec.requested_quantity_uom:=l_requested_quantity_uom;
5012 CLOSE get_MSI_details ;
5013 l_cursor_opened_flag:=1;
5014 END IF;
5015 END IF;
5016 -- end Bug 7165744
5017 --Added the following code as part of fix for bug 6082324
5018 ELSIF p_disabled_list(i) = 'MAXIMUM_LOAD_WEIGHT' THEN
5019 IF p_in_rec.MAXIMUM_LOAD_WEIGHT <> FND_API.G_MISS_NUM
5020 OR p_in_rec.MAXIMUM_LOAD_WEIGHT IS NULL THEN
5021 x_out_rec.MAXIMUM_LOAD_WEIGHT := p_in_rec.MAXIMUM_LOAD_WEIGHT;
5022 ELSIF (p_in_rec.inventory_item_id <> FND_API.G_MISS_NUM ) THEN
5023 IF l_cursor_opened_flag = 1 THEN
5024 x_out_rec.MAXIMUM_LOAD_WEIGHT:=l_maximum_load_weight;
5025 ELSE
5026 OPEN get_MSI_details (p_in_rec.inventory_item_id,p_in_rec.delivery_detail_id);
5027 FETCH get_MSI_details INTO l_container_type_code,
5028 l_maximum_load_weight,
5029 l_requested_quantity_uom;
5030 CLOSE get_MSI_details ;
5031 l_cursor_opened_flag:=1;
5032 x_out_rec.MAXIMUM_LOAD_WEIGHT:=l_maximum_load_weight;
5033 END IF;
5034 END IF;
5035 --End of fix for bug # 6082324
5036
5037
5038 ELSIF p_disabled_list(i) = 'LOCATOR_NAME' THEN
5039 IF p_in_rec.locator_id <> FND_API.G_MISS_NUM
5040 OR p_in_rec.locator_id IS NULL THEN
5041 x_out_rec.locator_id := p_in_rec.locator_id ;
5042 END IF;
5043 ELSIF p_disabled_list(i) = 'LOAD_SEQ_NUMBER' THEN
5044 IF p_in_rec.load_seq_number <> FND_API.G_MISS_NUM
5045 OR p_in_rec.load_seq_number IS NULL THEN
5046 x_out_rec.load_seq_number := p_in_rec.load_seq_number ;
5047 END IF;
5048 ELSIF p_disabled_list(i) = 'LPN_ID' THEN
5049 IF p_in_rec.lpn_id <> FND_API.G_MISS_NUM
5050 OR p_in_rec.lpn_id IS NULL THEN
5051 x_out_rec.lpn_id := p_in_rec.lpn_id ;
5052 END IF;
5053 ELSIF p_disabled_list(i) = 'MASTER_CONTAINER_ITEM_NAME' THEN
5054 IF p_in_rec.master_container_item_id <> FND_API.G_MISS_NUM
5055 OR p_in_rec.master_container_item_id IS NULL THEN
5056 x_out_rec.master_container_item_id := p_in_rec.master_container_item_id ;
5057 END IF;
5058 ELSIF p_disabled_list(i) = 'PACKING_INSTRUCTIONS' THEN
5059 IF p_in_rec.PACKING_INSTRUCTIONS <> FND_API.G_MISS_CHAR
5060 OR p_in_rec.PACKING_INSTRUCTIONS IS NULL THEN
5061 x_out_rec.PACKING_INSTRUCTIONS := p_in_rec.PACKING_INSTRUCTIONS ;
5062 END IF;
5063 ELSIF p_disabled_list(i) = 'PICKED_QUANTITY2' THEN
5064 IF p_in_rec.PICKED_QUANTITY2 <> FND_API.G_MISS_NUM
5065 OR p_in_rec.PICKED_QUANTITY2 IS NULL THEN
5066 x_out_rec.picked_quantity2 := p_in_rec.picked_quantity2 ;
5067 END IF;
5068 ELSIF p_disabled_list(i) = 'REQUESTED_QUANTITY_UOM2' THEN
5069 IF p_in_rec.REQUESTED_QUANTITY_UOM2 <> FND_API.G_MISS_CHAR
5070 OR p_in_rec.REQUESTED_QUANTITY_UOM2 IS NULL THEN
5071 x_out_rec.REQUESTED_QUANTITY_UOM2 := p_in_rec.REQUESTED_QUANTITY_UOM2 ;
5072 END IF;
5073
5074 -- bmso
5075 ELSIF p_disabled_list(i) = 'PREFERED_GRADE' THEN
5076 IF p_in_rec.PREFERRED_GRADE <> FND_API.G_MISS_CHAR
5077 OR p_in_rec.PREFERRED_GRADE IS NULL THEN
5078 x_out_rec.PREFERRED_GRADE := p_in_rec.PREFERRED_GRADE ;
5079 END IF;
5080 ELSIF p_disabled_list(i) = 'SRC_REQUESTED_QUANTITY2' THEN
5081 IF p_in_rec.SRC_REQUESTED_QUANTITY2 <> FND_API.G_MISS_NUM
5082 OR p_in_rec.SRC_REQUESTED_QUANTITY2 IS NULL THEN
5083 x_out_rec.SRC_REQUESTED_QUANTITY2 := p_in_rec.SRC_REQUESTED_QUANTITY2 ;
5084 END IF;
5085 ELSIF p_disabled_list(i) = 'SRC_REQUESTED_QUANTITY_UOM2' THEN
5086 IF p_in_rec.SRC_REQUESTED_QUANTITY_UOM2 <> FND_API.G_MISS_CHAR
5087 OR p_in_rec.SRC_REQUESTED_QUANTITY_UOM2 IS NULL THEN
5088 x_out_rec.SRC_REQUESTED_QUANTITY_UOM2 := p_in_rec.SRC_REQUESTED_QUANTITY_UOM2 ;
5089 END IF;
5090 ELSIF p_disabled_list(i) = 'REQUESTED_QUANTITY2' THEN
5091 IF p_in_rec.REQUESTED_QUANTITY2 <> FND_API.G_MISS_NUM
5092 OR p_in_rec.REQUESTED_QUANTITY2 IS NULL THEN
5093 x_out_rec.REQUESTED_QUANTITY2 := p_in_rec.REQUESTED_QUANTITY2 ;
5094 END IF;
5095 ELSIF p_disabled_list(i) = 'QUALITY_CONTROL_QUANTITY2' THEN
5096 IF p_in_rec.QUALITY_CONTROL_QUANTITY2 <> FND_API.G_MISS_NUM
5097 OR p_in_rec.QUALITY_CONTROL_QUANTITY2 IS NULL THEN
5098 x_out_rec.QUALITY_CONTROL_QUANTITY2 := p_in_rec.QUALITY_CONTROL_QUANTITY2 ;
5099 END IF;
5100 ELSIF p_disabled_list(i) = 'SUBLOT_NUMBER' THEN
5101 NULL;
5102 --IF p_in_rec.SUBLOT_NUMBER <> FND_API.G_MISS_CHAR
5103 --OR p_in_rec.SUBLOT_NUMBER IS NULL THEN
5104 --x_out_rec.SUBLOT_NUMBER := p_in_rec.SUBLOT_NUMBER ;
5105 --END IF;
5106 ELSIF p_disabled_list(i) = 'RETURNED_QUANTITY2' THEN
5107 IF p_in_rec.RETURNED_QUANTITY2 <> FND_API.G_MISS_NUM
5108 OR p_in_rec.RETURNED_QUANTITY2 IS NULL THEN
5109 x_out_rec.RETURNED_QUANTITY2 := p_in_rec.RETURNED_QUANTITY2 ;
5110 END IF;
5111 ELSIF p_disabled_list(i) = 'RECEIVED_QUANTITY2' THEN
5112 IF p_in_rec.RECEIVED_QUANTITY2 <> FND_API.G_MISS_NUM
5113 OR p_in_rec.RECEIVED_QUANTITY2 IS NULL THEN
5114 x_out_rec.RECEIVED_QUANTITY2 := p_in_rec.RECEIVED_QUANTITY2 ;
5115 END IF;
5116 ELSIF p_disabled_list(i) = 'PICKED_QUANTITY2' THEN
5117 IF p_in_rec.PICKED_QUANTITY2 <> FND_API.G_MISS_NUM
5118 OR p_in_rec.PICKED_QUANTITY2 IS NULL THEN
5119 x_out_rec.PICKED_QUANTITY2 := p_in_rec.PICKED_QUANTITY2 ;
5120 END IF;
5121 ELSIF p_disabled_list(i) = 'TO_SERIAL_NUMBER' THEN
5122 IF p_in_rec.TO_SERIAL_NUMBER <> FND_API.G_MISS_CHAR
5123 OR p_in_rec.TO_SERIAL_NUMBER IS NULL THEN
5124 x_out_rec.TO_SERIAL_NUMBER := p_in_rec.TO_SERIAL_NUMBER ;
5125 END IF;
5126 ELSIF p_disabled_list(i) = 'SERIAL_NUMBER' THEN
5127 IF p_in_rec.SERIAL_NUMBER <> FND_API.G_MISS_CHAR
5128 OR p_in_rec.SERIAL_NUMBER IS NULL THEN
5129 x_out_rec.SERIAL_NUMBER := p_in_rec.SERIAL_NUMBER ;
5130 END IF;
5131 ELSIF p_disabled_list(i) = 'TRANSACTION_TEMP_ID' THEN
5132 IF p_in_rec.TRANSACTION_TEMP_ID <> FND_API.G_MISS_NUM
5133 OR p_in_rec.TRANSACTION_TEMP_ID IS NULL THEN
5134 x_out_rec.TRANSACTION_TEMP_ID := p_in_rec.TRANSACTION_TEMP_ID ;
5135 END IF;
5136 ELSIF p_disabled_list(i) = 'REVISION' THEN
5137 IF p_in_rec.REVISION <> FND_API.G_MISS_CHAR
5138 OR p_in_rec.REVISION IS NULL THEN
5139 x_out_rec.REVISION := p_in_rec.REVISION ;
5140 END IF;
5141 ELSIF p_disabled_list(i) = 'LOT_NUMBER' THEN
5142 IF p_in_rec.LOT_NUMBER <> FND_API.G_MISS_CHAR
5143 OR p_in_rec.LOT_NUMBER IS NULL THEN
5144 x_out_rec.LOT_NUMBER := p_in_rec.LOT_NUMBER ;
5145 END IF;
5146 ELSIF p_disabled_list(i) = 'REQUESTED_QUANTITY_UOM' THEN
5147 IF p_in_rec.REQUESTED_QUANTITY_UOM <> FND_API.G_MISS_CHAR
5148 OR p_in_rec.REQUESTED_QUANTITY_UOM IS NULL THEN
5149 x_out_rec.REQUESTED_QUANTITY_UOM := p_in_rec.REQUESTED_QUANTITY_UOM ;
5150 END IF;
5151 --
5152 ELSIF p_disabled_list(i) = 'SHIPPING_INSTRUCTIONS' THEN
5153 IF p_in_rec.shipping_instructions <> FND_API.G_MISS_CHAR
5154 OR p_in_rec.shipping_instructions IS NULL THEN
5155 x_out_rec.shipping_instructions := p_in_rec.shipping_instructions ;
5156 END IF;
5157 ELSIF p_disabled_list(i) = 'SHIPPED_QUANTITY' THEN
5158 IF p_in_rec.shipped_quantity <> FND_API.G_MISS_NUM
5159 OR p_in_rec.shipped_quantity IS NULL THEN
5160 x_out_rec.shipped_quantity := p_in_rec.shipped_quantity ;
5161 END IF;
5162 -- muom: Allow updation of picked quantity (when fulfillment base is secondary)
5163 ELSIF p_disabled_list(i) = 'PICKED_QUANTITY' THEN
5164 IF p_in_rec.PICKED_quantity <> FND_API.G_MISS_NUM
5165 OR p_in_rec.PICKED_quantity IS NULL THEN
5166 x_out_rec.PICKED_quantity := p_in_rec.PICKED_quantity ;
5167 END IF;
5168 ELSIF p_disabled_list(i) = 'SEAL_CODE' THEN
5169 IF p_in_rec.seal_code <> FND_API.G_MISS_CHAR
5170 OR p_in_rec.seal_code IS NULL THEN
5171 x_out_rec.seal_code := p_in_rec.seal_code ;
5172 END IF;
5173 ELSIF p_disabled_list(i) = 'SHIPPED_QUANTITY2' THEN
5174 IF p_in_rec.shipped_quantity2 <> FND_API.G_MISS_NUM
5175 OR p_in_rec.shipped_quantity2 IS NULL THEN
5176 x_out_rec.shipped_quantity2 := p_in_rec.shipped_quantity2 ;
5177 END IF;
5178 ELSIF p_disabled_list(i) = 'SUBINVENTORY' THEN
5179 IF p_in_rec.subinventory <> FND_API.G_MISS_CHAR
5180 OR p_in_rec.subinventory IS NULL THEN
5181 x_out_rec.subinventory := p_in_rec.subinventory ;
5182 END IF;
5183 -- TPW - Distributed changes
5184 ELSIF p_disabled_list(i) = 'REVISION' THEN
5185 IF p_in_rec.revision <> FND_API.G_MISS_CHAR
5186 OR p_in_rec.revision IS NULL THEN
5187 x_out_rec.revision := p_in_rec.revision ;
5188 END IF;
5189 --Bugfix 6939348 start
5190 ELSIF p_disabled_list(i) = 'LOT_NUMBER' THEN
5191 IF p_in_rec.lot_number <> FND_API.G_MISS_CHAR
5192 OR p_in_rec.lot_number IS NULL THEN
5193 x_out_rec.lot_number := p_in_rec.lot_number;
5194 END IF;
5195 -- Bugfix 6939348 end
5196 ELSIF p_disabled_list(i) = 'TRACKING_NUMBER' THEN
5197 IF p_in_rec.tracking_number <> FND_API.G_MISS_CHAR
5198 OR p_in_rec.tracking_number IS NULL THEN
5199 x_out_rec.tracking_number := p_in_rec.tracking_number ;
5200 END IF;
5201 ELSIF p_disabled_list(i) = 'SHIP_METHOD_CODE' THEN
5202 IF p_in_rec.ship_method_code <> FND_API.G_MISS_CHAR
5203 OR p_in_rec.ship_method_code IS NULL THEN
5204 x_out_rec.ship_method_code := p_in_rec.ship_method_code ;
5205 END IF;
5206 ELSIF p_disabled_list(i) = 'CARRIER_ID' THEN
5207 IF p_in_rec.carrier_id <> FND_API.G_MISS_NUM
5208 OR p_in_rec.carrier_id IS NULL THEN
5209 x_out_rec.carrier_id := p_in_rec.carrier_id ;
5210 END IF;
5211 ELSIF p_disabled_list(i) = 'MODE_OF_TRANSPORT' THEN
5212 IF p_in_rec.ship_method_code <> FND_API.G_MISS_CHAR
5213 OR p_in_rec.mode_of_transport IS NULL THEN
5214 x_out_rec.mode_of_transport := p_in_rec.mode_of_transport ;
5215 END IF;
5216 ELSIF p_disabled_list(i) = 'SERVICE_LEVEL' THEN
5217 IF p_in_rec.service_level <> FND_API.G_MISS_CHAR
5218 OR p_in_rec.service_level IS NULL THEN
5219 x_out_rec.service_level := p_in_rec.service_level ;
5220 END IF;
5221 ELSIF p_disabled_list(i) = 'ITEM_NUMBER' THEN
5222 IF nvl(p_in_rec.inventory_item_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM
5223 THEN
5224 x_out_rec.inventory_item_id := p_in_rec.inventory_item_id ;
5225 END IF;
5226 ELSIF p_disabled_list(i) = 'DESC_FLEX' THEN
5227 IF p_in_rec.attribute1 <> FND_API.G_MISS_CHAR
5228 OR p_in_rec.attribute1 IS NULL THEN
5229 x_out_rec.attribute1 := p_in_rec.attribute1 ;
5230 END IF;
5231 IF p_in_rec.attribute2 <> FND_API.G_MISS_CHAR
5232 OR p_in_rec.attribute2 IS NULL THEN
5233 x_out_rec.attribute2 := p_in_rec.attribute2 ;
5234 END IF;
5235 IF p_in_rec.attribute3 <> FND_API.G_MISS_CHAR
5236 OR p_in_rec.attribute3 IS NULL THEN
5237 x_out_rec.attribute3 := p_in_rec.attribute3 ;
5238 END IF;
5239 IF p_in_rec.attribute4 <> FND_API.G_MISS_CHAR
5240 OR p_in_rec.attribute4 IS NULL THEN
5241 x_out_rec.attribute4 := p_in_rec.attribute4 ;
5242 END IF;
5243 IF p_in_rec.attribute5 <> FND_API.G_MISS_CHAR
5244 OR p_in_rec.attribute5 IS NULL THEN
5245 x_out_rec.attribute5 := p_in_rec.attribute5 ;
5246 END IF;
5247 IF p_in_rec.attribute6 <> FND_API.G_MISS_CHAR
5248 OR p_in_rec.attribute6 IS NULL THEN
5249 x_out_rec.attribute6 := p_in_rec.attribute6 ;
5250 END IF;
5251 IF p_in_rec.attribute7 <> FND_API.G_MISS_CHAR
5252 OR p_in_rec.attribute7 IS NULL THEN
5253 x_out_rec.attribute7 := p_in_rec.attribute7 ;
5254 END IF;
5255 IF p_in_rec.attribute8 <> FND_API.G_MISS_CHAR
5256 OR p_in_rec.attribute8 IS NULL THEN
5257 x_out_rec.attribute8 := p_in_rec.attribute8 ;
5258 END IF;
5259 IF p_in_rec.attribute9 <> FND_API.G_MISS_CHAR
5260 OR p_in_rec.attribute9 IS NULL THEN
5261 x_out_rec.attribute9 := p_in_rec.attribute9 ;
5262 END IF;
5263 IF p_in_rec.attribute10 <> FND_API.G_MISS_CHAR
5264 OR p_in_rec.attribute10 IS NULL THEN
5265 x_out_rec.attribute10 := p_in_rec.attribute10 ;
5266 END IF;
5267 IF p_in_rec.attribute11 <> FND_API.G_MISS_CHAR
5268 OR p_in_rec.attribute11 IS NULL THEN
5269 x_out_rec.attribute11 := p_in_rec.attribute11 ;
5270 END IF;
5271 IF p_in_rec.attribute12 <> FND_API.G_MISS_CHAR
5272 OR p_in_rec.attribute12 IS NULL THEN
5273 x_out_rec.attribute12 := p_in_rec.attribute12 ;
5274 END IF;
5275 IF p_in_rec.attribute13 <> FND_API.G_MISS_CHAR
5276 OR p_in_rec.attribute13 IS NULL THEN
5277 x_out_rec.attribute13 := p_in_rec.attribute13 ;
5278 END IF;
5279 IF p_in_rec.attribute14 <> FND_API.G_MISS_CHAR
5280 OR p_in_rec.attribute14 IS NULL THEN
5281 x_out_rec.attribute14 := p_in_rec.attribute14 ;
5282 END IF;
5283 IF p_in_rec.attribute15 <> FND_API.G_MISS_CHAR
5284 OR p_in_rec.attribute15 IS NULL THEN
5285 x_out_rec.attribute15 := p_in_rec.attribute15 ;
5286 END IF;
5287 IF p_in_rec.attribute_category <> FND_API.G_MISS_CHAR
5288 OR p_in_rec.attribute_category IS NULL THEN
5289 x_out_rec.attribute_category := p_in_rec.attribute_category ;
5290 END IF;
5291 ELSIF p_disabled_list(i) = 'TP_FLEXFIELD' THEN
5292 IF p_in_rec.tp_attribute1 <> FND_API.G_MISS_CHAR
5293 OR p_in_rec.tp_attribute1 IS NULL THEN
5294 x_out_rec.tp_attribute1 := p_in_rec.tp_attribute1 ;
5295 END IF;
5296 IF p_in_rec.tp_attribute2 <> FND_API.G_MISS_CHAR
5297 OR p_in_rec.tp_attribute2 IS NULL THEN
5298 x_out_rec.tp_attribute2 := p_in_rec.tp_attribute2 ;
5299 END IF;
5300 IF p_in_rec.tp_attribute3 <> FND_API.G_MISS_CHAR
5301 OR p_in_rec.tp_attribute3 IS NULL THEN
5302 x_out_rec.tp_attribute3 := p_in_rec.tp_attribute3 ;
5303 END IF;
5304 IF p_in_rec.tp_attribute4 <> FND_API.G_MISS_CHAR
5305 OR p_in_rec.tp_attribute4 IS NULL THEN
5306 x_out_rec.tp_attribute4 := p_in_rec.tp_attribute4 ;
5307 END IF;
5308 IF p_in_rec.tp_attribute5 <> FND_API.G_MISS_CHAR
5309 OR p_in_rec.tp_attribute5 IS NULL THEN
5310 x_out_rec.tp_attribute5 := p_in_rec.tp_attribute5 ;
5311 END IF;
5312 IF p_in_rec.tp_attribute6 <> FND_API.G_MISS_CHAR
5313 OR p_in_rec.tp_attribute6 IS NULL THEN
5314 x_out_rec.tp_attribute6 := p_in_rec.tp_attribute6 ;
5315 END IF;
5316 IF p_in_rec.tp_attribute7 <> FND_API.G_MISS_CHAR
5317 OR p_in_rec.tp_attribute7 IS NULL THEN
5318 x_out_rec.tp_attribute7 := p_in_rec.tp_attribute7 ;
5319 END IF;
5320 IF p_in_rec.tp_attribute8 <> FND_API.G_MISS_CHAR
5321 OR p_in_rec.tp_attribute8 IS NULL THEN
5322 x_out_rec.tp_attribute8 := p_in_rec.tp_attribute8 ;
5323 END IF;
5324 IF p_in_rec.tp_attribute9 <> FND_API.G_MISS_CHAR
5325 OR p_in_rec.tp_attribute9 IS NULL THEN
5326 x_out_rec.tp_attribute9 := p_in_rec.tp_attribute9 ;
5327 END IF;
5328 IF p_in_rec.tp_attribute10 <> FND_API.G_MISS_CHAR
5329 OR p_in_rec.tp_attribute10 IS NULL THEN
5330 x_out_rec.tp_attribute10 := p_in_rec.tp_attribute10 ;
5331 END IF;
5332 IF p_in_rec.tp_attribute11 <> FND_API.G_MISS_CHAR
5333 OR p_in_rec.tp_attribute11 IS NULL THEN
5334 x_out_rec.tp_attribute11 := p_in_rec.tp_attribute11 ;
5335 END IF;
5336 IF p_in_rec.tp_attribute12 <> FND_API.G_MISS_CHAR
5337 OR p_in_rec.tp_attribute12 IS NULL THEN
5338 x_out_rec.tp_attribute12 := p_in_rec.tp_attribute12 ;
5339 END IF;
5340 IF p_in_rec.tp_attribute13 <> FND_API.G_MISS_CHAR
5341 OR p_in_rec.tp_attribute13 IS NULL THEN
5342 x_out_rec.tp_attribute13 := p_in_rec.tp_attribute13 ;
5343 END IF;
5344 IF p_in_rec.tp_attribute14 <> FND_API.G_MISS_CHAR
5345 OR p_in_rec.tp_attribute14 IS NULL THEN
5346 x_out_rec.tp_attribute14 := p_in_rec.tp_attribute14 ;
5347 END IF;
5348 IF p_in_rec.tp_attribute15 <> FND_API.G_MISS_CHAR
5349 OR p_in_rec.tp_attribute15 IS NULL THEN
5350 x_out_rec.tp_attribute15 := p_in_rec.tp_attribute15 ;
5351 END IF;
5352 IF p_in_rec.tp_attribute_category <> FND_API.G_MISS_CHAR
5353 OR p_in_rec.tp_attribute_category IS NULL THEN
5354 x_out_rec.tp_attribute_category := p_in_rec.tp_attribute_category ;
5355 END IF;
5356 -- Commenting out Tare Weight field to make it enable for
5357 -- non-container items for bug 2890559
5358 /* ELSIF p_disabled_list(i) = 'TARE_WEIGHT' THEN
5359 NULL;*/
5360 ELSE
5361 -- invalid name
5362 x_field_name := p_disabled_list(i);
5363 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
5364 RETURN;
5365 --
5366 END IF;
5367 END LOOP;
5368 END enable_from_list;
5369
5370 --
5371 -- Overloaded procedure
5372 --
5373 PROCEDURE Get_Disabled_List (
5374 p_delivery_detail_rec IN wsh_glbl_var_strct_grp.delivery_details_rec_type
5375 , p_delivery_id IN NUMBER
5376 , p_in_rec IN wsh_glbl_var_strct_grp.detailInRecType
5377 , x_return_status OUT NOCOPY VARCHAR2
5378 , x_msg_count OUT NOCOPY NUMBER
5379 , x_msg_data OUT NOCOPY VARCHAR2
5380 , x_delivery_detail_rec OUT NOCOPY wsh_glbl_var_strct_grp.delivery_details_rec_type
5381 )
5382 IS
5383 l_disabled_list WSH_UTIL_CORE.column_tab_type;
5384 l_db_col_rec wsh_glbl_var_strct_grp.delivery_details_rec_type;
5385 l_return_status VARCHAR2(30);
5386 l_field_name VARCHAR2(100);
5387 j NUMBER := 0;
5388 l_status_code VARCHAR2(3);
5389 l_released_status VARCHAR2(1);
5390 l_lpn_id NUMBER;
5391 l_all_disabled VARCHAR2(1):='N';
5392 l_inv_controls WSH_DELIVERY_DETAILS_INV.inv_control_flag_rec;
5393 l_inventory_item_id NUMBER;
5394 l_organization_id NUMBER;
5395 l_pickable_flag VARCHAR2(1);
5396 l_subinventory VARCHAR2(30);
5397 i NUMBER;
5398 -- muom
5399 l_fulfillment_base VARCHAR2(1);
5400
5401 l_debug_on BOOLEAN;
5402 l_module_name CONSTANT VARCHAR2(100) :=
5403 'wsh.plsql.' || G_PKG_NAME || '.' || 'GET_DISABLED_LIST';
5404
5405
5406 CURSOR get_delivery_status IS
5407 SELECT status_code
5408 FROM wsh_new_deliveries
5409 WHERE delivery_id = p_delivery_id;
5410
5411
5412 CURSOR c_tbl_rec IS
5413 SELECT delivery_detail_id
5414 ,source_code
5415 ,source_header_id
5416 ,source_line_id
5417 ,customer_id
5418 ,sold_to_contact_id
5419 ,inventory_item_id
5420 ,item_description
5421 ,hazard_class_id
5422 ,country_of_origin
5423 ,classification
5424 ,ship_from_location_id
5425 ,ship_to_location_id
5426 ,ship_to_contact_id
5427 ,ship_to_site_use_id
5428 ,deliver_to_location_id
5429 ,deliver_to_contact_id
5430 ,deliver_to_site_use_id
5431 ,intmed_ship_to_location_id
5432 ,intmed_ship_to_contact_id
5433 ,hold_code
5434 ,ship_tolerance_above
5435 ,ship_tolerance_below
5436 ,requested_quantity
5437 ,shipped_quantity
5438 ,delivered_quantity
5439 ,requested_quantity_uom
5440 ,subinventory
5441 ,revision
5442 ,lot_number
5443 ,customer_requested_lot_flag
5444 ,serial_number
5445 ,locator_id
5446 ,date_requested
5447 ,date_scheduled
5448 ,master_container_item_id
5449 ,detail_container_item_id
5450 ,load_seq_number
5451 ,ship_method_code
5452 ,carrier_id
5453 ,freight_terms_code
5454 ,shipment_priority_code
5455 ,fob_code
5456 ,customer_item_id
5457 ,dep_plan_required_flag
5458 ,customer_prod_seq
5459 ,customer_dock_code
5460 ,cust_model_serial_number
5461 ,customer_job
5462 ,customer_production_line
5463 ,net_weight
5464 ,weight_uom_code
5465 ,volume
5466 ,volume_uom_code
5467 ,tp_attribute_category
5468 ,tp_attribute1
5469 ,tp_attribute2
5470 ,tp_attribute3
5471 ,tp_attribute4
5472 ,tp_attribute5
5473 ,tp_attribute6
5474 ,tp_attribute7
5475 ,tp_attribute8
5476 ,tp_attribute9
5477 ,tp_attribute10
5478 ,tp_attribute11
5479 ,tp_attribute12
5480 ,tp_attribute13
5481 ,tp_attribute14
5482 ,tp_attribute15
5483 ,attribute_category
5484 ,attribute1
5485 ,attribute2
5486 ,attribute3
5487 ,attribute4
5488 ,attribute5
5489 ,attribute6
5490 ,attribute7
5491 ,attribute8
5492 ,attribute9
5493 ,attribute10
5494 ,attribute11
5495 ,attribute12
5496 ,attribute13
5497 ,attribute14
5498 ,attribute15
5499 ,created_by
5500 ,creation_date
5501 ,sysdate
5502 ,FND_GLOBAL.LOGIN_ID
5503 ,FND_GLOBAL.USER_ID
5504 ,program_application_id
5505 ,program_id
5506 ,program_update_date
5507 ,request_id
5508 ,mvt_stat_status
5509 ,p_delivery_detail_rec.released_flag
5510 ,organization_id
5511 ,transaction_temp_id
5512 ,ship_set_id
5513 ,arrival_set_id
5514 ,ship_model_complete_flag
5515 ,top_model_line_id
5516 ,source_header_number
5517 ,source_header_type_id
5518 ,source_header_type_name
5519 ,cust_po_number
5520 ,ato_line_id
5521 ,src_requested_quantity
5522 ,src_requested_quantity_uom
5523 ,move_order_line_id
5524 ,cancelled_quantity
5525 ,quality_control_quantity
5526 ,cycle_count_quantity
5527 ,tracking_number
5528 ,movement_id
5529 ,shipping_instructions
5530 ,packing_instructions
5531 ,project_id
5532 ,task_id
5533 ,org_id
5534 ,oe_interfaced_flag
5535 ,split_from_delivery_detail_id
5536 ,inv_interfaced_flag
5537 ,source_line_number
5538 ,inspection_flag
5539 ,released_status
5540 ,container_flag
5541 ,container_type_code
5542 ,container_name
5543 ,fill_percent
5544 ,gross_weight
5545 ,master_serial_number
5546 ,maximum_load_weight
5547 ,maximum_volume
5548 ,minimum_fill_percent
5549 ,seal_code
5550 ,unit_number
5551 ,unit_price
5552 ,currency_code
5553 ,freight_class_cat_id
5554 ,commodity_code_cat_id
5555 ,preferred_grade
5556 ,src_requested_quantity2
5557 ,src_requested_quantity_uom2
5558 ,requested_quantity2
5559 ,shipped_quantity2
5560 ,delivered_quantity2
5561 ,cancelled_quantity2
5562 ,quality_control_quantity2
5563 ,cycle_count_quantity2
5564 ,requested_quantity_uom2
5565 -- HW OPMCONV - No need for sublot_number
5566 -- ,sublot_number
5567 ,lpn_id
5568 ,pickable_flag
5569 ,original_subinventory
5570 ,to_serial_number
5571 ,picked_quantity
5572 ,picked_quantity2
5573 ,received_quantity
5574 ,received_quantity2
5575 ,source_line_set_id
5576 ,batch_id
5577 ,p_delivery_detail_rec.ROWID
5578 ,transaction_id
5579 /*J Inbound Logistics new columns. jckwok*/
5580 ,vendor_id
5581 ,ship_from_site_id
5582 ,nvl(line_direction, 'O')
5583 ,party_id
5584 ,routing_req_id
5585 ,shipping_control
5586 ,source_blanket_reference_id
5587 ,source_blanket_reference_num
5588 ,po_shipment_line_id
5589 ,po_shipment_line_number
5590 ,returned_quantity
5591 ,returned_quantity2
5592 ,rcv_shipment_line_id
5593 ,source_line_type_code
5594 ,supplier_item_number
5595 /* J TP Release : New columns ttrichy*/
5596 ,nvl(IGNORE_FOR_PLANNING, 'N') ignore_for_planning
5597 ,EARLIEST_PICKUP_DATE
5598 ,LATEST_PICKUP_DATE
5599 ,EARLIEST_DROPOFF_DATE
5600 ,LATEST_DROPOFF_DATE
5601 ,REQUEST_DATE_TYPE_CODE
5602 ,tp_delivery_detail_id
5603 ,source_document_type_id
5604 -- J: W/V Changes
5605 ,unit_weight
5606 ,unit_volume
5607 ,filled_volume
5608 ,wv_frozen_flag
5609 ,mode_of_transport
5610 ,service_level
5611 /*J IB: asutar*/
5612 ,po_revision_number
5613 ,release_revision_number
5614 ,replenishment_status --bug# 6689448 (replenishment project)
5615 -- Standalone Project Start
5616 ,original_lot_number
5617 ,reference_number
5618 ,reference_line_number
5619 ,reference_line_quantity
5620 ,reference_line_quantity_uom
5621 ,original_revision
5622 ,original_locator_id
5623 -- Standalone Project End
5624 -- TPW - Distributed Organization Changes - Start
5625 ,shipment_batch_id
5626 ,shipment_line_number
5627 ,reference_line_id
5628 -- TPW - Distributed Organization Changes - End
5629 ,client_id -- LSP PROJECT : Added just for compatibility (not used anywhere)
5630 ,consignee_flag --RTV changes
5631 FROM wsh_delivery_details
5632 WHERE delivery_detail_id = p_delivery_detail_rec.delivery_detail_id;
5633
5634 e_dp_no_entity EXCEPTION;
5635 e_bad_field EXCEPTION;
5636 e_all_disabled EXCEPTION ;
5637
5638 l_caller VARCHAR2(32767);
5639 l_wms_org VARCHAR2(100) := 'N';
5640
5641 BEGIN
5642 --
5643 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
5644 --
5645 IF l_debug_on IS NULL
5646 THEN
5647 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
5648 END IF;
5649 --
5650 IF l_debug_on THEN
5651 WSH_DEBUG_SV.push(l_module_name);
5652 --
5653 WSH_DEBUG_SV.log(l_module_name,'DELIVERY_DETAIL_ID',p_delivery_detail_rec.DELIVERY_DETAIL_ID);
5654 WSH_DEBUG_SV.log(l_module_name,'P_DELIVERY_ID',P_DELIVERY_ID);
5655 WSH_DEBUG_SV.log(l_module_name,'p_action',p_in_rec.action_code);
5656 wsh_debug_sv.log(l_module_name, 'Caller', p_in_rec.caller);
5657 END IF;
5658 --
5659 x_return_status := FND_API.G_RET_STS_SUCCESS;
5660 --
5661 IF p_in_rec.action_code = 'CREATE' THEN
5662 IF l_debug_on THEN
5663 WSH_DEBUG_SV.log(l_module_name,'calling eliminate_displayonly_fields');
5664 END IF;
5665 --
5666 -- nothing else need to be disabled
5667 --
5668 eliminate_displayonly_fields (p_delivery_detail_rec, p_in_rec, x_delivery_detail_rec);
5669 IF l_debug_on THEN
5670 WSH_DEBUG_SV.log(l_module_name,'x_return_status',x_return_status);
5671 WSH_DEBUG_SV.pop(l_module_name);
5672 END IF;
5673 -- RETURN; --public api changes
5674 --
5675 ELSIF p_in_rec.action_code = 'UPDATE' THEN
5676 --
5677 l_caller := p_in_rec.caller;
5678 IF (l_caller like 'FTE%') THEN
5679 l_caller := 'WSH_PUB';
5680 END IF;
5681
5682 -- Added for bug 4399278, 4418754
5683 IF ( p_in_rec.caller = 'WSH_PUB' and
5684 p_delivery_detail_rec.subinventory is not null and
5685 p_delivery_detail_rec.subinventory <> FND_API.G_MISS_CHAR ) THEN
5686 G_SUBINVENTORY := p_delivery_detail_rec.subinventory;
5687 END IF;
5688
5689 Get_Disabled_List( p_delivery_detail_rec.DELIVERY_DETAIL_ID
5690 , p_delivery_id
5691 , 'FORM'
5692 , x_return_status
5693 , l_disabled_list
5694 , x_msg_count
5695 , x_msg_data
5696 , l_caller --public api changes
5697 );
5698 --
5699 IF x_return_status = WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR OR
5700 x_return_status = WSH_UTIL_CORE.G_RET_STS_ERROR
5701 THEN
5702 --
5703 IF l_debug_on THEN
5704 WSH_DEBUG_SV.log(l_module_name,'x_return_status',x_return_status);
5705 WSH_DEBUG_SV.pop(l_module_name);
5706 END IF;
5707 RETURN;
5708 --
5709 END IF;
5710 --
5711 IF l_disabled_list.COUNT = 1 THEN
5712 IF l_disabled_list(1) = 'FULL' THEN
5713 l_all_disabled :='Y';
5714 --Everything is disabled
5715 END IF;
5716 END IF;
5717
5718 OPEN c_tbl_rec;
5719 FETCH c_tbl_rec INTO x_delivery_detail_rec;
5720 IF c_tbl_rec%NOTFOUND THEN
5721 --
5722 CLOSE c_tbl_rec;
5723 RAISE e_dp_no_entity;
5724 --
5725 END IF;
5726 CLOSE c_tbl_rec;
5727
5728 --
5729 l_released_status := x_delivery_detail_rec.released_status;
5730
5731 IF (l_disabled_list(1) <> 'FULL') or (l_disabled_list.COUNT <> 0) THEN
5732
5733 i := l_disabled_list.COUNT;
5734
5735 IF (l_released_status = 'Y') THEN
5736
5737 IF p_delivery_detail_rec.inventory_item_id = FND_API.G_MISS_NUM THEN
5738
5739 l_inventory_item_id := x_delivery_detail_rec.inventory_item_id;
5740
5741 ELSE
5742
5743 l_inventory_item_id := p_delivery_detail_rec.inventory_item_id;
5744
5745 END IF;
5746 IF p_delivery_detail_rec.organization_id = FND_API.G_MISS_NUM THEN
5747
5748 l_organization_id := x_delivery_detail_rec.organization_id;
5749
5750 ELSE
5751
5752 l_organization_id := p_delivery_detail_rec.organization_id;
5753
5754 END IF;
5755 IF p_delivery_detail_rec.pickable_flag = FND_API.G_MISS_CHAR THEN
5756
5757 l_pickable_flag := x_delivery_detail_rec.pickable_flag;
5758
5759 ELSE
5760
5761 l_pickable_flag := p_delivery_detail_rec.pickable_flag;
5762
5763 END IF;
5764 IF p_delivery_detail_rec.subinventory = FND_API.G_MISS_CHAR THEN
5765
5766 l_subinventory := x_delivery_detail_rec.subinventory;
5767
5768
5769 ELSE
5770
5771 l_subinventory := p_delivery_detail_rec.subinventory;
5772
5773 END IF;
5774
5775 END IF; -- if l_released_status...
5776
5777 END IF;
5778
5779
5780
5781 l_lpn_id := x_delivery_detail_rec.lpn_id;
5782
5783 IF l_debug_on THEN
5784 WSH_DEBUG_SV.log(l_module_name,'list.COUNT',l_disabled_list.COUNT);
5785 END IF;
5786
5787 IF l_disabled_list.COUNT = 0 THEN
5788
5789 --
5790 IF l_debug_on THEN
5791 WSH_DEBUG_SV.log(l_module_name,'calling eliminate_displayonly_fields');
5792 END IF;
5793 --
5794 -- nothing else need to be disabled
5795 --
5796 eliminate_displayonly_fields (p_delivery_detail_rec, p_in_rec, x_delivery_detail_rec);
5797
5798 ELSIF l_disabled_list(1) = 'FULL' THEN
5799 IF l_disabled_list.COUNT > 1 THEN
5800
5801 IF l_debug_on THEN
5802 FOR i in 1..l_disabled_list.COUNT
5803 LOOP
5804 WSH_DEBUG_SV.log(l_module_name,'list values',l_disabled_list(i));
5805 END LOOP;
5806 WSH_DEBUG_SV.log(l_module_name,'calling enable_from_list');
5807 END IF;
5808 --enable the columns matching the l_disabled_list
5809 enable_from_list(l_disabled_list,
5810 p_delivery_detail_rec,
5811 x_delivery_detail_rec,
5812 l_return_status,
5813 l_field_name);
5814 IF l_return_status = WSH_UTIL_CORE.G_RET_STS_ERROR THEN
5815 RAISE e_bad_field;
5816 END IF;
5817 END IF;
5818 ELSE -- list.count > 1 and list(1) <> 'FULL'
5819 l_db_col_rec := x_delivery_detail_rec ;
5820 --
5821 FOR i in 1..l_disabled_list.COUNT
5822 LOOP
5823 IF l_debug_on THEN
5824 WSH_DEBUG_SV.log(l_module_name,'list values',l_disabled_list(i));
5825 END IF;
5826 -- Added for bug 4399278, 4418754
5827 IF ( p_in_rec.caller = 'WSH_PUB' and
5828 l_disabled_list(i) = 'LOCATOR_NAME' and
5829 l_db_col_rec.locator_id is not null and
5830 --Modified for bug 4560576, 4701803
5831 l_db_col_rec.released_status = 'Y' and
5832 WSH_DELIVERY_DETAILS_INV.get_reservable_flag (
5833 x_item_id => l_inventory_item_id,
5834 x_organization_id => l_organization_id,
5835 x_pickable_flag => l_pickable_flag ) = 'N' )
5836 THEN
5837 l_db_col_rec.locator_id := NULL;
5838 END IF;
5839 END LOOP;
5840
5841 IF l_debug_on THEN
5842 WSH_DEBUG_SV.log(l_module_name,'First element is not FULL');
5843 WSH_DEBUG_SV.log(l_module_name,'calling eliminate_displayonly_fields');
5844 END IF;
5845 --
5846 eliminate_displayonly_fields (p_delivery_detail_rec, p_in_rec, x_delivery_detail_rec);
5847 --
5848 IF l_debug_on THEN
5849 WSH_DEBUG_SV.log(l_module_name,'calling disable_from_list');
5850 END IF;
5851 -- The fileds in the list are getting disabled
5852 disable_from_list(l_disabled_list,
5853 l_db_col_rec,
5854 x_delivery_detail_rec,
5855 l_return_status,
5856 l_field_name);
5857 IF l_return_status = WSH_UTIL_CORE.G_RET_STS_ERROR THEN
5858 RAISE e_bad_field;
5859 END IF;
5860 END IF;
5861
5862 -- Now enable/disable the fields that need to be enabled/disabled
5863 -- based on the caller.
5864
5865 l_disabled_list.delete;
5866 -- rebuild the list according to the caller
5867
5868 IF p_in_rec.caller like 'WMS%' THEN
5869
5870 j:=j+1; l_disabled_list(j) := 'FULL';
5871 -- Only the elements in the list will be enabled.
5872 -- The other fields will remain enabled/disabled as before (untouched).
5873
5874 IF p_delivery_id is not null THEN
5875 open get_delivery_status;
5876 fetch get_delivery_status into l_status_code;
5877 close get_delivery_status;
5878 END IF;
5879 --
5880 -- lpn conv.
5881 IF (nvl(l_organization_id, fnd_api.g_miss_num) = fnd_api.g_miss_num) THEN
5882 l_organization_id := x_delivery_detail_rec.organization_id;
5883 END IF;
5884
5885 IF l_debug_on THEN
5886 WSH_DEBUG_SV.log(l_module_name,'organization_id is ', l_organization_id);
5887 END IF;
5888 l_wms_org := wsh_util_validate.Check_Wms_Org(l_organization_id);
5889 -- lpn conv.
5890 --
5891 --{
5892 IF NVL(l_status_code, 'OP') = 'OP' AND l_released_status = 'Y' THEN
5893
5894 j:=j+1; l_disabled_list(j) := 'SUBINVENTORY';
5895 j:=j+1; l_disabled_list(j) := 'LOCATOR_NAME';
5896 -- muom
5897 IF x_delivery_detail_rec.source_code = 'OE' THEN
5898 l_fulfillment_base := WSH_UTIL_CORE.Get_Line_Fulfillment_Base('OE',x_delivery_detail_rec.source_line_id );
5899 END IF;
5900 if nvl(l_fulfillment_base ,'P' ) <> 'S' THEN
5901 j:=j+1; l_disabled_list(j) := 'PICKED_QUANTITY2';
5902 -- Bug 3382932
5903 j:=j+1; l_disabled_list(j) := 'SHIPPED_QUANTITY2';
5904 j:=j+1; l_disabled_list(j) := 'REQUESTED_QUANTITY_UOM2';
5905 ELSE
5906 /* When fulfillment base is secondary, allow updation of picked/shipped quantity
5907 for Catch Weight Scenarios */
5908 j:=j+1; l_disabled_list(j) := 'PICKED_QUANTITY';
5909 j:=j+1; l_disabled_list(j) := 'SHIPPED_QUANTITY';
5910 END IF;
5911 -- j:=j+1; l_disabled_list(j) := 'REQUESTED_QUANTITY_UOM2';
5912
5913 -- X-dock changes
5914 -- Only for specific cases, let WMS update released_status and MOL
5915 ELSIF (l_released_status IN (WSH_DELIVERY_DETAILS_PKG.C_READY_TO_RELEASE,
5916 WSH_DELIVERY_DETAILS_PKG.C_BACKORDERED,
5917 WSH_DELIVERY_DETAILS_PKG.C_RELEASED_TO_WAREHOUSE)
5918 AND p_in_rec.caller like 'WMS_XDOCK%') THEN
5919 if l_debug_on then
5920 wsh_debug_sv.log(l_module_name, 'WMS Caller to update Released status and MOL', p_in_rec.caller);
5921 end if;
5922 j:=j+1; l_disabled_list(j) := 'RELEASED_STATUS';
5923 j:=j+1; l_disabled_list(j) := 'MOVE_ORDER_LINE_ID';
5924 j:=j+1; l_disabled_list(j) := 'BATCH_ID';
5925
5926 -- end of X-dock changes
5927
5928 --bug# 6689448 (replenishment project): let WMS update replenishment status for ready to release and backorder dds
5929 ELSIF (l_released_status IN (WSH_DELIVERY_DETAILS_PKG.C_READY_TO_RELEASE,
5930 WSH_DELIVERY_DETAILS_PKG.C_BACKORDERED) AND p_in_rec.caller like 'WMS_REP%') THEN
5931 j:=j+1;
5932 l_disabled_list(j) := 'REPLENISHMENT_STATUS';
5933 ELSIF p_delivery_detail_rec.lpn_id IS NULL AND l_lpn_id is NOT NULL THEN
5934 -- LPN sync-up
5935 IF (l_wms_org='N') THEN
5936 j:=j+1; l_disabled_list(j) := 'CONTAINER_NAME';
5937 END IF;
5938 j:=j+1; l_disabled_list(j) := 'LPN_ID';
5939 IF l_released_status = 'X' then
5940 j:=j+1; l_disabled_list(j) := 'SUBINVENTORY';
5941 j:=j+1; l_disabled_list(j) := 'LOCATOR_NAME';
5942 END IF;
5943 ELSIF NVL(x_delivery_detail_rec.container_flag,'N') IN ('Y','C') THEN
5944 IF l_released_status = 'X' then
5945 j:=j+1; l_disabled_list(j) := 'SUBINVENTORY';
5946 j:=j+1; l_disabled_list(j) := 'LOCATOR_NAME';
5947 END IF;
5948 END IF; --}
5949
5950 IF( l_wms_org = 'Y'
5951 AND NVL(x_delivery_detail_rec.container_flag,'N') IN ('Y','C')
5952 AND l_released_status = 'X'
5953 AND x_delivery_detail_rec.inventory_item_id IS NULL
5954 ) THEN
5955 --{
5956 j:=j+1; l_disabled_list(j) := 'ITEM_NUMBER';
5957 --}
5958 END IF;
5959
5960 -- bug 5077108
5961 IF l_db_col_rec.container_flag = 'Y' THEN
5962 --{
5963 j:=j+1; l_disabled_list(j) := 'INVENTORY_ITEM_ID';
5964 --Bug 5212632
5965 j:=j+1; l_disabled_list(j) := 'CONTAINER_TYPE_CODE';
5966 --}
5967 -- bug 6082324 - Adding MAXIMUM_LOAD_WEIGHT TO disabled_list
5968 j:=j+1; l_disabled_list(j) := 'MAXIMUM_LOAD_WEIGHT';
5969 -- bug 7165744 Adding REQUESTED_QUANTITY_UOM TO disabled_list
5970 j:=j+1; l_disabled_list(j) := 'REQUESTED_QUANTITY_UOM';
5971 END IF;
5972
5973
5974 ELSIF p_in_rec.caller = 'WSH_INBOUND' THEN
5975 if l_debug_on then
5976 wsh_debug_sv.logmsg(l_module_name, 'WSH_INBOUND: Enabling subinventory', WSH_DEBUG_SV.C_STMT_LEVEL);
5977 wsh_debug_sv.log(l_module_name, 'Input subinventory', p_delivery_detail_rec.subinventory);
5978 wsh_debug_sv.log(l_module_name, 'Input LOT_NUMBER', p_delivery_detail_rec.lot_number);
5979 end if;
5980 -- Subinventory should be updateable during inbound processing
5981 j:=j+1; l_disabled_list(j) := 'FULL';
5982 j:=j+1; l_disabled_list(j) := 'SUBINVENTORY';
5983 --Bugfix 6939348 start
5984 IF l_debug_on THEN
5985 WSH_DEBUG_SV.log(l_module_name,'Calling program unit WSH_DELIVERY_DETAILS_INV.Fetch_Inv_Controls',WSH_DEBUG_SV.C_PROC_LEVEL);
5986 END IF;
5987
5988 WSH_DELIVERY_DETAILS_INV.Fetch_Inv_Controls(p_delivery_detail_id => x_delivery_detail_rec.delivery_detail_id,
5989 p_inventory_item_id => x_delivery_detail_rec.inventory_item_id,
5990 p_organization_id => x_delivery_detail_rec.organization_id,
5991 p_subinventory => nvl(x_delivery_detail_rec.subinventory,p_delivery_detail_rec.subinventory), -- bug 8303281
5992 x_inv_controls_rec => l_inv_controls,
5993 x_return_status => x_return_status);
5994 --{Bug 8303281
5995 IF l_debug_on THEN
5996 WSH_DEBUG_SV.log(l_module_name,'x_return_status',x_return_status);
5997 END IF;
5998
5999 IF l_debug_on THEN
6000 WSH_DEBUG_SV.log(l_module_name,'Lot Control Flag',l_inv_controls.lot_flag);
6001 WSH_DEBUG_SV.log(l_module_name,'Locator Control Flag',l_inv_controls.loc_flag);
6002 END IF;
6003 --}Bug 8303281
6004 -- TPW - Distributed changes
6005 IF l_inv_controls.rev_flag = 'Y' THEN
6006 j:=j+1; l_disabled_list(j) := 'REVISION';
6007 END IF;
6008
6009 IF l_inv_controls.lot_flag = 'Y' THEN
6010 j:=j+1; l_disabled_list(j) := 'LOT_NUMBER';
6011 END IF;
6012
6013 --{Bug 8303281
6014 IF l_inv_controls.loc_flag = 'Y' THEN
6015 j:=j+1; l_disabled_list(j) := 'LOCATOR_NAME';
6016 END IF;
6017
6018 j:=j+1; l_disabled_list(j) := 'SHIPPED_QUANTITY';
6019 j:=j+1; l_disabled_list(j) := 'CYCLE_COUNT_QUANTITY';
6020 --}Bug 8303281
6021 --Bugfix 6939348 end
6022
6023 ELSIF p_in_rec.caller = 'WSH_USA' THEN
6024 -- Bug 3292364
6025 -- Enable Ship Method Components to be updated for container during OM changes.
6026
6027 IF l_debug_on THEN
6028 WSH_DEBUG_SV.logmsg(l_module_name, 'Enable SM Components for CMS changes, caller = WSH_USA' );
6029 END IF;
6030 j:=j+1; l_disabled_list(j) := 'FULL';
6031 j:=j+1; l_disabled_list(j) := 'SERVICE_LEVEL';
6032 j:=j+1; l_disabled_list(j) := 'MODE_OF_TRANSPORT';
6033 j:=j+1; l_disabled_list(j) := 'CARRIER_ID';
6034 j:=j+1; l_disabled_list(j) := 'SHIP_METHOD_CODE';
6035 END IF;
6036
6037 --{Bug 8303281
6038 IF l_debug_on THEN
6039 FOR j in 1..l_disabled_list.COUNT
6040 LOOP
6041 WSH_DEBUG_SV.log(l_module_name,'list values',l_disabled_list(j));
6042 END LOOP;
6043 END IF;
6044 --}Bug 8303281
6045
6046 IF l_disabled_list.count > 1 and l_disabled_list(1) = 'FULL' THEN
6047
6048 l_all_disabled :='N';
6049 IF l_debug_on THEN
6050 WSH_DEBUG_SV.log(l_module_name,'calling enable_from_list');
6051 END IF;
6052
6053 enable_from_list(l_disabled_list,
6054 p_delivery_detail_rec,
6055 x_delivery_detail_rec,
6056 l_return_status,
6057 l_field_name);
6058
6059 IF l_return_status = WSH_UTIL_CORE.G_RET_STS_ERROR THEN
6060 RAISE e_bad_field;
6061 END IF;
6062
6063
6064 END IF;
6065
6066 IF l_all_disabled ='Y' THEN
6067 RAISE e_all_disabled;
6068 END IF;
6069 --
6070 END IF; /* if action = 'UPDATE' */
6071
6072 --public api changes
6073 IF (NVL(p_in_rec.caller, '!!!') <> 'WSH_FSTRX' AND
6074 NVL(p_in_rec.caller, '!!!') NOT LIKE 'FTE%'
6075 AND NVL(p_in_rec.caller, '!!!') <> 'WSH_INBOUND'
6076 AND NVL(p_in_rec.caller, '!!!') <> 'WSH_TPW_INBOUND') THEN
6077 --
6078 user_non_updatable_columns
6079 (p_user_in_rec => p_delivery_detail_rec,
6080 p_out_rec => x_delivery_detail_rec,
6081 p_in_rec => p_in_rec,
6082 x_return_status => l_return_status);
6083 --
6084 IF l_return_status = WSH_UTIL_CORE.G_RET_STS_ERROR THEN
6085 x_return_status := l_return_status;
6086 END IF;
6087 --
6088 END IF;
6089 --
6090 IF l_debug_on THEN
6091 WSH_DEBUG_SV.pop(l_module_name);
6092 END IF;
6093
6094 EXCEPTION
6095 WHEN e_all_disabled THEN
6096 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
6097 FND_MESSAGE.SET_NAME('WSH','WSH_ALL_COLS_DISABLED');
6098 FND_MESSAGE.Set_Token('ENTITY_ID',p_delivery_detail_rec.delivery_detail_id);
6099 wsh_util_core.add_message(x_return_status,l_module_name);
6100 IF l_debug_on THEN
6101 -- Nothing is updateable
6102 WSH_DEBUG_SV.pop(l_module_name,'e_all_disabled');
6103 END IF;
6104 WHEN e_dp_no_entity THEN
6105 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
6106 -- the message for this is set in original get_disabled_list
6107 IF l_debug_on THEN
6108 WSH_DEBUG_SV.pop(l_module_name,'e_dp_no_entity');
6109 END IF;
6110 WHEN e_bad_field THEN
6111 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
6112 FND_MESSAGE.SET_NAME('WSH','WSH_BAD_FIELD_NAME');
6113 FND_MESSAGE.Set_Token('FIELD_NAME',l_field_name);
6114 wsh_util_core.add_message(x_return_status,l_module_name);
6115 IF l_debug_on THEN
6116 WSH_DEBUG_SV.log(l_module_name,'Bad field name passed to the list:'
6117 ,l_field_name);
6118 WSH_DEBUG_SV.pop(l_module_name,'e_bad_field');
6119 END IF;
6120
6121 WHEN OTHERS THEN
6122 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
6123 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.get_disabled_list',
6124 l_module_name);
6125 IF l_debug_on THEN
6126 WSH_DEBUG_SV.log(l_module_name,'Error:',SUBSTR(SQLERRM,1,200));
6127 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
6128 END IF;
6129 END Get_Disabled_List;
6130
6131
6132 PROCEDURE Init_Detail_Actions_Tbl (
6133 p_action IN VARCHAR2
6134 , x_detail_actions_tab OUT NOCOPY DetailActionsTabType
6135 , x_return_status OUT NOCOPY VARCHAR2
6136 )
6137
6138 IS
6139 i NUMBER := 0;
6140 l_debug_on BOOLEAN;
6141 l_gc3_is_installed VARCHAR2(1); -- OTM R12
6142 l_module_name CONSTANT VARCHAR2(100) :=
6143 'wsh.plsql.' || G_PKG_NAME || '.' || 'Init_Detail_Actions_Tbl';
6144 BEGIN
6145 --
6146 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
6147 --
6148 IF l_debug_on IS NULL
6149 THEN
6150 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
6151 END IF;
6152 --
6153 IF l_debug_on THEN
6154 WSH_DEBUG_SV.push(l_module_name);
6155 --
6156 WSH_DEBUG_SV.log(l_module_name,'p_action', p_action);
6157 END IF;
6158 --
6159 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
6160
6161 -- OTM R12
6162 l_gc3_is_installed := WSH_UTIL_CORE.G_GC3_IS_INSTALLED;
6163
6164 IF (l_gc3_is_installed IS NULL) THEN
6165 l_gc3_is_installed := WSH_UTIL_CORE.GC3_IS_INSTALLED;
6166 END IF;
6167 -- End of OTM R12
6168
6169 --
6170 -- J-IB-NPARIKH-{
6171 --
6172 -- Disable all the actions for inbound/drop-ship lines
6173 -- when called from shipping transaction form
6174 --
6175 i := i+1;
6176 x_detail_actions_tab(i).line_direction := 'I';
6177 x_detail_actions_tab(i).caller := 'WSH_FSTRX';
6178 x_detail_actions_tab(i).action_not_allowed := p_action;
6179 i := i+1;
6180 x_detail_actions_tab(i).line_direction := 'D';
6181 x_detail_actions_tab(i).caller := 'WSH_FSTRX';
6182 x_detail_actions_tab(i).action_not_allowed := p_action;
6183 -- J-IB-NPARIKH-}
6184 --
6185
6186 -- OTM R12 : disable actions for delivery detail
6187 IF l_gc3_is_installed = 'Y' THEN
6188 IF p_action IN ('RATE_WITH_UPS', 'UPS_TIME_IN_TRANSIT', 'UPS_ADDRESS_VALIDATION', 'UPS_TRACKING') THEN
6189 i := i + 1;
6190 x_detail_actions_tab(i).action_not_allowed := p_action;
6191 END IF;
6192 END IF;
6193 -- End of OTM R12 : disable actions for delivery detail
6194
6195 -- R12 MDC
6196 IF p_action IN ( 'ASSIGN','AUTOCREATE-DEL', 'AUTO-PACK',
6197 'AUTO-PACK-MASTER', 'AUTOCREATE-TRIP',
6198 'PACK', 'UNASSIGN','UNPACK', 'DELETE',
6199 'PICK-SHIP', 'PICK-PACK-SHIP',
6200 'CYCLE-COUNT', 'SPLIT-LINE',
6201 'INCLUDE_PLAN', 'IGNORE_PLAN')
6202 THEN
6203 i := i+1;
6204 x_detail_actions_tab(i).container_flag := 'C';
6205 x_detail_actions_tab(i).action_not_allowed := p_action;
6206 x_detail_actions_tab(i).caller := 'WSH_FSTRX';
6207 i := i+1;
6208 x_detail_actions_tab(i).container_flag := 'C';
6209 x_detail_actions_tab(i).action_not_allowed := p_action;
6210 x_detail_actions_tab(i).caller := 'WSH_PUB';
6211 END IF;
6212 --
6213
6214 IF p_action IN ( 'ASSIGN' ,'AUTOCREATE-DEL', 'AUTO-PACK', 'AUTO-PACK-MASTER',
6215 'AUTOCREATE-TRIP', 'PACK' , 'PICK-RELEASE',
6216 'PICK-RELEASE-UI', 'UNASSIGN','UNPACK','WT-VOL', 'DELETE',
6217 'RESOLVE-EXCEPTIONS-UI') THEN
6218
6219 -- Fixed as part of bug fix 2864546
6220 -- Resolve Exceptions should be allowed for cancelled lines
6221 --Bug 7025876
6222 --UNASSIGN action should be allowed for cancelled delivery details assigned to planned deliveries
6223 IF p_action NOT IN ('RESOLVE-EXCEPTIONS-UI','UNASSIGN') THEN
6224 i := i+1;
6225 x_detail_actions_tab(i).released_status := 'D';
6226 x_detail_actions_tab(i).action_not_allowed := p_action;
6227 END IF;
6228 /*J Inbound Logistics disallowed actions jckwok */
6229 IF p_action IN ('AUTOCREATE-TRIP','PICK-RELEASE','PICK-RELEASE-UI','DELETE','RESOLVE-EXCEPTIONS-UI') THEN
6230 i := i+1;
6231 x_detail_actions_tab(i).line_direction := 'I';
6232 x_detail_actions_tab(i).action_not_allowed := p_action;
6233 i := i+1;
6234 x_detail_actions_tab(i).line_direction := 'D';
6235 x_detail_actions_tab(i).action_not_allowed := p_action;
6236 END IF;
6237 -- J-IB-NPARIKH-{
6238 --
6239 IF p_action = 'WT-VOL'
6240 THEN
6241 i := i+1;
6242 x_detail_actions_tab(i).line_direction := 'O';
6243 x_detail_actions_tab(i).released_status := 'C';
6244 x_detail_actions_tab(i).action_not_allowed := p_action;
6245 i := i+1;
6246 x_detail_actions_tab(i).line_direction := 'IO';
6247 x_detail_actions_tab(i).released_status := 'C';
6248 x_detail_actions_tab(i).action_not_allowed := p_action;
6249 ELSE
6250 -- J-IB-NPARIKH-}
6251 --Bug 4370491 Resolve Exception UI should be allowed for Shipped lines
6252 IF p_action <> 'RESOLVE-EXCEPTIONS-UI' THEN
6253 i := i + 1;
6254 x_detail_actions_tab(i).released_status := 'C';
6255 x_detail_actions_tab(i).action_not_allowed := p_action;
6256 END IF;
6257 END IF;
6258 IF p_action IN ('AUTO-PACK', 'PACK', 'AUTO-PACK-MASTER', 'UNPACK') THEN
6259 IF p_action <> 'UNPACK' THEN
6260 i := i+1;
6261 x_detail_actions_tab(i).released_status := 'S';
6262 x_detail_actions_tab(i).action_not_allowed := p_action;
6263 END IF;
6264 -- Bug fix 2644558
6265 -- Disallow packing actions for WMS
6266 i := i+1;
6267 x_detail_actions_tab(i).org_type := 'WMS';
6268 x_detail_actions_tab(i).action_not_allowed := p_action;
6269 -- Bug#: 2648481
6270 x_detail_actions_tab(i).message_name := 'WSH_WMS_PACK_NOT_ALLOWED';
6271 /*Inbound Logistics disallowed actions jckwok */
6272 i := i+1;
6273 x_detail_actions_tab(i).line_direction := 'I';
6274 x_detail_actions_tab(i).action_not_allowed := p_action;
6275 i := i+1;
6276 x_detail_actions_tab(i).line_direction := 'D';
6277 x_detail_actions_tab(i).action_not_allowed := p_action;
6278 END IF;
6279 -- J-IB-NPARIKH-{
6280 /*
6281 IF p_action IN ( 'AUTOCREATE-DEL','ASSIGN', 'UNASSIGN','WT-VOL','RESOLVE-EXCEPTIONS-UI' )
6282 */
6283 --
6284 -- Disable auto-create Delivery/assign to delivery/unassign from delivery
6285 -- actions for inbound/drop-ship lines
6286 -- when line status is Closed(received) or Purged.
6287 -- or ship from location id is -1
6288 --
6289 IF p_action IN ( 'AUTOCREATE-DEL','ASSIGN', 'UNASSIGN')
6290 THEN
6291 --{
6292 i := i+1;
6293 x_detail_actions_tab(i).line_direction := 'D';
6294 x_detail_actions_tab(i).released_status := 'P';
6295 x_detail_actions_tab(i).action_not_allowed := p_action;
6296 i := i+1;
6297 x_detail_actions_tab(i).line_direction := 'I';
6298 x_detail_actions_tab(i).released_status := 'P';
6299 x_detail_actions_tab(i).action_not_allowed := p_action;
6300 --}
6301 END IF;
6302 --
6303 --
6304 IF p_action IN ( 'AUTOCREATE-DEL','ASSIGN', 'UNASSIGN' )
6305 THEN
6306 --{
6307 i := i+1;
6308 x_detail_actions_tab(i).line_direction := 'D';
6309 x_detail_actions_tab(i).released_status := 'L';
6310 x_detail_actions_tab(i).action_not_allowed := p_action;
6311 i := i+1;
6312 x_detail_actions_tab(i).line_direction := 'I';
6313 x_detail_actions_tab(i).released_status := 'L';
6314 x_detail_actions_tab(i).action_not_allowed := p_action;
6315 i := i+1;
6316 x_detail_actions_tab(i).ship_from_location_id := WSH_UTIL_CORE.C_NULL_SF_LOCN_ID;
6317 x_detail_actions_tab(i).action_not_allowed := p_action;
6318 --}
6319 END IF;
6320 -- J-IB-NPARIKH-}
6321
6322 ELSIF p_action IN ('CYCLE-COUNT', 'SPLIT-LINE' ) THEN
6323 i := i+1;
6324 x_detail_actions_tab(i).released_status := 'D';
6325 x_detail_actions_tab(i).action_not_allowed := p_action;
6326 i := i + 1;
6327 x_detail_actions_tab(i).released_status := 'C';
6328 x_detail_actions_tab(i).action_not_allowed := p_action;
6329 i := i + 1;
6330 x_detail_actions_tab(i).container_flag := 'Y';
6331 x_detail_actions_tab(i).action_not_allowed := p_action;
6332 --
6333 -- Bug fix 2644558
6334 -- Disallow cycle_count for WMS
6335 -- Bug fix 2751113 Disallow cycle-count for OKE source system
6336 -- R12 X-dock project, Split will be allowed conditionally
6337 -- for released to warehouse line and caller = WMS_XDOCK%
6338 IF p_action = 'CYCLE-COUNT' THEN
6339 i := i+1;
6340 x_detail_actions_tab(i).released_status := WSH_DELIVERY_DETAILS_PKG.C_RELEASED_TO_WAREHOUSE;
6341 x_detail_actions_tab(i).action_not_allowed := p_action;
6342 i := i+1;
6343 x_detail_actions_tab(i).org_type := 'WMS';
6344 x_detail_actions_tab(i).action_not_allowed := p_action;
6345 i := i+1;
6346 x_detail_actions_tab(i).source_code := 'OKE';
6347 x_detail_actions_tab(i).action_not_allowed := p_action;
6348 /*Inbound Logistics disallowed actions jckwok */
6349 i := i+1;
6350 x_detail_actions_tab(i).line_direction := 'I';
6351 x_detail_actions_tab(i).action_not_allowed := p_action;
6352 i := i+1;
6353 x_detail_actions_tab(i).line_direction := 'D';
6354 x_detail_actions_tab(i).action_not_allowed := p_action;
6355 END IF;
6356 -- J-IB-NPARIKH-{
6357 --
6358 -- Disable split line action for inbound/drop-ship lines
6359 -- when line status is Closed(received) or Purged.
6360 --
6361 IF p_action = 'SPLIT-LINE'
6362 THEN
6363 --{
6364 i := i+1;
6365 x_detail_actions_tab(i).line_direction := 'D';
6366 x_detail_actions_tab(i).released_status := 'L';
6367 x_detail_actions_tab(i).action_not_allowed := p_action;
6368 i := i+1;
6369 x_detail_actions_tab(i).line_direction := 'I';
6370 x_detail_actions_tab(i).released_status := 'L';
6371 x_detail_actions_tab(i).action_not_allowed := p_action;
6372 i := i+1;
6373 x_detail_actions_tab(i).line_direction := 'D';
6374 x_detail_actions_tab(i).released_status := 'P';
6375 x_detail_actions_tab(i).action_not_allowed := p_action;
6376 i := i+1;
6377 x_detail_actions_tab(i).line_direction := 'I';
6378 x_detail_actions_tab(i).released_status := 'P';
6379 x_detail_actions_tab(i).action_not_allowed := p_action;
6380 --}
6381 END IF;
6382 -- J-IB-NPARIKH-}
6383 ELSIF p_action = 'PACKING-WORKBENCH' THEN
6384 i := i+1;
6385 x_detail_actions_tab(i).released_status := 'C';
6386 x_detail_actions_tab(i).container_flag := 'N';
6387 x_detail_actions_tab(i).action_not_allowed := p_action;
6388 i := i + 1;
6389 x_detail_actions_tab(i).released_status := 'S';
6390 x_detail_actions_tab(i).action_not_allowed := p_action;
6391 i := i + 1;
6392 x_detail_actions_tab(i).released_status := 'D';
6393 x_detail_actions_tab(i).action_not_allowed := p_action;
6394 -- Bug fix 2644558
6395 -- Disallow packing actions for WMS
6396 i := i+1;
6397 x_detail_actions_tab(i).org_type := 'WMS';
6398 x_detail_actions_tab(i).action_not_allowed := p_action;
6399 /*Inbound Logistics disallowed actions jckwok */
6400 i := i+1;
6401 x_detail_actions_tab(i).line_direction := 'I';
6402 x_detail_actions_tab(i).action_not_allowed := p_action;
6403 i := i+1;
6404 x_detail_actions_tab(i).line_direction := 'D';
6405 x_detail_actions_tab(i).action_not_allowed := p_action;
6406 ELSIF p_action = 'ASSIGN-FREIGHT-COSTS' THEN
6407 /*Inbound Logistics disallowed actions jckwok */
6408 i := i+1;
6409 x_detail_actions_tab(i).line_direction := 'I';
6410 x_detail_actions_tab(i).action_not_allowed := p_action;
6411 i := i+1;
6412 x_detail_actions_tab(i).line_direction := 'D';
6413 x_detail_actions_tab(i).action_not_allowed := p_action;
6414 -- J-IB-NPARIKH-{
6415 ELSIF p_Action = 'INCLUDE_PLAN'
6416 THEN
6417 --{
6418 --
6419 -- Lines cannot be included for planning if ship-from location is null
6420 --
6421 i := i+1;
6422 x_detail_actions_tab(i).ship_from_location_id := WSH_UTIL_CORE.C_NULL_SF_LOCN_ID;
6423 x_detail_actions_tab(i).action_not_allowed := p_action;
6424 --bug 3458160
6425 IF l_gc3_is_installed = 'N' THEN
6426 -- 5746444: enforce this condition when OTM is disabled.
6427 i := i + 1;
6428 x_detail_actions_tab(i).action_not_allowed := p_action;
6429 x_detail_actions_tab(i).source_code := 'WSH';
6430 x_detail_actions_tab(i).container_flag := 'N';
6431 ELSE
6432 -- 5746110: enforce this condition when OTM is installed.
6433 i := i + 1;
6434 x_detail_actions_tab(i).action_not_allowed := p_action;
6435 x_detail_actions_tab(i).otm_enabled := 'N';
6436 END IF;
6437 --}
6438 -- J-IB-NPARIKH-}
6439 -- { IB-Phase-2
6440 ELSIF p_action = 'ASSIGN-CONSOL-LPN' THEN
6441 --
6442 -- Inbound Lines cannot be a part of a consolidated LPN.
6443 --
6444 i := i + 1;
6445 x_detail_actions_tab(i).line_direction := 'I';
6446 x_detail_actions_tab(i).action_not_allowed := p_action;
6447 i := i + 1;
6448 x_detail_actions_tab(i).line_direction := 'D';
6449 x_detail_actions_tab(i).action_not_allowed := p_action;
6450 -- } IB-Phase-2
6451 END IF;
6452
6453
6454 IF l_debug_on THEN
6455 WSH_DEBUG_SV.pop(l_module_name);
6456 END IF;
6457 EXCEPTION
6458 WHEN OTHERS THEN
6459 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
6460 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.Init_Detail_Actions_Tbl', l_module_name);
6461 IF l_debug_on THEN
6462 WSH_DEBUG_SV.log(l_module_name,'Error:',SUBSTR(SQLERRM,1,200));
6463 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
6464 END IF;
6465
6466 END Init_Detail_Actions_Tbl;
6467
6468
6469 -- ---------------------------------------------------------------------
6470 -- Procedure: Validate_Shipped_CC_Quantity
6471 --
6472 -- Parameters:
6473 --
6474 -- Description: This procedure validates shipped_quantity or cycle_count_quantity
6475 -- This procedure consolidates the validations needed for these quantities
6476 --
6477 -- Created: Harmonization Project. Patchset I
6478 -- -----------------------------------------------------------------------
6479 PROCEDURE Validate_Shipped_CC_Quantity(
6480 p_flag IN VARCHAR2, -- either 'SQ' or 'CCQ'
6481 x_det_rec IN OUT NOCOPY ValidateQuantityAttrRecType,
6482 x_return_status OUT NOCOPY VARCHAR2,
6483 x_msg_count OUT NOCOPY NUMBER,
6484 x_msg_data OUT NOCOPY VARCHAR2
6485 ) IS
6486
6487 l_quantity NUMBER;
6488 l_input_quantity NUMBER;
6489
6490 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Shipped_CC_Quantity';
6491 l_api_version CONSTANT NUMBER := 1.0;
6492 --
6493 --
6494 l_return_status VARCHAR2(32767);
6495 l_msg_count NUMBER;
6496 l_msg_data VARCHAR2(32767);
6497 l_program_name VARCHAR2(32767);
6498
6499 l_number_of_errors NUMBER := 0;
6500 l_number_of_warnings NUMBER := 0;
6501
6502 --added for bug # 3266333
6503 l_field_name VARCHAR2(50);
6504 l_fulfillment_base VARCHAR2(1);
6505 -- muom
6506 l_det_source_code VARCHAR2(3);
6507 l_det_source_line_id NUMBER;
6508 --
6509 CURSOR C_DETAIL_INFO(p_detail_id IN number) IS
6510 SELECT SOURCE_CODE,
6511 SOURCE_LINE_ID
6512 FROM WSH_DELIVERY_DETAILS
6513 WHERE DELIVERY_DETAIL_ID = p_detail_id;
6514
6515 l_debug_on BOOLEAN;
6516 --
6517 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'VALIDATE_SHIPPED_CC_QUANTITY';
6518 BEGIN
6519 --
6520 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
6521 --
6522 IF l_debug_on IS NULL
6523 THEN
6524 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
6525 END IF;
6526 --
6527 IF l_debug_on THEN
6528 WSH_DEBUG_SV.push(l_module_name);
6529 WSH_DEBUG_SV.log(l_module_name,'P_FLAG',P_FLAG);
6530 WSH_DEBUG_SV.log(l_module_name, 'Del detail id', x_det_rec.delivery_detail_id);
6531 WSH_DEBUG_SV.log(l_module_name, 'Shipped_Quantity', x_det_rec.shipped_quantity);
6532 WSH_DEBUG_SV.log(l_module_name, 'Cycle_Count_Quantity', x_det_rec.cycle_count_quantity);
6533 WSH_DEBUG_SV.log(l_module_name, 'Requested Quantity', x_det_rec.requested_quantity);
6534 WSH_DEBUG_SV.log(l_module_name, 'Picked Quantity', x_det_rec.picked_quantity);
6535 WSH_DEBUG_SV.log(l_module_name, 'Organization Id', x_det_rec.organization_id);
6536 WSH_DEBUG_SV.log(l_module_name, 'Inventory Item Id', x_det_rec.inventory_item_id);
6537 WSH_DEBUG_SV.log(l_module_name, 'Serial Qty', x_det_rec.serial_quantity);
6538 WSH_DEBUG_SV.log(l_module_name, 'Transaction Temp Id', x_det_rec.transaction_temp_id);
6539 WSH_DEBUG_SV.log(l_module_name, 'Top Model Line Id', x_det_rec.top_model_line_id);
6540 WSH_DEBUG_SV.log(l_module_name, 'Ship Tolerance Above', x_det_rec.ship_tolerance_above);
6541 WSH_DEBUG_SV.log(l_module_name, 'requested qty uom', x_det_rec.requested_quantity_uom);
6542 WSH_DEBUG_SV.log(l_module_name, 'unmark_serial_server ', x_det_rec.unmark_serial_server);
6543 WSH_DEBUG_SV.log(l_module_name, 'unmark_serial_form ', x_det_rec.unmark_serial_form);
6544 END IF;
6545
6546 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
6547
6548 IF(p_flag = 'SQ') THEN
6549 l_input_quantity := x_det_rec.shipped_quantity;
6550 --added for Bug # 3266333
6551 l_field_name := 'shipped_quantity';
6552 --
6553 ELSIF(p_flag = 'CCQ') THEN
6554 l_input_quantity := x_det_rec.cycle_count_quantity;
6555 --added for Bug # 3266333
6556 l_field_name := 'cycle_count_quantity';
6557 --
6558 ELSE
6559 -- invalid flag
6560 raise fnd_api.g_exc_error;
6561 END IF;
6562 open c_detail_info(x_det_rec.delivery_detail_id);
6563 fetch c_detail_info INTO l_det_source_code, l_det_source_line_id;
6564 close c_detail_info;
6565 l_fulfillment_base := WSH_UTIL_CORE.Get_Line_Fulfillment_Base(l_det_source_code, l_det_source_line_id);
6566 --1.a) if entered, enable backordered quantity and update it as max(requested_quantity - shipped_quantity),0)
6567 --1.b) if null, clear cycle count and secondary quantity
6568 IF(x_det_rec.shipped_quantity IS NOT NULL) THEN
6569 -- muom
6570 if l_fulfillment_base = 'P' THEN
6571 x_det_rec.cycle_count_quantity := Greatest((x_det_rec.requested_quantity - x_det_rec.shipped_quantity),0);
6572 ELSE
6573 x_det_rec.cycle_count_quantity := Greatest((x_det_rec.picked_quantity - x_det_rec.shipped_quantity),0);
6574 END IF;
6575 ELSE
6576 x_det_rec.cycle_count_quantity := NULL;
6577 -- HW Harmonization project for OPM. no need to assign qty2 since it's being handleded in Validate_Shipped_CC_Quantity2
6578 -- x_det_rec.cycle_count_quantity2 := NULL;
6579
6580 END IF;
6581
6582 -- 2) Check for negative
6583
6584 IF l_debug_on THEN
6585 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_NEGATIVE',WSH_DEBUG_SV.C_PROC_LEVEL);
6586 END IF;
6587 --Bug # 3266333
6588 WSH_UTIL_VALIDATE.validate_negative(
6589 p_value => l_input_quantity,
6590 p_field_name => l_field_name,
6591 x_return_status => l_return_status );
6592 --
6593
6594 IF(l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
6595 RAISE FND_API.G_EXC_ERROR;
6596 END IF;
6597
6598
6599 -- 3) check for decimal
6600 -- HW Harmonization project for OPM. No need to call this procedure for OPM
6601 -- Need to branch
6602
6603 -- HW OPMCONV - No need to branch
6604
6605 IF l_debug_on THEN
6606 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DETAILS_VALIDATIONS.CHECK_DECIMAL_QUANTITY',WSH_DEBUG_SV.C_PROC_LEVEL);
6607 END IF;
6608 wsh_details_validations.check_decimal_quantity(
6609 p_item_id => x_det_rec.inventory_item_id,
6610 p_organization_id => x_det_rec.organization_id,
6611 p_input_quantity => l_input_quantity,
6612 p_uom_code => x_det_rec.requested_quantity_uom,
6613 x_output_quantity => l_quantity,
6614 x_return_status => l_return_status,
6615 p_top_model_line_id => x_det_rec.top_model_line_id
6616 );
6617
6618 IF(p_flag = 'SQ') THEN
6619 x_det_rec.shipped_quantity := l_quantity;
6620 ELSIF(p_flag = 'CCQ') THEN
6621 x_det_rec.cycle_count_quantity := l_quantity;
6622 END IF;
6623
6624 IF l_return_status <> wsh_util_core.g_ret_sts_success THEN
6625 IF l_return_status = WSH_UTIL_CORE.G_RET_STS_WARNING THEN
6626 RAISE WSH_UTIL_CORE.G_EXC_WARNING;
6627 ELSE
6628 RAISE FND_API.G_EXC_ERROR;
6629 END IF;
6630 END IF;
6631
6632 -- HW OPM bug 2677054
6633
6634
6635 -- HW -- HW Harmonization project for OPM. end of changes
6636 -- muom
6637 IF l_fulfillment_base = 'P' THEN --{
6638 -- 4) If SQ, check shipped qty
6639 -- If CCQ, check cc qty
6640 IF (p_flag = 'SQ') THEN
6641 IF l_debug_on THEN
6642 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DETAILS_VALIDATIONS.CHECK_SHIPPED_QUANTITY',WSH_DEBUG_SV.C_PROC_LEVEL);
6643 END IF;
6644 wsh_details_validations.check_shipped_quantity(
6645 p_ship_above_tolerance => x_det_rec.ship_tolerance_above,
6646 p_requested_quantity => x_det_rec.requested_quantity,
6647 p_picked_quantity => x_det_rec.picked_quantity,
6648 p_shipped_quantity => NVL(l_quantity, 0),
6649 p_cycle_count_quantity => NVL(x_det_rec.cycle_count_quantity, 0),
6650 -- muom
6651 p_fulfill_base => 'P',
6652 x_return_status => l_return_status);
6653
6654 IF(l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
6655 RAISE FND_API.G_EXC_ERROR;
6656 END IF;
6657
6658
6659 ELSIF(p_flag = 'CCQ') THEN
6660
6661 IF l_debug_on THEN
6662 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DETAILS_VALIDATIONS.CHECK_CYCLE_COUNT_QUANTITY',WSH_DEBUG_SV.C_PROC_LEVEL);
6663 END IF;
6664
6665 wsh_details_validations.check_cycle_count_quantity(
6666 p_ship_above_tolerance => x_det_rec.ship_tolerance_above,
6667 p_requested_quantity => x_det_rec.requested_quantity,
6668 p_picked_quantity => x_det_rec.picked_quantity,
6669 p_shipped_quantity => NVL(x_det_rec.shipped_quantity, 0),
6670 p_cycle_count_quantity => NVL(l_quantity, 0),
6671 -- muom
6672 p_fulfill_base => 'P',
6673 x_return_status => l_return_status);
6674
6675 IF(l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
6676 RAISE FND_API.G_EXC_ERROR;
6677 END IF;
6678 END IF;
6679 END IF;-- }
6680
6681 -- 5) clear and unmark serial numbers based on quantity checks
6682 -- HW OPMCONV - No need to branch
6683
6684
6685 IF NVL(x_det_rec.picked_quantity, x_det_rec.requested_quantity)=1 THEN
6686 /*Bug 2174761 */
6687 /*
6688 IF ((x_det_rec.shipped_quantity >1 and x_det_rec.serial_number IS NOT NULL)
6689 OR -- Bug 2941879 : check for >= 0 . Treat null as 0 .
6690 (nvl(x_det_rec.shipped_quantity,0) >= 0 and x_det_rec.serial_quantity >
6691 x_det_rec.shipped_quantity )) THEN
6692 */
6693 -- Bug 3628620
6694 IF ( -- Bug 2941879 : check for >= 0 . Treat null as 0 .
6695 (nvl(x_det_rec.shipped_quantity,0) >= 0 and x_det_rec.serial_quantity >
6696 x_det_rec.shipped_quantity )) THEN
6697 -- End of Bug 3628620
6698 -- Bug 2828503 : added warning for unmarking of serial_numbers
6699 x_det_rec.unmark_serial_form := 'Y';
6700 fnd_message.set_name('WSH', 'WSH_UI_UNMARK_SERIAL_NUM');
6701 wsh_util_core.add_message(wsh_util_core.g_ret_sts_warning);
6702 l_number_of_warnings := l_number_of_warnings + 1;
6703
6704 IF x_det_rec.serial_quantity > 0 AND x_det_rec.unmark_serial_server = 'Y' THEN
6705
6706 IF l_debug_on THEN
6707 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_DETAILS_INV.UNMARK_SERIAL_NUMBER',WSH_DEBUG_SV.C_PROC_LEVEL);
6708 END IF;
6709 wsh_delivery_details_inv.unmark_serial_number(
6710 p_delivery_detail_id => x_det_rec.delivery_detail_id,
6711 p_serial_number_code => x_det_rec.inv_ser_control_code,
6712 p_serial_number => x_det_rec.serial_number,
6713 p_transaction_temp_id => x_det_rec.transaction_temp_id,
6714 x_return_status => l_return_status,
6715 p_inventory_item_id => x_det_rec.inventory_item_id
6716 );
6717 IF l_debug_on THEN
6718 wsh_debug_sv.log(l_module_name, 'Return status after Unmark serial', l_return_status);
6719 END IF;
6720
6721 IF(l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
6722 RAISE FND_API.G_EXC_ERROR;
6723 END IF;
6724 END IF; -- if serial_quantity > 0
6725
6726 x_det_rec.serial_quantity := 0;
6727 x_det_rec.serial_number := NULL;
6728 x_det_rec.transaction_temp_id := NULL;
6729 END IF;
6730
6731 ELSIF x_det_rec.serial_quantity > x_det_rec.shipped_quantity
6732 OR nvl(x_det_rec.shipped_quantity,0) = 0
6733 -- Bug 3628620 , Commented Code below
6734 -- OR
6735 --(x_det_rec.serial_quantity = 1 AND x_det_rec.shipped_quantity > 1) OR
6736 --(x_det_rec.serial_quantity = 1 AND x_det_rec.shipped_quantity = 1 AND
6737 -- x_det_rec.transaction_temp_id is not null)
6738 -- End of Bug 3628620
6739 THEN
6740
6741 IF x_det_rec.serial_quantity > 0 THEN
6742 -- Bug 2828503 : added warning for unmarking of serial_numbers
6743 x_det_rec.unmark_serial_form := 'Y';
6744 fnd_message.set_name('WSH', 'WSH_UI_UNMARK_SERIAL_NUM');
6745 wsh_util_core.add_message(wsh_util_core.g_ret_sts_warning);
6746 l_number_of_warnings := l_number_of_warnings + 1;
6747
6748 IF l_debug_on THEN
6749 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_DETAILS_INV.UNMARK_SERIAL_NUMBER',WSH_DEBUG_SV.C_PROC_LEVEL);
6750 END IF;
6751
6752 IF x_det_rec.unmark_serial_server = 'Y' THEN
6753 wsh_delivery_details_inv.unmark_serial_number(
6754 p_delivery_detail_id => x_det_rec.delivery_detail_id,
6755 p_serial_number_code => x_det_rec.inv_ser_control_code,
6756 p_serial_number => x_det_rec.serial_number,
6757 p_transaction_temp_id => x_det_rec.transaction_temp_id,
6758 x_return_status => l_return_status,
6759 p_inventory_item_id => x_det_rec.inventory_item_id);
6760
6761 IF l_debug_on THEN
6762 wsh_debug_sv.log(l_module_name, 'Return status after Unmark serial', l_return_status);
6763 END IF;
6764
6765 IF(l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
6766 RAISE FND_API.G_EXC_ERROR;
6767 END IF;
6768 END IF; -- if serial_quantity > 0
6769
6770 x_det_rec.serial_quantity := 0;
6771 x_det_rec.serial_number := NULL;
6772 x_det_rec.transaction_temp_id := NULL;
6773
6774 END IF;
6775
6776 END IF;
6777
6778
6779
6780 IF(p_flag = 'SQ') THEN
6781 x_det_rec.shipped_quantity := l_quantity;
6782
6783 ELSIF(p_flag = 'CCQ') THEN
6784 x_det_rec.cycle_count_quantity := l_quantity;
6785 END IF;
6786
6787 IF l_debug_on THEN
6788 WSH_DEBUG_SV.log(l_module_name,'Output shipped quantity', x_det_rec.shipped_quantity);
6789 WSH_DEBUG_SV.log(l_module_name, 'Output Cycle_Count quantity', x_det_rec.cycle_count_quantity);
6790 END IF;
6791
6792 IF l_number_of_warnings > 0 THEN
6793 x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
6794 END IF;
6795
6796 IF l_debug_on THEN
6797 WSH_DEBUG_SV.log(l_module_name, 'Return status from api ', x_return_status);
6798 WSH_DEBUG_SV.pop(l_module_name);
6799 END IF;
6800
6801 EXCEPTION
6802 WHEN FND_API.G_EXC_ERROR THEN
6803 x_return_status := FND_API.G_RET_STS_ERROR ;
6804 wsh_util_core.add_message(x_return_status, l_module_name);
6805 FND_MSG_PUB.Count_And_Get
6806 (
6807 p_count => x_msg_count,
6808 p_data => x_msg_data,
6809 p_encoded => FND_API.G_FALSE
6810 );
6811
6812 IF l_debug_on THEN
6813 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
6814 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_ERROR');
6815 END IF;
6816 --
6817 WHEN WSH_UTIL_CORE.G_EXC_WARNING THEN
6818 x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
6819 wsh_util_core.add_message(x_return_status, l_module_name);
6820 FND_MSG_PUB.Count_And_Get
6821 (
6822 p_count => x_msg_count,
6823 p_data => x_msg_data,
6824 p_encoded => FND_API.G_FALSE
6825 );
6826 --
6827 IF l_debug_on THEN
6828 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_UTIL_CORE.G_EXC_WARNING exception has occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
6829 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_UTIL_CORE.G_EXC_WARNING');
6830 END IF;
6831
6832 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
6833 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
6834 FND_MSG_PUB.Count_And_Get
6835 (
6836 p_count => x_msg_count,
6837 p_data => x_msg_data,
6838 p_encoded => FND_API.G_FALSE
6839 );
6840
6841 IF l_debug_on THEN
6842 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_UNEXPECTED_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
6843 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
6844 END IF;
6845 --
6846 WHEN OTHERS THEN
6847 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
6848 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.VALIDATE_SHIPPED_CC_QUANTITY');
6849 --
6850 IF l_debug_on THEN
6851 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
6852 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
6853 END IF;
6854
6855
6856 END Validate_Shipped_CC_Quantity;
6857 --Harmonization Project I
6858
6859
6860 ------------------------------------------------------------------------
6861 -- Procedure: Validate_Shipped_CC_Quantity2
6862 --
6863 -- Parameters:
6864 --
6865 -- Description: This procedure validates shipped_quantity2 or cycle_count_quantity2
6866 -- This procedure consolidates the validations needed for these quantities
6867 --
6868 -- Created: Harmonization Project. Patchset I
6869 -- HW Harmonization project for OPM
6870 -- -----------------------------------------------------------------------
6871 PROCEDURE Validate_Shipped_CC_Quantity2(
6872 p_flag IN VARCHAR2, -- either 'SQ' or 'CCQ'
6873 x_det_rec IN OUT NOCOPY ValidateQuantityAttrRecType,
6874 x_return_status OUT NOCOPY VARCHAR2,
6875 x_msg_count OUT NOCOPY NUMBER,
6876 x_msg_data OUT NOCOPY VARCHAR2
6877 ) IS
6878
6879 l_quantity NUMBER;
6880 l_input_quantity NUMBER;
6881
6882 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Shipped_CC_Quantity2';
6883 l_api_version CONSTANT NUMBER := 1.0;
6884 --
6885 --
6886 l_return_status VARCHAR2(32767);
6887 l_msg_count NUMBER;
6888 l_msg_data VARCHAR2(32767);
6889 l_program_name VARCHAR2(32767);
6890
6891 l_number_of_errors NUMBER := 0;
6892 l_number_of_warnings NUMBER := 0;
6893
6894 --added for Bug # 3266333
6895 l_field_name VARCHAR2(50);
6896 -- muom
6897 l_det_source_code VARCHAR2(3);
6898 l_det_source_line_id NUMBER;
6899
6900
6901 --
6902 l_debug_on BOOLEAN;
6903 --
6904 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'VALIDATE_SHIPPED_CC_QUANTITY2';
6905 BEGIN
6906
6907
6908 --
6909 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
6910 --
6911 IF l_debug_on IS NULL
6912 THEN
6913 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
6914 END IF;
6915 --
6916 IF l_debug_on THEN
6917 WSH_DEBUG_SV.push(l_module_name);
6918 WSH_DEBUG_SV.log(l_module_name,'P_FLAG',P_FLAG);
6919 WSH_DEBUG_SV.log(l_module_name, 'Shipped_Quantity2', x_det_rec.shipped_quantity2);
6920 WSH_DEBUG_SV.log(l_module_name, 'Cycle_Count_Quantity2', x_det_rec.cycle_count_quantity2);
6921 WSH_DEBUG_SV.log(l_module_name, 'Requested Quantity2', x_det_rec.requested_quantity2);
6922 WSH_DEBUG_SV.log(l_module_name, 'Picked Quantity2', x_det_rec.picked_quantity2);
6923 WSH_DEBUG_SV.log(l_module_name, 'Organization Id', x_det_rec.organization_id);
6924 WSH_DEBUG_SV.log(l_module_name, 'Inventory Item Id', x_det_rec.inventory_item_id);
6925 END IF;
6926
6927 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
6928 IF(p_flag = 'SQ') THEN
6929 l_input_quantity := x_det_rec.shipped_quantity2;
6930 --added for Bug # 3266333
6931 l_field_name := 'shipped_quantity2';
6932 --
6933 ELSIF(p_flag = 'CCQ') THEN
6934 l_input_quantity := x_det_rec.cycle_count_quantity2;
6935 --added for Bug # 3266333
6936 l_field_name := 'cycle_count_quantity2';
6937 --
6938 ELSE
6939 -- invalid flag
6940 raise fnd_api.g_exc_error;
6941 END IF;
6942
6943 --1.a) if entered, enable backordered quantity and update it as max(requested_quantity2 - shipped_quantity2),0)
6944 --1.b) if null, clear cycle count and secondary quantity
6945 IF(x_det_rec.shipped_quantity2 IS NOT NULL) THEN
6946 --x_det_rec.cycle_count_quantity2 := Greatest((x_det_rec.requested_quantity2 - x_det_rec.shipped_quantity2),0);
6947 -- bug 5391211, cycle_count_qty2 should be a value that is derived from qty1
6948 open c_detail_info(x_det_rec.delivery_detail_id);
6949 fetch c_detail_info INTO l_det_source_code, l_det_source_line_id;
6950 close c_detail_info;
6951 IF l_debug_on THEN
6952 WSH_DEBUG_SV.logmsg(l_module_name,'Calculate CC2 only in FB=P case',WSH_DEBUG_SV.C_STMT_LEVEL);
6953 END IF;
6954
6955 IF WSH_UTIL_CORE.Get_Line_Fulfillment_Base(l_det_source_code,
6956 l_det_source_line_id) <>'S' THEN
6957 x_det_rec.cycle_count_quantity2 := WSH_WV_UTILS.convert_uom
6958 (
6959 from_uom => x_det_rec.requested_quantity_uom,
6960 to_uom => x_det_rec.requested_quantity_uom2,
6961 quantity => x_det_rec.cycle_count_quantity,
6962 item_id => x_det_rec.inventory_item_id
6963 );
6964 END IF;
6965 -- PK Bug 3055126 added else clause
6966 ELSE
6967 x_det_rec.cycle_count_quantity2 := NULL;
6968
6969 END IF;
6970
6971 IF l_debug_on THEN
6972 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_NEGATIVE',WSH_DEBUG_SV.C_PROC_LEVEL);
6973 END IF;
6974 -- 2) Check for negative
6975 --Bug # 3266333
6976 WSH_UTIL_VALIDATE.validate_negative(
6977 p_value => l_input_quantity,
6978 p_field_name => l_field_name,
6979 x_return_status => l_return_status );
6980 --
6981
6982 IF(l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
6983 RAISE FND_API.G_EXC_ERROR;
6984 END IF;
6985
6986 -- HW OPM BUG#:2677054
6987 IF(p_flag = 'SQ') THEN
6988 l_quantity := x_det_rec.shipped_quantity2;
6989
6990 ELSIF(p_flag = 'CCQ') THEN
6991 l_quantity :=x_det_rec.cycle_count_quantity2;
6992 END IF;
6993
6994 -- muom
6995 open c_detail_info(x_det_rec.delivery_detail_id);
6996 fetch c_detail_info INTO l_det_source_code, l_det_source_line_id;
6997 close c_detail_info;
6998
6999 IF WSH_UTIL_CORE.Get_Line_Fulfillment_Base(l_det_source_code, l_det_source_line_id) = 'S' THEN --{
7000
7001 IF (p_flag = 'SQ') THEN
7002
7003 IF l_debug_on THEN
7004 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DETAILS_VALIDATIONS.CHECK_SHIPPED_QUANTITY',WSH_DEBUG_SV.C_PROC_LEVEL);
7005 END IF;
7006 wsh_details_validations.check_shipped_quantity(
7007 p_ship_above_tolerance => x_det_rec.ship_tolerance_above,
7008 p_requested_quantity => x_det_rec.requested_quantity2,
7009 p_picked_quantity => x_det_rec.picked_quantity2,
7010 p_shipped_quantity => NVL(l_quantity, 0),
7011 p_cycle_count_quantity => NVL(x_det_rec.cycle_count_quantity2, 0),
7012 -- muom
7013 p_fulfill_base => 'S',
7014 x_return_status => l_return_status);
7015
7016 IF(l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
7017 RAISE FND_API.G_EXC_ERROR;
7018 END IF;
7019 ELSIF(p_flag = 'CCQ') THEN
7020
7021 IF l_debug_on THEN
7022 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DETAILS_VALIDATIONS.CHECK_CYCLE_COUNT_QUANTITY',WSH_DEBUG_SV.C_PROC_LEVEL);
7023 END IF;
7024 wsh_details_validations.check_cycle_count_quantity(
7025 p_ship_above_tolerance => x_det_rec.ship_tolerance_above,
7026 p_requested_quantity => x_det_rec.requested_quantity2,
7027 p_picked_quantity => x_det_rec.picked_quantity2,
7028 p_shipped_quantity => NVL(x_det_rec.shipped_quantity2, 0),
7029 p_cycle_count_quantity => NVL(l_quantity, 0),
7030 -- muom
7031 p_fulfill_base => 'S',
7032 x_return_status => l_return_status);
7033
7034 IF(l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
7035 RAISE FND_API.G_EXC_ERROR;
7036 END IF;
7037 END IF;
7038 END IF;
7039
7040 IF(p_flag = 'SQ') THEN
7041 x_det_rec.shipped_quantity2 := l_quantity;
7042 ELSIF(p_flag = 'CCQ') THEN
7043 x_det_rec.cycle_count_quantity2 := l_quantity;
7044 END IF;
7045
7046 IF l_debug_on THEN
7047 WSH_DEBUG_SV.log(l_module_name,'Output shipped quantity2', x_det_rec.shipped_quantity2);
7048 WSH_DEBUG_SV.log(l_module_name, 'Output Cycle_Count quantity2', x_det_rec.cycle_count_quantity2);
7049 END IF;
7050
7051 IF l_debug_on THEN
7052 WSH_DEBUG_SV.pop(l_module_name);
7053 END IF;
7054
7055 EXCEPTION
7056 WHEN FND_API.G_EXC_ERROR THEN
7057 x_return_status := FND_API.G_RET_STS_ERROR ;
7058 FND_MSG_PUB.Count_And_Get
7059 (
7060 p_count => x_msg_count,
7061 p_data => x_msg_data,
7062 p_encoded => FND_API.G_FALSE
7063 );
7064
7065 IF l_debug_on THEN
7066 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
7067 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_ERROR');
7068 END IF;
7069 --
7070 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
7071 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
7072 FND_MSG_PUB.Count_And_Get
7073 (
7074 p_count => x_msg_count,
7075 p_data => x_msg_data,
7076 p_encoded => FND_API.G_FALSE
7077 );
7078
7079 IF l_debug_on THEN
7080 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_UNEXPECTED_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
7081 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
7082 END IF;
7083 --
7084 WHEN OTHERS THEN
7085 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
7086 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.VALIDATE_SHIPPED_CC_QUANTITY2');
7087 --
7088 IF l_debug_on THEN
7089 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
7090 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
7091 END IF;
7092
7093
7094 END Validate_Shipped_CC_Quantity2;
7095
7096 -- for Load Tender Project
7097 /*
7098 -----------------------------------------------------------------------------
7099 PROCEDURE : Compare_Detail_Attributes
7100 PARAMETERS : p_old_table - Table of old records
7101 p_new_table - Table of new records
7102 p_entity - entity name -DELIVERY_DETAIL
7103 p_action_code - action code for each action
7104 p_phase - 1 for Before the action is performed, 2 for after.
7105 p_caller - where is this API being called from
7106 x_changed_id - Table of Changed ids
7107 x_return_status - Return Status
7108 DESCRIPTION : This procedure compares the attributes for each entity.
7109 For Delivery Detail,attributes are - weight/volume,quantity,
7110 delivery,parent_delivery_detail
7111 Added for Load Tender Project but this is independent of
7112 FTE is installed or not.
7113 ------------------------------------------------------------------------------
7114 */
7115 PROCEDURE compare_detail_attributes
7116 (p_old_table IN wsh_interface.deliverydetailtab,
7117 p_new_table IN wsh_interface.deliverydetailtab,
7118 p_action_code IN VARCHAR2,
7119 p_phase IN NUMBER,
7120 p_caller IN VARCHAR2,
7121 x_changed_id_tab OUT NOCOPY wsh_util_core.id_tab_type,
7122 x_return_status OUT NOCOPY VARCHAR2
7123 ) IS
7124
7125 l_return_status VARCHAR2(30);
7126 i NUMBER;
7127 l_id_tab WSH_UTIL_CORE.ID_TAB_TYPE;
7128 --
7129 l_debug_on BOOLEAN;
7130 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'COMPARE_DETAIL_ATTRIBUTES';
7131 --
7132
7133 BEGIN
7134
7135 --
7136 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
7137 --
7138 IF l_debug_on IS NULL THEN
7139 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
7140 END IF;
7141 --
7142
7143 IF l_debug_on THEN
7144 WSH_DEBUG_SV.push(l_module_name);
7145 WSH_DEBUG_SV.log(l_module_name,'P_Old_table.count',P_OLD_TABLE.COUNT);
7146 WSH_DEBUG_SV.log(l_module_name,'P_new_table.count',P_NEW_TABLE.COUNT);
7147 WSH_DEBUG_SV.log(l_module_name,'P_action_code',P_ACTION_CODE);
7148 WSH_DEBUG_SV.log(l_module_name,'P_phase',P_PHASE);
7149 WSH_DEBUG_SV.log(l_module_name,'P_caller',P_CALLER);
7150 END IF;
7151
7152 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
7153 l_id_tab.DELETE;
7154
7155 IF p_old_table.count = p_new_table.count THEN
7156 FOR i in 1..p_old_table.count
7157 LOOP
7158 IF (
7159 (p_old_table(i).requested_quantity <>
7160 p_new_table(i).requested_quantity)
7161 OR
7162 (nvl(p_old_table(i).shipped_quantity,-99) <>
7163 nvl(p_new_table(i).shipped_quantity,-99))
7164 OR
7165 (nvl(p_old_table(i).picked_quantity,-99) <>
7166 nvl(p_new_table(i).picked_quantity,-99))
7167 OR
7168 (nvl(p_old_table(i).gross_weight,-99) <>
7169 nvl(p_new_table(i).gross_weight,-99))
7170 OR
7171 (nvl(p_old_table(i).net_weight,-99) <>
7172 nvl(p_new_table(i).net_weight,-99))
7173 OR
7174 (nvl(p_old_table(i).weight_uom_code,'XXX') <>
7175 nvl(p_new_table(i).weight_uom_code,'XXX'))
7176 OR
7177 (nvl(p_old_table(i).volume,-99) <>
7178 nvl(p_new_table(i).volume,-99))
7179 OR
7180 (nvl(p_old_table(i).volume_uom_code,'XXX') <>
7181 nvl(p_new_table(i).volume_uom_code,'XXX'))
7182 OR
7183 (nvl(p_old_table(i).delivery_id,-99) <>
7184 nvl(p_new_table(i).delivery_id,-99))
7185 OR
7186 (nvl(p_old_table(i).parent_delivery_detail_id,-99) <>
7187 nvl(p_new_table(i).parent_delivery_detail_id,-99))
7188 ) THEN
7189
7190 l_id_tab(l_id_tab.count + 1) := p_old_table(i).delivery_detail_id;
7191
7192 END IF;
7193
7194 END LOOP;
7195
7196 x_changed_id_tab := l_id_tab;
7197 END IF;
7198
7199 IF l_debug_on THEN
7200 WSH_DEBUG_SV.pop(l_module_name);
7201 END IF;
7202
7203 EXCEPTION
7204 WHEN others THEN
7205 wsh_util_core.default_handler('WSH_TRIP_UTILITIES.compare_detail_attributes');
7206 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
7207 IF l_debug_on THEN
7208 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
7209 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
7210 END IF;
7211
7212 END compare_detail_attributes;
7213
7214 -- End for Load Tender Project
7215
7216
7217 -- ----------------------------------------------------------------------
7218 -- Procedure: validate_secondary_quantity
7219 -- Parameters:
7220 -- p_delivery_detail_id Delivery Detail Id of line to be split
7221 -- x_quantity Primary Quantity to be split
7222 -- x_quantity2 Secondary Quantity to be split
7223 --
7224 -- Description: Validates secondary quantity for OPM org. for tolerance.
7225 -- Following validations are performed :
7226 -- 1. Primary quantity to be split is mandatory and should be positive
7227 -- 2. If OPM item then secondary quantity to be split is
7228 -- mandatory and should be positive
7229 --
7230 -- 3. If item is under lot control, then validate lot number
7231 -- 4. Check that secondary quantity is within tolerance for
7232 -- items with dual UOM indicator 2 or 3
7233 -- 5. get secondary quantity from primary quantity by applying UOM conversion
7234 -- - for items with dual UOM indicator 1 (Always)
7235 --
7236 -- ----------------------------------------------------------------------
7237 -- HW OPMCONV - Added p_caller parameter
7238 PROCEDURE validate_secondary_quantity
7239 (
7240 p_delivery_detail_id IN NUMBER,
7241 x_quantity IN OUT NOCOPY NUMBER,
7242 x_quantity2 IN OUT NOCOPY NUMBER,
7243 p_caller IN VARCHAR2 ,
7244 x_return_status OUT NOCOPY VARCHAR2,
7245 x_msg_count OUT NOCOPY NUMBER,
7246 x_msg_data OUT NOCOPY VARCHAR2
7247 )
7248 IS
7249 --{
7250
7251 -- HW OPMCONV - No need for OPM variables
7252
7253 l_return NUMBER;
7254 l_outside_tolerance BOOLEAN := TRUE;
7255 l_qty2 NUMBER;
7256
7257 -- HW OPMCONV - New variable
7258 out_of_deviation EXCEPTION;
7259 --
7260 -- Fetch delivery line information
7261 --
7262 CURSOR line_csr (p_delivery_detail_id IN NUMBER)
7263 IS
7264 SELECT organization_id, inventory_item_id,
7265 lot_number, nvl(line_direction,'O') line_direction,
7266 requested_quantity_uom,
7267 requested_quantity_uom2
7268 FROM wsh_delivery_details
7269 WHERE delivery_detail_id = p_delivery_detail_id;
7270 --
7271 --
7272 l_line_rec line_csr%ROWTYPE;
7273 --
7274 --
7275 -- Validate lot number for the item
7276 --
7277 -- HW OPMCONV - Validate lot against Inventory table instead of OPM's
7278 CURSOR lot_csr (p_item_id IN NUMBER, p_organization_id IN NUMBER,
7279 p_lot_number IN VARCHAR2)
7280 IS
7281 SELECT lot_number
7282 FROM MTL_LOT_NUMBERS
7283 WHERE inventory_item_id = p_item_id
7284 AND organization_id = p_organization_id
7285 AND lot_number = p_lot_number ;
7286 --
7287 --
7288 -- HW OPMCONV - Changed type to char from number
7289 l_lot_num VARCHAR2(80);
7290
7291 --
7292 --
7293 l_debug_on BOOLEAN;
7294 --
7295 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || g_pkg_name || '.' || 'VALIDATE_SECONDARY_QUANTITY';
7296 --
7297 l_number_of_errors NUMBER := 0;
7298 l_number_of_warnings NUMBER := 0;
7299 l_msg_count NUMBER;
7300 l_msg_data VARCHAR2(32767);
7301 l_return_status VARCHAR2(32767);
7302 --
7303 -- HW OPMCONV - New variables
7304 l_item_info WSH_DELIVERY_DETAILS_INV.mtl_system_items_rec;
7305 INVALID_LOT EXCEPTION;
7306 e_end_of_api EXCEPTION;
7307 --}
7308 BEGIN
7309 --{
7310 --
7311 l_debug_on := wsh_debug_interface.g_debug;
7312 --
7313 IF l_debug_on IS NULL THEN
7314 l_debug_on := wsh_debug_sv.is_debug_enabled;
7315 END IF;
7316 --
7317 IF l_debug_on THEN
7318 wsh_debug_sv.push(l_module_name);
7319 --
7320 wsh_debug_sv.LOG(l_module_name, 'p_caller', p_caller);
7321 wsh_debug_sv.LOG(l_module_name, 'P_DELIVERY_DETAIL_ID', p_delivery_detail_id);
7322 wsh_debug_sv.LOG(l_module_name, 'X_QUANTITY', x_quantity);
7323 wsh_debug_sv.LOG(l_module_name, 'X_QUANTITY2', x_quantity2);
7324 END IF;
7325 --
7326 x_return_status := wsh_util_core.g_ret_sts_success;
7327 --
7328 --
7329 -- Check that primary quantity to be split is mandatory and should be
7330 -- positive
7331 --
7332 IF x_quantity IS NULL
7333 THEN
7334 --{
7335 fnd_message.set_name('WSH', 'WSH_REQUIRED_FIELD_NULL');
7336 fnd_message.set_token('FIELD_NAME','x_quantity');
7337 wsh_util_core.add_message(FND_API.G_RET_STS_ERROR, l_module_name);
7338 RAISE FND_API.G_EXC_ERROR;
7339 --}
7340 /* HW BUG 4548713- Removed checking for Qty being 0
7341 ELSIF x_quantity = 0
7342 THEN
7343 --{
7344 --
7345 fnd_message.set_name('WSH', 'WSH_NO_ZERO_NUM');
7346 wsh_util_core.add_message(FND_API.G_RET_STS_ERROR, l_module_name);
7347 RAISE FND_API.G_EXC_ERROR;
7348 --}
7349 */
7350 ELSIF x_quantity < 0
7351 THEN
7352 --{
7353 fnd_message.set_name('WSH', 'WSH_NO_NEG_NUM');
7354 wsh_util_core.add_message(FND_API.G_RET_STS_ERROR, l_module_name);
7355 RAISE FND_API.G_EXC_ERROR;
7356 --}
7357 END IF;
7358 --
7359 --
7360 -- Fetch Delivery Line information
7361 --
7362 OPEN line_csr (p_delivery_detail_id);
7363 FETCH line_csr INTO l_line_rec;
7364 --
7365 IF line_csr%NOTFOUND
7366 THEN
7367 --{
7368 fnd_message.set_name('WSH', 'WSH_DET_INVALID_DETAIL');
7369 fnd_message.set_token('DETAIL_ID',p_delivery_detail_id);
7370 wsh_util_core.add_message(FND_API.G_RET_STS_ERROR, l_module_name);
7371 RAISE FND_API.G_EXC_ERROR;
7372 --}
7373 END IF;
7374 --
7375 --
7376 CLOSE line_csr;
7377 --
7378 --
7379 IF l_debug_on THEN
7380 wsh_debug_sv.LOG(l_module_name, 'l_line_rec.organization_id', l_line_rec.organization_id);
7381 wsh_debug_sv.LOG(l_module_name, 'l_line_rec.inventory_item_id', l_line_rec.inventory_item_id);
7382 wsh_debug_sv.LOG(l_module_name, 'l_line_rec.lot_number', l_line_rec.lot_number);
7383 wsh_debug_sv.LOG(l_module_name, 'l_line_rec.requested_quantity_uom', l_line_rec.requested_quantity_uom);
7384 wsh_debug_sv.LOG(l_module_name, 'l_line_rec.requested_quantity_uom2', l_line_rec.requested_quantity_uom2);
7385
7386 END IF;
7387 --
7388 --
7389 --
7390 IF l_line_rec.inventory_item_id IS NULL
7391 THEN
7392 RAISE e_end_of_api;
7393 END IF;
7394 --
7395 --
7396 -- HW OPMCONV - No need to call OPM APIS
7397
7398 -- HW OPMCONV - Call API to get item info
7399 IF l_debug_on THEN
7400 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_DETAILS_INV.Get_item_information',WSH_DEBUG_SV.C_PROC_LEVEL);
7401 END IF;
7402
7403 WSH_DELIVERY_DETAILS_INV.Get_item_information
7404 (
7405 p_organization_id => l_line_rec.organization_id
7406 , p_inventory_item_id => l_line_rec.inventory_item_id
7407 , x_mtl_system_items_rec => l_item_info
7408 , x_return_status => l_return_status
7409 );
7410
7411 --
7412 wsh_util_core.api_post_call
7413 (
7414 p_return_status => l_return_status,
7415 x_num_warnings => l_number_of_warnings,
7416 x_num_errors => l_number_of_errors
7417 );
7418 --
7419 --
7420 -- HW OPMCONV -Print debugging statements
7421 IF l_debug_on THEN
7422 wsh_debug_sv.LOG(l_module_name, 'l_item_info.lot_control_code', l_item_info.lot_control_code);
7423 wsh_debug_sv.LOG(l_module_name, 'l_item_info.tracking_quantity_ind', l_item_info.tracking_quantity_ind);
7424 END IF;
7425 --
7426 --
7427 -- HW OPMCONV - Changed condition to check for secondary_default_ind
7428 IF x_quantity2 IS NULL
7429 AND l_item_info.secondary_default_ind in ('F','D','N')
7430 THEN
7431 --{
7432 fnd_message.set_name('WSH', 'WSH_OPM_SEC_QTY_REQD_ERROR');
7433 wsh_util_core.add_message(FND_API.G_RET_STS_ERROR, l_module_name);
7434 RAISE FND_API.G_EXC_ERROR;
7435 --}
7436 -- HW OPMCONV - Changed condition to check for secondary_default_ind
7437 -- HW BUG 4548713 - Added check for x_quantity
7438 ELSIF x_quantity2 = 0
7439 AND l_item_info.secondary_default_ind in ('F','D','N')
7440 AND x_quantity > 0
7441 THEN
7442 --{
7443 --
7444
7445
7446 fnd_message.set_name('WSH', 'WSH_NO_ZERO_NUM');
7447 wsh_util_core.add_message(FND_API.G_RET_STS_ERROR, l_module_name);
7448 RAISE FND_API.G_EXC_ERROR;
7449 --}
7450 -- HW OPMCONV - Changed condition to check for secondary_default_ind
7451 ELSIF x_quantity2 < 0
7452 AND l_item_info.secondary_default_ind in ('F','D','N')
7453 THEN
7454 --{
7455 fnd_message.set_name('WSH', 'WSH_NO_NEG_NUM');
7456 wsh_util_core.add_message(FND_API.G_RET_STS_ERROR, l_module_name);
7457 RAISE FND_API.G_EXC_ERROR;
7458 --}
7459 END IF;
7460 --
7461 --
7462 -- If item is under lot control, validate lot number.
7463 --
7464 -- HW OPMCONV - Changed condition to check for lot_control_code
7465 -- and lot_number
7466 IF l_item_info.lot_control_code > 0
7467 AND l_line_rec.lot_number IS NOT NULL
7468 THEN
7469 --{
7470 OPEN lot_csr (l_line_rec.inventory_item_id,
7471 l_line_rec.organization_id,l_line_rec.lot_number);
7472 FETCH lot_csr INTO l_lot_num;
7473 --
7474 IF lot_csr%NOTFOUND
7475 THEN
7476 --{
7477 --fnd_message.set_name('GMI', 'IC_INVALID_LOT');
7478 --wsh_util_core.add_message(FND_API.G_RET_STS_ERROR, l_module_name);
7479 RAISE INVALID_LOT;
7480 --}
7481 END IF;
7482 --
7483 --
7484 CLOSE lot_csr;
7485 --}
7486 ELSE
7487 -- HW OPMCONV make lot_number NULL
7488 l_lot_num := NULL;
7489 END IF;
7490 --
7491 --
7492 -- Check if secondary quantity is within tolerance for
7493 -- items with dual UOM indicator 2 or 3
7494 --
7495 -- HW OPMCONV - Check for two types only (Default and No Default)
7496 IF ( l_item_info.secondary_default_ind in ('D','N') ) OR
7497 ( p_caller = 'WSH_PUB' AND l_item_info.secondary_default_ind in ('F','D','N'))
7498 THEN
7499 --{
7500 --
7501 IF l_debug_on THEN
7502 wsh_debug_sv.logmsg(l_module_name, 'Calling program unit
7503 WSH_WV_UTILS.within_deviation', wsh_debug_sv.c_proc_level);
7504 END IF;
7505 --
7506 -- HW OPMCONV - Call new API to check deviation
7507 l_return := WSH_WV_UTILS.within_deviation
7508 (
7509 p_organization_id => l_line_rec.organization_id,
7510 p_inventory_item_id => l_line_rec.inventory_item_id,
7511 p_lot_number => l_lot_num,
7512 p_precision => WSH_UTIL_CORE.C_MAX_DECIMAL_DIGITS_INV,
7513 p_quantity => x_quantity,
7514 p_uom1 => l_line_rec.requested_quantity_uom,
7515 p_quantity2 => x_quantity2,
7516 p_uom2 =>l_line_rec.requested_quantity_uom2
7517 );
7518 --
7519 IF ( l_return = 1 ) THEN
7520 l_outside_tolerance := FALSE;
7521 ELSE -- this includes invalids UOMs)
7522 RAISE out_of_deviation;
7523 END IF;
7524 END IF;
7525 --}
7526
7527 --
7528 --
7529 -- get secondary quantity from primary quantity by applying UOM conversion
7530 -- for items with dual UOM indicator 1 (Always)
7531 --
7532 --
7533 -- HW OPMCONV - Changed condition to check for secondary_default_ind
7534 IF l_outside_tolerance AND l_item_info.secondary_default_ind in ('F','D')
7535 AND ( p_caller <> 'WSH_PUB' )
7536 THEN
7537 --{
7538 --
7539 IF l_debug_on THEN
7540 wsh_debug_sv.logmsg(l_module_name, 'Calling program unit WSH_WV_UTILS.convert_uom', wsh_debug_sv.c_proc_level);
7541 END IF;
7542 --
7543 -- HW OPMCONV - Call UOM routine passing lot_num
7544 l_qty2 := WSH_WV_UTILS.convert_uom
7545 (
7546 item_id => l_line_rec.inventory_item_id,
7547 org_id => l_line_rec.organization_id,
7548 from_uom => l_line_rec.requested_quantity_uom,
7549 to_uom => l_line_rec.requested_quantity_uom2,
7550 quantity => x_quantity,
7551 lot_number => l_lot_num
7552 );
7553 --
7554 IF ( l_qty2 <= 0 ) THEN
7555 FND_MESSAGE.SET_NAME('wsh','WSH_UPDATE_CANNOT_SPLIT');
7556 wsh_util_core.add_message(FND_API.G_RET_STS_ERROR, l_module_name);
7557 RAISE FND_API.G_EXC_ERROR;
7558 END IF;
7559 --
7560 IF l_qty2 <> x_quantity2
7561 THEN
7562 --{
7563 FND_MESSAGE.SET_NAME('WSH','WSH_OPM_QTY_ERROR');
7564 FND_MESSAGE.SET_TOKEN('QUANTITY2',x_quantity2);
7565 FND_MESSAGE.SET_TOKEN('CONV_QUANTITY2',l_qty2);
7566 --wsh_util_core.add_message(FND_API.G_RET_STS_ERROR, l_module_name);
7567 --RAISE FND_API.G_EXC_ERROR;
7568 wsh_util_core.add_message(WSH_UTIL_CORE.G_RET_STS_WARNING, l_module_name);
7569 l_number_of_warnings := NVL(l_number_of_warnings,0) + 1;
7570 --}
7571 END IF;
7572 --
7573 x_quantity2 := l_qty2;
7574 --}
7575 END IF;
7576 --
7577 IF l_number_of_warnings > 0 THEN
7578 IF l_debug_on THEN
7579 wsh_debug_sv.log(l_module_name, 'Number of warnings', l_number_of_warnings);
7580 END IF;
7581
7582 RAISE wsh_util_core.g_exc_warning;
7583 END IF;
7584 --
7585 fnd_msg_pub.count_and_get(
7586 p_count => x_msg_count,
7587 p_data => x_msg_data,
7588 p_encoded => fnd_api.g_false);
7589
7590 IF l_debug_on THEN
7591 wsh_debug_sv.LOG(l_module_name, 'X_QUANTITY2', x_quantity2);
7592 wsh_debug_sv.pop(l_module_name);
7593 END IF;
7594 --
7595 --}
7596 EXCEPTION
7597 WHEN e_end_of_api THEN
7598 x_return_status := fnd_api.g_ret_sts_success;
7599 fnd_msg_pub.count_and_get(
7600 p_count => x_msg_count,
7601 p_data => x_msg_data,
7602 p_encoded => fnd_api.g_false);
7603 --
7604 IF l_debug_on THEN
7605 wsh_debug_sv.pop(l_module_name);
7606 END IF;
7607 --
7608
7609 WHEN INVALID_LOT THEN
7610 x_return_status := fnd_api.g_ret_sts_error;
7611 IF l_debug_on THEN
7612 wsh_debug_sv.logmsg(l_module_name, 'FND_API.G_EXC_ERROR exception has occured.', wsh_debug_sv.c_excep_level);
7613 WSH_DEBUG_SV.logmsg(l_module_name, 'Invalid Lot Number');
7614 END IF;
7615
7616 WHEN OUT_OF_DEVIATION THEN
7617 x_return_status := fnd_api.g_ret_sts_error;
7618 IF l_debug_on THEN
7619 wsh_debug_sv.logmsg(l_module_name, 'FND_API.G_EXC_ERROR exception has occured.', wsh_debug_sv.c_excep_level);
7620 wsh_debug_sv.pop(l_module_name, 'EXCEPTION:FND_API.G_EXC_ERROR');
7621 END IF;
7622
7623 WHEN fnd_api.g_exc_error THEN
7624 x_return_status := fnd_api.g_ret_sts_error;
7625 fnd_msg_pub.count_and_get(
7626 p_count => x_msg_count,
7627 p_data => x_msg_data,
7628 p_encoded => fnd_api.g_false);
7629 --
7630 IF l_debug_on THEN
7631 wsh_debug_sv.logmsg(l_module_name, 'FND_API.G_EXC_ERROR exception has occured.', wsh_debug_sv.c_excep_level);
7632 wsh_debug_sv.pop(l_module_name, 'EXCEPTION:FND_API.G_EXC_ERROR');
7633 END IF;
7634 --
7635 WHEN fnd_api.g_exc_unexpected_error THEN
7636 x_return_status := fnd_api.g_ret_sts_unexp_error;
7637 fnd_msg_pub.count_and_get(
7638 p_count => x_msg_count,
7639 p_data => x_msg_data,
7640 p_encoded => fnd_api.g_false);
7641 --
7642 IF l_debug_on THEN
7643 wsh_debug_sv.logmsg(l_module_name, 'FND_API.G_EXC_UNEXPECTED_ERROR exception has occured.', wsh_debug_sv.c_excep_level);
7644 wsh_debug_sv.pop(l_module_name, 'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
7645 END IF;
7646 --
7647 WHEN wsh_util_core.g_exc_warning THEN
7648 x_return_status := wsh_util_core.g_ret_sts_warning;
7649 fnd_msg_pub.count_and_get(
7650 p_count => x_msg_count,
7651 p_data => x_msg_data,
7652 p_encoded => fnd_api.g_false);
7653 --
7654 IF l_debug_on THEN
7655 wsh_debug_sv.logmsg(l_module_name, 'WSH_UTIL_CORE.G_EXC_WARNING exception has occured ', wsh_debug_sv.c_excep_level);
7656 wsh_debug_sv.pop(l_module_name, 'EXCEPTION:WSH_UTIL_CORE.G_EXC_WARNING');
7657 END IF;
7658 WHEN OTHERS THEN
7659 x_return_status := fnd_api.g_ret_sts_unexp_error;
7660 wsh_util_core.default_handler('WSH_DETAILS_VALIDATIONS.validate_secondary_quantity',l_module_name);
7661 --
7662 fnd_msg_pub.count_and_get(
7663 p_count => x_msg_count,
7664 p_data => x_msg_data,
7665 p_encoded => fnd_api.g_false);
7666 --
7667 IF l_debug_on THEN
7668 wsh_debug_sv.pop(l_module_name, 'EXCEPTION:OTHERS');
7669 END IF;
7670 --
7671 END validate_secondary_quantity;
7672
7673 --public api change
7674 PROCEDURE user_non_updatable_columns
7675 (p_user_in_rec IN wsh_glbl_var_strct_grp.delivery_details_rec_type,
7676 p_out_rec IN wsh_glbl_var_strct_grp.delivery_details_rec_type,
7677 p_in_rec IN wsh_glbl_var_strct_grp.detailInRecType,
7678 x_return_status OUT NOCOPY VARCHAR2)
7679
7680 IS
7681 l_attributes VARCHAR2(2500) ;
7682 k number;
7683 l_return_status VARCHAR2(1);
7684 l_debug_on BOOLEAN;
7685 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'user_non_updatable_columns';
7686
7687 BEGIN
7688
7689 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
7690 --
7691 IF l_debug_on IS NULL
7692 THEN
7693 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
7694 END IF;
7695 --
7696 IF l_debug_on THEN
7697 --
7698 WSH_DEBUG_SV.push(l_module_name);
7699 WSH_DEBUG_SV.log(l_module_name,'p_in_rec.caller',p_in_rec.caller);
7700 --
7701 END IF;
7702 --
7703 x_return_status := FND_API.G_RET_STS_SUCCESS;
7704 --
7705 IF p_user_in_rec.DELIVERY_DETAIL_ID <> FND_API.G_MISS_NUM
7706 AND NVL(p_user_in_rec.DELIVERY_DETAIL_ID,-99) <> NVL(p_out_rec.DELIVERY_DETAIL_ID,-99)
7707 THEN
7708 l_attributes := l_attributes || 'DELIVERY_DETAIL_ID, ';
7709 END IF;
7710
7711 IF p_user_in_rec.SOURCE_CODE <> FND_API.G_MISS_CHAR
7712 AND NVL(p_user_in_rec.SOURCE_CODE,'!!!') <> NVL(p_out_rec.SOURCE_CODE,'!!!')
7713 THEN
7714 l_attributes := l_attributes || 'SOURCE_CODE, ';
7715 END IF;
7716
7717 IF p_user_in_rec.SOURCE_HEADER_ID <> FND_API.G_MISS_NUM
7718 AND NVL(p_user_in_rec.SOURCE_HEADER_ID,-99) <> NVL(p_out_rec.SOURCE_HEADER_ID,-99)
7719 THEN
7720 l_attributes := l_attributes || 'SOURCE_HEADER_ID, ';
7721 END IF;
7722
7723 IF p_user_in_rec.SOURCE_LINE_ID <> FND_API.G_MISS_NUM
7724 AND NVL(p_user_in_rec.SOURCE_LINE_ID,-99) <> NVL(p_out_rec.SOURCE_LINE_ID,-99)
7725 THEN
7726 l_attributes := l_attributes || 'SOURCE_LINE_ID, ';
7727 END IF;
7728
7729 IF p_user_in_rec.CUSTOMER_ID <> FND_API.G_MISS_NUM
7730 AND NVL(p_user_in_rec.CUSTOMER_ID,-99) <> NVL(p_out_rec.CUSTOMER_ID,-99)
7731 THEN
7732 l_attributes := l_attributes || 'CUSTOMER_ID, ';
7733 END IF;
7734
7735 IF p_user_in_rec.SOLD_TO_CONTACT_ID <> FND_API.G_MISS_NUM
7736 AND NVL(p_user_in_rec.SOLD_TO_CONTACT_ID,-99) <> NVL(p_out_rec.SOLD_TO_CONTACT_ID,-99)
7737 THEN
7738 l_attributes := l_attributes || 'SOLD_TO_CONTACT_ID, ';
7739 END IF;
7740
7741 IF p_user_in_rec.INVENTORY_ITEM_ID <> FND_API.G_MISS_NUM
7742 AND NVL(p_user_in_rec.INVENTORY_ITEM_ID,-99) <> NVL(p_out_rec.INVENTORY_ITEM_ID,-99)
7743 THEN
7744 l_attributes := l_attributes || 'INVENTORY_ITEM_ID, ';
7745 END IF;
7746
7747 IF p_user_in_rec.ITEM_DESCRIPTION <> FND_API.G_MISS_CHAR
7748 AND NVL(p_user_in_rec.ITEM_DESCRIPTION,'!!!') <> NVL(p_out_rec.ITEM_DESCRIPTION,'!!!')
7749 THEN
7750 l_attributes := l_attributes || 'ITEM_DESCRIPTION, ';
7751 END IF;
7752
7753 IF p_user_in_rec.HAZARD_CLASS_ID <> FND_API.G_MISS_NUM
7754 AND NVL(p_user_in_rec.HAZARD_CLASS_ID,-99) <> NVL(p_out_rec.HAZARD_CLASS_ID,-99)
7755 THEN
7756 l_attributes := l_attributes || 'HAZARD_CLASS_ID, ';
7757 END IF;
7758
7759 IF p_user_in_rec.COUNTRY_OF_ORIGIN <> FND_API.G_MISS_CHAR
7760 AND NVL(p_user_in_rec.COUNTRY_OF_ORIGIN,'!!!') <> NVL(p_out_rec.COUNTRY_OF_ORIGIN,'!!!')
7761 THEN
7762 l_attributes := l_attributes || 'COUNTRY_OF_ORIGIN, ';
7763 END IF;
7764
7765 IF p_user_in_rec.CLASSIFICATION <> FND_API.G_MISS_CHAR
7766 AND NVL(p_user_in_rec.CLASSIFICATION,'!!!') <> NVL(p_out_rec.CLASSIFICATION,'!!!')
7767 THEN
7768 l_attributes := l_attributes || 'CLASSIFICATION, ';
7769 END IF;
7770
7771 IF p_user_in_rec.SHIP_FROM_LOCATION_ID <> FND_API.G_MISS_NUM
7772 AND NVL(p_user_in_rec.SHIP_FROM_LOCATION_ID,-99) <> NVL(p_out_rec.SHIP_FROM_LOCATION_ID,-99)
7773 THEN
7774 l_attributes := l_attributes || 'SHIP_FROM_LOCATION_ID, ';
7775 END IF;
7776
7777 IF p_user_in_rec.SHIP_TO_LOCATION_ID <> FND_API.G_MISS_NUM
7778 AND NVL(p_user_in_rec.SHIP_TO_LOCATION_ID,-99) <> NVL(p_out_rec.SHIP_TO_LOCATION_ID,-99)
7779 THEN
7780 l_attributes := l_attributes || 'SHIP_TO_LOCATION_ID, ';
7781 END IF;
7782
7783 IF p_user_in_rec.SHIP_TO_CONTACT_ID <> FND_API.G_MISS_NUM
7784 AND NVL(p_user_in_rec.SHIP_TO_CONTACT_ID,-99) <> NVL(p_out_rec.SHIP_TO_CONTACT_ID,-99)
7785 THEN
7786 l_attributes := l_attributes || 'SHIP_TO_CONTACT_ID, ';
7787 END IF;
7788
7789 IF p_user_in_rec.SHIP_TO_SITE_USE_ID <> FND_API.G_MISS_NUM
7790 AND NVL(p_user_in_rec.SHIP_TO_SITE_USE_ID,-99) <> NVL(p_out_rec.SHIP_TO_SITE_USE_ID,-99)
7791 THEN
7792 l_attributes := l_attributes || 'SHIP_TO_SITE_USE_ID, ';
7793 END IF;
7794
7795 IF p_user_in_rec.DELIVER_TO_LOCATION_ID <> FND_API.G_MISS_NUM
7796 AND NVL(p_user_in_rec.DELIVER_TO_LOCATION_ID,-99) <> NVL(p_out_rec.DELIVER_TO_LOCATION_ID,-99)
7797 THEN
7798 l_attributes := l_attributes || 'DELIVER_TO_LOCATION_ID, ';
7799 END IF;
7800
7801 IF p_user_in_rec.DELIVER_TO_CONTACT_ID <> FND_API.G_MISS_NUM
7802 AND NVL(p_user_in_rec.DELIVER_TO_CONTACT_ID,-99) <> NVL(p_out_rec.DELIVER_TO_CONTACT_ID,-99)
7803 THEN
7804 l_attributes := l_attributes || 'DELIVER_TO_CONTACT_ID, ';
7805 END IF;
7806
7807 IF p_user_in_rec.DELIVER_TO_SITE_USE_ID <> FND_API.G_MISS_NUM
7808 AND NVL(p_user_in_rec.DELIVER_TO_SITE_USE_ID,-99) <> NVL(p_out_rec.DELIVER_TO_SITE_USE_ID,-99)
7809 THEN
7810 l_attributes := l_attributes || 'DELIVER_TO_SITE_USE_ID, ';
7811 END IF;
7812
7813 IF p_user_in_rec.INTMED_SHIP_TO_LOCATION_ID <> FND_API.G_MISS_NUM
7814 AND NVL(p_user_in_rec.INTMED_SHIP_TO_LOCATION_ID,-99) <> NVL(p_out_rec.INTMED_SHIP_TO_LOCATION_ID,-99)
7815 THEN
7816 l_attributes := l_attributes || 'INTMED_SHIP_TO_LOCATION_ID, ';
7817 END IF;
7818
7819 IF p_user_in_rec.INTMED_SHIP_TO_CONTACT_ID <> FND_API.G_MISS_NUM
7820 AND NVL(p_user_in_rec.INTMED_SHIP_TO_CONTACT_ID,-99) <> NVL(p_out_rec.INTMED_SHIP_TO_CONTACT_ID,-99)
7821 THEN
7822 l_attributes := l_attributes || 'INTMED_SHIP_TO_CONTACT_ID, ';
7823 END IF;
7824
7825 IF p_user_in_rec.HOLD_CODE <> FND_API.G_MISS_CHAR
7826 AND NVL(p_user_in_rec.HOLD_CODE,'!!!') <> NVL(p_out_rec.HOLD_CODE,'!!!')
7827 THEN
7828 l_attributes := l_attributes || 'HOLD_CODE, ';
7829 END IF;
7830
7831 IF p_user_in_rec.SHIP_TOLERANCE_ABOVE <> FND_API.G_MISS_NUM
7832 AND NVL(p_user_in_rec.SHIP_TOLERANCE_ABOVE,-99) <> NVL(p_out_rec.SHIP_TOLERANCE_ABOVE,-99)
7833 THEN
7834 l_attributes := l_attributes || 'SHIP_TOLERANCE_ABOVE, ';
7835 END IF;
7836
7837 IF p_user_in_rec.SHIP_TOLERANCE_BELOW <> FND_API.G_MISS_NUM
7838 AND NVL(p_user_in_rec.SHIP_TOLERANCE_BELOW,-99) <> NVL(p_out_rec.SHIP_TOLERANCE_BELOW,-99)
7839 THEN
7840 l_attributes := l_attributes || 'SHIP_TOLERANCE_BELOW, ';
7841 END IF;
7842
7843 IF p_user_in_rec.REQUESTED_QUANTITY <> FND_API.G_MISS_NUM
7844 AND NVL(p_user_in_rec.REQUESTED_QUANTITY,-99) <> NVL(p_out_rec.REQUESTED_QUANTITY,-99)
7845 THEN
7846 l_attributes := l_attributes || 'REQUESTED_QUANTITY, ';
7847 END IF;
7848
7849 IF p_user_in_rec.SHIPPED_QUANTITY <> FND_API.G_MISS_NUM
7850 AND NVL(p_user_in_rec.SHIPPED_QUANTITY,-99) <> NVL(p_out_rec.SHIPPED_QUANTITY,-99)
7851 THEN
7852 l_attributes := l_attributes || 'SHIPPED_QUANTITY, ';
7853 END IF;
7854
7855 IF p_user_in_rec.DELIVERED_QUANTITY <> FND_API.G_MISS_NUM
7856 AND NVL(p_user_in_rec.DELIVERED_QUANTITY,-99) <> NVL(p_out_rec.DELIVERED_QUANTITY,-99)
7857 THEN
7858 l_attributes := l_attributes || 'DELIVERED_QUANTITY, ';
7859 END IF;
7860
7861 IF p_user_in_rec.REQUESTED_QUANTITY_UOM <> FND_API.G_MISS_CHAR
7862 AND NVL(p_user_in_rec.REQUESTED_QUANTITY_UOM,'!!!') <> NVL(p_out_rec.REQUESTED_QUANTITY_UOM,'!!!')
7863 THEN
7864 l_attributes := l_attributes || 'REQUESTED_QUANTITY_UOM, ';
7865 END IF;
7866
7867 IF p_user_in_rec.SUBINVENTORY <> FND_API.G_MISS_CHAR
7868 AND NVL(p_user_in_rec.SUBINVENTORY,'!!!') <> NVL(p_out_rec.SUBINVENTORY,'!!!')
7869 THEN
7870 l_attributes := l_attributes || 'SUBINVENTORY, ';
7871 END IF;
7872
7873 IF p_user_in_rec.REVISION <> FND_API.G_MISS_CHAR
7874 AND NVL(p_user_in_rec.REVISION,'!!!') <> NVL(p_out_rec.REVISION,'!!!')
7875 THEN
7876 l_attributes := l_attributes || 'REVISION, ';
7877 END IF;
7878
7879 IF p_user_in_rec.LOT_NUMBER <> FND_API.G_MISS_CHAR
7880 AND NVL(p_user_in_rec.LOT_NUMBER,'!!!') <> NVL(p_out_rec.LOT_NUMBER,'!!!')
7881 THEN
7882 l_attributes := l_attributes || 'LOT_NUMBER, ';
7883 END IF;
7884
7885 IF p_user_in_rec.CUSTOMER_REQUESTED_LOT_FLAG <> FND_API.G_MISS_CHAR
7886 AND NVL(p_user_in_rec.CUSTOMER_REQUESTED_LOT_FLAG,'!!!') <> NVL(p_out_rec.CUSTOMER_REQUESTED_LOT_FLAG,'!!!')
7887 THEN
7888 l_attributes := l_attributes || 'CUSTOMER_REQUESTED_LOT_FLAG, ';
7889 END IF;
7890
7891 IF p_user_in_rec.SERIAL_NUMBER <> FND_API.G_MISS_CHAR
7892 AND NVL(p_user_in_rec.SERIAL_NUMBER,'!!!') <> NVL(p_out_rec.SERIAL_NUMBER,'!!!')
7893 THEN
7894 l_attributes := l_attributes || 'SERIAL_NUMBER, ';
7895 END IF;
7896
7897 IF p_user_in_rec.LOCATOR_ID <> FND_API.G_MISS_NUM
7898 AND NVL(p_user_in_rec.LOCATOR_ID,-99) <> NVL(p_out_rec.LOCATOR_ID,-99)
7899 THEN
7900 l_attributes := l_attributes || 'LOCATOR_ID, ';
7901 END IF;
7902
7903 IF p_user_in_rec.DATE_REQUESTED <> FND_API.G_MISS_DATE
7904 AND NVL(p_user_in_rec.DATE_REQUESTED,TO_DATE('2','j')) <> NVL(p_out_rec.DATE_REQUESTED,TO_DATE('2','j'))
7905 THEN
7906 l_attributes := l_attributes || 'DATE_REQUESTED, ';
7907 END IF;
7908
7909 IF p_user_in_rec.DATE_SCHEDULED <> FND_API.G_MISS_DATE
7910 AND NVL(p_user_in_rec.DATE_SCHEDULED,TO_DATE('2','j')) <> NVL(p_out_rec.DATE_SCHEDULED,TO_DATE('2','j'))
7911 THEN
7912 l_attributes := l_attributes || 'DATE_SCHEDULED, ';
7913 END IF;
7914
7915 IF p_user_in_rec.MASTER_CONTAINER_ITEM_ID <> FND_API.G_MISS_NUM
7916 AND NVL(p_user_in_rec.MASTER_CONTAINER_ITEM_ID,-99) <> NVL(p_out_rec.MASTER_CONTAINER_ITEM_ID,-99)
7917 THEN
7918 l_attributes := l_attributes || 'MASTER_CONTAINER_ITEM_ID, ';
7919 END IF;
7920
7921 IF p_user_in_rec.DETAIL_CONTAINER_ITEM_ID <> FND_API.G_MISS_NUM
7922 AND NVL(p_user_in_rec.DETAIL_CONTAINER_ITEM_ID,-99) <> NVL(p_out_rec.DETAIL_CONTAINER_ITEM_ID,-99)
7923 THEN
7924 l_attributes := l_attributes || 'DETAIL_CONTAINER_ITEM_ID, ';
7925 END IF;
7926
7927 IF p_user_in_rec.LOAD_SEQ_NUMBER <> FND_API.G_MISS_NUM
7928 AND NVL(p_user_in_rec.LOAD_SEQ_NUMBER,-99) <> NVL(p_out_rec.LOAD_SEQ_NUMBER,-99)
7929 THEN
7930 l_attributes := l_attributes || 'LOAD_SEQ_NUMBER, ';
7931 END IF;
7932
7933 IF p_user_in_rec.SHIP_METHOD_CODE <> FND_API.G_MISS_CHAR
7934 AND NVL(p_user_in_rec.SHIP_METHOD_CODE,'!!!') <> NVL(p_out_rec.SHIP_METHOD_CODE,'!!!')
7935 THEN
7936 l_attributes := l_attributes || 'SHIP_METHOD_CODE, ';
7937 END IF;
7938
7939 IF p_user_in_rec.CARRIER_ID <> FND_API.G_MISS_NUM
7940 AND NVL(p_user_in_rec.CARRIER_ID,-99) <> NVL(p_out_rec.CARRIER_ID,-99)
7941 THEN
7942 l_attributes := l_attributes || 'CARRIER_ID, ';
7943 END IF;
7944
7945 IF p_user_in_rec.FREIGHT_TERMS_CODE <> FND_API.G_MISS_CHAR
7946 AND NVL(p_user_in_rec.FREIGHT_TERMS_CODE,'!!!') <> NVL(p_out_rec.FREIGHT_TERMS_CODE,'!!!')
7947 THEN
7948 l_attributes := l_attributes || 'FREIGHT_TERMS_CODE, ';
7949 END IF;
7950
7951 IF p_user_in_rec.SHIPMENT_PRIORITY_CODE <> FND_API.G_MISS_CHAR
7952 AND NVL(p_user_in_rec.SHIPMENT_PRIORITY_CODE,'!!!') <> NVL(p_out_rec.SHIPMENT_PRIORITY_CODE,'!!!')
7953 THEN
7954 l_attributes := l_attributes || 'SHIPMENT_PRIORITY_CODE, ';
7955 END IF;
7956
7957 IF p_user_in_rec.FOB_CODE <> FND_API.G_MISS_CHAR
7958 AND NVL(p_user_in_rec.FOB_CODE,'!!!') <> NVL(p_out_rec.FOB_CODE,'!!!')
7959 THEN
7960 l_attributes := l_attributes || 'FOB_CODE, ';
7961 END IF;
7962
7963 IF p_user_in_rec.CUSTOMER_ITEM_ID <> FND_API.G_MISS_NUM
7964 AND NVL(p_user_in_rec.CUSTOMER_ITEM_ID,-99) <> NVL(p_out_rec.CUSTOMER_ITEM_ID,-99)
7965 THEN
7966 l_attributes := l_attributes || 'CUSTOMER_ITEM_ID, ';
7967 END IF;
7968
7969 IF p_user_in_rec.DEP_PLAN_REQUIRED_FLAG <> FND_API.G_MISS_CHAR
7970 AND NVL(p_user_in_rec.DEP_PLAN_REQUIRED_FLAG,'!!!') <> NVL(p_out_rec.DEP_PLAN_REQUIRED_FLAG,'!!!')
7971 THEN
7972 l_attributes := l_attributes || 'DEP_PLAN_REQUIRED_FLAG, ';
7973 END IF;
7974
7975 IF p_user_in_rec.CUSTOMER_PROD_SEQ <> FND_API.G_MISS_CHAR
7976 AND NVL(p_user_in_rec.CUSTOMER_PROD_SEQ,'!!!') <> NVL(p_out_rec.CUSTOMER_PROD_SEQ,'!!!')
7977 THEN
7978 l_attributes := l_attributes || 'CUSTOMER_PROD_SEQ, ';
7979 END IF;
7980
7981 IF p_user_in_rec.CUSTOMER_DOCK_CODE <> FND_API.G_MISS_CHAR
7982 AND NVL(p_user_in_rec.CUSTOMER_DOCK_CODE,'!!!') <> NVL(p_out_rec.CUSTOMER_DOCK_CODE,'!!!')
7983 THEN
7984 l_attributes := l_attributes || 'CUSTOMER_DOCK_CODE, ';
7985 END IF;
7986
7987 IF p_user_in_rec.CUST_MODEL_SERIAL_NUMBER <> FND_API.G_MISS_CHAR
7988 AND NVL(p_user_in_rec.CUST_MODEL_SERIAL_NUMBER,'!!!') <> NVL(p_out_rec.CUST_MODEL_SERIAL_NUMBER,'!!!')
7989 THEN
7990 l_attributes := l_attributes || 'CUST_MODEL_SERIAL_NUMBER, ';
7991 END IF;
7992
7993 IF p_user_in_rec.CUSTOMER_JOB <> FND_API.G_MISS_CHAR
7994 AND NVL(p_user_in_rec.CUSTOMER_JOB,'!!!') <> NVL(p_out_rec.CUSTOMER_JOB,'!!!')
7995 THEN
7996 l_attributes := l_attributes || 'CUSTOMER_JOB, ';
7997 END IF;
7998
7999 IF p_user_in_rec.CUSTOMER_PRODUCTION_LINE <> FND_API.G_MISS_CHAR
8000 AND NVL(p_user_in_rec.CUSTOMER_PRODUCTION_LINE,'!!!') <> NVL(p_out_rec.CUSTOMER_PRODUCTION_LINE,'!!!')
8001 THEN
8002 l_attributes := l_attributes || 'CUSTOMER_PRODUCTION_LINE, ';
8003 END IF;
8004
8005 IF p_user_in_rec.NET_WEIGHT <> FND_API.G_MISS_NUM
8006 AND NVL(p_user_in_rec.NET_WEIGHT,-99) <> NVL(p_out_rec.NET_WEIGHT,-99)
8007 THEN
8008 l_attributes := l_attributes || 'NET_WEIGHT, ';
8009 END IF;
8010
8011 IF p_user_in_rec.WEIGHT_UOM_CODE <> FND_API.G_MISS_CHAR
8012 AND NVL(p_user_in_rec.WEIGHT_UOM_CODE,'!!!') <> NVL(p_out_rec.WEIGHT_UOM_CODE,'!!!')
8013 THEN
8014 IF (NVL(p_in_rec.caller,'WSH') LIKE 'WMS%')
8015 AND (NVL(p_in_rec.action_code,'CREATE') = 'UPDATE') THEN
8016 NULL;
8017 ELSE
8018 l_attributes := l_attributes || 'WEIGHT_UOM_CODE, ';
8019 END IF;
8020 END IF;
8021
8022 IF p_user_in_rec.VOLUME <> FND_API.G_MISS_NUM
8023 AND NVL(p_user_in_rec.VOLUME,-99) <> NVL(p_out_rec.VOLUME,-99)
8024 THEN
8025 l_attributes := l_attributes || 'VOLUME, ';
8026 END IF;
8027
8028 IF p_user_in_rec.VOLUME_UOM_CODE <> FND_API.G_MISS_CHAR
8029 AND NVL(p_user_in_rec.VOLUME_UOM_CODE,'!!!') <> NVL(p_out_rec.VOLUME_UOM_CODE,'!!!')
8030 THEN
8031 IF (NVL(p_in_rec.caller,'WSH') LIKE 'WMS%')
8032 AND (NVL(p_in_rec.action_code,'CREATE') = 'UPDATE') THEN
8033 NULL;
8034 ELSE
8035 l_attributes := l_attributes || 'VOLUME_UOM_CODE, ';
8036 END IF;
8037 END IF;
8038
8039 IF p_user_in_rec.TP_ATTRIBUTE_CATEGORY <> FND_API.G_MISS_CHAR
8040 AND NVL(p_user_in_rec.TP_ATTRIBUTE_CATEGORY,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE_CATEGORY,'!!!')
8041 THEN
8042 l_attributes := l_attributes || 'TP_ATTRIBUTE_CATEGORY, ';
8043 END IF;
8044
8045 IF p_user_in_rec.TP_ATTRIBUTE1 <> FND_API.G_MISS_CHAR
8046 AND NVL(p_user_in_rec.TP_ATTRIBUTE1,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE1,'!!!')
8047 THEN
8048 l_attributes := l_attributes || 'TP_ATTRIBUTE1, ';
8049 END IF;
8050
8051 IF p_user_in_rec.TP_ATTRIBUTE2 <> FND_API.G_MISS_CHAR
8052 AND NVL(p_user_in_rec.TP_ATTRIBUTE2,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE2,'!!!')
8053 THEN
8054 l_attributes := l_attributes || 'TP_ATTRIBUTE2, ';
8055 END IF;
8056
8057 IF p_user_in_rec.TP_ATTRIBUTE3 <> FND_API.G_MISS_CHAR
8058 AND NVL(p_user_in_rec.TP_ATTRIBUTE3,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE3,'!!!')
8059 THEN
8060 l_attributes := l_attributes || 'TP_ATTRIBUTE3, ';
8061 END IF;
8062
8063 IF p_user_in_rec.TP_ATTRIBUTE4 <> FND_API.G_MISS_CHAR
8064 AND NVL(p_user_in_rec.TP_ATTRIBUTE4,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE4,'!!!')
8065 THEN
8066 l_attributes := l_attributes || 'TP_ATTRIBUTE4, ';
8067 END IF;
8068
8069 IF p_user_in_rec.TP_ATTRIBUTE5 <> FND_API.G_MISS_CHAR
8070 AND NVL(p_user_in_rec.TP_ATTRIBUTE5,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE5,'!!!')
8071 THEN
8072 l_attributes := l_attributes || 'TP_ATTRIBUTE5, ';
8073 END IF;
8074
8075 IF p_user_in_rec.TP_ATTRIBUTE6 <> FND_API.G_MISS_CHAR
8076 AND NVL(p_user_in_rec.TP_ATTRIBUTE6,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE6,'!!!')
8077 THEN
8078 l_attributes := l_attributes || 'TP_ATTRIBUTE6, ';
8079 END IF;
8080
8081 IF p_user_in_rec.TP_ATTRIBUTE7 <> FND_API.G_MISS_CHAR
8082 AND NVL(p_user_in_rec.TP_ATTRIBUTE7,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE7,'!!!')
8083 THEN
8084 l_attributes := l_attributes || 'TP_ATTRIBUTE7, ';
8085 END IF;
8086
8087 IF p_user_in_rec.TP_ATTRIBUTE8 <> FND_API.G_MISS_CHAR
8088 AND NVL(p_user_in_rec.TP_ATTRIBUTE8,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE8,'!!!')
8089 THEN
8090 l_attributes := l_attributes || 'TP_ATTRIBUTE8, ';
8091 END IF;
8092
8093 IF p_user_in_rec.TP_ATTRIBUTE9 <> FND_API.G_MISS_CHAR
8094 AND NVL(p_user_in_rec.TP_ATTRIBUTE9,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE9,'!!!')
8095 THEN
8096 l_attributes := l_attributes || 'TP_ATTRIBUTE9, ';
8097 END IF;
8098
8099 IF p_user_in_rec.TP_ATTRIBUTE10 <> FND_API.G_MISS_CHAR
8100 AND NVL(p_user_in_rec.TP_ATTRIBUTE10,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE10,'!!!')
8101 THEN
8102 l_attributes := l_attributes || 'TP_ATTRIBUTE10, ';
8103 END IF;
8104
8105 IF p_user_in_rec.TP_ATTRIBUTE11 <> FND_API.G_MISS_CHAR
8106 AND NVL(p_user_in_rec.TP_ATTRIBUTE11,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE11,'!!!')
8107 THEN
8108 l_attributes := l_attributes || 'TP_ATTRIBUTE11, ';
8109 END IF;
8110
8111 IF p_user_in_rec.TP_ATTRIBUTE12 <> FND_API.G_MISS_CHAR
8112 AND NVL(p_user_in_rec.TP_ATTRIBUTE12,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE12,'!!!')
8113 THEN
8114 l_attributes := l_attributes || 'TP_ATTRIBUTE12, ';
8115 END IF;
8116
8117 IF p_user_in_rec.TP_ATTRIBUTE13 <> FND_API.G_MISS_CHAR
8118 AND NVL(p_user_in_rec.TP_ATTRIBUTE13,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE13,'!!!')
8119 THEN
8120 l_attributes := l_attributes || 'TP_ATTRIBUTE13, ';
8121 END IF;
8122
8123 IF p_user_in_rec.TP_ATTRIBUTE14 <> FND_API.G_MISS_CHAR
8124 AND NVL(p_user_in_rec.TP_ATTRIBUTE14,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE14,'!!!')
8125 THEN
8126 l_attributes := l_attributes || 'TP_ATTRIBUTE14, ';
8127 END IF;
8128
8129 IF p_user_in_rec.TP_ATTRIBUTE15 <> FND_API.G_MISS_CHAR
8130 AND NVL(p_user_in_rec.TP_ATTRIBUTE15,'!!!') <> NVL(p_out_rec.TP_ATTRIBUTE15,'!!!')
8131 THEN
8132 l_attributes := l_attributes || 'TP_ATTRIBUTE15, ';
8133 END IF;
8134
8135 IF p_user_in_rec.ATTRIBUTE_CATEGORY <> FND_API.G_MISS_CHAR
8136 AND NVL(p_user_in_rec.ATTRIBUTE_CATEGORY,'!!!') <> NVL(p_out_rec.ATTRIBUTE_CATEGORY,'!!!')
8137 THEN
8138 l_attributes := l_attributes || 'ATTRIBUTE_CATEGORY, ';
8139 END IF;
8140
8141 IF p_user_in_rec.ATTRIBUTE1 <> FND_API.G_MISS_CHAR
8142 AND NVL(p_user_in_rec.ATTRIBUTE1,'!!!') <> NVL(p_out_rec.ATTRIBUTE1,'!!!')
8143 THEN
8144 l_attributes := l_attributes || 'ATTRIBUTE1, ';
8145 END IF;
8146
8147 IF p_user_in_rec.ATTRIBUTE2 <> FND_API.G_MISS_CHAR
8148 AND NVL(p_user_in_rec.ATTRIBUTE2,'!!!') <> NVL(p_out_rec.ATTRIBUTE2,'!!!')
8149 THEN
8150 l_attributes := l_attributes || 'ATTRIBUTE2, ';
8151 END IF;
8152
8153 IF p_user_in_rec.ATTRIBUTE3 <> FND_API.G_MISS_CHAR
8154 AND NVL(p_user_in_rec.ATTRIBUTE3,'!!!') <> NVL(p_out_rec.ATTRIBUTE3,'!!!')
8155 THEN
8156 l_attributes := l_attributes || 'ATTRIBUTE3, ';
8157 END IF;
8158
8159 IF p_user_in_rec.ATTRIBUTE4 <> FND_API.G_MISS_CHAR
8160 AND NVL(p_user_in_rec.ATTRIBUTE4,'!!!') <> NVL(p_out_rec.ATTRIBUTE4,'!!!')
8161 THEN
8162 l_attributes := l_attributes || 'ATTRIBUTE4, ';
8163 END IF;
8164
8165 IF p_user_in_rec.ATTRIBUTE5 <> FND_API.G_MISS_CHAR
8166 AND NVL(p_user_in_rec.ATTRIBUTE5,'!!!') <> NVL(p_out_rec.ATTRIBUTE5,'!!!')
8167 THEN
8168 l_attributes := l_attributes || 'ATTRIBUTE5, ';
8169 END IF;
8170
8171 IF p_user_in_rec.ATTRIBUTE6 <> FND_API.G_MISS_CHAR
8172 AND NVL(p_user_in_rec.ATTRIBUTE6,'!!!') <> NVL(p_out_rec.ATTRIBUTE6,'!!!')
8173 THEN
8174 l_attributes := l_attributes || 'ATTRIBUTE6, ';
8175 END IF;
8176
8177 IF p_user_in_rec.ATTRIBUTE7 <> FND_API.G_MISS_CHAR
8178 AND NVL(p_user_in_rec.ATTRIBUTE7,'!!!') <> NVL(p_out_rec.ATTRIBUTE7,'!!!')
8179 THEN
8180 l_attributes := l_attributes || 'ATTRIBUTE7, ';
8181 END IF;
8182
8183 IF p_user_in_rec.ATTRIBUTE8 <> FND_API.G_MISS_CHAR
8184 AND NVL(p_user_in_rec.ATTRIBUTE8,'!!!') <> NVL(p_out_rec.ATTRIBUTE8,'!!!')
8185 THEN
8186 l_attributes := l_attributes || 'ATTRIBUTE8, ';
8187 END IF;
8188
8189 IF p_user_in_rec.ATTRIBUTE9 <> FND_API.G_MISS_CHAR
8190 AND NVL(p_user_in_rec.ATTRIBUTE9,'!!!') <> NVL(p_out_rec.ATTRIBUTE9,'!!!')
8191 THEN
8192 l_attributes := l_attributes || 'ATTRIBUTE9, ';
8193 END IF;
8194
8195 IF p_user_in_rec.ATTRIBUTE10 <> FND_API.G_MISS_CHAR
8196 AND NVL(p_user_in_rec.ATTRIBUTE10,'!!!') <> NVL(p_out_rec.ATTRIBUTE10,'!!!')
8197 THEN
8198 l_attributes := l_attributes || 'ATTRIBUTE10, ';
8199 END IF;
8200
8201 IF p_user_in_rec.ATTRIBUTE11 <> FND_API.G_MISS_CHAR
8202 AND NVL(p_user_in_rec.ATTRIBUTE11,'!!!') <> NVL(p_out_rec.ATTRIBUTE11,'!!!')
8203 THEN
8204 l_attributes := l_attributes || 'ATTRIBUTE11, ';
8205 END IF;
8206
8207 IF p_user_in_rec.ATTRIBUTE12 <> FND_API.G_MISS_CHAR
8208 AND NVL(p_user_in_rec.ATTRIBUTE12,'!!!') <> NVL(p_out_rec.ATTRIBUTE12,'!!!')
8209 THEN
8210 l_attributes := l_attributes || 'ATTRIBUTE12, ';
8211 END IF;
8212
8213 IF p_user_in_rec.ATTRIBUTE13 <> FND_API.G_MISS_CHAR
8214 AND NVL(p_user_in_rec.ATTRIBUTE13,'!!!') <> NVL(p_out_rec.ATTRIBUTE13,'!!!')
8215 THEN
8216 l_attributes := l_attributes || 'ATTRIBUTE13, ';
8217 END IF;
8218
8219 IF p_user_in_rec.ATTRIBUTE14 <> FND_API.G_MISS_CHAR
8220 AND NVL(p_user_in_rec.ATTRIBUTE14,'!!!') <> NVL(p_out_rec.ATTRIBUTE14,'!!!')
8221 THEN
8222 l_attributes := l_attributes || 'ATTRIBUTE14, ';
8223 END IF;
8224
8225 IF p_user_in_rec.ATTRIBUTE15 <> FND_API.G_MISS_CHAR
8226 AND NVL(p_user_in_rec.ATTRIBUTE15,'!!!') <> NVL(p_out_rec.ATTRIBUTE15,'!!!')
8227 THEN
8228 l_attributes := l_attributes || 'ATTRIBUTE15, ';
8229 END IF;
8230
8231 /**
8232 -- Bug 3613650 : Need not compare WHO columns
8233 --
8234 IF p_user_in_rec.CREATED_BY <> FND_API.G_MISS_NUM
8235 AND NVL(p_user_in_rec.CREATED_BY,-99) <> NVL(p_out_rec.CREATED_BY,-99)
8236 THEN
8237 l_attributes := l_attributes || 'CREATED_BY, ';
8238 END IF;
8239
8240 IF p_user_in_rec.CREATION_DATE <> FND_API.G_MISS_DATE
8241 AND NVL(p_user_in_rec.CREATION_DATE,TO_DATE('2','j')) <> NVL(p_out_rec.CREATION_DATE,TO_DATE('2','j'))
8242 THEN
8243 l_attributes := l_attributes || 'CREATION_DATE, ';
8244 END IF;
8245
8246 IF p_user_in_rec.LAST_UPDATE_DATE <> FND_API.G_MISS_DATE
8247 AND NVL(p_user_in_rec.LAST_UPDATE_DATE,TO_DATE('2','j')) <> NVL(p_out_rec.LAST_UPDATE_DATE,TO_DATE('2','j'))
8248 THEN
8249 l_attributes := l_attributes || 'LAST_UPDATE_DATE, ';
8250 END IF;
8251
8252 IF p_user_in_rec.LAST_UPDATE_LOGIN <> FND_API.G_MISS_NUM
8253 AND NVL(p_user_in_rec.LAST_UPDATE_LOGIN,-99) <> NVL(p_out_rec.LAST_UPDATE_LOGIN,-99)
8254 THEN
8255 l_attributes := l_attributes || 'LAST_UPDATE_LOGIN, ';
8256 END IF;
8257
8258 IF p_user_in_rec.LAST_UPDATED_BY <> FND_API.G_MISS_NUM
8259 AND NVL(p_user_in_rec.LAST_UPDATED_BY,-99) <> NVL(p_out_rec.LAST_UPDATED_BY,-99)
8260 THEN
8261 l_attributes := l_attributes || 'LAST_UPDATED_BY, ';
8262 END IF;
8263
8264 IF p_user_in_rec.PROGRAM_APPLICATION_ID <> FND_API.G_MISS_NUM
8265 AND NVL(p_user_in_rec.PROGRAM_APPLICATION_ID,-99) <> NVL(p_out_rec.PROGRAM_APPLICATION_ID,-99)
8266 THEN
8267 l_attributes := l_attributes || 'PROGRAM_APPLICATION_ID, ';
8268 END IF;
8269
8270 IF p_user_in_rec.PROGRAM_ID <> FND_API.G_MISS_NUM
8271 AND NVL(p_user_in_rec.PROGRAM_ID,-99) <> NVL(p_out_rec.PROGRAM_ID,-99)
8272 THEN
8273 l_attributes := l_attributes || 'PROGRAM_ID, ';
8274 END IF;
8275
8276 IF p_user_in_rec.PROGRAM_UPDATE_DATE <> FND_API.G_MISS_DATE
8277 AND NVL(p_user_in_rec.PROGRAM_UPDATE_DATE,TO_DATE('2','j')) <> NVL(p_out_rec.PROGRAM_UPDATE_DATE,TO_DATE('2','j'))
8278 THEN
8279 l_attributes := l_attributes || 'PROGRAM_UPDATE_DATE, ';
8280 END IF;
8281
8282 IF p_user_in_rec.REQUEST_ID <> FND_API.G_MISS_NUM
8283 AND NVL(p_user_in_rec.REQUEST_ID,-99) <> NVL(p_out_rec.REQUEST_ID,-99)
8284 THEN
8285 l_attributes := l_attributes || 'REQUEST_ID, ';
8286 END IF;
8287 **/
8288
8289 IF p_user_in_rec.MVT_STAT_STATUS <> FND_API.G_MISS_CHAR
8290 AND NVL(p_user_in_rec.MVT_STAT_STATUS,'!!!') <> NVL(p_out_rec.MVT_STAT_STATUS,'!!!')
8291 THEN
8292 l_attributes := l_attributes || 'MVT_STAT_STATUS, ';
8293 END IF;
8294
8295 IF p_user_in_rec.RELEASED_FLAG <> FND_API.G_MISS_CHAR
8296 AND NVL(p_user_in_rec.RELEASED_FLAG,'!!!') <> NVL(p_out_rec.RELEASED_FLAG,'!!!')
8297 THEN
8298 l_attributes := l_attributes || 'RELEASED_FLAG, ';
8299 END IF;
8300
8301 IF p_user_in_rec.ORGANIZATION_ID <> FND_API.G_MISS_NUM
8302 AND NVL(p_user_in_rec.ORGANIZATION_ID,-99) <> NVL(p_out_rec.ORGANIZATION_ID,-99)
8303 THEN
8304 l_attributes := l_attributes || 'ORGANIZATION_ID, ';
8305 END IF;
8306
8307 IF p_user_in_rec.TRANSACTION_TEMP_ID <> FND_API.G_MISS_NUM
8308 AND NVL(p_user_in_rec.TRANSACTION_TEMP_ID,-99) <> NVL(p_out_rec.TRANSACTION_TEMP_ID,-99)
8309 THEN
8310 l_attributes := l_attributes || 'TRANSACTION_TEMP_ID, ';
8311 END IF;
8312
8313 IF p_user_in_rec.SHIP_SET_ID <> FND_API.G_MISS_NUM
8314 AND NVL(p_user_in_rec.SHIP_SET_ID,-99) <> NVL(p_out_rec.SHIP_SET_ID,-99)
8315 THEN
8316 l_attributes := l_attributes || 'SHIP_SET_ID, ';
8317 END IF;
8318
8319 IF p_user_in_rec.ARRIVAL_SET_ID <> FND_API.G_MISS_NUM
8320 AND NVL(p_user_in_rec.ARRIVAL_SET_ID,-99) <> NVL(p_out_rec.ARRIVAL_SET_ID,-99)
8321 THEN
8322 l_attributes := l_attributes || 'ARRIVAL_SET_ID, ';
8323 END IF;
8324
8325 IF p_user_in_rec.SHIP_MODEL_COMPLETE_FLAG <> FND_API.G_MISS_CHAR
8326 AND NVL(p_user_in_rec.SHIP_MODEL_COMPLETE_FLAG,'!!!') <> NVL(p_out_rec.SHIP_MODEL_COMPLETE_FLAG,'!!!')
8327 THEN
8328 l_attributes := l_attributes || 'SHIP_MODEL_COMPLETE_FLAG, ';
8329 END IF;
8330
8331 IF p_user_in_rec.TOP_MODEL_LINE_ID <> FND_API.G_MISS_NUM
8332 AND NVL(p_user_in_rec.TOP_MODEL_LINE_ID,-99) <> NVL(p_out_rec.TOP_MODEL_LINE_ID,-99)
8333 THEN
8334 l_attributes := l_attributes || 'TOP_MODEL_LINE_ID, ';
8335 END IF;
8336
8337 IF p_user_in_rec.SOURCE_HEADER_NUMBER <> FND_API.G_MISS_CHAR
8338 AND NVL(p_user_in_rec.SOURCE_HEADER_NUMBER,'!!!') <> NVL(p_out_rec.SOURCE_HEADER_NUMBER,'!!!')
8339 THEN
8340 l_attributes := l_attributes || 'SOURCE_HEADER_NUMBER, ';
8341 END IF;
8342
8343 IF p_user_in_rec.SOURCE_HEADER_TYPE_ID <> FND_API.G_MISS_NUM
8344 AND NVL(p_user_in_rec.SOURCE_HEADER_TYPE_ID,-99) <> NVL(p_out_rec.SOURCE_HEADER_TYPE_ID,-99)
8345 THEN
8346 l_attributes := l_attributes || 'SOURCE_HEADER_TYPE_ID, ';
8347 END IF;
8348
8349 IF p_user_in_rec.SOURCE_HEADER_TYPE_NAME <> FND_API.G_MISS_CHAR
8350 AND NVL(p_user_in_rec.SOURCE_HEADER_TYPE_NAME,'!!!') <> NVL(p_out_rec.SOURCE_HEADER_TYPE_NAME,'!!!')
8351 THEN
8352 l_attributes := l_attributes || 'SOURCE_HEADER_TYPE_NAME, ';
8353 END IF;
8354
8355 IF p_user_in_rec.CUST_PO_NUMBER <> FND_API.G_MISS_CHAR
8356 AND NVL(p_user_in_rec.CUST_PO_NUMBER,'!!!') <> NVL(p_out_rec.CUST_PO_NUMBER,'!!!')
8357 THEN
8358 l_attributes := l_attributes || 'CUST_PO_NUMBER, ';
8359 END IF;
8360
8361 IF p_user_in_rec.ATO_LINE_ID <> FND_API.G_MISS_NUM
8362 AND NVL(p_user_in_rec.ATO_LINE_ID,-99) <> NVL(p_out_rec.ATO_LINE_ID,-99)
8363 THEN
8364 l_attributes := l_attributes || 'ATO_LINE_ID, ';
8365 END IF;
8366
8367 IF p_user_in_rec.SRC_REQUESTED_QUANTITY <> FND_API.G_MISS_NUM
8368 AND NVL(p_user_in_rec.SRC_REQUESTED_QUANTITY,-99) <> NVL(p_out_rec.SRC_REQUESTED_QUANTITY,-99)
8369 THEN
8370 l_attributes := l_attributes || 'SRC_REQUESTED_QUANTITY, ';
8371 END IF;
8372
8373 IF p_user_in_rec.SRC_REQUESTED_QUANTITY_UOM <> FND_API.G_MISS_CHAR
8374 AND NVL(p_user_in_rec.SRC_REQUESTED_QUANTITY_UOM,'!!!') <> NVL(p_out_rec.SRC_REQUESTED_QUANTITY_UOM,'!!!')
8375 THEN
8376 l_attributes := l_attributes || 'SRC_REQUESTED_QUANTITY_UOM, ';
8377 END IF;
8378
8379 IF p_user_in_rec.MOVE_ORDER_LINE_ID <> FND_API.G_MISS_NUM
8380 AND NVL(p_user_in_rec.MOVE_ORDER_LINE_ID,-99) <> NVL(p_out_rec.MOVE_ORDER_LINE_ID,-99)
8381 THEN
8382 l_attributes := l_attributes || 'MOVE_ORDER_LINE_ID, ';
8383 END IF;
8384 --bug# 6689448 (replenishment project)
8385 IF p_user_in_rec.REPLENISHMENT_STATUS <> FND_API.G_MISS_CHAR
8386 AND NVL(p_user_in_rec.REPLENISHMENT_STATUS,'!!!') <> NVL(p_out_rec.REPLENISHMENT_STATUS,'!!!')
8387 THEN
8388 l_attributes := l_attributes || 'REPLENISHMENT_STATUS, ';
8389 END IF;
8390
8391 IF p_user_in_rec.CANCELLED_QUANTITY <> FND_API.G_MISS_NUM
8392 AND NVL(p_user_in_rec.CANCELLED_QUANTITY,-99) <> NVL(p_out_rec.CANCELLED_QUANTITY,-99)
8393 THEN
8394 l_attributes := l_attributes || 'CANCELLED_QUANTITY, ';
8395 END IF;
8396
8397 IF p_user_in_rec.QUALITY_CONTROL_QUANTITY <> FND_API.G_MISS_NUM
8398 AND NVL(p_user_in_rec.QUALITY_CONTROL_QUANTITY,-99) <> NVL(p_out_rec.QUALITY_CONTROL_QUANTITY,-99)
8399 THEN
8400 l_attributes := l_attributes || 'QUALITY_CONTROL_QUANTITY, ';
8401 END IF;
8402
8403 IF p_user_in_rec.CYCLE_COUNT_QUANTITY <> FND_API.G_MISS_NUM
8404 AND NVL(p_user_in_rec.CYCLE_COUNT_QUANTITY,-99) <> NVL(p_out_rec.CYCLE_COUNT_QUANTITY,-99)
8405 THEN
8406 l_attributes := l_attributes || 'CYCLE_COUNT_QUANTITY, ';
8407 END IF;
8408
8409 IF p_user_in_rec.TRACKING_NUMBER <> FND_API.G_MISS_CHAR
8410 AND NVL(p_user_in_rec.TRACKING_NUMBER,'!!!') <> NVL(p_out_rec.TRACKING_NUMBER,'!!!')
8411 THEN
8412 l_attributes := l_attributes || 'TRACKING_NUMBER, ';
8413 END IF;
8414
8415 IF p_user_in_rec.MOVEMENT_ID <> FND_API.G_MISS_NUM
8416 AND NVL(p_user_in_rec.MOVEMENT_ID,-99) <> NVL(p_out_rec.MOVEMENT_ID,-99)
8417 THEN
8418 l_attributes := l_attributes || 'MOVEMENT_ID, ';
8419 END IF;
8420
8421 IF p_user_in_rec.SHIPPING_INSTRUCTIONS <> FND_API.G_MISS_CHAR
8422 AND NVL(p_user_in_rec.SHIPPING_INSTRUCTIONS,'!!!') <> NVL(p_out_rec.SHIPPING_INSTRUCTIONS,'!!!')
8423 THEN
8424 l_attributes := l_attributes || 'SHIPPING_INSTRUCTIONS, ';
8425 END IF;
8426
8427 IF p_user_in_rec.PACKING_INSTRUCTIONS <> FND_API.G_MISS_CHAR
8428 AND NVL(p_user_in_rec.PACKING_INSTRUCTIONS,'!!!') <> NVL(p_out_rec.PACKING_INSTRUCTIONS,'!!!')
8429 THEN
8430 l_attributes := l_attributes || 'PACKING_INSTRUCTIONS, ';
8431 END IF;
8432
8433 IF p_user_in_rec.PROJECT_ID <> FND_API.G_MISS_NUM
8434 AND NVL(p_user_in_rec.PROJECT_ID,-99) <> NVL(p_out_rec.PROJECT_ID,-99)
8435 THEN
8436 l_attributes := l_attributes || 'PROJECT_ID, ';
8437 END IF;
8438
8439 IF p_user_in_rec.TASK_ID <> FND_API.G_MISS_NUM
8440 AND NVL(p_user_in_rec.TASK_ID,-99) <> NVL(p_out_rec.TASK_ID,-99)
8441 THEN
8442 l_attributes := l_attributes || 'TASK_ID, ';
8443 END IF;
8444
8445 IF p_user_in_rec.ORG_ID <> FND_API.G_MISS_NUM
8446 AND NVL(p_user_in_rec.ORG_ID,-99) <> NVL(p_out_rec.ORG_ID,-99)
8447 THEN
8448 l_attributes := l_attributes || 'ORG_ID, ';
8449 END IF;
8450
8451 IF p_user_in_rec.OE_INTERFACED_FLAG <> FND_API.G_MISS_CHAR
8452 AND NVL(p_user_in_rec.OE_INTERFACED_FLAG,'!!!') <> NVL(p_out_rec.OE_INTERFACED_FLAG,'!!!')
8453 THEN
8454 l_attributes := l_attributes || 'OE_INTERFACED_FLAG, ';
8455 END IF;
8456
8457 IF p_user_in_rec.SPLIT_FROM_DETAIL_ID <> FND_API.G_MISS_NUM
8458 AND NVL(p_user_in_rec.SPLIT_FROM_DETAIL_ID,-99) <> NVL(p_out_rec.SPLIT_FROM_DETAIL_ID,-99)
8459 THEN
8460 l_attributes := l_attributes || 'SPLIT_FROM_DETAIL_ID, ';
8461 END IF;
8462
8463 IF p_user_in_rec.INV_INTERFACED_FLAG <> FND_API.G_MISS_CHAR
8464 AND NVL(p_user_in_rec.INV_INTERFACED_FLAG,'!!!') <> NVL(p_out_rec.INV_INTERFACED_FLAG,'!!!')
8465 THEN
8466 l_attributes := l_attributes || 'INV_INTERFACED_FLAG, ';
8467 END IF;
8468
8469 IF p_user_in_rec.SOURCE_LINE_NUMBER <> FND_API.G_MISS_CHAR
8470 AND NVL(p_user_in_rec.SOURCE_LINE_NUMBER,'!!!') <> NVL(p_out_rec.SOURCE_LINE_NUMBER,'!!!')
8471 THEN
8472 l_attributes := l_attributes || 'SOURCE_LINE_NUMBER, ';
8473 END IF;
8474
8475 IF p_user_in_rec.INSPECTION_FLAG <> FND_API.G_MISS_CHAR
8476 AND NVL(p_user_in_rec.INSPECTION_FLAG,'!!!') <> NVL(p_out_rec.INSPECTION_FLAG,'!!!')
8477 THEN
8478 l_attributes := l_attributes || 'INSPECTION_FLAG, ';
8479 END IF;
8480
8481 IF p_user_in_rec.RELEASED_STATUS <> FND_API.G_MISS_CHAR
8482 AND NVL(p_user_in_rec.RELEASED_STATUS,'!!!') <> NVL(p_out_rec.RELEASED_STATUS,'!!!')
8483 THEN
8484 l_attributes := l_attributes || 'RELEASED_STATUS, ';
8485 END IF;
8486
8487 IF p_user_in_rec.CONTAINER_FLAG <> FND_API.G_MISS_CHAR
8488 AND NVL(p_user_in_rec.CONTAINER_FLAG,'!!!') <> NVL(p_out_rec.CONTAINER_FLAG,'!!!')
8489 THEN
8490 l_attributes := l_attributes || 'CONTAINER_FLAG, ';
8491 END IF;
8492
8493 IF p_user_in_rec.CONTAINER_TYPE_CODE <> FND_API.G_MISS_CHAR
8494 AND NVL(p_user_in_rec.CONTAINER_TYPE_CODE,'!!!') <> NVL(p_out_rec.CONTAINER_TYPE_CODE,'!!!')
8495 THEN
8496 l_attributes := l_attributes || 'CONTAINER_TYPE_CODE, ';
8497 END IF;
8498
8499 IF p_user_in_rec.CONTAINER_NAME <> FND_API.G_MISS_CHAR
8500 AND NVL(p_user_in_rec.CONTAINER_NAME,'!!!') <> NVL(p_out_rec.CONTAINER_NAME,'!!!')
8501 THEN
8502 l_attributes := l_attributes || 'CONTAINER_NAME, ';
8503 END IF;
8504
8505 IF p_user_in_rec.FILL_PERCENT <> FND_API.G_MISS_NUM
8506 AND NVL(p_user_in_rec.FILL_PERCENT,-99) <> NVL(p_out_rec.FILL_PERCENT,-99)
8507 THEN
8508 l_attributes := l_attributes || 'FILL_PERCENT, ';
8509 END IF;
8510
8511 IF p_user_in_rec.GROSS_WEIGHT <> FND_API.G_MISS_NUM
8512 AND NVL(p_user_in_rec.GROSS_WEIGHT,-99) <> NVL(p_out_rec.GROSS_WEIGHT,-99)
8513 THEN
8514 l_attributes := l_attributes || 'GROSS_WEIGHT, ';
8515 END IF;
8516
8517 IF p_user_in_rec.MASTER_SERIAL_NUMBER <> FND_API.G_MISS_CHAR
8518 AND NVL(p_user_in_rec.MASTER_SERIAL_NUMBER,'!!!') <> NVL(p_out_rec.MASTER_SERIAL_NUMBER,'!!!')
8519 THEN
8520 l_attributes := l_attributes || 'MASTER_SERIAL_NUMBER, ';
8521 END IF;
8522
8523 IF p_user_in_rec.MAXIMUM_LOAD_WEIGHT <> FND_API.G_MISS_NUM
8524 AND NVL(p_user_in_rec.MAXIMUM_LOAD_WEIGHT,-99) <> NVL(p_out_rec.MAXIMUM_LOAD_WEIGHT,-99)
8525 THEN
8526 l_attributes := l_attributes || 'MAXIMUM_LOAD_WEIGHT, ';
8527 END IF;
8528
8529 IF p_user_in_rec.MAXIMUM_VOLUME <> FND_API.G_MISS_NUM
8530 AND NVL(p_user_in_rec.MAXIMUM_VOLUME,-99) <> NVL(p_out_rec.MAXIMUM_VOLUME,-99)
8531 THEN
8532 l_attributes := l_attributes || 'MAXIMUM_VOLUME, ';
8533 END IF;
8534
8535 IF p_user_in_rec.MINIMUM_FILL_PERCENT <> FND_API.G_MISS_NUM
8536 AND NVL(p_user_in_rec.MINIMUM_FILL_PERCENT,-99) <> NVL(p_out_rec.MINIMUM_FILL_PERCENT,-99)
8537 THEN
8538 l_attributes := l_attributes || 'MINIMUM_FILL_PERCENT, ';
8539 END IF;
8540
8541 IF p_user_in_rec.SEAL_CODE <> FND_API.G_MISS_CHAR
8542 AND NVL(p_user_in_rec.SEAL_CODE,'!!!') <> NVL(p_out_rec.SEAL_CODE,'!!!')
8543 THEN
8544 l_attributes := l_attributes || 'SEAL_CODE, ';
8545 END IF;
8546
8547 IF p_user_in_rec.UNIT_NUMBER <> FND_API.G_MISS_CHAR
8548 AND NVL(p_user_in_rec.UNIT_NUMBER,'!!!') <> NVL(p_out_rec.UNIT_NUMBER,'!!!')
8549 THEN
8550 l_attributes := l_attributes || 'UNIT_NUMBER, ';
8551 END IF;
8552
8553 IF p_user_in_rec.UNIT_PRICE <> FND_API.G_MISS_NUM
8554 AND NVL(p_user_in_rec.UNIT_PRICE,-99) <> NVL(p_out_rec.UNIT_PRICE,-99)
8555 THEN
8556 l_attributes := l_attributes || 'UNIT_PRICE, ';
8557 END IF;
8558
8559 IF p_user_in_rec.CURRENCY_CODE <> FND_API.G_MISS_CHAR
8560 AND NVL(p_user_in_rec.CURRENCY_CODE,'!!!') <> NVL(p_out_rec.CURRENCY_CODE,'!!!')
8561 THEN
8562 l_attributes := l_attributes || 'CURRENCY_CODE, ';
8563 END IF;
8564
8565 IF p_user_in_rec.FREIGHT_CLASS_CAT_ID <> FND_API.G_MISS_NUM
8566 AND NVL(p_user_in_rec.FREIGHT_CLASS_CAT_ID,-99) <> NVL(p_out_rec.FREIGHT_CLASS_CAT_ID,-99)
8567 THEN
8568 l_attributes := l_attributes || 'FREIGHT_CLASS_CAT_ID, ';
8569 END IF;
8570
8571 IF p_user_in_rec.COMMODITY_CODE_CAT_ID <> FND_API.G_MISS_NUM
8572 AND NVL(p_user_in_rec.COMMODITY_CODE_CAT_ID,-99) <> NVL(p_out_rec.COMMODITY_CODE_CAT_ID,-99)
8573 THEN
8574 l_attributes := l_attributes || 'COMMODITY_CODE_CAT_ID, ';
8575 END IF;
8576
8577 IF p_user_in_rec.PREFERRED_GRADE <> FND_API.G_MISS_CHAR
8578 AND NVL(p_user_in_rec.PREFERRED_GRADE,'!!!') <> NVL(p_out_rec.PREFERRED_GRADE,'!!!')
8579 THEN
8580 l_attributes := l_attributes || 'PREFERRED_GRADE, ';
8581 END IF;
8582
8583 IF p_user_in_rec.SRC_REQUESTED_QUANTITY2 <> FND_API.G_MISS_NUM
8584 AND NVL(p_user_in_rec.SRC_REQUESTED_QUANTITY2,-99) <> NVL(p_out_rec.SRC_REQUESTED_QUANTITY2,-99)
8585 THEN
8586 l_attributes := l_attributes || 'SRC_REQUESTED_QUANTITY2, ';
8587 END IF;
8588
8589 IF p_user_in_rec.SRC_REQUESTED_QUANTITY_UOM2 <> FND_API.G_MISS_CHAR
8590 AND NVL(p_user_in_rec.SRC_REQUESTED_QUANTITY_UOM2,'!!!') <> NVL(p_out_rec.SRC_REQUESTED_QUANTITY_UOM2,'!!!')
8591 THEN
8592 l_attributes := l_attributes || 'SRC_REQUESTED_QUANTITY_UOM2, ';
8593 END IF;
8594
8595 IF p_user_in_rec.REQUESTED_QUANTITY2 <> FND_API.G_MISS_NUM
8596 AND NVL(p_user_in_rec.REQUESTED_QUANTITY2,-99) <> NVL(p_out_rec.REQUESTED_QUANTITY2,-99)
8597 THEN
8598 l_attributes := l_attributes || 'REQUESTED_QUANTITY2, ';
8599 END IF;
8600
8601 IF p_user_in_rec.SHIPPED_QUANTITY2 <> FND_API.G_MISS_NUM
8602 AND NVL(p_user_in_rec.SHIPPED_QUANTITY2,-99) <> NVL(p_out_rec.SHIPPED_QUANTITY2,-99)
8603 THEN
8604 l_attributes := l_attributes || 'SHIPPED_QUANTITY2, ';
8605 END IF;
8606
8607 IF p_user_in_rec.DELIVERED_QUANTITY2 <> FND_API.G_MISS_NUM
8608 AND NVL(p_user_in_rec.DELIVERED_QUANTITY2,-99) <> NVL(p_out_rec.DELIVERED_QUANTITY2,-99)
8609 THEN
8610 l_attributes := l_attributes || 'DELIVERED_QUANTITY2, ';
8611 END IF;
8612
8613 IF p_user_in_rec.CANCELLED_QUANTITY2 <> FND_API.G_MISS_NUM
8614 AND NVL(p_user_in_rec.CANCELLED_QUANTITY2,-99) <> NVL(p_out_rec.CANCELLED_QUANTITY2,-99)
8615 THEN
8616 l_attributes := l_attributes || 'CANCELLED_QUANTITY2, ';
8617 END IF;
8618
8619 IF p_user_in_rec.QUALITY_CONTROL_QUANTITY2 <> FND_API.G_MISS_NUM
8620 AND NVL(p_user_in_rec.QUALITY_CONTROL_QUANTITY2,-99) <> NVL(p_out_rec.QUALITY_CONTROL_QUANTITY2,-99)
8621 THEN
8622 l_attributes := l_attributes || 'QUALITY_CONTROL_QUANTITY2, ';
8623 END IF;
8624
8625 IF p_user_in_rec.CYCLE_COUNT_QUANTITY2 <> FND_API.G_MISS_NUM
8626 AND NVL(p_user_in_rec.CYCLE_COUNT_QUANTITY2,-99) <> NVL(p_out_rec.CYCLE_COUNT_QUANTITY2,-99)
8627 THEN
8628 l_attributes := l_attributes || 'CYCLE_COUNT_QUANTITY2, ';
8629 END IF;
8630
8631 IF p_user_in_rec.REQUESTED_QUANTITY_UOM2 <> FND_API.G_MISS_CHAR
8632 AND NVL(p_user_in_rec.REQUESTED_QUANTITY_UOM2,'!!!') <> NVL(p_out_rec.REQUESTED_QUANTITY_UOM2,'!!!')
8633 THEN
8634 l_attributes := l_attributes || 'REQUESTED_QUANTITY_UOM2, ';
8635 END IF;
8636
8637 -- HW OPMCONV - No need for sublot_number
8638
8639 IF p_user_in_rec.LPN_ID <> FND_API.G_MISS_NUM
8640 AND NVL(p_user_in_rec.LPN_ID,-99) <> NVL(p_out_rec.LPN_ID,-99)
8641 THEN
8642 l_attributes := l_attributes || 'LPN_ID, ';
8643 END IF;
8644
8645 IF p_user_in_rec.PICKABLE_FLAG <> FND_API.G_MISS_CHAR
8646 AND NVL(p_user_in_rec.PICKABLE_FLAG,'!!!') <> NVL(p_out_rec.PICKABLE_FLAG,'!!!')
8647 THEN
8648 l_attributes := l_attributes || 'PICKABLE_FLAG, ';
8649 END IF;
8650
8651 IF p_user_in_rec.ORIGINAL_SUBINVENTORY <> FND_API.G_MISS_CHAR
8652 AND NVL(p_user_in_rec.ORIGINAL_SUBINVENTORY,'!!!') <> NVL(p_out_rec.ORIGINAL_SUBINVENTORY,'!!!')
8653 THEN
8654 l_attributes := l_attributes || 'ORIGINAL_SUBINVENTORY, ';
8655 END IF;
8656
8657 IF p_user_in_rec.TO_SERIAL_NUMBER <> FND_API.G_MISS_CHAR
8658 AND NVL(p_user_in_rec.TO_SERIAL_NUMBER,'!!!') <> NVL(p_out_rec.TO_SERIAL_NUMBER,'!!!')
8659 THEN
8660 l_attributes := l_attributes || 'TO_SERIAL_NUMBER, ';
8661 END IF;
8662
8663 IF p_user_in_rec.PICKED_QUANTITY <> FND_API.G_MISS_NUM
8664 AND NVL(p_user_in_rec.PICKED_QUANTITY,-99) <> NVL(p_out_rec.PICKED_QUANTITY,-99)
8665 THEN
8666 l_attributes := l_attributes || 'PICKED_QUANTITY, ';
8667 END IF;
8668
8669 IF p_user_in_rec.PICKED_QUANTITY2 <> FND_API.G_MISS_NUM
8670 AND NVL(p_user_in_rec.PICKED_QUANTITY2,-99) <> NVL(p_out_rec.PICKED_QUANTITY2,-99)
8671 THEN
8672 l_attributes := l_attributes || 'PICKED_QUANTITY2, ';
8673 END IF;
8674
8675 IF p_user_in_rec.RECEIVED_QUANTITY <> FND_API.G_MISS_NUM
8676 AND NVL(p_user_in_rec.RECEIVED_QUANTITY,-99) <> NVL(p_out_rec.RECEIVED_QUANTITY,-99)
8677 THEN
8678 l_attributes := l_attributes || 'RECEIVED_QUANTITY, ';
8679 END IF;
8680
8681 IF p_user_in_rec.RECEIVED_QUANTITY2 <> FND_API.G_MISS_NUM
8682 AND NVL(p_user_in_rec.RECEIVED_QUANTITY2,-99) <> NVL(p_out_rec.RECEIVED_QUANTITY2,-99)
8683 THEN
8684 l_attributes := l_attributes || 'RECEIVED_QUANTITY2, ';
8685 END IF;
8686
8687 IF p_user_in_rec.SOURCE_LINE_SET_ID <> FND_API.G_MISS_NUM
8688 AND NVL(p_user_in_rec.SOURCE_LINE_SET_ID,-99) <> NVL(p_out_rec.SOURCE_LINE_SET_ID,-99)
8689 THEN
8690 l_attributes := l_attributes || 'SOURCE_LINE_SET_ID, ';
8691 END IF;
8692
8693 IF p_user_in_rec.BATCH_ID <> FND_API.G_MISS_NUM
8694 AND NVL(p_user_in_rec.BATCH_ID,-99) <> NVL(p_out_rec.BATCH_ID,-99)
8695 THEN
8696 l_attributes := l_attributes || 'BATCH_ID, ';
8697 END IF;
8698
8699 IF p_user_in_rec.ROWID <> FND_API.G_MISS_CHAR
8700 AND NVL(p_user_in_rec.ROWID,'!!!') <> NVL(p_out_rec.ROWID,'!!!')
8701 THEN
8702 l_attributes := l_attributes || 'ROWID, ';
8703 END IF;
8704
8705 IF p_user_in_rec.TRANSACTION_ID <> FND_API.G_MISS_NUM
8706 AND NVL(p_user_in_rec.TRANSACTION_ID,-99) <> NVL(p_out_rec.TRANSACTION_ID,-99)
8707 THEN
8708 l_attributes := l_attributes || 'TRANSACTION_ID, ';
8709 END IF;
8710
8711 IF p_user_in_rec.VENDOR_ID <> FND_API.G_MISS_NUM
8712 AND NVL(p_user_in_rec.VENDOR_ID,-99) <> NVL(p_out_rec.VENDOR_ID,-99)
8713 THEN
8714 l_attributes := l_attributes || 'VENDOR_ID, ';
8715 END IF;
8716
8717 IF p_user_in_rec.SHIP_FROM_SITE_ID <> FND_API.G_MISS_NUM
8718 AND NVL(p_user_in_rec.SHIP_FROM_SITE_ID,-99) <> NVL(p_out_rec.SHIP_FROM_SITE_ID,-99)
8719 THEN
8720 l_attributes := l_attributes || 'SHIP_FROM_SITE_ID, ';
8721 END IF;
8722
8723 IF p_user_in_rec.LINE_DIRECTION <> FND_API.G_MISS_CHAR
8724 AND NVL(p_user_in_rec.LINE_DIRECTION,'!!!') <> NVL(p_out_rec.LINE_DIRECTION,'!!!')
8725 THEN
8726 l_attributes := l_attributes || 'LINE_DIRECTION, ';
8727 END IF;
8728
8729 IF p_user_in_rec.PARTY_ID <> FND_API.G_MISS_NUM
8730 AND NVL(p_user_in_rec.PARTY_ID,-99) <> NVL(p_out_rec.PARTY_ID,-99)
8731 THEN
8732 l_attributes := l_attributes || 'PARTY_ID, ';
8733 END IF;
8734
8735 IF p_user_in_rec.ROUTING_REQ_ID <> FND_API.G_MISS_NUM
8736 AND NVL(p_user_in_rec.ROUTING_REQ_ID,-99) <> NVL(p_out_rec.ROUTING_REQ_ID,-99)
8737 THEN
8738 l_attributes := l_attributes || 'ROUTING_REQ_ID, ';
8739 END IF;
8740
8741 IF p_user_in_rec.SHIPPING_CONTROL <> FND_API.G_MISS_CHAR
8742 AND NVL(p_user_in_rec.SHIPPING_CONTROL,'!!!') <> NVL(p_out_rec.SHIPPING_CONTROL,'!!!')
8743 THEN
8744 l_attributes := l_attributes || 'SHIPPING_CONTROL, ';
8745 END IF;
8746
8747 IF p_user_in_rec.SOURCE_BLANKET_REFERENCE_ID <> FND_API.G_MISS_NUM
8748 AND NVL(p_user_in_rec.SOURCE_BLANKET_REFERENCE_ID,-99) <> NVL(p_out_rec.SOURCE_BLANKET_REFERENCE_ID,-99)
8749 THEN
8750 l_attributes := l_attributes || 'SOURCE_BLANKET_REFERENCE_ID, ';
8751 END IF;
8752
8753 IF p_user_in_rec.SOURCE_BLANKET_REFERENCE_NUM <> FND_API.G_MISS_NUM
8754 AND NVL(p_user_in_rec.SOURCE_BLANKET_REFERENCE_NUM,-99) <> NVL(p_out_rec.SOURCE_BLANKET_REFERENCE_NUM,-99)
8755 THEN
8756 l_attributes := l_attributes || 'SOURCE_BLANKET_REFERENCE_NUM, ';
8757 END IF;
8758
8759 IF p_user_in_rec.PO_SHIPMENT_LINE_ID <> FND_API.G_MISS_NUM
8760 AND NVL(p_user_in_rec.PO_SHIPMENT_LINE_ID,-99) <> NVL(p_out_rec.PO_SHIPMENT_LINE_ID,-99)
8761 THEN
8762 l_attributes := l_attributes || 'PO_SHIPMENT_LINE_ID, ';
8763 END IF;
8764
8765 IF p_user_in_rec.PO_SHIPMENT_LINE_NUMBER <> FND_API.G_MISS_NUM
8766 AND NVL(p_user_in_rec.PO_SHIPMENT_LINE_NUMBER,-99) <> NVL(p_out_rec.PO_SHIPMENT_LINE_NUMBER,-99)
8767 THEN
8768 l_attributes := l_attributes || 'PO_SHIPMENT_LINE_NUMBER, ';
8769 END IF;
8770
8771 IF p_user_in_rec.RETURNED_QUANTITY <> FND_API.G_MISS_NUM
8772 AND NVL(p_user_in_rec.RETURNED_QUANTITY,-99) <> NVL(p_out_rec.RETURNED_QUANTITY,-99)
8773 THEN
8774 l_attributes := l_attributes || 'RETURNED_QUANTITY, ';
8775 END IF;
8776
8777 IF p_user_in_rec.RETURNED_QUANTITY2 <> FND_API.G_MISS_NUM
8778 AND NVL(p_user_in_rec.RETURNED_QUANTITY2,-99) <> NVL(p_out_rec.RETURNED_QUANTITY2,-99)
8779 THEN
8780 l_attributes := l_attributes || 'RETURNED_QUANTITY2, ';
8781 END IF;
8782
8783 IF p_user_in_rec.RCV_SHIPMENT_LINE_ID <> FND_API.G_MISS_NUM
8784 AND NVL(p_user_in_rec.RCV_SHIPMENT_LINE_ID,-99) <> NVL(p_out_rec.RCV_SHIPMENT_LINE_ID,-99)
8785 THEN
8786 l_attributes := l_attributes || 'RCV_SHIPMENT_LINE_ID, ';
8787 END IF;
8788
8789 IF p_user_in_rec.SOURCE_LINE_TYPE_CODE <> FND_API.G_MISS_CHAR
8790 AND NVL(p_user_in_rec.SOURCE_LINE_TYPE_CODE,'!!!') <> NVL(p_out_rec.SOURCE_LINE_TYPE_CODE,'!!!')
8791 THEN
8792 l_attributes := l_attributes || 'SOURCE_LINE_TYPE_CODE, ';
8793 END IF;
8794
8795 IF p_user_in_rec.SUPPLIER_ITEM_NUMBER <> FND_API.G_MISS_CHAR
8796 AND NVL(p_user_in_rec.SUPPLIER_ITEM_NUMBER,'!!!') <> NVL(p_out_rec.SUPPLIER_ITEM_NUMBER,'!!!')
8797 THEN
8798 l_attributes := l_attributes || 'SUPPLIER_ITEM_NUMBER, ';
8799 END IF;
8800
8801 IF p_user_in_rec.IGNORE_FOR_PLANNING <> FND_API.G_MISS_CHAR
8802 AND NVL(p_user_in_rec.IGNORE_FOR_PLANNING,'!!!') <> NVL(p_out_rec.IGNORE_FOR_PLANNING,'!!!')
8803 THEN
8804 l_attributes := l_attributes || 'IGNORE_FOR_PLANNING, ';
8805 END IF;
8806
8807 IF p_user_in_rec.EARLIEST_PICKUP_DATE <> FND_API.G_MISS_DATE
8808 AND NVL(p_user_in_rec.EARLIEST_PICKUP_DATE,TO_DATE('2','j')) <> NVL(p_out_rec.EARLIEST_PICKUP_DATE,TO_DATE('2','j'))
8809 THEN
8810 l_attributes := l_attributes || 'EARLIEST_PICKUP_DATE, ';
8811 END IF;
8812
8813 IF p_user_in_rec.LATEST_PICKUP_DATE <> FND_API.G_MISS_DATE
8814 AND NVL(p_user_in_rec.LATEST_PICKUP_DATE,TO_DATE('2','j')) <> NVL(p_out_rec.LATEST_PICKUP_DATE,TO_DATE('2','j'))
8815 THEN
8816 l_attributes := l_attributes || 'LATEST_PICKUP_DATE, ';
8817 END IF;
8818
8819 IF p_user_in_rec.EARLIEST_DROPOFF_DATE <> FND_API.G_MISS_DATE
8820 AND NVL(p_user_in_rec.EARLIEST_DROPOFF_DATE,TO_DATE('2','j')) <> NVL(p_out_rec.EARLIEST_DROPOFF_DATE,TO_DATE('2','j'))
8821 THEN
8822 l_attributes := l_attributes || 'EARLIEST_DROPOFF_DATE, ';
8823 END IF;
8824
8825 IF p_user_in_rec.LATEST_DROPOFF_DATE <> FND_API.G_MISS_DATE
8826 AND NVL(p_user_in_rec.LATEST_DROPOFF_DATE,TO_DATE('2','j')) <> NVL(p_out_rec.LATEST_DROPOFF_DATE,TO_DATE('2','j'))
8827 THEN
8828 l_attributes := l_attributes || 'LATEST_DROPOFF_DATE, ';
8829 END IF;
8830
8831 IF p_user_in_rec.REQUEST_DATE_TYPE_CODE <> FND_API.G_MISS_CHAR
8832 AND NVL(p_user_in_rec.REQUEST_DATE_TYPE_CODE,'!!!') <> NVL(p_out_rec.REQUEST_DATE_TYPE_CODE,'!!!')
8833 THEN
8834 l_attributes := l_attributes || 'REQUEST_DATE_TYPE_CODE, ';
8835 END IF;
8836
8837 IF p_user_in_rec.TP_DELIVERY_DETAIL_ID <> FND_API.G_MISS_NUM
8838 AND NVL(p_user_in_rec.TP_DELIVERY_DETAIL_ID,-99) <> NVL(p_out_rec.TP_DELIVERY_DETAIL_ID,-99)
8839 THEN
8840 l_attributes := l_attributes || 'TP_DELIVERY_DETAIL_ID, ';
8841 END IF;
8842
8843 IF p_user_in_rec.SOURCE_DOCUMENT_TYPE_ID <> FND_API.G_MISS_NUM
8844 AND NVL(p_user_in_rec.SOURCE_DOCUMENT_TYPE_ID,-99) <> NVL(p_out_rec.SOURCE_DOCUMENT_TYPE_ID,-99)
8845 THEN
8846 l_attributes := l_attributes || 'SOURCE_DOCUMENT_TYPE_ID, ';
8847 END IF;
8848
8849 IF p_user_in_rec.UNIT_WEIGHT <> FND_API.G_MISS_NUM
8850 AND NVL(p_user_in_rec.UNIT_WEIGHT,-99) <> NVL(p_out_rec.UNIT_WEIGHT,-99)
8851 THEN
8852 l_attributes := l_attributes || 'UNIT_WEIGHT, ';
8853 END IF;
8854
8855 IF p_user_in_rec.UNIT_VOLUME <> FND_API.G_MISS_NUM
8856 AND NVL(p_user_in_rec.UNIT_VOLUME,-99) <> NVL(p_out_rec.UNIT_VOLUME,-99)
8857 THEN
8858 l_attributes := l_attributes || 'UNIT_VOLUME, ';
8859 END IF;
8860
8861 IF p_user_in_rec.FILLED_VOLUME <> FND_API.G_MISS_NUM
8862 AND NVL(p_user_in_rec.FILLED_VOLUME,-99) <> NVL(p_out_rec.FILLED_VOLUME,-99)
8863 THEN
8864 l_attributes := l_attributes || 'FILLED_VOLUME, ';
8865 END IF;
8866
8867 IF p_user_in_rec.WV_FROZEN_FLAG <> FND_API.G_MISS_CHAR
8868 AND NVL(p_user_in_rec.WV_FROZEN_FLAG,'!!!') <> NVL(p_out_rec.WV_FROZEN_FLAG,'!!!')
8869 THEN
8870 l_attributes := l_attributes || 'WV_FROZEN_FLAG, ';
8871 END IF;
8872
8873 IF p_user_in_rec.MODE_OF_TRANSPORT <> FND_API.G_MISS_CHAR
8874 AND NVL(p_user_in_rec.MODE_OF_TRANSPORT,'!!!') <> NVL(p_out_rec.MODE_OF_TRANSPORT,'!!!')
8875 THEN
8876 l_attributes := l_attributes || 'MODE_OF_TRANSPORT, ';
8877 END IF;
8878
8879 IF p_user_in_rec.SERVICE_LEVEL <> FND_API.G_MISS_CHAR
8880 AND NVL(p_user_in_rec.SERVICE_LEVEL,'!!!') <> NVL(p_out_rec.SERVICE_LEVEL,'!!!')
8881 THEN
8882 l_attributes := l_attributes || 'SERVICE_LEVEL, ';
8883 END IF;
8884
8885 IF p_user_in_rec.PO_REVISION_NUMBER <> FND_API.G_MISS_NUM
8886 AND NVL(p_user_in_rec.PO_REVISION_NUMBER,-99) <> NVL(p_out_rec.PO_REVISION_NUMBER,-99)
8887 THEN
8888 l_attributes := l_attributes || 'PO_REVISION_NUMBER, ';
8889 END IF;
8890
8891 IF p_user_in_rec.RELEASE_REVISION_NUMBER <> FND_API.G_MISS_NUM
8892 AND NVL(p_user_in_rec.RELEASE_REVISION_NUMBER,-99) <> NVL(p_out_rec.RELEASE_REVISION_NUMBER,-99)
8893 THEN
8894 l_attributes := l_attributes || 'RELEASE_REVISION_NUMBER, ';
8895 END IF;
8896
8897
8898
8899 IF l_debug_on THEN
8900 WSH_DEBUG_SV.log(l_module_name,'l_attributes',l_attributes);
8901 WSH_DEBUG_SV.log(l_module_name,'length(l_attributes)',length(l_attributes));
8902 END IF;
8903
8904
8905 IF l_attributes IS NULL THEN
8906 --no message to be shown to the user
8907 IF l_debug_on THEN
8908 WSH_DEBUG_SV.pop(l_module_name);
8909 END IF;
8910 RETURN;
8911 ELSE
8912 Wsh_Utilities.process_message(
8913 p_entity => 'DLVB',
8914 p_entity_name => p_out_rec.DELIVERY_DETAIL_ID,
8915 p_attributes => l_attributes,
8916 x_return_status => l_return_status
8917 );
8918
8919 IF l_return_status IN (WSH_UTIL_CORE.G_RET_STS_ERROR,WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR)
8920 THEN
8921 x_return_status := l_return_status;
8922 IF l_debug_on THEN
8923 wsh_debug_sv.logmsg(l_module_name,'Error returned by wsh_utilities.process_message',WSH_DEBUG_SV.C_PROC_LEVEL);
8924 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
8925 wsh_debug_sv.pop(l_module_name);
8926 END IF;
8927 return;
8928 ELSE
8929 x_return_status := wsh_util_core.G_RET_STS_WARNING;
8930 END IF;
8931 END IF;
8932 --
8933 IF l_debug_on THEN
8934 WSH_DEBUG_SV.pop(l_module_name);
8935 END IF;
8936 --
8937 EXCEPTION
8938 WHEN OTHERS THEN
8939 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
8940 --
8941 IF l_debug_on THEN
8942 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
8943 END IF;
8944 --
8945 END user_non_updatable_columns;
8946
8947 -- HW OPMCONV - Added new function to check if line is elibible for split
8948 /*
8949 -----------------------------------------------------------------------------
8950 FUNCTION : is_split_allowed
8951 PARAMETERS : p_delivery_detail_id - delivery detail id
8952 p_organization_id - organization id
8953 p_inventory_item_id - inventory item id
8954 p_released_status - released status for this wdd line
8955
8956 DESCRIPTION : This function checks if delivery detail line
8957 is eligible for a split
8958 e.g if delivery detail has an item that is lot
8959 indivisible and it's staged, split actions will not be permitted
8960 ------------------------------------------------------------------------------
8961 */
8962
8963 FUNCTION is_split_allowed(
8964 p_delivery_detail_id IN NUMBER,
8965 p_organization_id IN NUMBER,
8966 p_inventory_item_id IN NUMBER,
8967 p_released_status IN VARCHAR2)
8968 RETURN BOOLEAN
8969 IS
8970
8971 l_item_info WSH_DELIVERY_DETAILS_INV.mtl_system_items_rec;
8972 l_released_status VARCHAR2(1);
8973 l_debug_on BOOLEAN;
8974 l_return_status VARCHAR2(1);
8975 l_number_of_errors NUMBER ;
8976 l_number_of_warnings NUMBER ;
8977 l_source_line_id NUMBER;
8978 l_exist NUMBER ;
8979 no_entry EXCEPTION;
8980 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'is_split_allowed';
8981
8982 Cursor get_indiv_reservation Is
8983 Select 1
8984 From mtl_reservations
8985 Where demand_source_type_id = 2
8986 and demand_source_line_id = l_source_line_id
8987 and rownum = 1
8988 ;
8989
8990
8991 CURSOR get_line_id IS
8992 SELECT source_line_id
8993 from wsh_delivery_details
8994 WHERE delivery_detail_id = p_delivery_detail_id;
8995
8996
8997 BEGIN
8998
8999
9000 l_debug_on := wsh_debug_interface.g_debug;
9001 l_exist := 0;
9002 l_number_of_errors := 0;
9003 l_number_of_warnings := 0;
9004 l_released_status := p_released_status ;
9005 --
9006 IF l_debug_on IS NULL THEN
9007 l_debug_on := wsh_debug_sv.is_debug_enabled;
9008 END IF;
9009 --
9010 IF l_debug_on THEN
9011 wsh_debug_sv.push(l_module_name);
9012 --
9013 wsh_debug_sv.LOG(l_module_name, 'P_DELIVERY_DETAIL_ID', p_delivery_detail_id);
9014 wsh_debug_sv.LOG(l_module_name, 'p_organization_id', p_organization_id);
9015 wsh_debug_sv.LOG(l_module_name, 'p_inventory_item_id', p_inventory_item_id);
9016 END IF;
9017 --
9018
9019 WSH_DELIVERY_DETAILS_INV.Get_item_information
9020 (
9021 p_organization_id => p_organization_id,
9022 p_inventory_item_id => p_inventory_item_id,
9023 x_mtl_system_items_rec => l_item_info,
9024 x_return_status => l_return_status
9025 );
9026 --
9027 wsh_util_core.api_post_call
9028 (
9029 p_return_status => l_return_status,
9030 x_num_warnings => l_number_of_warnings,
9031 x_num_errors => l_number_of_errors
9032 );
9033
9034
9035
9036 IF ( l_item_info.lot_divisible_flag = 'N' AND
9037 l_item_info.lot_control_code = 2 AND l_released_status ='Y') THEN
9038 IF l_debug_on THEN
9039 wsh_debug_sv.LOG(l_module_name, 'l_item_info.lot_divisible_flag', l_item_info.lot_divisible_flag);
9040 wsh_debug_sv.LOG(l_module_name, 'l_item_info.lot_control_code', l_item_info.lot_control_code);
9041 wsh_debug_sv.LOG(l_module_name, 'l_released_status', l_released_status);
9042 WSH_DEBUG_SV.pop(l_module_name);
9043 END IF;
9044 return(FALSE);
9045
9046 ELSE
9047 /* Lgao, bug 5141589, if reservation exists for the line, no split allowed for indivisible items*/
9048 IF ( l_item_info.lot_divisible_flag = 'N' and l_item_info.lot_control_code = 2) THEN
9049
9050 /*Bug# 9958325*/
9051 OPEN get_line_id ;
9052 FETCH get_line_id into l_source_line_id;
9053 CLOSE get_line_id ;
9054
9055 Open get_indiv_reservation;
9056 Fetch get_indiv_reservation into l_exist;
9057 Close get_indiv_reservation;
9058 If l_exist = 1 Then
9059 IF l_debug_on THEN
9060 wsh_debug_sv.LOG(l_module_name, 'lot_divisible_flag', l_item_info.lot_divisible_flag);
9061 wsh_debug_sv.LOG(l_module_name, 'Reservation Exists' );
9062 wsh_debug_sv.LOG(l_module_name, 'Split Not Allowed' );
9063 WSH_DEBUG_SV.pop(l_module_name);
9064 End if;
9065 return(FALSE);
9066 End if;
9067 End if;
9068 IF l_debug_on THEN
9069 wsh_debug_sv.LOG(l_module_name, 'lot_divisible_flag', l_item_info.lot_divisible_flag);
9070 wsh_debug_sv.LOG(l_module_name, 'l_item_info.lot_control_code', l_item_info.lot_control_code);
9071 wsh_debug_sv.LOG(l_module_name, 'l_released_status', l_released_status);
9072
9073 WSH_DEBUG_SV.pop(l_module_name);
9074 END IF;
9075
9076 return(TRUE);
9077 END IF;
9078
9079 IF l_debug_on THEN
9080 WSH_DEBUG_SV.pop(l_module_name);
9081 END IF;
9082
9083 return(TRUE);
9084
9085 EXCEPTION
9086 WHEN NO_DATA_FOUND THEN
9087 -- Debug Statements
9088 --
9089 -- CLOSE line_status;
9090 IF l_debug_on THEN
9091 WSH_DEBUG_SV.logmsg(l_module_name,'NO_DATA_FOUND exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
9092 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:NO_DATA_FOUND');
9093 END IF;
9094 --
9095 return(FALSE);
9096
9097 WHEN others THEN
9098 IF get_indiv_reservation%ISOPEN THEN
9099 Close get_indiv_reservation;
9100 END IF;
9101 --
9102 IF l_debug_on THEN
9103 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
9104 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
9105 END IF;
9106 --
9107 return(FALSE);
9108
9109 END is_split_allowed;
9110
9111 FUNCTION is_cycle_count_allowed(
9112 p_delivery_detail_id IN NUMBER,
9113 p_organization_id IN NUMBER,
9114 p_inventory_item_id IN NUMBER,
9115 p_released_status IN VARCHAR2,
9116 p_picked_qty IN NUMBER,
9117 p_cycle_qty IN NUMBER)
9118 RETURN BOOLEAN
9119 IS
9120
9121 l_item_info WSH_DELIVERY_DETAILS_INV.mtl_system_items_rec;
9122 l_released_status VARCHAR2(1);
9123 l_debug_on BOOLEAN;
9124 l_return_status VARCHAR2(1);
9125 l_number_of_errors NUMBER ;
9126 l_number_of_warnings NUMBER ;
9127 l_picked_qty NUMBER;
9128 l_exist NUMBER ;
9129 no_entry EXCEPTION;
9130 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'is_cycle_count_allowed';
9131
9132 BEGIN
9133
9134
9135 l_debug_on := wsh_debug_interface.g_debug;
9136 l_exist := 0;
9137 l_number_of_errors := 0;
9138 l_number_of_warnings := 0;
9139 l_released_status := p_released_status;
9140 l_picked_qty := p_picked_qty;
9141 --
9142 IF l_debug_on IS NULL THEN
9143 l_debug_on := wsh_debug_sv.is_debug_enabled;
9144 END IF;
9145 --
9146 IF l_debug_on THEN
9147 wsh_debug_sv.push(l_module_name);
9148 --
9149 wsh_debug_sv.LOG(l_module_name, 'P_DELIVERY_DETAIL_ID', p_delivery_detail_id);
9150 wsh_debug_sv.LOG(l_module_name, 'p_organization_id', p_organization_id);
9151 wsh_debug_sv.LOG(l_module_name, 'p_inventory_item_id', p_inventory_item_id);
9152 END IF;
9153 --
9154
9155 WSH_DELIVERY_DETAILS_INV.Get_item_information
9156 (
9157 p_organization_id => p_organization_id,
9158 p_inventory_item_id => p_inventory_item_id,
9159 x_mtl_system_items_rec => l_item_info,
9160 x_return_status => l_return_status
9161 );
9162 --
9163 wsh_util_core.api_post_call
9164 (
9165 p_return_status => l_return_status,
9166 x_num_warnings => l_number_of_warnings,
9167 x_num_errors => l_number_of_errors
9168 );
9169
9170 IF ( l_item_info.lot_divisible_flag = 'N' AND p_cycle_qty <> l_picked_qty AND
9171 l_item_info.lot_control_code = 2 AND l_released_status ='Y') THEN
9172 IF l_debug_on THEN
9173 wsh_debug_sv.LOG(l_module_name, 'l_item_info.lot_divisible_flag', l_item_info.lot_divisible_flag);
9174 wsh_debug_sv.LOG(l_module_name, 'l_item_info.lot_control_code', l_item_info.lot_control_code);
9175 wsh_debug_sv.LOG(l_module_name, 'l_released_status', l_released_status);
9176 WSH_DEBUG_SV.pop(l_module_name);
9177 END IF;
9178 return(FALSE);
9179
9180 ELSE
9181 IF l_debug_on THEN
9182 wsh_debug_sv.LOG(l_module_name, 'lot_divisible_flag', l_item_info.lot_divisible_flag);
9183 wsh_debug_sv.LOG(l_module_name, 'l_item_info.lot_control_code', l_item_info.lot_control_code);
9184 wsh_debug_sv.LOG(l_module_name, 'l_released_status', l_released_status);
9185
9186 WSH_DEBUG_SV.pop(l_module_name);
9187 END IF;
9188
9189 return(TRUE);
9190 END IF;
9191
9192 IF l_debug_on THEN
9193 WSH_DEBUG_SV.pop(l_module_name);
9194 END IF;
9195
9196 return(TRUE);
9197
9198 EXCEPTION
9199 WHEN NO_DATA_FOUND THEN
9200 -- Debug Statements
9201 --
9202 -- CLOSE line_status;
9203 IF l_debug_on THEN
9204 WSH_DEBUG_SV.logmsg(l_module_name,'NO_DATA_FOUND exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
9205 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:NO_DATA_FOUND');
9206 END IF;
9207 --
9208 return(FALSE);
9209
9210 WHEN others THEN
9211 /*IF line_status%ISOPEN THEN
9212 CLOSE line_status;
9213 END IF;
9214 */
9215 --
9216 IF l_debug_on THEN
9217 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
9218 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
9219 END IF;
9220 --
9221 return(FALSE);
9222
9223 END is_cycle_count_allowed;
9224
9225 END WSH_DETAILS_VALIDATIONS;