[Home] [Help]
PACKAGE BODY: APPS.WSH_BULK_PROCESS_PVT
Source
1 PACKAGE BODY WSH_BULK_PROCESS_PVT as
2 /* $Header: WSHBLPRB.pls 120.3.12000000.5 2007/01/23 19:27:27 rvishnuv ship $ */
3
4 G_PKG_NAME CONSTANT VARCHAR2(30) := 'WSH_BULK_PROCESS_PVT';
5 l_vendor_party_id NUMBER;
6
7
8 --========================================================================
9 -- PROCEDURE : clear_wsh_prev_tabs
10 --
11 -- PARAMETERS:
12 -- p_line_rec
13 -- x_return_status return status
14 -- COMMENT : If OM calls Create_delivery_details several time in one session
15 -- this procedure will clear the previously populated tables.
16 -- Delete operation is not used to avoid extending performance
17 -- issues.
18 --========================================================================
19 PROCEDURE clear_wsh_prev_tabs(
20 p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.line_rec_type,
21 x_return_status OUT NOCOPY VARCHAR2)
22 IS
23 l_debug_on BOOLEAN;
24 --
25 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME ||
26 '.' || 'clear_wsh_prev_tabs';
27 i NUMBER;
28 l_debug_num NUMBER := 0;
29
30 BEGIN
31 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
32 IF l_debug_on IS NULL
33 THEN
34 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
35 END IF;
36 --
37 IF l_debug_on THEN
38 wsh_debug_sv.push (l_module_name);
39 WSH_DEBUG_SV.log(l_module_name,'count ',
40 p_line_rec.ship_from_location_id.COUNT);
41 END IF;
42 --
43 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
44
45 i := p_line_rec.ship_from_location_id.FIRST;
46 WHILE i IS NOT NULL LOOP
47
48 l_debug_num := 1;
49 p_line_rec.country_of_origin(i) := NULL;
50 l_debug_num := l_debug_num + 1;
51 p_line_rec.lpn_id(i) := NULL;
52 l_debug_num := l_debug_num + 1;
53 p_line_rec.ship_from_location_id(i) := NULL;
54 l_debug_num := l_debug_num + 1;
55 p_line_rec.ship_to_location_id(i) := NULL;
56 l_debug_num := l_debug_num + 1;
57 p_line_rec.deliver_to_location_id(i) := NULL;
58 l_debug_num := l_debug_num + 1;
59 p_line_rec.intmed_ship_to_location_id(i) := NULL;
60 l_debug_num := l_debug_num + 1;
61 p_line_rec.intermed_ship_to_contact_id(i) := NULL;
62 l_debug_num := l_debug_num + 1;
63 p_line_rec.requested_quantity(i) := NULL;
64 l_debug_num := l_debug_num + 1;
65 p_line_rec.carrier_id(i) := NULL;
66 l_debug_num := l_debug_num + 1;
67 p_line_rec.customer_item_id(i) := NULL;
68 l_debug_num := l_debug_num + 1;
69 p_line_rec.dep_plan_required_flag(i) := NULL;
70 l_debug_num := l_debug_num + 1;
71 p_line_rec.net_weight(i) := NULL;
72 l_debug_num := l_debug_num + 1;
73 p_line_rec.volume(i) := NULL;
74 l_debug_num := l_debug_num + 1;
75 p_line_rec.mvt_stat_status(i) := NULL;
76 l_debug_num := l_debug_num + 1;
77 p_line_rec.organization_id(i) := NULL;
78 l_debug_num := l_debug_num + 1;
79 p_line_rec.cancelled_quantity2(i) := NULL;
80 l_debug_num := l_debug_num + 1;
81 p_line_rec.tracking_number(i) := NULL;
82 l_debug_num := l_debug_num + 1;
83 p_line_rec.shipping_interfaced_flag(i) := NULL;
84 l_debug_num := l_debug_num + 1;
85 p_line_rec.source_line_number(i) := NULL;
86 l_debug_num := l_debug_num + 1;
87 p_line_rec.inspection_flag(i) := NULL;
88 l_debug_num := l_debug_num + 1;
89 p_line_rec.gross_weight(i) := NULL;
90 l_debug_num := l_debug_num + 1;
91 p_line_rec.seal_code(i) := NULL;
92 l_debug_num := l_debug_num + 1;
93 p_line_rec.requested_quantity2(i) := NULL;
94 l_debug_num := l_debug_num + 1;
95 p_line_rec.requested_quantity_uom2(i) := NULL;
96 l_debug_num := l_debug_num + 1;
97 p_line_rec.revision(i) := NULL;
98 l_debug_num := l_debug_num + 1;
99 p_line_rec.container_name(i) := NULL;
100 l_debug_num := l_debug_num + 1;
101 p_line_rec.source_line_set_id(i) := NULL;
102 l_debug_num := l_debug_num + 1;
103 p_line_rec.detail_container_item_id(i) := NULL;
104 l_debug_num := l_debug_num + 1;
105 p_line_rec.master_container_item_id(i) := NULL;
106 l_debug_num := l_debug_num + 1;
107 p_line_rec.original_subinventory(i) := NULL;
108 l_debug_num := l_debug_num + 1;
109 p_line_rec.error_message_count(i) := NULL;
110 l_debug_num := l_debug_num + 1;
111 p_line_rec.received_quantity(i) := NULL;
112 l_debug_num := l_debug_num + 1;
113 p_line_rec.received_quantity2(i) := NULL;
114 l_debug_num := l_debug_num + 1;
115 p_line_rec.line_set_id(i) := NULL;
116 l_debug_num := l_debug_num + 1;
117 p_line_rec.drop_ship_flag(i) := NULL;
118 l_debug_num := l_debug_num + 1;
119 p_line_rec.source_document_type_id(i) := NULL;
120 l_debug_num := l_debug_num + 1;
121 p_line_rec.intermed_ship_to_org_id(i) := NULL;
122 l_debug_num := l_debug_num + 1;
123 p_line_rec.delivery_detail_id(i) := NULL;
124 l_debug_num := l_debug_num + 1;
125 p_line_rec.source_blanket_reference_id(i) := NULL;
126 l_debug_num := l_debug_num + 1;
127 p_line_rec.source_blanket_reference_num(i) := NULL;
128 l_debug_num := l_debug_num + 1;
129 p_line_rec.vendor_id(i) := NULL;
130 l_debug_num := l_debug_num + 1;
131 p_line_rec.vendor_party_id(i) := NULL;
132 l_debug_num := l_debug_num + 1;
133 p_line_rec.Days_early_receipt_allowed(i) := NULL;
134 l_debug_num := l_debug_num + 1;
135 p_line_rec.Days_late_receipt_allowed(i) := NULL;
136 l_debug_num := l_debug_num + 1;
137 p_line_rec.ship_from_site_id(i) := NULL;
138 l_debug_num := l_debug_num + 1;
139 p_line_rec.hold_code(i) := NULL;
140 l_debug_num := l_debug_num + 1;
141 p_line_rec.supplier_item_num(i) := NULL;
142 l_debug_num := l_debug_num + 1;
143 p_line_rec.po_shipment_line_id(i) := NULL;
144 l_debug_num := l_debug_num + 1;
145 p_line_rec.po_shipment_line_number(i) := NULL;
146 l_debug_num := l_debug_num + 1;
147 p_line_rec.shipping_control(i) := NULL;
148 l_debug_num := l_debug_num + 1;
149 p_line_rec.source_line_type_code(i) := NULL;
150 l_debug_num := l_debug_num + 1;
151 p_line_rec.consolidate_quantity(i) := NULL;
152 l_debug_num := l_debug_num + 1;
153 p_line_rec.po_revision(i) := NULL;
154 l_debug_num := l_debug_num + 1;
155 p_line_rec.release_revision(i) := NULL;
156 l_debug_num := l_debug_num + 1;
157 i := p_line_rec.ship_from_location_id.NEXT(i);
158
159 END LOOP;
160 IF l_debug_on THEN
161 WSH_DEBUG_SV.pop(l_module_name);
162 END IF;
163
164 EXCEPTION
165 WHEN OTHERS THEN
166 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
167 wsh_util_core.default_handler('WSH_BULK_PROCESS_PVT.clear_wsh_prev_tabs');
168 --
169 IF l_debug_on THEN
170 WSH_DEBUG_SV.log(l_module_name,'i ',i);
171 WSH_DEBUG_SV.log(l_module_name,'l_debug_num ',l_debug_num);
172 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. '||
173 'Oracle error message is '||
174 SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
175 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
176 END IF;
177 END clear_wsh_prev_tabs;
178
179
180
181
182 --========================================================================
183 -- PROCEDURE : calc_service_mode
184 --
185 -- PARAMETERS:
186 -- p_line_rec
187 -- p_cache_tbl used to store the cache info
188 -- p_cache_ext_tbl used to store the cache info
189 -- p_index current index for tables in
190 -- p_additional_line_info_rec
191 -- p_additional_line_info_rec
192 -- x_return_status return status
193 -- COMMENT : The service_level and mode_of_transport is calculated and
194 -- populated to the p_additional_line_info_rec.mode_of_transport
195 -- and p_additional_line_info_rec.service_level tables.
196 -- The index of these tables are cached, so that the for the same
197 -- ship_method_code these information is reused.
198 --========================================================================
199 PROCEDURE calc_service_mode(
200 p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.line_rec_type,
201 p_cache_tbl IN OUT NOCOPY
202 wsh_util_core.char500_tab_type,
203 p_cache_ext_tbl IN OUT NOCOPY
204 wsh_util_core.char500_tab_type,
205 p_index IN NUMBER,
206 p_additional_line_info_rec IN OUT NOCOPY
207 additional_line_info_rec_type,
208 x_return_status OUT NOCOPY VARCHAR2)
209 IS
210 l_debug_on BOOLEAN;
211 --
212 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME ||
213 '.' || 'calc_service_mode';
214 l_num_warnings NUMBER;
215 l_num_errors NUMBER;
216 l_index NUMBER;
217 l_return_status VARCHAR2(1);
218 l_value NUMBER;
219 l_ship_method_code VARCHAR2(30);
220 l_carrier_rec WSH_CARRIERS_GRP.Carrier_Service_InOut_Rec_Type;
221
222
223 BEGIN
224 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
225 IF l_debug_on IS NULL
226 THEN
227 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
228 END IF;
229 --
230 IF l_debug_on THEN
231 wsh_debug_sv.push (l_module_name);
232 WSH_DEBUG_SV.log(l_module_name,'ship_method_code ',
233 p_line_rec.shipping_method_code(p_index));
234 WSH_DEBUG_SV.log(l_module_name,'p_index ',p_index);
235 END IF;
236 --
237 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
238 l_ship_method_code := p_line_rec.shipping_method_code(p_index);
239 IF l_ship_method_code IS NOT NULL THEN --{
240 wsh_util_core.get_cached_value(
241 p_cache_tbl=> p_cache_tbl,
242 p_cache_ext_tbl => p_cache_ext_tbl,
243 p_value => l_ship_method_code,
244 p_key => l_index,
245 p_action => 'GET',
246 x_return_status => l_return_status) ;
247
248 wsh_util_core.api_post_call(
249 p_return_status => l_return_status,
250 x_num_warnings => l_num_warnings,
251 x_num_errors => l_num_errors);
252 IF l_return_status = WSH_UTIL_CORE.G_RET_STS_WARNING THEN --{
253 --the information is not cached, so calculate it
254 l_carrier_rec.ship_method_code := l_ship_method_code;
255
256 WSH_CARRIERS_GRP.get_carrier_service_mode(
257 p_carrier_service_inout_rec => l_carrier_rec,
258 x_return_status => l_return_status);
259 wsh_util_core.api_post_call(
260 p_return_status => l_return_status,
261 x_num_warnings => l_num_warnings,
262 x_num_errors => l_num_errors);
263
264 IF l_carrier_rec.generic_flag = 'Y' THEN
265 p_line_rec.shipping_method_code(p_index) := NULL;
266 p_line_rec.carrier_id(p_index) := NULL;
267 l_ship_method_code := NULL;
268 ELSE
269 p_line_rec.carrier_id(p_index) := l_carrier_rec.carrier_id;
270 END IF;
271 p_additional_line_info_rec.service_level(p_index) := l_carrier_rec.service_level;
272 p_additional_line_info_rec.mode_of_transport(p_index) := l_carrier_rec.mode_of_transport;
273 IF l_debug_on THEN
274 WSH_DEBUG_SV.log(l_module_name,'generic_flag ',
275 l_carrier_rec.generic_flag);
276 WSH_DEBUG_SV.log(l_module_name,'calculated service level ',
277 p_additional_line_info_rec.service_level(p_index));
278 WSH_DEBUG_SV.log(l_module_name,'calculated mode_of_transport ',
279 p_additional_line_info_rec.mode_of_transport(p_index));
280 END IF;
281 --insert the values into the cache
282 wsh_util_core.get_cached_value(
283 p_cache_tbl=> p_cache_tbl,
284 p_cache_ext_tbl => p_cache_ext_tbl,
285 p_value => l_ship_method_code,
286 p_key => p_index,
287 p_action => 'PUT',
288 x_return_status => l_return_status) ;
289 ELSE --}{
290 -- the values are already cached
291 p_additional_line_info_rec.service_level(p_index) :=
292 p_additional_line_info_rec.service_level(l_index);
293 p_additional_line_info_rec.mode_of_transport(p_index) :=
294 p_additional_line_info_rec.mode_of_transport(l_index);
295 p_line_rec.shipping_method_code(p_index) :=
296 p_line_rec.shipping_method_code(l_index);
297 p_line_rec.carrier_id(p_index) :=
298 p_line_rec.carrier_id(l_index);
299 END IF; --}
300 END IF; --}
301
302 IF l_debug_on THEN
303 WSH_DEBUG_SV.log(l_module_name,'service level ',
304 p_additional_line_info_rec.service_level(p_index));
305 WSH_DEBUG_SV.log(l_module_name,'mode of transport ',
306 p_additional_line_info_rec.mode_of_transport(p_index));
307 WSH_DEBUG_SV.log(l_module_name,'shipping_method_code ',
308 p_line_rec.shipping_method_code(p_index));
309 WSH_DEBUG_SV.pop(l_module_name);
310 END IF;
311 EXCEPTION
312
313 WHEN OTHERS THEN
314 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
315 wsh_util_core.default_handler('WSH_BULK_PROCESS_PVT.calc_service_mode');
316 --
317 IF l_debug_on THEN
318 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. '||
319 'Oracle error message is '||
320 SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
321 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
322 END IF;
323 END calc_service_mode;
324
325
326
327 -- Start of comments
328 -- API name : CHECK_NULL_FIELDS
329 -- Type : Public
330 -- Pre-reqs : None.
331 -- Function : If the caller is not OM (e.g OKE) then this procedure will
332 -- check for the required fields.The fields which are NULL are
333 -- collected in the local variable l_token.
334 -- Parameters :
335 -- IN:
336 -- p_index IN NUMBER
337 -- The index of the record of the i/p table of records
338 -- namely p_line_rec. Only the fields of the record
339 -- corresponding to this index are checked for Null.
340 -- IN OUT:
341 -- p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.Line_rec_type
342 -- The input table of records, which contains the fields
343 -- to be checked for NULL.
344 -- OUT:
345 -- x_return_status OUT NOCOPY VARCHAR2
346 -- Version : 1.0
347 -- Previous version 1.0
348 -- Initial version 1.0
349 -- End of comments
350
351
352
353 PROCEDURE check_null_fields(
354 p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.Line_rec_type,
355 p_index IN NUMBER,
356 x_return_status OUT NOCOPY VARCHAR2
357 )
358 IS
359
360 l_token VARCHAR2(200);
361 --
362 l_debug_on BOOLEAN;
363 --
364 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME ||
365 '.' || 'check_null_fields';
366
367 BEGIN
368
369 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
370 IF l_debug_on IS NULL
371 THEN
372 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
373 END IF;
374 --
375 IF l_debug_on THEN
376 wsh_debug_sv.push (l_module_name);
377 WSH_DEBUG_SV.log(l_module_name,'p_index',p_index);
378 WSH_DEBUG_SV.log(l_module_name,'p_line_rec.header_id.COUNT',p_line_rec.header_id.COUNT);
379 END IF;
380 --
381 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
382
383 /*bms create a message WSH_REQUIRED_FIELDS_NULL saying
384 Fields and FIELD_NAME cannot be null
385 */
386 IF p_line_rec.header_id(p_index) IS NULL THEN
387 l_token := 'header_id ';
388 END IF;
389 IF p_line_rec.line_id(p_index) IS NULL THEN
390 l_token := l_token || 'line_id ';
391 END IF;
392 IF p_line_rec.ordered_quantity(p_index) IS NULL THEN
393 l_token := l_token || 'ordered_quantity ';
394 END IF;
395 IF p_line_rec.order_quantity_uom(p_index) IS NULL THEN
396 l_token := l_token || 'order_quantity_uom ';
397 END IF;
398 IF (p_line_rec.inventory_item_id(p_index) IS NULL)
399 AND (p_line_rec.item_description(p_index) IS NULL)
400 THEN
401 l_token := l_token || 'inventory_item_id item_description ';
402 END IF;
403 IF p_line_rec.organization_id(p_index) IS NULL THEN
404 l_token := l_token || 'organization_id ';
405 END IF;
406 IF p_line_rec.source_header_number(p_index) IS NULL THEN
407 l_token := l_token || 'source_header_number ';
408 END IF;
409 IF p_line_rec.source_line_number(p_index) IS NULL THEN
410 l_token := l_token || 'source_line_number ';
411 END IF;
412 IF p_line_rec.ship_from_location_id(p_index) IS NULL THEN
413 l_token := l_token || 'ship_from_location_id ';
414 END IF;
415 IF p_line_rec.ship_to_location_id(p_index) IS NULL THEN
416 l_token := l_token || 'shipping_eligible_flag ';
417 END IF;
418
419
420 -- If true, it implies that certain field(s) are NULL.
421 IF l_token IS NOT NULL THEN
422 IF l_debug_on THEN
423 WSH_DEBUG_SV.log(l_module_name,'l_token ',l_token);
424 END IF;
425
426 FND_MESSAGE.SET_NAME('WSH','WSH_REQUIRED_FIELDS_NULL');
427 FND_MESSAGE.SET_TOKEN('FIELD_NAMES',l_token);
428 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
429 wsh_util_core.add_message(x_return_status, l_module_name);
430
431 END IF;
432
433 IF l_debug_on THEN
434 WSH_DEBUG_SV.pop(l_module_name);
435 END IF;
436
437 EXCEPTION
438
439 WHEN OTHERS THEN
440 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
441 wsh_util_core.default_handler('WSH_BULK_PROCESS_PVT.check_null_fields');
442 --
443 IF l_debug_on THEN
444 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. '||
445 'Oracle error message is '||
446 SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
447 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
448 END IF;
449 END check_null_fields;
450
451
452
453
454
455
456 --========================================================================
457 -- PROCEDURE : Calc_wt_vol_qty
458 --
459 -- PARAMETERS: p_line_rec Line record
460 -- p_additional_line_info_rec additional tables for the line
461 -- p_index The index for p_line_rec
462 -- x_return_status return status
463 --
464 -- COMMENT : This procedure calculates the weight, volume and quantity
465 -- related fields.
466 --========================================================================
467
468 PROCEDURE Calc_wt_vol_qty(
469 p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.line_rec_type,
470 p_additional_line_info_rec IN OUT NOCOPY
471 additional_line_info_rec_type ,
472 p_index IN NUMBER,
473 p_action_prms IN OUT NOCOPY
474 WSH_BULK_TYPES_GRP.action_parameters_rectype,
475 x_return_status OUT NOCOPY VARCHAR2
476 )
477 IS
478 l_debug_on BOOLEAN;
479 --
480 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME ||
481 '.' || 'CALC_WT_VOL_QTY';
482 v_item_info_rec wsh_util_validate.item_info_rec_type;
483 l_return_status VARCHAR2(1);
484 l_item_type VARCHAR2(30);
485 l_token VARCHAR2(100);
486 l_num_warnings NUMBER := 0;
487 l_num_errors NUMBER := 0;
488
489 -- RV DEC_QTY
490 l_max_decimal_digits NUMBER ;
491 -- RV DEC_QTY
492
493 -- HW BUG #3064890 for HVOP for OPM
494 -- end of 3064890
495
496 BEGIN
497
498 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
499 IF l_debug_on IS NULL
500 THEN
501 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
502 END IF;
503 --
504 IF l_debug_on THEN
505 wsh_debug_sv.push (l_module_name);
506 END IF;
507
508 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
509
510 IF (p_line_rec.inventory_item_id(p_index) is NULL) THEN --{
511 IF (p_line_rec.requested_quantity(p_index) is null ) THEN
512 p_line_rec.requested_quantity_uom(p_index) :=
513 p_line_rec.order_quantity_uom(p_index);
514 p_line_rec.requested_quantity(p_index) :=
515 p_line_rec.ordered_quantity(p_index);
516 END IF;
517 IF p_line_rec.volume IS NULL THEN
518 l_token := 'volume';
519 ELSIF p_line_rec.weight_uom_code IS NULL THEN
520 l_token := 'weight_uom_code';
521 ELSIF p_line_rec.net_weight IS NULL THEN
522 l_token := 'net_weight';
523 ELSIF p_line_rec.volume_uom_code IS NULL THEN
524 l_token := 'volume_uom_code';
525 END IF;
526
527 IF l_token IS NOT NULL THEN
528
529 FND_MESSAGE.SET_NAME('WSH','WSH_REQUIRED_FIELD_NULL');
530 FND_MESSAGE.SET_TOKEN('FIELD_NAME',l_token);
531 wsh_util_core.add_message(WSH_UTIL_CORE.G_RET_STS_ERROR,
532 l_module_name);
533
534 RAISE FND_API.G_EXC_ERROR;
535
536 END IF;
537
538 p_additional_line_info_rec.inv_interfaced_flag(p_index) := 'X';
539 ELSE --}{
540 IF p_line_rec.weight_uom_code(p_index) IS NULL OR
541 p_line_rec.item_description(p_index) IS NULL OR
542 p_line_rec.requested_quantity_uom(p_index) IS NULL OR
543 p_line_rec.volume_uom_code(p_index) IS NULL
544 THEN --{
545
546 wsh_util_validate.get_item_info(
547 p_organization_id => p_line_rec.organization_id(p_index),
548 p_inventory_item_id => p_line_rec.inventory_item_id(p_index),
549 x_Item_info_rec => v_item_info_rec,
550 x_return_status => l_return_status);
551
552 wsh_util_core.api_post_call(
553 p_return_status => l_return_status,
554 x_num_warnings => l_num_warnings,
555 x_num_errors => l_num_errors);
556
557 p_line_rec.item_description(p_index) := NVL(p_line_rec.item_description(p_index), v_item_info_rec.description);
558 p_line_rec.requested_quantity_uom(p_index) := NVL(p_line_rec.requested_quantity_uom(p_index), v_item_info_rec.primary_uom_code);
559 p_line_rec.weight_uom_code(p_index) := NVL(p_line_rec.weight_uom_code(p_index), v_item_info_rec.weight_uom_code);
560 p_line_rec.volume_uom_code(p_index) := NVL(p_line_rec.volume_uom_code(p_index), v_item_info_rec.volume_uom_code);
561 p_line_rec.mtl_unit_weight(p_index) := NVL(p_line_rec.mtl_unit_weight(p_index), v_item_info_rec.unit_weight);
562 p_line_rec.mtl_unit_volume(p_index) := NVL(p_line_rec.mtl_unit_volume(p_index), v_item_info_rec.unit_volume);
563
564 END IF;--}
565
566 -- HW need to branch for OPM and use conversion for OPM lines
567 -- HW OPM BUG#:3064890 HVOP for OPM
568
569 --HW OPMCONV. Removed code forking
570
571 IF p_line_rec.requested_quantity(p_index) IS NULL THEN
572 -- RV DEC_QTY
573 IF (p_action_prms.caller = 'PO') THEN
574 --{
575 l_max_decimal_digits := WSH_UTIL_CORE.C_MAX_DECIMAL_DIGITS;
576 --}
577 ELSE
578 --{
579 l_max_decimal_digits := WSH_UTIL_CORE.C_MAX_DECIMAL_DIGITS_INV;
580 --}
581 END IF;
582 -- RV DEC_QTY
583 p_line_rec.requested_quantity(p_index) :=
584 wsh_wv_utils.convert_uom(
585 p_line_rec.order_quantity_uom(p_index),
586 p_line_rec.requested_quantity_uom(p_index),
587 p_line_rec.ordered_quantity(p_index),
588 p_line_rec.inventory_item_id(p_index),
589 l_max_decimal_digits); -- RV DEC_QTY
590
591 END IF;
592 -- HW OPMCONV - Removed code forking
593 -- end of 3064890
594
595 p_line_rec.net_weight(p_index) := p_line_rec.mtl_unit_weight(p_index) *
596 p_line_rec.requested_quantity(p_index);
597 p_line_rec.volume(p_index) := p_line_rec.mtl_unit_volume(p_index) *
598 p_line_rec.requested_quantity(p_index);
599
600 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_validate_OM_QTY_WT_VOL_LVL) = 1
601 OR WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_PO_CALC_WT_VOL_LVL) = 1 THEN --{
602 p_line_rec.gross_weight(p_index) := p_line_rec.net_weight(p_index);
603 ELSE --}{
604 WSH_UTIL_VALIDATE.Find_Item_Type(
605 p_inventory_item_id => p_line_rec.inventory_item_id(p_index),
606 p_organization_id => p_line_rec.organization_id(p_index) ,
607 x_item_type => l_item_type,
608 x_return_status => l_return_status );
609
610 --bms new message: containers cannot be imported.
611
612 IF(l_item_type = 'CONT_ITEM') THEN
613 FND_MESSAGE.SET_NAME('WSH','WSH_BAD_ITEM_TYPE');
614 wsh_util_core.add_message(WSH_UTIL_CORE.G_RET_STS_ERROR,
615 l_module_name);
616 RAISE FND_API.G_EXC_ERROR;
617 END IF;
618 END IF; --}
619 END IF; --}
620
621 l_token := NULL;
622 IF p_line_rec.requested_quantity(p_index) IS NULL THEN
623 l_token := 'requested_quantity';
624 ELSIF P_line_rec.requested_quantity_uom(p_index) IS NULL THEN
625 l_token := 'requested_quantity_uom';
626 END IF;
627
628 IF l_token IS NOT NULL THEN
629 FND_MESSAGE.SET_NAME('WSH','WSH_REQUIRED_FIELD_NULL');
630 FND_MESSAGE.SET_TOKEN('FIELD_NAME',l_token);
631 wsh_util_core.add_message(WSH_UTIL_CORE.G_RET_STS_ERROR,l_module_name);
632
633 IF l_debug_on THEN
634 WSH_DEBUG_SV.log(l_module_name,'l_token ',l_token);
635 END IF;
636
637 RAISE FND_API.G_EXC_ERROR;
638 END IF;
639
640 IF l_debug_on THEN
641 WSH_DEBUG_SV.log(l_module_name,'requeste_quantity ',
642 P_line_rec.requested_quantity(p_index));
643 WSH_DEBUG_SV.log(l_module_name,'requested_quantity_uom',
644 P_line_rec.requested_quantity_uom(p_index));
645 WSH_DEBUG_SV.pop(l_module_name);
646 END IF;
647
648 EXCEPTION
649
650 WHEN FND_API.G_EXC_ERROR THEN
651 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
652 --
653 IF l_debug_on THEN
654 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_ERROR exception has '
655 || 'occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
656 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_ERROR');
657 END IF;
658 --
659 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
660 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
661 --
662 IF l_debug_on THEN
663 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. ' ||
664 'Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
665 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
666 END IF;
667
668 WHEN WSH_UTIL_CORE.G_EXC_WARNING THEN
669 x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
670 --
671 IF l_debug_on THEN
672 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_UTIL_CORE.G_EXC_WARNING '||
673 'exception has occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
674 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_UTIL_CORE.G_EXC_WARNING');
675 END IF;
676 --
677
678 WHEN OTHERS THEN
679 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
680 wsh_util_core.default_handler('WSH_BULK_PROCESS_PVT.Calc_wt_vol_qty');
681 --
682 IF l_debug_on THEN
683 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. '||
684 'Oracle error message is '||
685 SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
686 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
687 END IF;
688
689 END Calc_wt_vol_qty;
690
691
692
693 --========================================================================
694 -- PROCEDURE : Create_delivery_details
695 --
696 -- PARAMETERS: p_action_prms Additional attributes needed
697 -- p_line_rec Line record
698 -- x_return_status return status
699 -- COMMENT : This API is called from the wrapper API:
700 -- WSH_BULK_PROCESS_GRP.Create_update_delivery_details
701 -- It imports the order lines into Shipping tables
702 --========================================================================
703
704 PROCEDURE Create_delivery_details(
705 p_action_prms IN OUT NOCOPY
706 WSH_BULK_TYPES_GRP.action_parameters_rectype,
707 p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.Line_rec_type,
708 x_return_status OUT NOCOPY VARCHAR2
709 )
710 IS
711 --Added the following cursor for Inbound Logistics
712
713 --Cursor checks for PO data in WSH.
714 CURSOR c_po_exists(p_header_id NUMBER,p_blanket_ref_id NUMBER) is
715 SELECT '1'
716 FROM wsh_delivery_details
717 WHERE source_header_id = p_header_id
718 AND source_code = 'PO'
719 AND (
720 (p_blanket_ref_id is NULL AND
721 source_blanket_reference_id IS NULL)
722 OR
723 (p_blanket_ref_id IS NOT NULL AND
724 source_blanket_reference_id = p_blanket_ref_id)
725 );
726
727
728 l_debug_on BOOLEAN;
729 --
730 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME ||
731 '.' || 'CREATE_DELIVERY_DETAILS';
732 l_return_status VARCHAR2(1);
733 l_num_warnings NUMBER := 0;
734 l_num_errors NUMBER := 0;
735 l_action_prms WSH_BULK_TYPES_GRP.action_parameters_rectype;
736 l_tab_count NUMBER := 0;
737 l_valid_rec_exist NUMBER;
738 l_eligible_rec_exist NUMBER;
739 l_additional_line_info_rec additional_line_info_rec_type;
740 l_dd_list WSH_PO_CMG_PVT.dd_list_type;
741 l_dd_exists VARCHAR2(1);
742 l_vendor_party_exists VARCHAR2(1);
743 l_index NUMBER := NULL;
744 l_action_prms1 WSH_BULK_TYPES_GRP.action_parameters_rectype;
745 i NUMBER;
746 BEGIN
747
748 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
749 IF l_debug_on IS NULL
750 THEN
751 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
752 END IF;
753 --
754 IF l_debug_on THEN
755 wsh_debug_sv.push (l_module_name);
756 END IF;
757
758 --
759
760 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
761 l_action_prms := p_action_prms;
762
763 IF l_debug_on THEN
764 WSH_DEBUG_SV.log(l_module_name,'count of wsh managed tables ',
765 p_line_rec.ship_from_location_id.COUNT);
766 WSH_DEBUG_SV.log(l_module_name,'Caller',p_action_prms.caller);
767 WSH_DEBUG_SV.log(l_module_name,'Action Code',p_action_prms.action_code);
768 END IF;
769
770 IF p_action_prms.caller = 'OM' AND p_line_rec.ship_from_location_id.COUNT > 0 THEN
771
772 clear_wsh_prev_tabs(p_line_rec => p_line_rec,
773 x_return_status => l_return_status);
774 wsh_util_core.api_post_call(
775 p_return_status => l_return_status,
776 x_num_warnings => l_num_warnings,
777 x_num_errors => l_num_errors);
778
779 END IF;
780
781 Extend_tables (
782 p_line_rec => p_line_rec,
783 p_action_prms => l_action_prms,
784 x_table_count => l_tab_count,
785 x_additional_line_info_rec => l_additional_line_info_rec,
786 x_return_status => l_return_status
787 );
788
789 wsh_util_core.api_post_call(
790 p_return_status => l_return_status,
791 x_num_warnings => l_num_warnings,
792 x_num_errors => l_num_errors);
793
794
795
796 --wsh_util_validate.G_ITEM_INFO_TAB.DELETE;
797 --wsh_util_validate.G_ITEM_CATEGORY_INFO_TAB.DELETE;
798 --wsh_util_validate.G_SHIPPING_PARAMS_INFO_EXP_TAB.DELETE;
799 --wsh_util_validate.G_SHIPPING_PARAMS_INFO_TAB.DELETE;
800
801 --Added for Inbound Logistics.
802 /*PO will pass the action code as APPROVE_PO even for reapproval case.
803 Depending on the cursor c_po_exists, we now need to set the action
804 code as APPROVE_PO or REAPPROVE_PO */
805
806 IF p_action_prms.caller = 'PO' AND
807 p_action_prms.action_code = 'APPROVE_PO' THEN
808
809 OPEN c_po_exists(p_line_rec.header_id(p_line_rec.header_id.FIRST),
810 p_line_rec.source_blanket_reference_id(p_line_rec.header_id.FIRST));
811 FETCH c_po_exists INTO l_dd_exists;
812 CLOSE c_po_exists;
813 IF l_dd_exists = '1' THEN
814 p_action_prms.action_code := 'REAPPROVE_PO';
815 ELSE
816 p_action_prms.action_code := 'APPROVE_PO';
817 END IF;
818 END IF;
819
820 IF p_action_prms.action_code = 'APPROVE_PO' THEN
821
822 IF l_debug_on THEN
823 WSH_DEBUG_SV.log(l_module_name,'p_line_rec.vendor_id(p_line_rec.vendor_id.FIRST)',p_line_rec.vendor_id(p_line_rec.vendor_id.FIRST));
824 END IF;
825
826 --To find the party ID for the given Vendor ID.
827 l_vendor_party_exists := WSH_SUPPLIER_PARTY.VENDOR_PARTY_EXISTS(
828 p_vendor_id => p_line_rec.vendor_id(p_line_rec.vendor_id.FIRST),
829 x_party_id => l_vendor_party_id);
830
831 IF l_debug_on THEN
832 WSH_DEBUG_SV.log(l_module_name,'p_line_rec.vendor_id(p_line_rec.vendor_id.FIRST)',p_line_rec.vendor_id(p_line_rec.vendor_id.FIRST));
833 WSH_DEBUG_SV.log(l_module_name,'l_vendor_party_exists',l_vendor_party_exists);
834 WSH_DEBUG_SV.log(l_module_name,'l_vendor_party_id',l_vendor_party_id);
835 END IF;
836
837
838 IF l_vendor_party_exists = 'N' THEN
839 -- { IB-Phase-2
840 --If party not exists, throw an error message and return.
841 IF l_debug_on THEN
842 WSH_DEBUG_SV.log(l_module_name,'Party does not Exist for the Vendor ');
843 END IF;
844 raise fnd_api.g_exc_error;
845 -- } IB-Phase-2
846 END IF;
847
848
849 END IF;
850
851 --
852 Validate_lines(
853 p_line_rec => p_line_rec,
854 P_action_prms => l_action_prms,
855 p_additional_line_info_rec => l_additional_line_info_rec,
856 x_valid_rec_exist => l_valid_rec_exist,
857 x_eligible_rec_exist => l_eligible_rec_exist,
858 X_return_status => l_return_status
859 );
860
861 wsh_util_core.api_post_call(
862 p_return_status => l_return_status,
863 x_num_warnings => l_num_warnings,
864 x_num_errors => l_num_errors);
865
866 IF l_debug_on THEN
867 WSH_DEBUG_SV.log(l_module_name,'l_valid_rec_exist ',l_valid_rec_exist);
868 WSH_DEBUG_SV.log(l_module_name,'l_eligible_rec_exist ',
869 l_eligible_rec_exist);
870 END IF;
871
872 IF l_valid_rec_exist = 0 THEN --{
873 IF l_eligible_rec_exist > 0 THEN
874
875 /* if no lines were validated successfully, but there were some
876 eligible records then raise error */
877
878 RAISE FND_API.G_EXC_ERROR;
879 ELSE
880
881 /* if no lines were validated successfully, and no lines were
882 eligible then return success */
883
884 IF l_debug_on THEN
885 WSH_DEBUG_SV.pop(l_module_name);
886 END IF;
887 RETURN;
888 END IF;
889 ELSE --}{
890 IF l_debug_on THEN
891 WSH_DEBUG_SV.logmsg(l_module_name,'calling bulk insert');
892 WSH_DEBUG_SV.log(l_module_name,'action code ', p_action_prms.action_code);
893 END IF;
894
895 --Added for Inbound Logistics
896 IF p_action_prms.action_code = 'APPROVE_PO' or
897 p_action_prms.action_code = 'CREATE' THEN
898 bulk_insert_details (
899 P_line_rec => P_line_rec,
900 p_index => l_index,
901 p_action_prms => l_action_prms,
902 p_additional_line_info_rec => l_additional_line_info_rec,
903 X_return_status => l_return_status
904 );
905 --skattama
906 i:= l_additional_line_info_rec.latest_pickup_tpdate_excep.FIRST;
907 WHILE i is not NULL LOOP
908 WSH_TP_RELEASE.log_tpdate_exception('LINE',P_line_rec.delivery_detail_id(i),TRUE,l_additional_line_info_rec.earliest_pickup_date(i),l_additional_line_info_rec.latest_pickup_tpdate_excep(i));
909 i := l_additional_line_info_rec.latest_pickup_tpdate_excep.NEXT(i);
910 END LOOP;
911
912 i:=l_additional_line_info_rec.latest_dropoff_tpdate_excep.FIRST;
913 WHILE i is not null LOOP
914 WSH_TP_RELEASE.log_tpdate_exception('LINE',P_line_rec.delivery_detail_id(i),TRUE,l_additional_line_info_rec.earliest_pickup_date(i),l_additional_line_info_rec.latest_dropoff_tpdate_excep(i));
915 i := l_additional_line_info_rec.latest_dropoff_tpdate_excep.NEXT(i);
916 END LOOP;
917 --skattama
918 --
919 IF p_action_prms.action_code = 'APPROVE_PO'
920 THEN
921 --
922 IF l_debug_on THEN
923 WSH_DEBUG_SV.log(l_module_name,'l_return_status',l_return_status);
924 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
925 END IF;
926 --
927 wsh_util_core.api_post_call
928 (
929 p_return_status => l_return_status,
930 x_num_warnings => l_num_warnings,
931 x_num_errors => l_num_errors
932 );
933 --
934 --
935 l_action_prms1.caller := 'PO_INTG';
936 --
937 IF l_debug_on THEN
938 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_IB_TXN_MATCH_PKG.handlePriorReceipts',WSH_DEBUG_SV.C_PROC_LEVEL);
939 END IF;
940 --
941 --
942 WSH_IB_TXN_MATCH_PKG.handlePriorReceipts
943 (
944 p_action_prms => l_action_prms1,
945 x_line_rec => p_line_rec,
946 x_return_status => l_return_status
947 );
948 END IF;
949 ELSIF p_action_prms.action_code = 'REAPPROVE_PO' THEN
950 WSH_PO_CMG_PVT.Reapprove_PO(
951 p_line_rec => p_line_rec,
952 p_action_prms => p_action_prms,
953 p_dd_list => l_dd_list,
954 x_return_status => l_return_status);
955 ELSIF (p_action_prms.action_code = 'CANCEL_PO' OR
956 p_action_prms.action_code = 'CLOSE_PO' OR
957 p_action_prms.action_code = 'FINAL_CLOSE' OR
958 p_action_prms.action_code = 'CLOSE_PO_FOR_RECEIVING' ) THEN
959 WSH_PO_CMG_PVT.Cancel_Close_PO(
960 p_line_rec => p_line_rec,
961 p_action_prms => p_action_prms,
962 x_return_status => l_return_status);
963 ELSIF p_action_prms.action_code = 'REOPEN_PO' THEN
964 WSH_PO_CMG_PVT.Reopen_PO(
965 p_line_rec => p_line_rec,
966 x_return_status => l_return_status);
967 END IF;
968
969 x_return_status := l_return_status;
970
971 wsh_util_core.api_post_call(
972 p_return_status => l_return_status,
973 x_num_warnings => l_num_warnings,
974 x_num_errors => l_num_errors);
975 END IF; --}
976
977 --
978 IF l_debug_on THEN
979 WSH_DEBUG_SV.logmsg(l_module_name,
980 'Number of Errors='||l_num_errors||',Number of Warnings='||l_num_warnings);
981 END IF;
982 --
983 IF l_num_errors > 0
984 THEN
985 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
986 ELSIF l_num_warnings > 0
987 THEN
988 x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
989 ELSE
990 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
991 END IF;
992
993 IF l_debug_on THEN
994 WSH_DEBUG_SV.pop(l_module_name);
995 END IF;
996 --
997 EXCEPTION
998 WHEN FND_API.G_EXC_ERROR THEN
999 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1000 WSH_UTIL_CORE.ADD_MESSAGE(x_return_status,l_module_name);
1001 --
1002 IF l_debug_on THEN
1003 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_ERROR exception has '
1004 || 'occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
1005 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_ERROR');
1006 END IF;
1007 --
1008 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1009 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
1010 --
1011 IF l_debug_on THEN
1012 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. ' ||
1013 'Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
1014 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
1015 END IF;
1016
1017 WHEN WSH_UTIL_CORE.G_EXC_WARNING THEN
1018 x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
1019 --
1020 IF l_debug_on THEN
1021 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_UTIL_CORE.G_EXC_WARNING '||
1022 'exception has occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
1023 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_UTIL_CORE.G_EXC_WARNING');
1024 END IF;
1025 --
1026
1027 WHEN OTHERS THEN
1028 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
1029 wsh_util_core.default_handler('WSH_BULK_PROCESS_PVT.Create_delivery_details');
1030 --
1031 IF l_debug_on THEN
1032 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. '||
1033 'Oracle error message is '||
1034 SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
1035 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
1036 END IF;
1037
1038 END Create_delivery_details;
1039
1040
1041 --========================================================================
1042 -- PROCEDURE : Extend_tables
1043 --
1044 -- PARAMETERS: p_line_rec Line record
1045 -- p_action_prms Additional attributes needed
1046 -- x_table_count Size of each table
1047 -- x_additional_line_info_rec Local record that is extended
1048 -- and ready to use to store additional
1049 -- information for line record.
1050 -- x_return_status return status
1051 -- COMMENT : This procedure extends all the common table in p_line_rec
1052 -- It also extends the local tables used during the import.
1053 --========================================================================
1054
1055
1056 PROCEDURE Extend_tables (
1057 p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.line_rec_type,
1058 p_action_prms IN WSH_BULK_TYPES_GRP.action_parameters_rectype ,
1059 x_table_count OUT NOCOPY NUMBER ,
1060 x_additional_line_info_rec OUT NOCOPY
1061 additional_line_info_rec_type ,
1062 x_return_status OUT NOCOPY VARCHAR2
1063 )
1064 IS
1065 l_debug_on BOOLEAN;
1066 --
1067 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME ||
1068 '.' || 'EXTEND_TABLES';
1069 l_field_name VARCHAR2(200);
1070 l_count NUMBER;
1071 e_extend_error EXCEPTION;
1072
1073 BEGIN
1074 --
1075 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
1076 IF l_debug_on IS NULL
1077 THEN
1078 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
1079 END IF;
1080 --
1081 IF l_debug_on THEN
1082 wsh_debug_sv.push (l_module_name);
1083 END IF;
1084 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
1085 --
1086 x_table_count := p_line_rec.line_id.COUNT;
1087 IF l_debug_on THEN
1088 WSH_DEBUG_SV.log(l_module_name,'x_table_count ',x_table_count);
1089 WSH_DEBUG_SV.log(l_module_name,'caller is ',p_action_prms.caller);
1090 END IF;
1091
1092 IF x_table_count = 0 THEN
1093 --bms do we need to set some message
1094 RAISE FND_API.G_EXC_ERROR;
1095 END IF;
1096
1097
1098 IF p_line_rec.org_id.COUNT = 0 AND nvl(p_action_prms.caller,'@@@') <> 'WSH_IB_UTIL' THEN
1099 p_line_rec.org_id.EXTEND(x_table_count);
1100 ELSIF p_line_rec.org_id.COUNT <> x_table_count AND nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1101 p_line_rec.org_id.EXTEND;
1102 END IF;
1103
1104 l_count := p_line_rec.organization_id.COUNT;
1105 IF l_count <> x_table_count THEN
1106 IF l_count = 0 THEN
1107 p_line_rec.organization_id.EXTEND(x_table_count);
1108 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1109 p_line_rec.organization_id.EXTEND;
1110 ELSIF l_count < x_table_count THEN
1111 p_line_rec.organization_id.EXTEND(x_table_count - l_count);
1112 END IF;
1113 END IF;
1114
1115 l_count := p_line_rec.arrival_set_id.COUNT;
1116 IF l_count <> x_table_count THEN
1117 IF l_count = 0 THEN
1118 p_line_rec.arrival_set_id.EXTEND(x_table_count);
1119 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1120 p_line_rec.arrival_set_id.EXTEND;
1121 ELSIF l_count < x_table_count THEN
1122 l_field_name := 'arrival_set_id';
1123 RAISE e_extend_error;
1124 END IF;
1125 END IF;
1126
1127 l_count := p_line_rec.ato_line_id.COUNT;
1128 IF p_line_rec.ato_line_id.COUNT <> x_table_count THEN
1129 IF p_line_rec.ato_line_id.COUNT = 0 THEN
1130 p_line_rec.ato_line_id.EXTEND(x_table_count);
1131 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1132 p_line_rec.ato_line_id.EXTEND;
1133 ELSIF l_count < x_table_count THEN
1134 l_field_name := 'ato_line_id';
1135 RAISE e_extend_error;
1136 END IF;
1137 END IF;
1138
1139 l_count := p_line_rec.lpn_id.COUNT;
1140 IF p_line_rec.lpn_id.COUNT <> x_table_count THEN
1141 IF l_count = 0 THEN
1142 p_line_rec.lpn_id.EXTEND(x_table_count);
1143 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1144 p_line_rec.lpn_id.EXTEND;
1145 ELSIF l_count < x_table_count THEN
1146 p_line_rec.lpn_id.EXTEND(x_table_count - l_count);
1147 END IF;
1148 END IF;
1149
1150 l_count := p_line_rec.attribute1.COUNT;
1151 IF p_line_rec.attribute1.COUNT <> x_table_count THEN
1152 IF p_line_rec.attribute1.COUNT = 0 THEN
1153 p_line_rec.attribute1.EXTEND(x_table_count);
1154 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1155 p_line_rec.attribute1.EXTEND;
1156 ELSIF l_count < x_table_count THEN
1157 l_field_name := 'attribute1';
1158 RAISE e_extend_error;
1159 END IF;
1160 END IF;
1161
1162 l_count := p_line_rec.attribute10.COUNT;
1163 IF p_line_rec.attribute10.COUNT <> x_table_count THEN
1164 IF p_line_rec.attribute10.COUNT = 0 THEN
1165 p_line_rec.attribute10.EXTEND(x_table_count);
1166 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1167 p_line_rec.attribute10.EXTEND;
1168 ELSIF l_count < x_table_count THEN
1169 l_field_name := 'attribute10';
1170 RAISE e_extend_error;
1171 END IF;
1172 END IF;
1173
1174 l_count := p_line_rec.attribute11.COUNT;
1175 IF p_line_rec.attribute11.COUNT <> x_table_count THEN
1176 IF p_line_rec.attribute11.COUNT = 0 THEN
1177 p_line_rec.attribute11.EXTEND(x_table_count);
1178 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1179 p_line_rec.attribute11.EXTEND;
1180 ELSIF l_count < x_table_count THEN
1181 l_field_name := 'attribute11';
1182 RAISE e_extend_error;
1183 END IF;
1184 END IF;
1185
1186 l_count := p_line_rec.attribute12.COUNT;
1187 IF p_line_rec.attribute12.COUNT <> x_table_count THEN
1188 IF p_line_rec.attribute12.COUNT = 0 THEN
1189 p_line_rec.attribute12.EXTEND(x_table_count);
1190 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1191 p_line_rec.attribute12.EXTEND;
1192 ELSIF l_count < x_table_count THEN
1193 l_field_name := 'attribute12';
1194 RAISE e_extend_error;
1195 END IF;
1196 END IF;
1197
1198 l_count := p_line_rec.attribute13.COUNT;
1199 IF p_line_rec.attribute13.COUNT <> x_table_count THEN
1200 IF p_line_rec.attribute13.COUNT = 0 THEN
1201 p_line_rec.attribute13.EXTEND(x_table_count);
1202 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1203 p_line_rec.attribute13.EXTEND;
1204 ELSIF l_count < x_table_count THEN
1205 l_field_name := 'attribute13';
1206 RAISE e_extend_error;
1207 END IF;
1208 END IF;
1209
1210 l_count := p_line_rec.attribute14.COUNT;
1211 IF p_line_rec.attribute14.COUNT <> x_table_count THEN
1212 IF p_line_rec.attribute14.COUNT = 0 THEN
1213 p_line_rec.attribute14.EXTEND(x_table_count);
1214 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1215 p_line_rec.attribute14.EXTEND;
1216 ELSIF l_count < x_table_count THEN
1217 l_field_name := 'attribute14';
1218 RAISE e_extend_error;
1219 END IF;
1220 END IF;
1221
1222 l_count := p_line_rec.attribute15.COUNT;
1223 IF p_line_rec.attribute15.COUNT <> x_table_count THEN
1224 IF p_line_rec.attribute15.COUNT = 0 THEN
1225 p_line_rec.attribute15.EXTEND(x_table_count);
1226 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1227 p_line_rec.attribute15.EXTEND;
1228 ELSIF l_count < x_table_count THEN
1229 l_field_name := 'attribute15';
1230 RAISE e_extend_error;
1231 END IF;
1232 END IF;
1233
1234 l_count := p_line_rec.attribute16.COUNT;
1235 IF p_line_rec.attribute16.COUNT <> x_table_count THEN
1236 IF p_line_rec.attribute16.COUNT = 0 THEN
1237 p_line_rec.attribute16.EXTEND(x_table_count);
1238 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1239 p_line_rec.attribute16.EXTEND;
1240 ELSIF l_count < x_table_count THEN
1241 l_field_name := 'attribute16';
1242 RAISE e_extend_error;
1243 END IF;
1244 END IF;
1245
1246 l_count := p_line_rec.attribute17.COUNT;
1247 IF p_line_rec.attribute17.COUNT <> x_table_count THEN
1248 IF p_line_rec.attribute17.COUNT = 0 THEN
1249 p_line_rec.attribute17.EXTEND(x_table_count);
1250 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1251 p_line_rec.attribute17.EXTEND;
1252 ELSIF l_count < x_table_count THEN
1253 l_field_name := 'attribute17';
1254 RAISE e_extend_error;
1255 END IF;
1256 END IF;
1257
1258 l_count := p_line_rec.attribute18.COUNT;
1259 IF p_line_rec.attribute18.COUNT <> x_table_count THEN
1260 IF p_line_rec.attribute18.COUNT = 0 THEN
1261 p_line_rec.attribute18.EXTEND(x_table_count);
1262 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1263 p_line_rec.attribute18.EXTEND;
1264 ELSIF l_count < x_table_count THEN
1265 l_field_name := 'attribute18';
1266 RAISE e_extend_error;
1267 END IF;
1268 END IF;
1269
1270 l_count := p_line_rec.attribute19.COUNT;
1271 IF p_line_rec.attribute19.COUNT <> x_table_count THEN
1272 IF p_line_rec.attribute19.COUNT = 0 THEN
1273 p_line_rec.attribute19.EXTEND(x_table_count);
1274 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1275 p_line_rec.attribute19.EXTEND;
1276 ELSIF l_count < x_table_count THEN
1277 l_field_name := 'attribute19';
1278 RAISE e_extend_error;
1279 END IF;
1280 END IF;
1281
1282 l_count := p_line_rec.attribute2.COUNT;
1283 IF p_line_rec.attribute2.COUNT <> x_table_count THEN
1284 IF p_line_rec.attribute2.COUNT = 0 THEN
1285 p_line_rec.attribute2.EXTEND(x_table_count);
1286 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1287 p_line_rec.attribute2.EXTEND;
1288 ELSIF l_count < x_table_count THEN
1289 l_field_name := 'attribute2';
1290 RAISE e_extend_error;
1291 END IF;
1292 END IF;
1293
1294 l_count := p_line_rec.attribute20.COUNT;
1295 IF p_line_rec.attribute20.COUNT <> x_table_count THEN
1296 IF p_line_rec.attribute20.COUNT = 0 THEN
1297 p_line_rec.attribute20.EXTEND(x_table_count);
1298 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1299 p_line_rec.attribute20.EXTEND;
1300 ELSIF l_count < x_table_count THEN
1301 l_field_name := 'attribute20';
1302 RAISE e_extend_error;
1303 END IF;
1304 END IF;
1305
1306 l_count := p_line_rec.attribute3.COUNT;
1307 IF p_line_rec.attribute3.COUNT <> x_table_count THEN
1308 IF p_line_rec.attribute3.COUNT = 0 THEN
1309 p_line_rec.attribute3.EXTEND(x_table_count);
1310 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1311 p_line_rec.attribute3.EXTEND;
1312 ELSIF l_count < x_table_count THEN
1313 l_field_name := 'attribute3';
1314 RAISE e_extend_error;
1315 END IF;
1316 END IF;
1317
1318 l_count := p_line_rec.attribute4.COUNT;
1319 IF p_line_rec.attribute4.COUNT <> x_table_count THEN
1320 IF p_line_rec.attribute4.COUNT = 0 THEN
1321 p_line_rec.attribute4.EXTEND(x_table_count);
1322 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1323 p_line_rec.attribute4.EXTEND;
1324 ELSIF l_count < x_table_count THEN
1325 l_field_name := 'attribute4';
1326 RAISE e_extend_error;
1327 END IF;
1328 END IF;
1329
1330 l_count := p_line_rec.attribute5.COUNT;
1331 IF p_line_rec.attribute5.COUNT <> x_table_count THEN
1332 IF p_line_rec.attribute5.COUNT = 0 THEN
1333 p_line_rec.attribute5.EXTEND(x_table_count);
1334 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1335 p_line_rec.attribute5.EXTEND;
1336 ELSIF l_count < x_table_count THEN
1337 l_field_name := 'attribute5';
1338 RAISE e_extend_error;
1339 END IF;
1340 END IF;
1341
1342 l_count := p_line_rec.attribute6.COUNT;
1343 IF p_line_rec.attribute6.COUNT <> x_table_count THEN
1344 IF p_line_rec.attribute6.COUNT = 0 THEN
1345 p_line_rec.attribute6.EXTEND(x_table_count);
1346 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1347 p_line_rec.attribute6.EXTEND;
1348 ELSIF l_count < x_table_count THEN
1349 l_field_name := 'attribute6';
1350 RAISE e_extend_error;
1351 END IF;
1352 END IF;
1353
1354 l_count := p_line_rec.attribute7.COUNT;
1355 IF p_line_rec.attribute7.COUNT <> x_table_count THEN
1356 IF p_line_rec.attribute7.COUNT = 0 THEN
1357 p_line_rec.attribute7.EXTEND(x_table_count);
1358 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1359 p_line_rec.attribute7.EXTEND;
1360 ELSIF l_count < x_table_count THEN
1361 l_field_name := 'attribute7';
1362 RAISE e_extend_error;
1363 END IF;
1364 END IF;
1365
1366 l_count := p_line_rec.attribute8.COUNT;
1367 IF p_line_rec.attribute8.COUNT <> x_table_count THEN
1368 IF p_line_rec.attribute8.COUNT = 0 THEN
1369 p_line_rec.attribute8.EXTEND(x_table_count);
1370 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1371 p_line_rec.attribute8.EXTEND;
1372 ELSIF l_count < x_table_count THEN
1373 l_field_name := 'attribute8';
1374 RAISE e_extend_error;
1375 END IF;
1376 END IF;
1377
1378 l_count := p_line_rec.attribute9.COUNT;
1379 IF p_line_rec.attribute9.COUNT <> x_table_count THEN
1380 IF p_line_rec.attribute9.COUNT = 0 THEN
1381 p_line_rec.attribute9.EXTEND(x_table_count);
1382 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1383 p_line_rec.attribute9.EXTEND;
1384 ELSIF l_count < x_table_count THEN
1385 l_field_name := 'attribute9';
1386 RAISE e_extend_error;
1387 END IF;
1388 END IF;
1389
1390 l_count := p_line_rec.CONTEXT.COUNT;
1391 IF p_line_rec.CONTEXT.COUNT <> x_table_count THEN
1392 IF p_line_rec.CONTEXT.COUNT = 0 THEN
1393 p_line_rec.CONTEXT.EXTEND(x_table_count);
1394 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1395 p_line_rec.CONTEXT.EXTEND;
1396 ELSIF l_count < x_table_count THEN
1397 l_field_name := 'CONTEXT';
1398 RAISE e_extend_error;
1399 END IF;
1400 END IF;
1401
1402 l_count := p_line_rec.customer_dock_code.COUNT;
1403 IF p_line_rec.customer_dock_code.COUNT <> x_table_count THEN
1404 IF p_line_rec.customer_dock_code.COUNT = 0 THEN
1405 p_line_rec.customer_dock_code.EXTEND(x_table_count);
1406 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1407 p_line_rec.customer_dock_code.EXTEND;
1408 ELSIF l_count < x_table_count THEN
1409 l_field_name := 'customer_dock_code';
1410 RAISE e_extend_error;
1411 END IF;
1412 END IF;
1413
1414 l_count := p_line_rec.customer_job.COUNT;
1415 IF p_line_rec.customer_job.COUNT <> x_table_count THEN
1416 IF p_line_rec.customer_job.COUNT = 0 THEN
1417 p_line_rec.customer_job.EXTEND(x_table_count);
1418 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1419 p_line_rec.customer_job.EXTEND;
1420 ELSIF l_count < x_table_count THEN
1421 l_field_name := 'customer_job';
1422 RAISE e_extend_error;
1423 END IF;
1424 END IF;
1425
1426 l_count := p_line_rec.customer_production_line.COUNT;
1427 IF p_line_rec.customer_production_line.COUNT <> x_table_count THEN
1428 IF p_line_rec.customer_production_line.COUNT = 0 THEN
1429 p_line_rec.customer_production_line.EXTEND(x_table_count);
1430 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1431 p_line_rec.customer_production_line.EXTEND;
1432 ELSIF l_count < x_table_count THEN
1433 l_field_name := 'customer_production_line';
1434 RAISE e_extend_error;
1435 END IF;
1436 END IF;
1437
1438 l_count := p_line_rec.cust_model_serial_number.COUNT;
1439 IF p_line_rec.cust_model_serial_number.COUNT <> x_table_count THEN
1440 IF p_line_rec.cust_model_serial_number.COUNT = 0 THEN
1441 p_line_rec.cust_model_serial_number.EXTEND(x_table_count);
1442 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1443 p_line_rec.cust_model_serial_number.EXTEND;
1444 ELSIF l_count < x_table_count THEN
1445 l_field_name := 'cust_model_serial_number';
1446 RAISE e_extend_error;
1447 END IF;
1448 END IF;
1449
1450 l_count := p_line_rec.cust_po_number.COUNT;
1451 IF p_line_rec.cust_po_number.COUNT <> x_table_count THEN
1452 IF p_line_rec.cust_po_number.COUNT = 0 THEN
1453 p_line_rec.cust_po_number.EXTEND(x_table_count);
1454 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1455 p_line_rec.cust_po_number.EXTEND;
1456 ELSIF l_count < x_table_count THEN
1457 l_field_name := 'cust_po_number';
1458 RAISE e_extend_error;
1459 END IF;
1460 END IF;
1461
1462 l_count := p_line_rec.cust_production_seq_num.COUNT;
1463 IF p_line_rec.cust_production_seq_num.COUNT <> x_table_count THEN
1464 IF p_line_rec.cust_production_seq_num.COUNT = 0 THEN
1465 p_line_rec.cust_production_seq_num.EXTEND(x_table_count);
1466 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1467 p_line_rec.cust_production_seq_num.EXTEND;
1468 ELSIF l_count < x_table_count THEN
1469 l_field_name := 'cust_production_seq_num';
1470 RAISE e_extend_error;
1471 END IF;
1472 END IF;
1473
1474 l_count := p_line_rec.deliver_to_contact_id.COUNT;
1475 IF p_line_rec.deliver_to_contact_id.COUNT <> x_table_count THEN
1476 IF p_line_rec.deliver_to_contact_id.COUNT = 0 THEN
1477 p_line_rec.deliver_to_contact_id.EXTEND(x_table_count);
1478 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1479 p_line_rec.deliver_to_contact_id.EXTEND;
1480 ELSIF l_count < x_table_count THEN
1481 l_field_name := 'deliver_to_contact_id';
1482 RAISE e_extend_error;
1483 END IF;
1484 END IF;
1485
1486 l_count := p_line_rec.deliver_to_org_id.COUNT;
1487 IF p_line_rec.deliver_to_org_id.COUNT <> x_table_count THEN
1488 IF p_line_rec.deliver_to_org_id.COUNT = 0 THEN
1489 p_line_rec.deliver_to_org_id.EXTEND(x_table_count);
1490 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1491 p_line_rec.deliver_to_org_id.EXTEND;
1492 ELSIF l_count < x_table_count THEN
1493 l_field_name := 'deliver_to_org_id';
1494 RAISE e_extend_error;
1495 END IF;
1496 END IF;
1497
1498 l_count := p_line_rec.dep_plan_required_flag.COUNT;
1499 IF p_line_rec.dep_plan_required_flag.COUNT <> x_table_count THEN
1500 IF p_line_rec.dep_plan_required_flag.COUNT = 0 THEN
1501 p_line_rec.dep_plan_required_flag.EXTEND(x_table_count);
1502 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1503 p_line_rec.dep_plan_required_flag.EXTEND;
1504 ELSIF l_count < x_table_count THEN
1505 p_line_rec.dep_plan_required_flag.EXTEND(x_table_count - l_count);
1506 END IF;
1507 END IF;
1508
1509 l_count := p_line_rec.end_item_unit_number.COUNT;
1510 IF p_line_rec.end_item_unit_number.COUNT <> x_table_count THEN
1511 IF p_line_rec.end_item_unit_number.COUNT = 0 THEN
1512 p_line_rec.end_item_unit_number.EXTEND(x_table_count);
1513 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1514 p_line_rec.end_item_unit_number.EXTEND;
1515 ELSIF l_count < x_table_count THEN
1516 l_field_name := 'end_item_unit_number';
1517 RAISE e_extend_error;
1518 END IF;
1519 END IF;
1520
1521 l_count := p_line_rec.fob_point_code.COUNT;
1522 IF p_line_rec.fob_point_code.COUNT <> x_table_count THEN
1523 IF p_line_rec.fob_point_code.COUNT = 0 THEN
1524 p_line_rec.fob_point_code.EXTEND(x_table_count);
1525 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1526 p_line_rec.fob_point_code.EXTEND;
1527 ELSIF l_count < x_table_count THEN
1528 l_field_name := 'fob_point_code';
1529 RAISE e_extend_error;
1530 END IF;
1531 END IF;
1532
1533 l_count := p_line_rec.freight_terms_code.COUNT;
1534 IF p_line_rec.freight_terms_code.COUNT <> x_table_count THEN
1535 IF p_line_rec.freight_terms_code.COUNT = 0 THEN
1536 p_line_rec.freight_terms_code.EXTEND(x_table_count);
1537 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1538 p_line_rec.freight_terms_code.EXTEND;
1539 ELSIF l_count < x_table_count THEN
1540 l_field_name := 'freight_terms_code';
1541 RAISE e_extend_error;
1542 END IF;
1543 END IF;
1544
1545 l_count := p_line_rec.header_id.COUNT;
1546 IF p_line_rec.header_id.COUNT <> x_table_count THEN
1547 IF p_line_rec.header_id.COUNT = 0 THEN
1548 p_line_rec.header_id.EXTEND(x_table_count);
1549 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1550 p_line_rec.header_id.EXTEND;
1551 ELSIF l_count < x_table_count THEN
1552 l_field_name := 'header_id';
1553 RAISE e_extend_error;
1554 END IF;
1555 END IF;
1556
1557 l_count := p_line_rec.TP_CONTEXT.COUNT;
1558 IF p_line_rec.TP_CONTEXT.COUNT <> x_table_count THEN
1559 IF p_line_rec.TP_CONTEXT.COUNT = 0 THEN
1560 p_line_rec.TP_CONTEXT.EXTEND(x_table_count);
1561 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1562 p_line_rec.TP_CONTEXT.EXTEND;
1563 ELSIF l_count < x_table_count THEN
1564 l_field_name := 'TP_CONTEXT';
1565 RAISE e_extend_error;
1566 END IF;
1567 END IF;
1568
1569 l_count := p_line_rec.TP_ATTRIBUTE1.COUNT;
1570 IF p_line_rec.TP_ATTRIBUTE1.COUNT <> x_table_count THEN
1571 IF p_line_rec.TP_ATTRIBUTE1.COUNT = 0 THEN
1572 p_line_rec.TP_ATTRIBUTE1.EXTEND(x_table_count);
1573 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1574 p_line_rec.TP_ATTRIBUTE1.EXTEND;
1575 ELSIF l_count < x_table_count THEN
1576 l_field_name := 'TP_ATTRIBUTE1';
1577 RAISE e_extend_error;
1578 END IF;
1579 END IF;
1580
1581 l_count := p_line_rec.TP_ATTRIBUTE2.COUNT;
1582 IF p_line_rec.TP_ATTRIBUTE2.COUNT <> x_table_count THEN
1583 IF p_line_rec.TP_ATTRIBUTE2.COUNT = 0 THEN
1584 p_line_rec.TP_ATTRIBUTE2.EXTEND(x_table_count);
1585 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1586 p_line_rec.TP_ATTRIBUTE2.EXTEND;
1587 ELSIF l_count < x_table_count THEN
1588 l_field_name := 'TP_ATTRIBUTE2';
1589 RAISE e_extend_error;
1590 END IF;
1591 END IF;
1592
1593 l_count := p_line_rec.TP_ATTRIBUTE3.COUNT;
1594 IF p_line_rec.TP_ATTRIBUTE3.COUNT <> x_table_count THEN
1595 IF p_line_rec.TP_ATTRIBUTE3.COUNT = 0 THEN
1596 p_line_rec.TP_ATTRIBUTE3.EXTEND(x_table_count);
1597 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1598 p_line_rec.TP_ATTRIBUTE3.EXTEND;
1599 ELSIF l_count < x_table_count THEN
1600 l_field_name := 'TP_ATTRIBUTE3';
1601 RAISE e_extend_error;
1602 END IF;
1603 END IF;
1604
1605 l_count := p_line_rec.TP_ATTRIBUTE4.COUNT;
1606 IF p_line_rec.TP_ATTRIBUTE4.COUNT <> x_table_count THEN
1607 IF p_line_rec.TP_ATTRIBUTE4.COUNT = 0 THEN
1608 p_line_rec.TP_ATTRIBUTE4.EXTEND(x_table_count);
1609 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1610 p_line_rec.TP_ATTRIBUTE4.EXTEND;
1611 ELSIF l_count < x_table_count THEN
1612 l_field_name := 'TP_ATTRIBUTE4';
1613 RAISE e_extend_error;
1614 END IF;
1615 END IF;
1616
1617 l_count := p_line_rec.TP_ATTRIBUTE5.COUNT;
1618 IF p_line_rec.TP_ATTRIBUTE5.COUNT <> x_table_count THEN
1619 IF p_line_rec.TP_ATTRIBUTE5.COUNT = 0 THEN
1620 p_line_rec.TP_ATTRIBUTE5.EXTEND(x_table_count);
1621 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1622 p_line_rec.TP_ATTRIBUTE5.EXTEND;
1623 ELSIF l_count < x_table_count THEN
1624 l_field_name := 'TP_ATTRIBUTE5';
1625 RAISE e_extend_error;
1626 END IF;
1627 END IF;
1628
1629 l_count := p_line_rec.TP_ATTRIBUTE6.COUNT;
1630 IF p_line_rec.TP_ATTRIBUTE6.COUNT <> x_table_count THEN
1631 IF p_line_rec.TP_ATTRIBUTE6.COUNT = 0 THEN
1632 p_line_rec.TP_ATTRIBUTE6.EXTEND(x_table_count);
1633 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1634 p_line_rec.TP_ATTRIBUTE6.EXTEND;
1635 ELSIF l_count < x_table_count THEN
1636 l_field_name := 'TP_ATTRIBUTE6';
1637 RAISE e_extend_error;
1638 END IF;
1639 END IF;
1640
1641 l_count := p_line_rec.TP_ATTRIBUTE7.COUNT;
1642 IF p_line_rec.TP_ATTRIBUTE7.COUNT <> x_table_count THEN
1643 IF p_line_rec.TP_ATTRIBUTE7.COUNT = 0 THEN
1644 p_line_rec.TP_ATTRIBUTE7.EXTEND(x_table_count);
1645 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1646 p_line_rec.TP_ATTRIBUTE7.EXTEND;
1647 ELSIF l_count < x_table_count THEN
1648 l_field_name := 'TP_ATTRIBUTE7';
1649 RAISE e_extend_error;
1650 END IF;
1651 END IF;
1652
1653 l_count := p_line_rec.TP_ATTRIBUTE8.COUNT;
1654 IF p_line_rec.TP_ATTRIBUTE8.COUNT <> x_table_count THEN
1655 IF p_line_rec.TP_ATTRIBUTE8.COUNT = 0 THEN
1656 p_line_rec.TP_ATTRIBUTE8.EXTEND(x_table_count);
1657 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1658 p_line_rec.TP_ATTRIBUTE8.EXTEND;
1659 ELSIF l_count < x_table_count THEN
1660 l_field_name := 'TP_ATTRIBUTE8';
1661 RAISE e_extend_error;
1662 END IF;
1663 END IF;
1664
1665 l_count := p_line_rec.TP_ATTRIBUTE9.COUNT;
1666 IF p_line_rec.TP_ATTRIBUTE9.COUNT <> x_table_count THEN
1667 IF p_line_rec.TP_ATTRIBUTE9.COUNT = 0 THEN
1668 p_line_rec.TP_ATTRIBUTE9.EXTEND(x_table_count);
1669 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1670 p_line_rec.TP_ATTRIBUTE9.EXTEND;
1671 ELSIF l_count < x_table_count THEN
1672 l_field_name := 'TP_ATTRIBUTE9';
1673 RAISE e_extend_error;
1674 END IF;
1675 END IF;
1676
1677 l_count := p_line_rec.TP_ATTRIBUTE10.COUNT;
1678 IF p_line_rec.TP_ATTRIBUTE10.COUNT <> x_table_count THEN
1679 IF p_line_rec.TP_ATTRIBUTE10.COUNT = 0 THEN
1680 p_line_rec.TP_ATTRIBUTE10.EXTEND(x_table_count);
1681 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1682 p_line_rec.TP_ATTRIBUTE10.EXTEND;
1683 ELSIF l_count < x_table_count THEN
1684 l_field_name := 'TP_ATTRIBUTE10';
1685 RAISE e_extend_error;
1686 END IF;
1687 END IF;
1688
1689 l_count := p_line_rec.TP_ATTRIBUTE11.COUNT;
1690 IF p_line_rec.TP_ATTRIBUTE11.COUNT <> x_table_count THEN
1691 IF p_line_rec.TP_ATTRIBUTE11.COUNT = 0 THEN
1692 p_line_rec.TP_ATTRIBUTE11.EXTEND(x_table_count);
1693 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1694 p_line_rec.TP_ATTRIBUTE11.EXTEND;
1695 ELSIF l_count < x_table_count THEN
1696 l_field_name := 'TP_ATTRIBUTE11';
1697 RAISE e_extend_error;
1698 END IF;
1699 END IF;
1700
1701 l_count := p_line_rec.TP_ATTRIBUTE12.COUNT;
1702 IF p_line_rec.TP_ATTRIBUTE12.COUNT <> x_table_count THEN
1703 IF p_line_rec.TP_ATTRIBUTE12.COUNT = 0 THEN
1704 p_line_rec.TP_ATTRIBUTE12.EXTEND(x_table_count);
1705 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1706 p_line_rec.TP_ATTRIBUTE12.EXTEND;
1707 ELSIF l_count < x_table_count THEN
1708 l_field_name := 'TP_ATTRIBUTE12';
1709 RAISE e_extend_error;
1710 END IF;
1711 END IF;
1712
1713 l_count := p_line_rec.TP_ATTRIBUTE13.COUNT;
1714 IF p_line_rec.TP_ATTRIBUTE13.COUNT <> x_table_count THEN
1715 IF p_line_rec.TP_ATTRIBUTE13.COUNT = 0 THEN
1716 p_line_rec.TP_ATTRIBUTE13.EXTEND(x_table_count);
1717 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1718 p_line_rec.TP_ATTRIBUTE13.EXTEND;
1719 ELSIF l_count < x_table_count THEN
1720 l_field_name := 'TP_ATTRIBUTE13';
1721 RAISE e_extend_error;
1722 END IF;
1723 END IF;
1724
1725 l_count := p_line_rec.TP_ATTRIBUTE14.COUNT;
1726 IF p_line_rec.TP_ATTRIBUTE14.COUNT <> x_table_count THEN
1727 IF p_line_rec.TP_ATTRIBUTE14.COUNT = 0 THEN
1728 p_line_rec.TP_ATTRIBUTE14.EXTEND(x_table_count);
1729 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1730 p_line_rec.TP_ATTRIBUTE14.EXTEND;
1731 ELSIF l_count < x_table_count THEN
1732 l_field_name := 'TP_ATTRIBUTE14';
1733 RAISE e_extend_error;
1734 END IF;
1735 END IF;
1736
1737 l_count := p_line_rec.TP_ATTRIBUTE15.COUNT;
1738 IF p_line_rec.TP_ATTRIBUTE15.COUNT <> x_table_count THEN
1739 IF p_line_rec.TP_ATTRIBUTE15.COUNT = 0 THEN
1740 p_line_rec.TP_ATTRIBUTE15.EXTEND(x_table_count);
1741 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1742 p_line_rec.TP_ATTRIBUTE15.EXTEND;
1743 ELSIF l_count < x_table_count THEN
1744 l_field_name := 'TP_ATTRIBUTE15';
1745 RAISE e_extend_error;
1746 END IF;
1747 END IF;
1748
1749 l_count := p_line_rec.intermed_ship_to_contact_id.COUNT;
1750 IF p_line_rec.intermed_ship_to_contact_id.COUNT <> x_table_count THEN
1751 IF p_line_rec.intermed_ship_to_contact_id.COUNT = 0 THEN
1752 p_line_rec.intermed_ship_to_contact_id.EXTEND(x_table_count);
1753 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1754 p_line_rec.intermed_ship_to_contact_id.EXTEND;
1755 ELSIF l_count < x_table_count THEN
1756 p_line_rec.intermed_ship_to_contact_id.EXTEND(x_table_count - l_count);
1757 END IF;
1758 END IF;
1759
1760 l_count := p_line_rec.inventory_item_id.COUNT;
1761 IF p_line_rec.inventory_item_id.COUNT <> x_table_count THEN
1762 IF p_line_rec.inventory_item_id.COUNT = 0 THEN
1763 p_line_rec.inventory_item_id.EXTEND(x_table_count);
1764 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1765 p_line_rec.inventory_item_id.EXTEND;
1766 ELSIF l_count < x_table_count THEN
1767 l_field_name := 'inventory_item_id';
1768 RAISE e_extend_error;
1769 END IF;
1770 END IF;
1771
1772 l_count := p_line_rec.line_number.COUNT;
1773 IF p_line_rec.line_number.COUNT <> x_table_count THEN
1774 IF p_line_rec.line_number.COUNT = 0 THEN
1775 p_line_rec.line_number.EXTEND(x_table_count);
1776 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1777 p_line_rec.line_number.EXTEND;
1778 ELSIF l_count < x_table_count THEN
1779 l_field_name := 'line_number';
1780 RAISE e_extend_error;
1781 END IF;
1782 END IF;
1783
1784 l_count := p_line_rec.ordered_quantity.COUNT;
1785 IF p_line_rec.ordered_quantity.COUNT <> x_table_count THEN
1786 IF p_line_rec.ordered_quantity.COUNT = 0 THEN
1787 p_line_rec.ordered_quantity.EXTEND(x_table_count);
1788 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1789 p_line_rec.ordered_quantity.EXTEND;
1790 ELSIF l_count < x_table_count THEN
1791 l_field_name := 'ordered_quantity';
1792 RAISE e_extend_error;
1793 END IF;
1794 END IF;
1795
1796 l_count := p_line_rec.ordered_quantity2.COUNT;
1797 IF p_line_rec.ordered_quantity2.COUNT <> x_table_count THEN
1798 IF p_line_rec.ordered_quantity2.COUNT = 0 THEN
1799 p_line_rec.ordered_quantity2.EXTEND(x_table_count);
1800 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1801 p_line_rec.ordered_quantity2.EXTEND;
1802 ELSIF l_count < x_table_count THEN
1803 l_field_name := 'ordered_quantity2';
1804 RAISE e_extend_error;
1805 END IF;
1806 END IF;
1807
1808 l_count := p_line_rec.order_quantity_uom.COUNT;
1809 IF p_line_rec.order_quantity_uom.COUNT <> x_table_count THEN
1810 IF p_line_rec.order_quantity_uom.COUNT = 0 THEN
1811 p_line_rec.order_quantity_uom.EXTEND(x_table_count);
1812 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1813 p_line_rec.order_quantity_uom.EXTEND;
1814 ELSIF l_count < x_table_count THEN
1815 l_field_name := 'order_quantity_uom';
1816 RAISE e_extend_error;
1817 END IF;
1818 END IF;
1819
1820 l_count := p_line_rec.ordered_quantity_uom2.COUNT;
1821 IF p_line_rec.ordered_quantity_uom2.COUNT <> x_table_count THEN
1822 IF p_line_rec.ordered_quantity_uom2.COUNT = 0 THEN
1823 p_line_rec.ordered_quantity_uom2.EXTEND(x_table_count);
1824 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1825 p_line_rec.ordered_quantity_uom2.EXTEND;
1826 ELSIF l_count < x_table_count THEN
1827 l_field_name := 'ordered_quantity_uom2';
1828 RAISE e_extend_error;
1829 END IF;
1830 END IF;
1831
1832 l_count := p_line_rec.preferred_grade.COUNT;
1833 IF p_line_rec.preferred_grade.COUNT <> x_table_count THEN
1834 IF p_line_rec.preferred_grade.COUNT = 0 THEN
1835 p_line_rec.preferred_grade.EXTEND(x_table_count);
1836 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1837 p_line_rec.preferred_grade.EXTEND;
1838 ELSIF l_count < x_table_count THEN
1839 l_field_name := 'preferred_grade';
1840 RAISE e_extend_error;
1841 END IF;
1842 END IF;
1843
1844
1845 l_count := p_line_rec.project_id.COUNT;
1846 IF p_line_rec.project_id.COUNT <> x_table_count THEN
1847 IF p_line_rec.project_id.COUNT = 0 THEN
1848 p_line_rec.project_id.EXTEND(x_table_count);
1849 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1850 p_line_rec.project_id.EXTEND;
1851 ELSIF l_count < x_table_count THEN
1852 l_field_name := 'project_id';
1853 RAISE e_extend_error;
1854 END IF;
1855 END IF;
1856
1857 l_count := p_line_rec.request_date.COUNT;
1858 IF p_line_rec.request_date.COUNT <> x_table_count THEN
1859 IF p_line_rec.request_date.COUNT = 0 THEN
1860 p_line_rec.request_date.EXTEND(x_table_count);
1861 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1862 p_line_rec.request_date.EXTEND;
1863 ELSIF l_count < x_table_count THEN
1864 l_field_name := 'request_date';
1865 RAISE e_extend_error;
1866 END IF;
1867 END IF;
1868
1869 l_count := p_line_rec.schedule_ship_date.COUNT;
1870 IF p_line_rec.schedule_ship_date.COUNT <> x_table_count THEN
1871 IF p_line_rec.schedule_ship_date.COUNT = 0 THEN
1872 p_line_rec.schedule_ship_date.EXTEND(x_table_count);
1873 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1874 p_line_rec.schedule_ship_date.EXTEND;
1875 ELSIF l_count < x_table_count THEN
1876 l_field_name := 'schedule_ship_date';
1877 RAISE e_extend_error;
1878 END IF;
1879 END IF;
1880
1881 l_count := p_line_rec.shipment_priority_code.COUNT;
1882 IF p_line_rec.shipment_priority_code.COUNT <> x_table_count THEN
1883 IF p_line_rec.shipment_priority_code.COUNT = 0 THEN
1884 p_line_rec.shipment_priority_code.EXTEND(x_table_count);
1885 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1886 p_line_rec.shipment_priority_code.EXTEND;
1887 ELSIF l_count < x_table_count THEN
1888 l_field_name := 'shipment_priority_code';
1889 RAISE e_extend_error;
1890 END IF;
1891 END IF;
1892
1893 l_count := p_line_rec.shipping_interfaced_flag.COUNT;
1894 IF p_line_rec.shipping_interfaced_flag.COUNT <> x_table_count THEN
1895 IF p_line_rec.shipping_interfaced_flag.COUNT = 0 THEN
1896 p_line_rec.shipping_interfaced_flag.EXTEND(x_table_count);
1897 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1898 p_line_rec.shipping_interfaced_flag.EXTEND;
1899 ELSIF l_count < x_table_count THEN
1900 p_line_rec.shipping_interfaced_flag.EXTEND(x_table_count - l_count);
1901 END IF;
1902 END IF;
1903
1904 l_count := p_line_rec.shipping_method_code.COUNT;
1905 IF p_line_rec.shipping_method_code.COUNT <> x_table_count THEN
1906 IF p_line_rec.shipping_method_code.COUNT = 0 THEN
1907 p_line_rec.shipping_method_code.EXTEND(x_table_count);
1908 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1909 p_line_rec.shipping_method_code.EXTEND;
1910 ELSIF l_count < x_table_count THEN
1911 l_field_name := 'shipping_method_code';
1912 RAISE e_extend_error;
1913 END IF;
1914 END IF;
1915
1916 l_count := p_line_rec.ship_from_org_id.COUNT;
1917 IF p_line_rec.ship_from_org_id.COUNT <> x_table_count THEN
1918 IF p_line_rec.ship_from_org_id.COUNT = 0 THEN
1919 p_line_rec.ship_from_org_id.EXTEND(x_table_count);
1920 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1921 p_line_rec.ship_from_org_id.EXTEND;
1922 ELSIF l_count < x_table_count THEN
1923 l_field_name := 'ship_from_org_id';
1924 RAISE e_extend_error;
1925 END IF;
1926 END IF;
1927
1928 l_count := p_line_rec.ship_model_complete_flag.COUNT;
1929 IF p_line_rec.ship_model_complete_flag.COUNT <> x_table_count THEN
1930 IF p_line_rec.ship_model_complete_flag.COUNT = 0 THEN
1931 p_line_rec.ship_model_complete_flag.EXTEND(x_table_count);
1932 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1933 p_line_rec.ship_model_complete_flag.EXTEND;
1934 ELSIF l_count < x_table_count THEN
1935 l_field_name := 'ship_model_complete_flag';
1936 RAISE e_extend_error;
1937 END IF;
1938 END IF;
1939
1940 l_count := p_line_rec.ship_set_id.COUNT;
1941 IF p_line_rec.ship_set_id.COUNT <> x_table_count THEN
1942 IF p_line_rec.ship_set_id.COUNT = 0 THEN
1943 p_line_rec.ship_set_id.EXTEND(x_table_count);
1944 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1945 p_line_rec.ship_set_id.EXTEND;
1946 ELSIF l_count < x_table_count THEN
1947 l_field_name := 'ship_set_id';
1948 RAISE e_extend_error;
1949 END IF;
1950 END IF;
1951
1952 l_count := p_line_rec.ship_tolerance_above.COUNT;
1953 IF p_line_rec.ship_tolerance_above.COUNT <> x_table_count THEN
1954 IF p_line_rec.ship_tolerance_above.COUNT = 0 THEN
1955 p_line_rec.ship_tolerance_above.EXTEND(x_table_count);
1956 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1957 p_line_rec.ship_tolerance_above.EXTEND;
1958 ELSIF l_count < x_table_count THEN
1959 l_field_name := 'ship_tolerance_above';
1960 RAISE e_extend_error;
1961 END IF;
1962 END IF;
1963
1964 l_count := p_line_rec.ship_tolerance_below.COUNT;
1965 IF p_line_rec.ship_tolerance_below.COUNT <> x_table_count THEN
1966 IF p_line_rec.ship_tolerance_below.COUNT = 0 THEN
1967 p_line_rec.ship_tolerance_below.EXTEND(x_table_count);
1968 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1969 p_line_rec.ship_tolerance_below.EXTEND;
1970 ELSIF l_count < x_table_count THEN
1971 l_field_name := 'ship_tolerance_below';
1972 RAISE e_extend_error;
1973 END IF;
1974 END IF;
1975
1976 l_count := p_line_rec.ship_to_contact_id.COUNT;
1977 IF p_line_rec.ship_to_contact_id.COUNT <> x_table_count THEN
1978 IF p_line_rec.ship_to_contact_id.COUNT = 0 THEN
1979 p_line_rec.ship_to_contact_id.EXTEND(x_table_count);
1980 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1981 p_line_rec.ship_to_contact_id.EXTEND;
1982 ELSIF l_count < x_table_count THEN
1983 l_field_name := 'ship_to_contact_id';
1984 RAISE e_extend_error;
1985 END IF;
1986 END IF;
1987
1988 l_count := p_line_rec.ship_to_org_id.COUNT;
1989 IF p_line_rec.ship_to_org_id.COUNT <> x_table_count THEN
1990 IF p_line_rec.ship_to_org_id.COUNT = 0 THEN
1991 p_line_rec.ship_to_org_id.EXTEND(x_table_count);
1992 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
1993 p_line_rec.ship_to_org_id.EXTEND;
1994 ELSIF l_count < x_table_count THEN
1995 l_field_name := 'ship_to_org_id';
1996 RAISE e_extend_error;
1997 END IF;
1998 END IF;
1999
2000 l_count := p_line_rec.sold_to_org_id.COUNT;
2001 IF p_line_rec.sold_to_org_id.COUNT <> x_table_count THEN
2002 IF p_line_rec.sold_to_org_id.COUNT = 0 THEN
2003 p_line_rec.sold_to_org_id.EXTEND(x_table_count);
2004 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2005 p_line_rec.sold_to_org_id.EXTEND;
2006 ELSIF l_count < x_table_count THEN
2007 l_field_name := 'sold_to_org_id';
2008 RAISE e_extend_error;
2009 END IF;
2010 END IF;
2011
2012 l_count := p_line_rec.task_id.COUNT;
2013 IF p_line_rec.task_id.COUNT <> x_table_count THEN
2014 IF p_line_rec.task_id.COUNT = 0 THEN
2015 p_line_rec.task_id.EXTEND(x_table_count);
2016 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2017 p_line_rec.task_id.EXTEND;
2018 ELSIF l_count < x_table_count THEN
2019 l_field_name := 'task_id';
2020 RAISE e_extend_error;
2021 END IF;
2022 END IF;
2023
2024 l_count := p_line_rec.top_model_line_id.COUNT;
2025 IF p_line_rec.top_model_line_id.COUNT <> x_table_count THEN
2026 IF p_line_rec.top_model_line_id.COUNT = 0 THEN
2027 p_line_rec.top_model_line_id.EXTEND(x_table_count);
2028 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2029 p_line_rec.top_model_line_id.EXTEND;
2030 ELSIF l_count < x_table_count THEN
2031 l_field_name := 'top_model_line_id';
2032 RAISE e_extend_error;
2033 END IF;
2034 END IF;
2035
2036 l_count := p_line_rec.unit_list_price.COUNT;
2037 IF p_line_rec.unit_list_price.COUNT <> x_table_count THEN
2038 IF p_line_rec.unit_list_price.COUNT = 0 THEN
2039 p_line_rec.unit_list_price.EXTEND(x_table_count);
2040 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2041 p_line_rec.unit_list_price.EXTEND;
2042 ELSIF l_count < x_table_count THEN
2043 l_field_name := 'unit_list_price';
2044 RAISE e_extend_error;
2045 END IF;
2046 END IF;
2047
2048 l_count := p_line_rec.ordered_item_id.COUNT;
2049 IF p_line_rec.ordered_item_id.COUNT <> x_table_count THEN
2050 IF p_line_rec.ordered_item_id.COUNT = 0 THEN
2051 p_line_rec.ordered_item_id.EXTEND(x_table_count);
2052 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2053 p_line_rec.ordered_item_id.EXTEND;
2054 ELSIF l_count < x_table_count THEN
2055 l_field_name := 'ordered_item_id';
2056 RAISE e_extend_error;
2057 END IF;
2058 END IF;
2059
2060 l_count := p_line_rec.item_identifier_type.COUNT;
2061 IF p_line_rec.item_identifier_type.COUNT <> x_table_count THEN
2062 IF p_line_rec.item_identifier_type.COUNT = 0 THEN
2063 p_line_rec.item_identifier_type.EXTEND(x_table_count);
2064 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2065 p_line_rec.item_identifier_type.EXTEND;
2066 ELSIF l_count < x_table_count THEN
2067 l_field_name := 'item_identifier_type';
2068 RAISE e_extend_error;
2069 END IF;
2070 END IF;
2071
2072 l_count := p_line_rec.shipping_instructions.COUNT;
2073 IF p_line_rec.shipping_instructions.COUNT <> x_table_count THEN
2074 IF p_line_rec.shipping_instructions.COUNT = 0 THEN
2075 p_line_rec.shipping_instructions.EXTEND(x_table_count);
2076 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2077 p_line_rec.shipping_instructions.EXTEND;
2078 ELSIF l_count < x_table_count THEN
2079 l_field_name := 'shipping_instructions';
2080 RAISE e_extend_error;
2081 END IF;
2082 END IF;
2083
2084 l_count := p_line_rec.packing_instructions.COUNT;
2085 IF p_line_rec.packing_instructions.COUNT <> x_table_count THEN
2086 IF p_line_rec.packing_instructions.COUNT = 0 THEN
2087 p_line_rec.packing_instructions.EXTEND(x_table_count);
2088 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2089 p_line_rec.packing_instructions.EXTEND;
2090 ELSIF l_count < x_table_count THEN
2091 l_field_name := 'packing_instructions';
2092 RAISE e_extend_error;
2093 END IF;
2094 END IF;
2095
2096 l_count := p_line_rec.Line_set_id.COUNT;
2097 IF p_line_rec.Line_set_id.COUNT <> x_table_count THEN
2098 IF p_line_rec.Line_set_id.COUNT = 0 THEN
2099 p_line_rec.Line_set_id.EXTEND(x_table_count);
2100 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2101 p_line_rec.Line_set_id.EXTEND;
2102 ELSIF l_count < x_table_count THEN
2103 p_line_rec.Line_set_id.EXTEND(x_table_count - l_count);
2104 END IF;
2105 END IF;
2106
2107 l_count := p_line_rec.ORIGINAL_subinventory.COUNT;
2108 IF p_line_rec.ORIGINAL_subinventory.COUNT <> x_table_count THEN
2109 IF p_line_rec.ORIGINAL_subinventory.COUNT = 0 THEN
2110 p_line_rec.ORIGINAL_subinventory.EXTEND(x_table_count);
2111 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2112 p_line_rec.ORIGINAL_subinventory.EXTEND;
2113 ELSIF l_count < x_table_count THEN
2114 p_line_rec.ORIGINAL_subinventory.EXTEND(x_table_count - l_count);
2115 END IF;
2116 END IF;
2117
2118 l_count := p_line_rec.subinventory.COUNT;
2119 IF p_line_rec.subinventory.COUNT <> x_table_count THEN
2120 IF p_line_rec.subinventory.COUNT = 0 THEN
2121 p_line_rec.subinventory.EXTEND(x_table_count);
2122 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2123 p_line_rec.subinventory.EXTEND;
2124 ELSIF l_count < x_table_count THEN
2125 l_field_name := 'subinventory';
2126 RAISE e_extend_error;
2127 END IF;
2128 END IF;
2129
2130 l_count := p_line_rec.shipping_eligible_flag.COUNT;
2131 IF p_line_rec.shipping_eligible_flag.COUNT <> x_table_count THEN
2132 IF p_line_rec.shipping_eligible_flag.COUNT = 0 THEN --{
2133
2134 IF p_action_prms.caller = 'OM' THEN
2135 IF l_debug_on THEN
2136 WSH_DEBUG_SV.log(l_module_name,'x_table_count ',x_table_count);
2137 END IF;
2138 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2139 END IF;
2140
2141 p_line_rec.shipping_eligible_flag.EXTEND;
2142 p_line_rec.shipping_eligible_flag(p_line_rec.shipping_eligible_flag.FIRST) := 'Y';
2143 IF x_table_count > 1 THEN
2144 p_line_rec.shipping_eligible_flag.EXTEND(x_table_count-1,1);
2145 END IF;
2146 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2147 p_line_rec.shipping_eligible_flag.EXTEND;
2148 p_line_rec.shipping_eligible_flag(p_line_rec.shipping_eligible_flag.COUNT) := 'Y';
2149 ELSIF l_count < x_table_count THEN --}{
2150 l_field_name := 'shipping_eligible_flag';
2151 RAISE e_extend_error;
2152 END IF; --}
2153 END IF;
2154
2155 l_count := p_line_rec.error_message_count.COUNT;
2156 IF p_line_rec.error_message_count.COUNT <> x_table_count THEN
2157 IF p_line_rec.error_message_count.COUNT = 0 THEN
2158 p_line_rec.error_message_count.EXTEND(x_table_count);
2159 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2160 p_line_rec.error_message_count.EXTEND;
2161 ELSIF l_count < x_table_count THEN
2162 p_line_rec.error_message_count.EXTEND(x_table_count - l_count);
2163 END IF;
2164 END IF;
2165
2166 l_count := p_line_rec.sold_to_contact_id.COUNT;
2167 IF p_line_rec.sold_to_contact_id.COUNT <> x_table_count THEN
2168 IF p_line_rec.sold_to_contact_id.COUNT = 0 THEN
2169 p_line_rec.sold_to_contact_id.EXTEND(x_table_count);
2170 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2171 p_line_rec.sold_to_contact_id.EXTEND;
2172 ELSIF l_count < x_table_count THEN
2173 l_field_name := 'sold_to_contact_id';
2174 RAISE e_extend_error;
2175 END IF;
2176 END IF;
2177
2178 l_count := p_line_rec.item_description.COUNT;
2179 IF p_line_rec.item_description.COUNT <> x_table_count THEN
2180 IF p_line_rec.item_description.COUNT = 0 THEN
2181 p_line_rec.item_description.EXTEND(x_table_count);
2182 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2183 p_line_rec.item_description.EXTEND;
2184 ELSIF l_count < x_table_count THEN
2185 l_field_name := 'item_description';
2186 RAISE e_extend_error;
2187 END IF;
2188 END IF;
2189
2190 l_count := p_line_rec.hazard_class_id.COUNT;
2191 IF p_line_rec.hazard_class_id.COUNT <> x_table_count THEN
2192 IF p_line_rec.hazard_class_id.COUNT = 0 THEN
2193 p_line_rec.hazard_class_id.EXTEND(x_table_count);
2194 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2195 p_line_rec.hazard_class_id.EXTEND;
2196 ELSIF l_count < x_table_count THEN
2197 l_field_name := 'hazard_class_id';
2198 RAISE e_extend_error;
2199 END IF;
2200 END IF;
2201
2202 l_count := p_line_rec.weight_uom_code.COUNT;
2203 IF p_line_rec.weight_uom_code.COUNT <> x_table_count THEN
2204 IF p_line_rec.weight_uom_code.COUNT = 0 THEN
2205 p_line_rec.weight_uom_code.EXTEND(x_table_count);
2206 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2207 p_line_rec.weight_uom_code.EXTEND;
2208 ELSIF l_count < x_table_count THEN
2209 l_field_name := 'weight_uom_code';
2210 RAISE e_extend_error;
2211 END IF;
2212 END IF;
2213
2214 l_count := p_line_rec.Volume.COUNT;
2215 IF p_line_rec.Volume.COUNT <> x_table_count THEN
2216 IF p_line_rec.Volume.COUNT = 0 THEN
2217 p_line_rec.Volume.EXTEND(x_table_count);
2218 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2219 p_line_rec.Volume.EXTEND;
2220 ELSIF l_count < x_table_count THEN
2221 p_line_rec.Volume.EXTEND(x_table_count - l_count);
2222 END IF;
2223 END IF;
2224
2225 l_count := p_line_rec.volume_uom_code.COUNT;
2226 IF p_line_rec.volume_uom_code.COUNT <> x_table_count THEN
2227 IF p_line_rec.volume_uom_code.COUNT = 0 THEN
2228 p_line_rec.volume_uom_code.EXTEND(x_table_count);
2229 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2230 p_line_rec.volume_uom_code.EXTEND;
2231 ELSIF l_count < x_table_count THEN
2232 l_field_name :='volume_uom_code';
2233 RAISE e_extend_error;
2234 END IF;
2235 END IF;
2236
2237 l_count := p_line_rec.source_header_number.COUNT;
2238 IF p_line_rec.source_header_number.COUNT <> x_table_count THEN
2239 IF p_line_rec.source_header_number.COUNT = 0 THEN
2240 p_line_rec.source_header_number.EXTEND(x_table_count);
2241 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2242 p_line_rec.source_header_number.EXTEND;
2243 ELSIF l_count < x_table_count THEN
2244 l_field_name :='source_header_number';
2245 RAISE e_extend_error;
2246 END IF;
2247 END IF;
2248
2249 l_count := p_line_rec.source_header_type_id.COUNT;
2250 IF p_line_rec.source_header_type_id.COUNT <> x_table_count THEN
2251 IF p_line_rec.source_header_type_id.COUNT = 0 THEN
2252 p_line_rec.source_header_type_id.EXTEND(x_table_count);
2253 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2254 p_line_rec.source_header_type_id.EXTEND;
2255 ELSIF l_count < x_table_count THEN
2256 l_field_name :='source_header_type_id';
2257 RAISE e_extend_error;
2258 END IF;
2259 END IF;
2260
2261 l_count := p_line_rec.source_header_type_name.COUNT;
2262 IF p_line_rec.source_header_type_name.COUNT <> x_table_count THEN
2263 IF p_line_rec.source_header_type_name.COUNT = 0 THEN
2264 p_line_rec.source_header_type_name.EXTEND(x_table_count);
2265 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2266 p_line_rec.source_header_type_name.EXTEND;
2267 ELSIF l_count < x_table_count THEN
2268 l_field_name :='source_header_type_name';
2269 RAISE e_extend_error;
2270 END IF;
2271 END IF;
2272
2273 l_count := p_line_rec.mtl_unit_weight.COUNT;
2274 IF p_line_rec.mtl_unit_weight.COUNT <> x_table_count THEN
2275 IF p_line_rec.mtl_unit_weight.COUNT = 0 THEN
2276 p_line_rec.mtl_unit_weight.EXTEND(x_table_count);
2277 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2278 p_line_rec.mtl_unit_weight.EXTEND;
2279 ELSIF l_count < x_table_count THEN
2280 l_field_name :='mtl_unit_weight';
2281 RAISE e_extend_error;
2282 END IF;
2283 END IF;
2284
2285 l_count := p_line_rec.mtl_unit_volume.COUNT;
2286 IF p_line_rec.mtl_unit_volume.COUNT <> x_table_count THEN
2287 IF p_line_rec.mtl_unit_volume.COUNT = 0 THEN
2288 p_line_rec.mtl_unit_volume.EXTEND(x_table_count);
2289 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2290 p_line_rec.mtl_unit_volume.EXTEND;
2291 ELSIF l_count < x_table_count THEN
2292 l_field_name :='mtl_unit_volume';
2293 RAISE e_extend_error;
2294 END IF;
2295 END IF;
2296
2297 l_count := p_line_rec.currency_code.COUNT;
2298 IF p_line_rec.currency_code.COUNT <> x_table_count THEN
2299 IF p_line_rec.currency_code.COUNT = 0 THEN
2300 p_line_rec.currency_code.EXTEND(x_table_count);
2301 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2302 p_line_rec.currency_code.EXTEND;
2303 ELSIF l_count < x_table_count THEN
2304 l_field_name := 'currency_code';
2305 RAISE e_extend_error;
2306 END IF;
2307 END IF;
2308
2309 l_count := p_line_rec.country_of_origin.COUNT;
2310 IF p_line_rec.country_of_origin.COUNT <> x_table_count THEN
2311 IF p_line_rec.country_of_origin.COUNT = 0 THEN
2312 p_line_rec.country_of_origin.EXTEND(x_table_count);
2313 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2314 p_line_rec.country_of_origin.EXTEND;
2315 ELSIF l_count < x_table_count THEN
2316 p_line_rec.country_of_origin.EXTEND(x_table_count - l_count);
2317 END IF;
2318 END IF;
2319
2320 l_count := p_line_rec.ship_from_location_id.COUNT;
2321 IF p_line_rec.ship_from_location_id.COUNT <> x_table_count THEN
2322 IF p_line_rec.ship_from_location_id.COUNT = 0 THEN
2323 p_line_rec.ship_from_location_id.EXTEND(x_table_count);
2324 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2325 p_line_rec.ship_from_location_id.EXTEND;
2326 ELSIF l_count < x_table_count THEN
2327 p_line_rec.ship_from_location_id.EXTEND(x_table_count - l_count);
2328 END IF;
2329 END IF;
2330
2331 l_count := p_line_rec.ship_to_location_id.COUNT;
2332 IF p_line_rec.ship_to_location_id.COUNT <> x_table_count THEN
2333 IF p_line_rec.ship_to_location_id.COUNT = 0 THEN
2334 p_line_rec.ship_to_location_id.EXTEND(x_table_count);
2335 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2336 p_line_rec.ship_to_location_id.EXTEND;
2337 ELSIF l_count < x_table_count THEN
2338 p_line_rec.ship_to_location_id.EXTEND(x_table_count - l_count);
2339 END IF;
2340 END IF;
2341
2342 l_count := p_line_rec.deliver_to_location_id.COUNT;
2343 IF p_line_rec.deliver_to_location_id.COUNT <> x_table_count THEN
2344 IF p_line_rec.deliver_to_location_id.COUNT = 0 THEN
2345 p_line_rec.deliver_to_location_id.EXTEND(x_table_count);
2346 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2347 p_line_rec.deliver_to_location_id.EXTEND;
2348 ELSIF l_count < x_table_count THEN
2349 p_line_rec.deliver_to_location_id.EXTEND(x_table_count - l_count);
2350 END IF;
2351 END IF;
2352
2353 l_count := p_line_rec.intmed_ship_to_location_id.COUNT;
2354 IF p_line_rec.intmed_ship_to_location_id.COUNT <> x_table_count THEN
2355 IF p_line_rec.intmed_ship_to_location_id.COUNT = 0 THEN
2356 p_line_rec.intmed_ship_to_location_id.EXTEND(x_table_count);
2357 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2358 p_line_rec.intmed_ship_to_location_id.EXTEND;
2359 ELSIF l_count < x_table_count THEN
2360 p_line_rec.intmed_ship_to_location_id.EXTEND(x_table_count - l_count);
2361 END IF;
2362 END IF;
2363
2364 l_count := p_line_rec.master_container_item_id.COUNT;
2365 IF p_line_rec.master_container_item_id.COUNT <> x_table_count THEN
2366 IF p_line_rec.master_container_item_id.COUNT = 0 THEN
2367 p_line_rec.master_container_item_id.EXTEND(x_table_count);
2368 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2369 p_line_rec.master_container_item_id.EXTEND;
2370 ELSIF l_count < x_table_count THEN
2371 p_line_rec.master_container_item_id.EXTEND(x_table_count - l_count);
2372 END IF;
2373 END IF;
2374
2375 l_count := p_line_rec.detail_container_item_id.COUNT;
2376 IF p_line_rec.detail_container_item_id.COUNT <> x_table_count THEN
2377 IF p_line_rec.detail_container_item_id.COUNT = 0 THEN
2378 p_line_rec.detail_container_item_id.EXTEND(x_table_count);
2379 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2380 p_line_rec.detail_container_item_id.EXTEND;
2381 ELSIF l_count < x_table_count THEN
2382 p_line_rec.detail_container_item_id.EXTEND(x_table_count - l_count);
2383 END IF;
2384 END IF;
2385
2386 l_count := p_line_rec.customer_item_id.COUNT;
2387 IF p_line_rec.customer_item_id.COUNT <> x_table_count THEN
2388 IF p_line_rec.customer_item_id.COUNT = 0 THEN
2389 p_line_rec.customer_item_id.EXTEND(x_table_count);
2390 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2391 p_line_rec.customer_item_id.EXTEND;
2392 ELSIF l_count < x_table_count THEN
2393 p_line_rec.customer_item_id.EXTEND(x_table_count - l_count);
2394 END IF;
2395 END IF;
2396
2397 l_count := p_line_rec.net_weight.COUNT;
2398 IF p_line_rec.net_weight.COUNT <> x_table_count THEN
2399 IF p_line_rec.net_weight.COUNT = 0 THEN
2400 p_line_rec.net_weight.EXTEND(x_table_count);
2401 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2402 p_line_rec.net_weight.EXTEND;
2403 ELSIF l_count < x_table_count THEN
2404 p_line_rec.net_weight.EXTEND(x_table_count - l_count);
2405 END IF;
2406 END IF;
2407
2408 l_count := p_line_rec.mvt_stat_status.COUNT;
2409 IF p_line_rec.mvt_stat_status.COUNT <> x_table_count THEN
2410 IF p_line_rec.mvt_stat_status.COUNT = 0 THEN
2411 p_line_rec.mvt_stat_status.EXTEND(x_table_count);
2412 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2413 p_line_rec.mvt_stat_status.EXTEND;
2414 ELSIF l_count < x_table_count THEN
2415 p_line_rec.mvt_stat_status.EXTEND(x_table_count - l_count);
2416 END IF;
2417 END IF;
2418 IF l_debug_on THEN
2419 WSH_DEBUG_SV.log(l_module_name,'count of p_line_recs p_del det id before extending it', p_line_rec.delivery_detail_id.count);
2420 END IF;
2421
2422 l_count := p_line_rec.delivery_detail_id.COUNT;
2423 IF p_line_rec.delivery_detail_id.COUNT <> x_table_count THEN
2424 IF p_line_rec.delivery_detail_id.COUNT = 0 THEN
2425 p_line_rec.delivery_detail_id.EXTEND(x_table_count);
2426 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2427 p_line_rec.delivery_detail_id.EXTEND;
2428 ELSIF l_count < x_table_count THEN
2429 p_line_rec.delivery_detail_id.EXTEND(x_table_count - l_count);
2430 END IF;
2431 END IF;
2432 IF l_debug_on THEN
2433 WSH_DEBUG_SV.log(l_module_name,'count of p_line_recs p_del det id after extending it', p_line_rec.delivery_detail_id.count);
2434 END IF;
2435
2436 l_count := p_line_rec.inspection_flag.COUNT;
2437 IF p_line_rec.inspection_flag.COUNT <> x_table_count THEN
2438 IF p_line_rec.inspection_flag.COUNT = 0 THEN
2439 p_line_rec.inspection_flag.EXTEND(x_table_count);
2440 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2441 p_line_rec.inspection_flag.EXTEND;
2442 ELSIF l_count < x_table_count THEN
2443 p_line_rec.inspection_flag.EXTEND(x_table_count - l_count);
2444 END IF;
2445 END IF;
2446
2447 l_count := p_line_rec.container_name.COUNT;
2448 IF p_line_rec.container_name.COUNT <> x_table_count THEN
2449 IF p_line_rec.container_name.COUNT = 0 THEN
2450 p_line_rec.container_name.EXTEND(x_table_count);
2451 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2452 p_line_rec.container_name.EXTEND;
2453 ELSIF l_count < x_table_count THEN
2454 p_line_rec.container_name.EXTEND(x_table_count - l_count);
2455 END IF;
2456 END IF;
2457
2458 l_count := p_line_rec.gross_weight.COUNT;
2459 IF p_line_rec.gross_weight.COUNT <> x_table_count THEN
2460 IF p_line_rec.gross_weight.COUNT = 0 THEN
2461 p_line_rec.gross_weight.EXTEND(x_table_count);
2462 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2463 p_line_rec.gross_weight.EXTEND;
2464 ELSIF l_count < x_table_count THEN
2465 p_line_rec.gross_weight.EXTEND(x_table_count - l_count);
2466 END IF;
2467 END IF;
2468 l_count := p_line_rec.seal_code.COUNT;
2469 IF p_line_rec.seal_code.COUNT <> x_table_count THEN
2470 IF p_line_rec.seal_code.COUNT = 0 THEN
2471 p_line_rec.seal_code.EXTEND(x_table_count);
2472 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2473 p_line_rec.seal_code.EXTEND;
2474 ELSIF l_count < x_table_count THEN
2475 p_line_rec.seal_code.EXTEND(x_table_count - l_count);
2476 END IF;
2477 END IF;
2478 l_count := p_line_rec.pickable_flag.COUNT;
2479 IF p_line_rec.pickable_flag.COUNT <> x_table_count THEN
2480 IF p_line_rec.pickable_flag.COUNT = 0 THEN
2481 p_line_rec.pickable_flag.EXTEND(x_table_count);
2482 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2483 p_line_rec.pickable_flag.EXTEND;
2484 ELSIF l_count < x_table_count THEN
2485 l_field_name := 'pickable_flag';
2486 RAISE e_extend_error;
2487 END IF;
2488 END IF;
2489 l_count := p_line_rec.source_line_set_id.COUNT;
2490 IF p_line_rec.source_line_set_id.COUNT <> x_table_count THEN
2491 IF p_line_rec.source_line_set_id.COUNT = 0 THEN
2492 p_line_rec.source_line_set_id.EXTEND(x_table_count);
2493 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2494 p_line_rec.source_line_set_id.EXTEND;
2495 ELSIF l_count < x_table_count THEN
2496 p_line_rec.source_line_set_id.EXTEND(x_table_count - l_count);
2497 END IF;
2498 END IF;
2499 l_count := p_line_rec.requested_quantity.COUNT;
2500 IF p_line_rec.requested_quantity.COUNT <> x_table_count THEN
2501 IF p_line_rec.requested_quantity.COUNT = 0 THEN
2502 p_line_rec.requested_quantity.EXTEND(x_table_count);
2503 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2504 p_line_rec.requested_quantity.EXTEND;
2505 ELSIF l_count < x_table_count THEN
2506 p_line_rec.requested_quantity.EXTEND(x_table_count - l_count);
2507 END IF;
2508 END IF;
2509 l_count := p_line_rec.requested_quantity2.COUNT;
2510 IF p_line_rec.requested_quantity2.COUNT <> x_table_count THEN
2511 IF p_line_rec.requested_quantity2.COUNT = 0 THEN
2512 p_line_rec.requested_quantity2.EXTEND(x_table_count);
2513 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2514 p_line_rec.requested_quantity2.EXTEND;
2515 ELSIF l_count < x_table_count THEN
2516 p_line_rec.requested_quantity2.EXTEND(x_table_count - l_count);
2517 END IF;
2518 END IF;
2519 l_count := p_line_rec.requested_quantity_uom2.COUNT;
2520 IF p_line_rec.requested_quantity_uom2.COUNT <> x_table_count THEN
2521 IF p_line_rec.requested_quantity_uom2.COUNT = 0 THEN
2522 p_line_rec.requested_quantity_uom2.EXTEND(x_table_count);
2523 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2524 p_line_rec.requested_quantity_uom2.EXTEND;
2525 ELSIF l_count < x_table_count THEN
2526 p_line_rec.requested_quantity_uom2.EXTEND(x_table_count - l_count);
2527 END IF;
2528 END IF;
2529 l_count := p_line_rec.cancelled_quantity.COUNT;
2530 IF p_line_rec.cancelled_quantity.COUNT <> x_table_count THEN
2531 IF p_line_rec.cancelled_quantity.COUNT = 0 THEN
2532 p_line_rec.cancelled_quantity.EXTEND(x_table_count);
2533 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2534 p_line_rec.cancelled_quantity.EXTEND;
2535 ELSIF l_count < x_table_count THEN
2536 l_field_name := 'cancelled_quantity';
2537 RAISE e_extend_error;
2538 END IF;
2539 END IF;
2540 l_count := p_line_rec.cancelled_quantity2.COUNT;
2541 IF p_line_rec.cancelled_quantity2.COUNT <> x_table_count THEN
2542 IF p_line_rec.cancelled_quantity2.COUNT = 0 THEN
2543 p_line_rec.cancelled_quantity2.EXTEND(x_table_count);
2544 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2545 p_line_rec.cancelled_quantity2.EXTEND;
2546 ELSIF l_count < x_table_count THEN
2547 p_line_rec.cancelled_quantity2.EXTEND(x_table_count - l_count);
2548 END IF;
2549 END IF;
2550 l_count := p_line_rec.source_line_number.COUNT;
2551 IF p_line_rec.source_line_number.COUNT <> x_table_count THEN
2552 IF p_line_rec.source_line_number.COUNT = 0 THEN
2553 p_line_rec.source_line_number.EXTEND(x_table_count);
2554 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2555 p_line_rec.source_line_number.EXTEND;
2556 ELSIF l_count < x_table_count THEN
2557 p_line_rec.source_line_number.EXTEND(x_table_count - l_count);
2558 END IF;
2559 END IF;
2560 l_count := p_line_rec.requested_quantity_uom.COUNT;
2561 IF p_line_rec.requested_quantity_uom.COUNT <> x_table_count THEN
2562 IF p_line_rec.requested_quantity_uom.COUNT = 0 THEN
2563 p_line_rec.requested_quantity_uom.EXTEND(x_table_count);
2564 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2565 p_line_rec.requested_quantity_uom.EXTEND;
2566 ELSIF l_count < x_table_count THEN
2567 l_field_name := 'requested_quantity_uom';
2568 RAISE e_extend_error;
2569 END IF;
2570 END IF;
2571 l_count := p_line_rec.revision.COUNT;
2572 IF p_line_rec.revision.COUNT <> x_table_count THEN
2573 IF p_line_rec.revision.COUNT = 0 THEN
2574 p_line_rec.revision.EXTEND(x_table_count);
2575 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2576 p_line_rec.revision.EXTEND;
2577 ELSIF l_count < x_table_count THEN
2578 p_line_rec.revision.EXTEND(x_table_count - l_count);
2579 END IF;
2580 END IF;
2581 l_count := p_line_rec.carrier_id.COUNT;
2582 IF p_line_rec.carrier_id.COUNT <> x_table_count THEN
2583 IF p_line_rec.carrier_id.COUNT = 0 THEN
2584 p_line_rec.carrier_id.EXTEND(x_table_count);
2585 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2586 p_line_rec.carrier_id.EXTEND;
2587 ELSIF l_count < x_table_count THEN
2588 p_line_rec.carrier_id.EXTEND(x_table_count - l_count);
2589 END IF;
2590 END IF;
2591 l_count := p_line_rec.tracking_number.COUNT;
2592 IF p_line_rec.tracking_number.COUNT <> x_table_count THEN
2593 IF p_line_rec.tracking_number.COUNT = 0 THEN
2594 p_line_rec.tracking_number.EXTEND(x_table_count);
2595 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2596 p_line_rec.tracking_number.EXTEND;
2597 ELSIF l_count < x_table_count THEN
2598 p_line_rec.tracking_number.EXTEND(x_table_count - l_count);
2599 END IF;
2600 END IF;
2601 l_count := p_line_rec.received_quantity.COUNT;
2602 IF p_line_rec.received_quantity.COUNT <> x_table_count THEN
2603 IF p_line_rec.received_quantity.COUNT = 0 THEN
2604 p_line_rec.received_quantity.EXTEND(x_table_count);
2605 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2606 p_line_rec.received_quantity.EXTEND;
2607 ELSIF l_count < x_table_count THEN
2608 p_line_rec.received_quantity.EXTEND(x_table_count - l_count);
2609 END IF;
2610 END IF;
2611 l_count := p_line_rec.received_quantity2.COUNT;
2612 IF p_line_rec.received_quantity2.COUNT <> x_table_count THEN
2613 IF p_line_rec.received_quantity2.COUNT = 0 THEN
2614 p_line_rec.received_quantity2.EXTEND(x_table_count);
2615 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2616 p_line_rec.received_quantity2.EXTEND;
2617 ELSIF l_count < x_table_count THEN
2618 p_line_rec.received_quantity2.EXTEND(x_table_count - l_count);
2619 END IF;
2620 END IF;
2621 l_count := p_line_rec.source_document_type_id.COUNT;
2622 IF p_line_rec.source_document_type_id.COUNT <> x_table_count THEN
2623 IF p_line_rec.source_document_type_id.COUNT = 0 THEN
2624 p_line_rec.source_document_type_id.EXTEND(x_table_count);
2625 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2626 p_line_rec.source_document_type_id.EXTEND;
2627 ELSIF l_count < x_table_count THEN
2628 p_line_rec.source_document_type_id.EXTEND(x_table_count - l_count);
2629 END IF;
2630 END IF;
2631 l_count := p_line_rec.latest_acceptable_date.COUNT;
2632 IF p_line_rec.latest_acceptable_date.COUNT <> x_table_count THEN
2633 IF p_line_rec.latest_acceptable_date.COUNT = 0 THEN
2634 p_line_rec.latest_acceptable_date.EXTEND(x_table_count);
2635 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2636 p_line_rec.latest_acceptable_date.EXTEND;
2637 ELSIF l_count < x_table_count THEN
2638 l_field_name := 'latest_acceptable_date';
2639 RAISE e_extend_error;
2640 END IF;
2641 END IF;
2642 l_count := p_line_rec.promise_date.COUNT;
2643 IF p_line_rec.promise_date.COUNT <> x_table_count THEN
2644 IF p_line_rec.promise_date.COUNT = 0 THEN
2645 p_line_rec.promise_date.EXTEND(x_table_count);
2646 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2647 p_line_rec.promise_date.EXTEND;
2648 ELSIF l_count < x_table_count THEN
2649 l_field_name := 'promise_date';
2650 RAISE e_extend_error;
2651 END IF;
2652 END IF;
2653 l_count := p_line_rec.schedule_arrival_date.COUNT;
2654 IF p_line_rec.schedule_arrival_date.COUNT <> x_table_count THEN
2655 IF p_line_rec.schedule_arrival_date.COUNT = 0 THEN
2656 p_line_rec.schedule_arrival_date.EXTEND(x_table_count);
2657 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2658 p_line_rec.schedule_arrival_date.EXTEND;
2659 ELSIF l_count < x_table_count THEN
2660 l_field_name := 'schedule_arrival_date';
2661 RAISE e_extend_error;
2662 END IF;
2663 END IF;
2664 l_count := p_line_rec.earliest_acceptable_date.COUNT;
2665 IF p_line_rec.earliest_acceptable_date.COUNT <> x_table_count THEN
2666 IF p_line_rec.earliest_acceptable_date.COUNT = 0 THEN
2667 p_line_rec.earliest_acceptable_date.EXTEND(x_table_count);
2668 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2669 p_line_rec.earliest_acceptable_date.EXTEND;
2670 ELSIF l_count < x_table_count THEN
2671 l_field_name := 'earliest_acceptable_date';
2672 RAISE e_extend_error;
2673 END IF;
2674 END IF;
2675 -- Added for Inbound Logistics
2676 l_count := p_line_rec.source_blanket_reference_id.COUNT;
2677 IF p_line_rec.source_blanket_reference_id.COUNT <> x_table_count THEN
2678 IF p_line_rec.source_blanket_reference_id.COUNT = 0 THEN
2679 p_line_rec.source_blanket_reference_id.EXTEND(x_table_count);
2680 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2681 p_line_rec.source_blanket_reference_id.EXTEND;
2682 ELSIF l_count < x_table_count THEN
2683 p_line_rec.source_blanket_reference_id.EXTEND(x_table_count - l_count);
2684 END IF;
2685 END IF;
2686 l_count := p_line_rec.source_blanket_reference_num.COUNT;
2687 IF p_line_rec.source_blanket_reference_num.COUNT <> x_table_count THEN
2688 IF p_line_rec.source_blanket_reference_num.COUNT = 0 THEN
2689 p_line_rec.source_blanket_reference_num.EXTEND(x_table_count);
2690 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2691 p_line_rec.source_blanket_reference_num.EXTEND;
2692 ELSIF l_count < x_table_count THEN
2693 p_line_rec.source_blanket_reference_num.EXTEND(x_table_count - l_count);
2694 END IF;
2695 END IF;
2696 l_count := p_line_rec.vendor_id.COUNT;
2697 IF p_line_rec.vendor_id.COUNT <> x_table_count THEN
2698 IF p_line_rec.vendor_id.COUNT = 0 THEN
2699 p_line_rec.vendor_id.EXTEND(x_table_count);
2700 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2701 p_line_rec.vendor_id.EXTEND;
2702 ELSIF l_count < x_table_count THEN
2703 p_line_rec.vendor_id.EXTEND(x_table_count - l_count);
2704 END IF;
2705 END IF;
2706 l_count := p_line_rec.ship_from_site_id.COUNT;
2707 IF p_line_rec.ship_from_site_id.COUNT <> x_table_count THEN
2708 IF p_line_rec.ship_from_site_id.COUNT = 0 THEN
2709 p_line_rec.ship_from_site_id.EXTEND(x_table_count);
2710 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2711 p_line_rec.ship_from_site_id.EXTEND;
2712 ELSIF l_count < x_table_count THEN
2713 p_line_rec.ship_from_site_id.EXTEND(x_table_count - l_count);
2714 END IF;
2715 END IF;
2716 l_count := p_line_rec.hold_code.COUNT;
2717 IF p_line_rec.hold_code.COUNT <> x_table_count THEN
2718 IF p_line_rec.hold_code.COUNT = 0 THEN
2719 p_line_rec.hold_code.EXTEND(x_table_count);
2720 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2721 p_line_rec.hold_code.EXTEND;
2722 ELSIF l_count < x_table_count THEN
2723 p_line_rec.hold_code.EXTEND(x_table_count - l_count);
2724 END IF;
2725 END IF;
2726 l_count := p_line_rec.supplier_item_num.COUNT;
2727 IF p_line_rec.supplier_item_num.COUNT <> x_table_count THEN
2728 IF p_line_rec.supplier_item_num.COUNT = 0 THEN
2729 p_line_rec.supplier_item_num.EXTEND(x_table_count);
2730 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2731 p_line_rec.supplier_item_num.EXTEND;
2732 ELSIF l_count < x_table_count THEN
2733 p_line_rec.supplier_item_num.EXTEND(x_table_count - l_count);
2734 END IF;
2735 END IF;
2736 l_count := p_line_rec.po_shipment_line_id.COUNT;
2737 IF p_line_rec.po_shipment_line_id.COUNT <> x_table_count THEN
2738 IF p_line_rec.po_shipment_line_id.COUNT = 0 THEN
2739 p_line_rec.po_shipment_line_id.EXTEND(x_table_count);
2740 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2741 p_line_rec.po_shipment_line_id.EXTEND;
2742 ELSIF l_count < x_table_count THEN
2743 p_line_rec.po_shipment_line_id.EXTEND(x_table_count - l_count);
2744 END IF;
2745 END IF;
2746 l_count := p_line_rec.po_shipment_line_number.COUNT;
2747 IF p_line_rec.po_shipment_line_number.COUNT <> x_table_count THEN
2748 IF p_line_rec.po_shipment_line_number.COUNT = 0 THEN
2749 p_line_rec.po_shipment_line_number.EXTEND(x_table_count);
2750 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2751 p_line_rec.po_shipment_line_number.EXTEND;
2752 ELSIF l_count < x_table_count THEN
2753 p_line_rec.po_shipment_line_number.EXTEND(x_table_count - l_count);
2754 END IF;
2755 END IF;
2756 l_count := p_line_rec.shipping_control.COUNT;
2757 IF p_line_rec.shipping_control.COUNT <> x_table_count THEN
2758 IF p_line_rec.shipping_control.COUNT = 0 THEN
2759 p_line_rec.shipping_control.EXTEND(x_table_count);
2760 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2761 p_line_rec.shipping_control.EXTEND;
2762 ELSIF l_count < x_table_count THEN
2763 p_line_rec.shipping_control.EXTEND(x_table_count - l_count);
2764 END IF;
2765 END IF;
2766 l_count := p_line_rec.source_line_type_code.COUNT;
2767 IF p_line_rec.source_line_type_code.COUNT <> x_table_count THEN
2768 IF p_line_rec.source_line_type_code.COUNT = 0 THEN
2769 p_line_rec.source_line_type_code.EXTEND(x_table_count);
2770 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2771 p_line_rec.source_line_type_code.EXTEND;
2772 ELSIF l_count < x_table_count THEN
2773 p_line_rec.source_line_type_code.EXTEND(x_table_count - l_count);
2774 END IF;
2775 END IF;
2776 l_count := p_line_rec.shipped_quantity.COUNT;
2777 IF p_line_rec.shipped_quantity.COUNT <> x_table_count THEN
2778 IF p_line_rec.shipped_quantity.COUNT = 0 THEN
2779 p_line_rec.shipped_quantity.EXTEND(x_table_count);
2780 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2781 p_line_rec.shipped_quantity.EXTEND;
2782 ELSIF l_count < x_table_count THEN
2783 l_field_name := 'shipped_quantity';
2784 RAISE e_extend_error;
2785 END IF;
2786 END IF;
2787 l_count := p_line_rec.shipped_quantity2.COUNT;
2788 IF p_line_rec.shipped_quantity2.COUNT <> x_table_count THEN
2789 IF p_line_rec.shipped_quantity2.COUNT = 0 THEN
2790 p_line_rec.shipped_quantity2.EXTEND(x_table_count);
2791 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2792 p_line_rec.shipped_quantity2.EXTEND;
2793 ELSIF l_count < x_table_count THEN
2794 l_field_name := 'shipped_quantity2';
2795 RAISE e_extend_error;
2796 END IF;
2797 END IF;
2798 l_count := p_line_rec.consolidate_quantity.COUNT;
2799 IF p_line_rec.consolidate_quantity.COUNT <> x_table_count THEN
2800 IF p_line_rec.consolidate_quantity.COUNT = 0 THEN
2801 p_line_rec.consolidate_quantity.EXTEND(x_table_count);
2802 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2803 p_line_rec.consolidate_quantity.EXTEND;
2804 ELSIF l_count < x_table_count THEN
2805 p_line_rec.consolidate_quantity.EXTEND(x_table_count - l_count);
2806 END IF;
2807 END IF;
2808
2809 IF l_debug_on THEN
2810 WSH_DEBUG_SV.log(l_module_name,'count of p_line_recs vendor_party_id before extending it', p_line_rec.vendor_party_id.COUNT);
2811 WSH_DEBUG_SV.log(l_module_name,'x_table_count', x_table_count);
2812 END IF;
2813
2814 l_count := p_line_rec.vendor_party_id.COUNT;
2815 IF p_line_rec.vendor_party_id.COUNT <> x_table_count THEN
2816 IF p_line_rec.vendor_party_id.COUNT = 0 THEN
2817 p_line_rec.vendor_party_id.EXTEND(x_table_count);
2818 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2819 p_line_rec.vendor_party_id.EXTEND;
2820 ELSIF l_count < x_table_count THEN
2821 p_line_rec.vendor_party_id.EXTEND(x_table_count - l_count);
2822 END IF;
2823 END IF;
2824 IF l_debug_on THEN
2825 WSH_DEBUG_SV.log(l_module_name,'count of p_line_recs vendor_party_id after extending it', p_line_rec.vendor_party_id.COUNT);
2826 END IF;
2827
2828 l_count := p_line_rec.Days_early_receipt_allowed.COUNT;
2829 IF p_line_rec.Days_early_receipt_allowed.COUNT <> x_table_count THEN
2830 IF p_line_rec.Days_early_receipt_allowed.COUNT = 0 THEN
2831 p_line_rec.Days_early_receipt_allowed.EXTEND(x_table_count);
2832 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2833 p_line_rec.Days_early_receipt_allowed.EXTEND;
2834 ELSIF l_count < x_table_count THEN
2835 p_line_rec.Days_early_receipt_allowed.EXTEND(x_table_count - l_count);
2836 END IF;
2837 END IF;
2838 l_count := p_line_rec.Days_late_receipt_allowed.COUNT;
2839 IF p_line_rec.Days_late_receipt_allowed.COUNT <> x_table_count THEN
2840 IF p_line_rec.Days_late_receipt_allowed.COUNT = 0 THEN
2841 p_line_rec.Days_late_receipt_allowed.EXTEND(x_table_count);
2842 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2843 p_line_rec.Days_late_receipt_allowed.EXTEND;
2844 ELSIF l_count < x_table_count THEN
2845 p_line_rec.Days_late_receipt_allowed.EXTEND(x_table_count - l_count);
2846 END IF;
2847 END IF;
2848 l_count := p_line_rec.drop_ship_flag.COUNT;
2849 IF p_line_rec.drop_ship_flag.COUNT <> x_table_count THEN
2850 IF p_line_rec.drop_ship_flag.COUNT = 0 THEN
2851 p_line_rec.drop_ship_flag.EXTEND(x_table_count);
2852 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2853 p_line_rec.drop_ship_flag.EXTEND;
2854 ELSIF l_count < x_table_count THEN
2855 p_line_rec.drop_ship_flag.EXTEND(x_table_count - l_count);
2856 END IF;
2857 END IF;
2858 l_count := p_line_rec.intermed_ship_to_org_id.COUNT;
2859 IF p_line_rec.intermed_ship_to_org_id.COUNT <> x_table_count THEN
2860 IF p_line_rec.intermed_ship_to_org_id.COUNT = 0 THEN
2861 p_line_rec.intermed_ship_to_org_id.EXTEND(x_table_count);
2862 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2863 p_line_rec.intermed_ship_to_org_id.EXTEND;
2864 ELSIF l_count < x_table_count THEN
2865 p_line_rec.intermed_ship_to_org_id.EXTEND(x_table_count - l_count);
2866 END IF;
2867 END IF;
2868
2869 l_count := p_line_rec.po_revision.COUNT;
2870 IF p_line_rec.po_revision.COUNT <> x_table_count THEN
2871 IF p_line_rec.po_revision.COUNT = 0 THEN
2872 p_line_rec.po_revision.EXTEND(x_table_count);
2873 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2874 p_line_rec.po_revision.EXTEND;
2875 ELSIF l_count < x_table_count THEN
2876 p_line_rec.po_revision.EXTEND(x_table_count - l_count);
2877 END IF;
2878 END IF;
2879 l_count := p_line_rec.release_revision.COUNT;
2880 IF p_line_rec.release_revision.COUNT <> x_table_count THEN
2881 IF p_line_rec.release_revision.COUNT = 0 THEN
2882 p_line_rec.release_revision.EXTEND(x_table_count);
2883 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2884 p_line_rec.release_revision.EXTEND;
2885 ELSIF l_count < x_table_count THEN
2886 p_line_rec.release_revision.EXTEND(x_table_count - l_count);
2887 END IF;
2888 END IF;
2889
2890 l_count := p_line_rec.ORDER_DATE_TYPE_CODE.COUNT;
2891 IF p_line_rec.ORDER_DATE_TYPE_CODE.COUNT <> x_table_count THEN
2892 IF p_line_rec.ORDER_DATE_TYPE_CODE.COUNT = 0 THEN
2893 p_line_rec.ORDER_DATE_TYPE_CODE.EXTEND(x_table_count);
2894 ELSIF nvl(p_action_prms.caller,'@@@') = 'WSH_IB_UTIL' THEN
2895 p_line_rec.ORDER_DATE_TYPE_CODE.EXTEND;
2896 ELSIF l_count < x_table_count THEN
2897 p_line_rec.ORDER_DATE_TYPE_CODE.EXTEND(x_table_count - l_count);
2898 END IF;
2899 END IF;
2900
2901
2902
2903 IF nvl(p_action_prms.caller,'@@@') <> 'WSH_IB_UTIL' THEN
2904 --{
2905 x_additional_line_info_rec.RELEASED_STATUS.EXTEND(x_table_count) ;
2906 x_additional_line_info_rec.inv_interfaced_flag.EXTEND(x_table_count);
2907 x_additional_line_info_rec.attribute1.EXTEND(x_table_count);
2908 x_additional_line_info_rec.attribute2.EXTEND(x_table_count);
2909 x_additional_line_info_rec.attribute3.EXTEND(x_table_count);
2910 x_additional_line_info_rec.attribute4.EXTEND(x_table_count);
2911 x_additional_line_info_rec.attribute5.EXTEND(x_table_count);
2912 x_additional_line_info_rec.attribute6.EXTEND(x_table_count);
2913 x_additional_line_info_rec.attribute7.EXTEND(x_table_count);
2914 x_additional_line_info_rec.attribute8.EXTEND(x_table_count);
2915 x_additional_line_info_rec.attribute9.EXTEND(x_table_count);
2916 x_additional_line_info_rec.attribute10.EXTEND(x_table_count);
2917 x_additional_line_info_rec.attribute11.EXTEND(x_table_count);
2918 x_additional_line_info_rec.attribute12.EXTEND(x_table_count);
2919 x_additional_line_info_rec.attribute13.EXTEND(x_table_count);
2920 x_additional_line_info_rec.attribute14.EXTEND(x_table_count);
2921 x_additional_line_info_rec.attribute15.EXTEND(x_table_count);
2922 x_additional_line_info_rec.attribute_category.EXTEND(x_table_count);
2923 x_additional_line_info_rec.ignore_for_planning.EXTEND(x_table_count);
2924 x_additional_line_info_rec.earliest_pickup_date.EXTEND(x_table_count);
2925 x_additional_line_info_rec.latest_pickup_date.EXTEND(x_table_count);
2926 x_additional_line_info_rec.earliest_dropoff_date.EXTEND(x_table_count);
2927 x_additional_line_info_rec.latest_dropoff_date.EXTEND(x_table_count);
2928 x_additional_line_info_rec.service_level.EXTEND(x_table_count);
2929 x_additional_line_info_rec.mode_of_transport.EXTEND(x_table_count);
2930 x_additional_line_info_rec.cancelled_quantity2.EXTEND(x_table_count);
2931 x_additional_line_info_rec.cancelled_quantity.EXTEND(x_table_count);
2932 x_additional_line_info_rec.master_container_item_id.EXTEND(x_table_count);
2933 x_additional_line_info_rec.detail_container_item_id.EXTEND(x_table_count);
2934 --}
2935 END IF;
2936 IF l_debug_on THEN
2937 WSH_DEBUG_SV.pop(l_module_name);
2938 END IF;
2939
2940 EXCEPTION
2941 WHEN FND_API.G_EXC_ERROR THEN
2942 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2943 --
2944 IF l_debug_on THEN
2945 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_ERROR exception has '
2946 || 'occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
2947 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_ERROR');
2948 END IF;
2949 --
2950 WHEN e_extend_error THEN
2951 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
2952 FND_MESSAGE.SET_NAME('WSH','WSH_TBL_EXTEND_ERR');
2953 FND_MESSAGE.SET_TOKEN('TBL_NAME',l_field_name);
2954 wsh_util_core.add_message(x_return_status, l_module_name);
2955 --
2956 IF l_debug_on THEN
2957 WSH_DEBUG_SV.log(l_module_name,'l_field_name ',l_field_name);
2958 WSH_DEBUG_SV.log(l_module_name,'l_count ',l_count);
2959 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:e_extend_error');
2960 END IF;
2961 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2962 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
2963 --
2964 IF l_debug_on THEN
2965 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. ' ||
2966 'Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
2967 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
2968 END IF;
2969
2970 WHEN WSH_UTIL_CORE.G_EXC_WARNING THEN
2971 x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
2972 --
2973 IF l_debug_on THEN
2974 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_UTIL_CORE.G_EXC_WARNING '||
2975 'exception has occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
2976 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_UTIL_CORE.G_EXC_WARNING');
2977 END IF;
2978 --
2979
2980 WHEN OTHERS THEN
2981 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
2982 wsh_util_core.default_handler('WSH_BULK_PROCESS_PVT.Extend_tables');
2983 --
2984 IF l_debug_on THEN
2985 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. '||
2986 'Oracle error message is '||
2987 SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
2988 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
2989 END IF;
2990
2991
2992 END Extend_tables;
2993
2994
2995
2996 --========================================================================
2997 -- PROCEDURE : Validate_lines
2998 --
2999 -- PARAMETERS: p_line_rec Line record
3000 -- p_action_prms Additional attributes needed
3001 -- x_table_count Size of each table
3002 -- x_additional_line_info_rec Local record that is extended
3003 -- and ready to use to store additional
3004 -- information for line record.
3005 -- x_valid_rec_exist set to 1, if any record was validated
3006 -- successfully
3007 -- x_eligible_rec_exist set to 1, if any eligible record exists.
3008 -- x_return_status return status
3009 -- COMMENT : This procedure goes through the tables in p_line_rec and
3010 -- validates them. If the validation is successful, a 'Y' will
3011 -- be set in the table p_line_rec.shipping_interfaced_flag
3012 --========================================================================
3013
3014
3015 PROCEDURE Validate_lines(
3016 p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.line_rec_type,
3017 P_action_prms IN OUT NOCOPY
3018 WSH_BULK_TYPES_GRP.action_parameters_rectype,
3019 p_additional_line_info_rec IN OUT NOCOPY
3020 additional_line_info_rec_type ,
3021 x_valid_rec_exist OUT NOCOPY NUMBER ,
3022 x_eligible_rec_exist OUT NOCOPY NUMBER ,
3023 X_return_status OUT NOCOPY VARCHAR2
3024 )
3025 IS
3026 l_debug_on BOOLEAN;
3027 --
3028
3029 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME ||
3030 '.' || 'VALIDATE_LINES';
3031 l_return_status VARCHAR2(1);
3032 l_num_warnings NUMBER := 0;
3033 l_num_errors NUMBER := 0;
3034 l_dff_attribute WSH_FLEXFIELD_UTILS.FlexfieldAttributeTabType ;
3035 l_dff_context VARCHAR2(150);
3036 l_dff_update_flag VARCHAR2(1);
3037 l_rec_count NUMBER;
3038 l_stack_size_start NUMBER;
3039 l_first NUMBER;
3040 l_tp_is_installed VARCHAR2(10);
3041 l_otm_is_installed VARCHAR2(10);
3042 l_cache_tbl wsh_util_core.char500_tab_type;
3043 l_cache_ext_tbl wsh_util_core.char500_tab_type;
3044 l_index NUMBER;
3045 l_caller varchar2(2000);
3046 --OTM R12 Org-Specific
3047 l_gc3_is_installed VARCHAR2(1);
3048
3049 e_next_line EXCEPTION;
3050 BEGIN
3051
3052 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
3053 IF l_debug_on IS NULL
3054 THEN
3055 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
3056 END IF;
3057 --
3058
3059 IF l_debug_on THEN
3060 wsh_debug_sv.push (l_module_name);
3061 WSH_DEBUG_SV.log(l_module_name,'caller ',p_action_prms.caller);
3062 WSH_DEBUG_SV.log(l_module_name,'p_action_prms.org_id',
3063 p_action_prms.org_id);
3064 WSH_DEBUG_SV.log(l_module_name,'line_rec org_id ',p_line_rec.org_id(p_line_rec.org_id.FIRST));
3065 WSH_DEBUG_SV.log(l_module_name,'l_gc3_is_installed ',l_gc3_is_installed); --OTM R12 Org-Specific.
3066 END IF;
3067
3068 --OTM R12 Org-Specific start.
3069 l_gc3_is_installed := WSH_UTIL_CORE.G_GC3_IS_INSTALLED;
3070 IF l_gc3_is_installed IS NULL THEN
3071 l_gc3_is_installed := WSH_UTIL_CORE.GC3_IS_INSTALLED;
3072 END IF;
3073 IF l_debug_on THEN
3074 WSH_DEBUG_SV.log(l_module_name,'l_gc3_is_installed ',l_gc3_is_installed);
3075 END IF;
3076 --OTM R12 End
3077
3078 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
3079 x_valid_rec_exist := 0;
3080 x_eligible_rec_exist := 0;
3081
3082 WSH_ACTIONS_LEVELS.set_validation_level (
3083 p_entity => 'DLVB',
3084 p_caller => p_action_prms.caller,
3085 p_phase => nvl(p_action_prms.phase,1),
3086 p_action => p_action_prms.action_code,
3087 x_return_status => l_return_status);
3088 --
3089 wsh_util_core.api_post_call(
3090 p_return_status => l_return_status,
3091 x_num_warnings => l_num_warnings,
3092 x_num_errors => l_num_errors);
3093
3094
3095 IF p_action_prms.caller = 'OM' THEN
3096 p_additional_line_info_rec.source_code := 'OE';
3097 ELSIF p_action_prms.caller = 'PO' THEN
3098 p_additional_line_info_rec.source_code := 'PO';
3099 p_action_prms.org_id := p_line_rec.org_id(p_line_rec.org_id.FIRST);
3100 ELSIF p_action_prms.caller = 'OKE' THEN
3101 p_additional_line_info_rec.source_code := 'OKE';
3102 p_action_prms.org_id := p_line_rec.org_id(p_line_rec.org_id.FIRST);
3103 ELSE
3104 IF l_debug_on THEN
3105 WSH_DEBUG_SV.log(l_module_name,'bad caller ',p_action_prms.caller);
3106 END IF;
3107 RAISE FND_API.G_EXC_ERROR;
3108 END IF;
3109
3110 IF p_action_prms.org_id IS NULL THEN
3111 IF l_debug_on THEN
3112 WSH_DEBUG_SV.logmsg(l_module_name,'org_id is not passed ',
3113 WSH_DEBUG_SV.C_EXCEP_LEVEL);
3114 END IF;
3115 FND_MESSAGE.SET_NAME('WSH','WSH_REQUIRED_FIELD_NULL');
3116 FND_MESSAGE.SET_TOKEN('FIELD_NAME','ORG_ID');
3117 wsh_util_core.add_message(WSH_UTIL_CORE.G_RET_STS_ERROR,
3118 l_module_name);
3119 RAISE FND_API.G_EXC_ERROR;
3120 END IF;
3121
3122
3123 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_POPULATE_ORGANIZATION_ID) = 1
3124 THEN
3125 l_index := p_line_rec.ship_from_org_id.FIRST;
3126 WHILE l_index IS NOT NULL LOOP
3127 p_line_rec.organization_id(l_index) :=
3128 p_line_rec.ship_from_org_id(l_index);
3129 l_index := p_line_rec.ship_from_org_id.NEXT(l_index);
3130 END LOOP;
3131 --bms what to do for inbound
3132 END IF;
3133
3134 l_tp_is_installed := wsh_util_core.tp_is_installed ;
3135 l_otm_is_installed := wsh_util_core.gc3_is_installed ;
3136 IF l_tp_is_installed = 'Y' OR l_otm_is_installed = 'Y' THEN
3137 IF l_debug_on THEN
3138 WSH_DEBUG_SV.log(l_module_name,'l_tp_is_installed',l_tp_is_installed);
3139 END IF;
3140 ELSE
3141 l_tp_is_installed := 'N';
3142 END IF;
3143
3144 WSH_FLEXFIELD_UTILS.Get_DFF_Defaults
3145 (p_flexfield_name => 'WSH_DELIVERY_DETAILS',
3146 p_default_values => l_dff_attribute,
3147 p_default_context => l_dff_context,
3148 p_update_flag => l_dff_update_flag,
3149 x_return_status => l_return_status);
3150
3151 wsh_util_core.api_post_call(
3152 p_return_status => l_return_status,
3153 x_num_warnings => l_num_warnings,
3154 x_num_errors => l_num_errors);
3155
3156 l_rec_count := p_line_rec.line_id.COUNT;
3157 l_first := p_line_rec.line_id.FIRST;
3158
3159 FOR i in l_first..l_rec_count LOOP --{
3160 BEGIN --{
3161
3162 IF NVL(p_line_rec.shipping_eligible_flag(i), 'N') <> 'Y' THEN
3163 IF l_debug_on THEN
3164 WSH_DEBUG_SV.log(l_module_name,'Not processing line ',
3165 p_line_rec.line_id(i));
3166 END IF;
3167 RAISE e_next_line;
3168 END IF;
3169 x_eligible_rec_exist := x_eligible_rec_exist + 1;
3170
3171 Set_message(
3172 p_line_rec =>p_line_rec,
3173 p_index =>i,
3174 p_caller =>p_action_prms.caller,
3175 p_first_call => 'T',
3176 x_stack_size_start => l_stack_size_start,
3177 x_return_status => l_return_status
3178 );
3179
3180 IF p_line_rec.source_document_type_id(i) = 10 THEN
3181 p_line_rec.shipping_interfaced_flag(i) := 'N';
3182 IF l_debug_on THEN
3183 WSH_DEBUG_SV.log(l_module_name,'Internal orders are not supported'
3184 ,p_line_rec.source_document_type_id(i));
3185 END IF;
3186 END IF;
3187
3188 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_VALIDATE_OKE_NULL_FIELDS_LVL) = 1
3189 THEN
3190 check_null_fields(p_line_rec => p_line_rec,
3191 p_index => i,
3192 x_return_status => l_return_status);
3193
3194 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3195 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3196 THEN
3197 p_line_rec.shipping_interfaced_flag(i) := 'N';
3198 END IF;
3199 END IF;
3200
3201 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_GET_SHIP_FROM_LOC_LVL) = 1
3202 THEN
3203 WSH_UTIL_CORE.GET_LOCATION_ID('ORG',
3204 p_line_rec.organization_id(i),
3205 p_line_rec.ship_from_location_id(i),
3206 l_return_status);
3207 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3208 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3209 THEN
3210 p_line_rec.shipping_interfaced_flag(i) := 'N';
3211 END IF;
3212 END IF;
3213
3214
3215 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_GET_SHIPTO_LOC_LVL) = 1
3216 THEN
3217 WSH_UTIL_CORE.GET_LOCATION_ID('CUSTOMER SITE',
3218 p_line_rec.ship_to_org_id(i),
3219 p_line_rec.ship_to_location_id(i),
3220 l_return_status);
3221 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3222 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3223 THEN
3224 p_line_rec.shipping_interfaced_flag(i) := 'N';
3225 END IF;
3226 END IF;
3227
3228 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_GET_DELIVER_TO_LOC_LVL) = 1
3229 THEN
3230 IF p_line_rec.deliver_to_org_id(i) IS NOT NULL THEN
3231 WSH_UTIL_CORE.GET_LOCATION_ID('CUSTOMER SITE',
3232 p_line_rec.deliver_to_org_id(i),
3233 p_line_rec.deliver_to_location_id(i),
3234 l_return_status);
3235 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3236 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3237 THEN
3238 p_line_rec.shipping_interfaced_flag(i) := 'N';
3239 END IF;
3240
3241 ELSE
3242 p_line_rec.deliver_to_location_id(i) :=
3243 p_line_rec.ship_to_location_id(i);
3244 END IF;
3245 END IF;
3246
3247
3248 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_GET_INTMED_SHIPTO_LOC_LVL) = 1
3249 THEN
3250 IF p_line_rec.intermed_ship_to_org_id(i) IS NOT NULL THEN
3251 WSH_UTIL_CORE.GET_LOCATION_ID('CUSTOMER SITE',
3252 p_line_rec.intermed_ship_to_org_id(i),
3253 p_line_rec.intmed_ship_to_location_id(i),
3254 l_return_status);
3255 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3256 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3257 THEN
3258 p_line_rec.shipping_interfaced_flag(i) := 'N';
3259 END IF;
3260 END IF;
3261 END IF;
3262
3263
3264 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_VALIDATE_SHIP_FROM_LOC_LVL) = 1
3265 THEN
3266 l_caller := null;
3267 IF (p_action_prms.caller = 'PO') THEN
3268 l_caller:='PO';
3269 END IF;
3270
3271 wsh_util_validate.validate_location(
3272 p_location_id => p_line_rec.ship_from_location_id(i),
3273 p_caller => l_caller,
3274 x_return_status => l_return_status,
3275 p_isWshLocation => FALSE);
3276
3277 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3278 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3279 THEN
3280 p_line_rec.shipping_interfaced_flag(i) := 'N';
3281 END IF;
3282 END IF;
3283
3284
3285
3286 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_VALIDATE_SHIPTO_LOC_LVL) = 1
3287 THEN
3288 l_caller := null;
3289 IF (p_action_prms.caller = 'PO') THEN
3290 l_caller:='PO';
3291 END IF;
3292
3293 wsh_util_validate.validate_location(
3294 p_location_id => p_line_rec.ship_to_location_id(i),
3295 p_caller => l_caller,
3296 x_return_status => l_return_status,
3297 p_isWshLocation => FALSE);
3298
3299 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3300 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3301 THEN
3302 p_line_rec.shipping_interfaced_flag(i) := 'N';
3303 END IF;
3304 END IF;
3305
3306 IF p_action_prms.caller <> 'PO' THEN
3307
3308 Calc_wt_vol_qty(p_line_rec => p_line_rec,
3309 p_additional_line_info_rec => p_additional_line_info_rec,
3310 p_index => i,
3311 p_action_prms => p_action_prms,
3312 x_return_status => l_return_status);
3313
3314
3315 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3316 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3317 THEN
3318 p_line_rec.shipping_interfaced_flag(i) := 'N';
3319 END IF;
3320 END IF;
3321
3322
3323
3324 wsh_util_validate.Calc_ignore_for_planning(
3325 p_organization_id => p_line_rec.organization_id(i),
3326 p_carrier_id => p_line_rec.carrier_id(i),
3327 p_ship_method_code=>
3328 p_line_rec.shipping_method_code(i),
3329 p_tp_installed => l_tp_is_installed,
3330 p_caller => p_action_prms.caller,
3331 x_ignore_for_planning =>
3332 p_additional_line_info_rec.ignore_for_planning(i),
3333 x_return_status => l_return_status,
3334 p_otm_installed => l_gc3_is_installed); --OTM R12 Org-Specific.
3335 --OTM R12 Org-Specific start.
3336 IF (l_debug_on) THEN
3337 wsh_debug_sv.log(l_module_name,'ignore_for_planning(i) ',
3338 p_additional_line_info_rec.ignore_for_planning(i));
3339 wsh_debug_sv.log(l_module_name,'l_return_status ',l_return_status);
3340 END IF;
3341 --OTM R12 End.
3342 --added for Inbound Logistics
3343 --{
3344 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_PO_DERIVE_DROPSHIP_LVL) = 1
3345 AND p_line_rec.drop_ship_flag(i) = 'Y' THEN
3346 WSH_INBOUND_UTIL_PKG.get_drop_ship_info(
3347 p_line_rec => p_line_rec,
3348 p_index =>i,
3349 x_return_status => l_return_status
3350 );
3351 wsh_util_core.api_post_call(
3352 p_return_status => l_return_status,
3353 x_num_warnings => l_num_warnings,
3354 x_num_errors => l_num_errors);
3355
3356 END IF;
3357
3358
3359 IF p_action_prms.caller <> 'PO' OR
3360 (p_action_prms.caller = 'PO' and p_line_rec.drop_ship_flag(i) = 'Y' ) THEN
3361 --{
3362 IF p_line_rec.shipping_method_code(i) IS NOT NULL THEN --{
3363
3364 --Call to API calc_service_mode. This call is made because PO does not capture
3365 --ship method code, but OM passes ship method code. This API takes care of decomposing
3366 --the ship method code to get the carrier, service level and ship method code.
3367 calc_service_mode(
3368 p_line_rec => p_line_rec,
3369 --p_ship_method_code => p_line_rec.shipping_method_code(i),
3370 p_cache_tbl => l_cache_tbl,
3371 p_cache_ext_tbl => l_cache_ext_tbl,
3372 p_index => i,
3373 p_additional_line_info_rec =>
3374 p_additional_line_info_rec,
3375 x_return_status => l_return_status);
3376
3377 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3378 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3379 THEN
3380 p_line_rec.shipping_interfaced_flag(i) := 'N';
3381 END IF;
3382 END IF; --}
3383 --}
3384 END IF;
3385 --
3386 --}
3387
3388 IF p_action_prms.caller <> 'PO' THEN --{
3389 wsh_tp_release.calculate_tp_dates(
3390
3391 p_request_date_type =>
3392 p_line_rec.ORDER_DATE_TYPE_CODE(i),
3393 p_latest_acceptable_date =>
3394 p_line_rec.latest_acceptable_date(i),
3395 p_promise_date =>
3396 p_line_rec.promise_date(i),
3397 p_schedule_arrival_date =>
3398 p_line_rec.schedule_arrival_date(i),
3399 p_schedule_ship_date =>
3400 p_line_rec.schedule_ship_date(i),
3401 p_earliest_acceptable_date =>
3402 p_line_rec.earliest_acceptable_date(i),
3403 p_demand_satisfaction_date =>
3404 NULL,
3405 p_source_line_id =>
3406 p_line_rec.line_id(i),
3407 p_source_code =>
3408 p_additional_line_info_rec.source_code,
3409 p_organization_id =>
3410 p_line_rec.organization_id(i),
3411 p_inventory_item_id =>
3412 p_line_rec.inventory_item_id(i),
3413 x_return_status =>
3414 l_return_status,
3415 x_earliest_pickup_date =>
3416 p_additional_line_info_rec.earliest_pickup_date(i),
3417 x_latest_pickup_date =>
3418 p_additional_line_info_rec.latest_pickup_date(i),
3419 x_earliest_dropoff_date =>
3420 p_additional_line_info_rec.earliest_dropoff_date(i),
3421 x_latest_dropoff_date =>
3422 p_additional_line_info_rec.latest_dropoff_date(i));
3423
3424 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3425 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3426 THEN
3427 IF l_debug_on THEN
3428 WSH_DEBUG_SV.logmsg(l_module_name,
3429 'Error in calculating TP dates');
3430 END IF;
3431 p_line_rec.shipping_interfaced_flag(i) := 'N';
3432 FND_MESSAGE.SET_NAME('WSH','WSH_CALC_TP_DATES');
3433 WSH_UTIL_CORE.Add_Message(l_return_status,l_module_name);
3434 END IF;
3435 --skattama
3436 IF (p_additional_line_info_rec.earliest_pickup_date(i) > p_additional_line_info_rec.latest_pickup_date(i)) THEN
3437 p_additional_line_info_rec.latest_pickup_tpdate_excep(i) := p_additional_line_info_rec.latest_pickup_date(i);
3438 p_additional_line_info_rec.latest_pickup_date(i) := p_additional_line_info_rec.earliest_pickup_date(i);
3439 END IF;
3440
3441 IF (p_additional_line_info_rec.earliest_dropoff_date(i) > p_additional_line_info_rec.latest_dropoff_date(i)) THEN
3442 p_additional_line_info_rec.latest_dropoff_tpdate_excep(i) := p_additional_line_info_rec.latest_dropoff_date(i);
3443 p_additional_line_info_rec.latest_dropoff_date(i) := p_additional_line_info_rec.earliest_dropoff_date(i);
3444 END IF;
3445 --skattama
3446 END IF ; --}
3447
3448 -- Added for Inbound Logistics
3449 --{
3450
3451
3452 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_PO_CHECK_ORGID_LVL) = 1
3453 THEN
3454
3455 IF p_line_rec.org_id(i) <> p_line_rec.org_id(p_line_rec.org_id.FIRST) then
3456 FND_MESSAGE.SET_NAME('WSH','WSH_ORG_ID_INVALID');
3457 WSH_UTIL_CORE.Add_Message(WSH_UTIL_CORE.G_RET_STS_ERROR);
3458 RAISE FND_API.G_EXC_ERROR;
3459 END IF;
3460 END IF;
3461
3462 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_PO_DEFAULT_SHIPFROM_LVL)=1
3463 THEN
3464 p_line_rec.ship_from_location_id(i) := -1;
3465 p_line_rec.vendor_party_id(i) := l_vendor_party_id;
3466 END IF;
3467
3468 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_PO_VALIDATE_MAN_FIELDS_LVL) = 1
3469 THEN
3470 validate_mandatory_info(
3471 p_line_rec => p_line_rec ,
3472 p_index =>i,
3473 x_return_status => l_return_status
3474 );
3475
3476 wsh_util_core.api_post_call(
3477 p_return_status => l_return_status,
3478 x_num_warnings => l_num_warnings,
3479 x_num_errors => l_num_errors);
3480 END IF;
3481 /* Moved the call to dervie drop ship info before calling calc_service_mode.
3482 p_line_rec.shipping_method_code is populated only ion get_drop_ship_info API.
3483 */
3484
3485 /* IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_PO_DERIVE_DROPSHIP_LVL) = 1
3486 AND p_line_rec.drop_ship_flag(p_line_rec.drop_ship_flag.FIRST) = 'Y' THEN
3487 WSH_INBOUND_UTIL_PKG.get_drop_ship_info(
3488 p_line_rec => p_line_rec,
3489 p_index =>i,
3490 x_return_status => l_return_status
3491 );
3492 wsh_util_core.api_post_call(
3493 p_return_status => l_return_status,
3494 x_num_warnings => l_num_warnings,
3495 x_num_errors => l_num_errors);
3496
3497 END IF;
3498 */
3499 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_PO_VALIDATE_SHPTO_LOC_LVL) = 1
3500 THEN
3501 l_caller := null;
3502 IF (p_action_prms.caller = 'PO') THEN
3503 l_caller:='PO';
3504 END IF;
3505
3506 wsh_util_validate.validate_location(
3507 p_location_id => p_line_rec.ship_to_location_id(i),
3508 p_caller => l_caller,
3509 x_return_status => l_return_status,
3510 p_isWshLocation => FALSE);
3511
3512 wsh_util_core.api_post_call(
3513 p_return_status => l_return_status,
3514 x_num_warnings => l_num_warnings,
3515 x_num_errors => l_num_errors);
3516
3517 END IF;
3518
3519 IF ( WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_PO_VALIDATE_FOB_LVL)= 1 )
3520 AND ( p_line_rec.fob_point_code(i) IS NOT NULL ) --condition added for bugfix 3679513
3521 THEN
3522 WSH_UTIL_VALIDATE.validate_fob(
3523 p_fob => p_line_rec.fob_point_code(i),
3524 x_return_status => l_return_status);
3525
3526 wsh_util_core.api_post_call(
3527 p_return_status => l_return_status,
3528 x_num_warnings => l_num_warnings,
3529 x_num_errors => l_num_errors);
3530 END IF;
3531
3532 IF (WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_PO_VALIDATE_FR_TERMS_LVL) = 1)
3533 AND (p_line_rec.freight_terms_code(i) IS NOT NULL) --condition added for bugfix 3679513
3534 THEN
3535 WSH_UTIL_VALIDATE.validate_freight_terms(
3536 p_freight_terms_code => p_line_rec.freight_terms_code(i),
3537 x_return_status => l_return_status);
3538
3539 wsh_util_core.api_post_call(
3540 p_return_status => l_return_status,
3541 x_num_warnings => l_num_warnings,
3542 x_num_errors => l_num_errors);
3543
3544 END IF;
3545
3546 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_PO_CALC_WT_VOL_LVL) = 1 THEN
3547 --{
3548 IF p_line_rec.inventory_item_id(i) IS NOT NULL THEN
3549 --{
3550 Calc_wt_vol_qty(p_line_rec => p_line_rec,
3551 p_additional_line_info_rec => p_additional_line_info_rec,
3552 p_index => i,
3553 p_action_prms => p_action_prms,
3554 x_return_status => l_return_status);
3555
3556 wsh_util_core.api_post_call(
3557 p_return_status => l_return_status,
3558 x_num_warnings => l_num_warnings,
3559 x_num_errors => l_num_errors);
3560 ELSIF (p_line_rec.inventory_item_id(i) is NULL) THEN
3561 IF (p_line_rec.requested_quantity(i) is null ) THEN
3562 p_line_rec.requested_quantity_uom(i) :=
3563 p_line_rec.order_quantity_uom(i);
3564 p_line_rec.requested_quantity(i) :=
3565 p_line_rec.ordered_quantity(i);
3566 p_additional_line_info_rec.inv_interfaced_flag(i) := 'X';
3567 END IF;
3568 --}
3569 END IF;
3570 --}
3571 END IF;
3572 --}
3573 -- HW 3064890 Added AND condition
3574 -- The calc_wt_vol_qty has been modified for OPM.So the following call is not
3575 -- needed.
3576
3577 -- HW OPMCONV - Removed call to get_opm_quantity. This call
3578 -- was commented earlier. So, it's a clean up
3579
3580 IF p_action_prms.caller = 'OM' THEN --{
3581
3582 IF p_line_rec.item_identifier_type(i) = 'CUST' THEN
3583 P_line_rec.customer_item_id(i) := p_line_rec.ordered_item_id(i);
3584 END IF;
3585
3586 IF p_line_rec.pickable_flag(i) = 'Y' THEN
3587 p_additional_line_info_rec.RELEASED_STATUS(i) := 'R';
3588 ELSE
3589 p_additional_line_info_rec.RELEASED_STATUS(i) := 'X';
3590 END IF;
3591
3592 P_line_rec.mvt_stat_status(i) := 'NEW';
3593 P_line_rec.original_subinventory(i) := p_line_rec.subinventory(i);
3594 p_additional_line_info_rec.cancelled_quantity2(i) := NULL;
3595 p_additional_line_info_rec.cancelled_quantity(i) := NULL;
3596
3597 ELSE --}{
3598 p_additional_line_info_rec.RELEASED_STATUS(i) := 'X';
3599 IF p_line_rec.request_date(i) IS NULL THEN
3600 P_line_rec.request_date(i) := p_line_rec.schedule_ship_date(i);
3601 END IF;
3602 p_additional_line_info_rec.earliest_dropoff_date(i):=
3603 (NVL(p_line_rec.schedule_ship_date(i),p_line_rec.request_date(i)) -
3604 NVL(p_line_rec.Days_early_receipt_allowed(i),0));
3605
3606 p_additional_line_info_rec.latest_dropoff_date(i) :=
3607 (NVL(p_line_rec.schedule_ship_date(i),p_line_rec.request_date(i)) +
3608 NVL(p_line_rec.Days_late_receipt_allowed(i),0));
3609 END IF; --}
3610
3611 IF (l_dff_update_flag = 'Y') AND ( WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_DEFAULT_FLEX_LVL) = 1)
3612 THEN --{
3613 IF p_action_prms.caller = 'OM' THEN --{
3614 p_additional_line_info_rec.attribute_category(i) := l_dff_context ;
3615 p_additional_line_info_rec.attribute1(i) :=l_dff_attribute(1);
3616 p_additional_line_info_rec.attribute2(i) :=l_dff_attribute(2);
3617 p_additional_line_info_rec.attribute3(i) :=l_dff_attribute(3);
3618 p_additional_line_info_rec.attribute4(i) :=l_dff_attribute(4);
3619 p_additional_line_info_rec.attribute5(i) :=l_dff_attribute(5);
3620 p_additional_line_info_rec.attribute6(i) :=l_dff_attribute(6);
3621 p_additional_line_info_rec.attribute7(i) :=l_dff_attribute(7);
3622 p_additional_line_info_rec.attribute8(i) :=l_dff_attribute(8);
3623 p_additional_line_info_rec.attribute9(i) :=l_dff_attribute(9);
3624 p_additional_line_info_rec.attribute10(i) :=l_dff_attribute(10);
3625 p_additional_line_info_rec.attribute11(i) := l_dff_attribute(11);
3626 p_additional_line_info_rec.attribute12(i) :=l_dff_attribute( 12);
3627 p_additional_line_info_rec.attribute13(i) :=l_dff_attribute(13);
3628 p_additional_line_info_rec.attribute14(i) :=l_dff_attribute(14);
3629 p_additional_line_info_rec.attribute15(i) :=l_dff_attribute(15);
3630
3631 ELSE --}{
3632 p_additional_line_info_rec.attribute_category(i) :=
3633 nvl(p_line_rec.context(i),l_dff_context ) ;
3634 p_additional_line_info_rec.attribute1(i) :=
3635 nvl(p_line_rec.attribute1(i),l_dff_attribute(1));
3636 p_additional_line_info_rec.attribute2(i) :=
3637 nvl(p_line_rec.attribute2(i),l_dff_attribute(2) );
3638 p_additional_line_info_rec.attribute3(i) :=
3639 nvl(p_line_rec.attribute3(i), l_dff_attribute( 3) );
3640 p_additional_line_info_rec.attribute4(i) :=
3641 nvl(p_line_rec.attribute4(i), l_dff_attribute( 4) );
3642 p_additional_line_info_rec.attribute5(i) :=
3643 nvl(p_line_rec.attribute5(i), l_dff_attribute( 5) );
3644 p_additional_line_info_rec.attribute6(i) :=
3645 nvl(p_line_rec.attribute6(i), l_dff_attribute( 6) );
3646 p_additional_line_info_rec.attribute7(i) :=
3647 nvl(p_line_rec.attribute7(i), l_dff_attribute( 7) );
3648 p_additional_line_info_rec.attribute8(i) :=
3649 nvl(p_line_rec.attribute8(i), l_dff_attribute( 8) );
3650 p_additional_line_info_rec.attribute9(i) :=
3651 nvl(p_line_rec.attribute9(i), l_dff_attribute( 9) );
3652 p_additional_line_info_rec.attribute10(i) :=
3653 nvl(p_line_rec.attribute10(i), l_dff_attribute( 10));
3654 p_additional_line_info_rec.attribute11(i) :=
3655 nvl(p_line_rec.attribute11(i), l_dff_attribute( 11));
3656 p_additional_line_info_rec.attribute12(i) :=
3657 nvl(p_line_rec.attribute12(i), l_dff_attribute( 12));
3658 p_additional_line_info_rec.attribute13(i) :=
3659 nvl(p_line_rec.attribute13(i), l_dff_attribute( 13));
3660 p_additional_line_info_rec.attribute14(i) :=
3661 nvl(p_line_rec.attribute14(i), l_dff_attribute( 14));
3662 p_additional_line_info_rec.attribute15(i) :=
3663 nvl(p_line_rec.attribute15(i), l_dff_attribute( 15));
3664
3665 END IF; --}
3666 END IF; --}
3667 IF WSH_ACTIONS_LEVELS.g_validation_level_tab(WSH_ACTIONS_LEVELS.C_DEFAULT_CONTAINEER_LVL) = 1 THEN
3668 IF l_debug_on THEN
3669 WSH_DEBUG_SV.log(l_module_name,'ordered_item_id ',
3670 p_line_rec.ordered_item_id(i));
3671 END IF;
3672 IF (p_line_rec.ordered_item_id(i) IS NOT NULL) AND (p_line_rec.item_identifier_type(i) = 'CUST') THEN
3673 wsh_util_validate.default_container(
3674 p_item_id => p_line_rec.ordered_item_id(i) ,
3675 x_master_container_item_id =>
3676 p_additional_line_info_rec.master_container_item_id(i),
3677 x_detail_container_item_id =>
3678 p_additional_line_info_rec.detail_container_item_id(i),
3679 x_return_status => l_return_status);
3680
3681 IF l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS
3682 AND l_return_status <> WSH_UTIL_CORE.G_RET_STS_WARNING
3683 THEN
3684 p_line_rec.shipping_interfaced_flag(i) := 'N';
3685 END IF;
3686 END IF;
3687 END IF;
3688
3689 IF nvl(p_line_rec.shipping_interfaced_flag(i) ,'-') <> 'N' THEN
3690 p_line_rec.shipping_interfaced_flag(i) := 'Y';
3691 x_valid_rec_exist := 1;
3692 ELSE
3693 p_additional_line_info_rec.released_status(i) := 'D';
3694 END IF;
3695
3696 Set_message(
3697 p_line_rec =>p_line_rec,
3698 p_index =>i,
3699 p_caller =>p_action_prms.caller,
3700 p_first_call => 'F',
3701 x_stack_size_start => l_stack_size_start,
3702 x_return_status => l_return_status
3703 );
3704
3705
3706 EXCEPTION
3707
3708 WHEN e_next_line THEN
3709 p_additional_line_info_rec.released_status(i) := 'D';
3710 p_line_rec.shipping_interfaced_flag(i) := 'N';
3711 END; --}
3712
3713 END LOOP; --}
3714
3715
3716 IF l_debug_on THEN
3717 WSH_DEBUG_SV.pop(l_module_name);
3718 END IF;
3719
3720 EXCEPTION
3721 WHEN FND_API.G_EXC_ERROR THEN
3722 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
3723 WSH_UTIL_CORE.ADD_MESSAGE(x_return_status,l_module_name);
3724 --
3725 IF l_debug_on THEN
3726 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_ERROR exception has '
3727 || 'occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
3728 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_ERROR');
3729 END IF;
3730 --
3731 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3732 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
3733 --
3734 IF l_debug_on THEN
3735 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. ' ||
3736 'Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
3737 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
3738 END IF;
3739
3740 WHEN WSH_UTIL_CORE.G_EXC_WARNING THEN
3741 x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
3742 --
3743 IF l_debug_on THEN
3744 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_UTIL_CORE.G_EXC_WARNING '||
3745 'exception has occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
3746 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_UTIL_CORE.G_EXC_WARNING');
3747 END IF;
3748 --
3749
3750 WHEN OTHERS THEN
3751 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
3752 wsh_util_core.default_handler('WSH_BULK_PROCESS_PVT.Validate_lines');
3753 --
3754 IF l_debug_on THEN
3755 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. '||
3756 'Oracle error message is '||
3757 SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
3758 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
3759 END IF;
3760
3761 END Validate_lines ;
3762
3763
3764
3765 --========================================================================
3766 -- PROCEDURE : bulk_insert_details
3767 --
3768 -- PARAMETERS: p_line_rec Line record
3769 -- p_action_prms Additional attributes needed
3770 -- p_additional_line_info_rec Local record that is extended
3771 -- and ready to use to store additional
3772 -- information for line record.
3773 -- x_return_status return status
3774 -- COMMENT : This procedure will bulk insert the records into tables
3775 -- wsh_delivery_details and wsh_delivery_assignments_v
3776 --========================================================================
3777
3778
3779 PROCEDURE bulk_insert_details (
3780 P_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.line_rec_type,
3781 p_index IN NUMBER,
3782 p_action_prms IN WSH_BULK_TYPES_GRP.action_parameters_rectype,
3783 p_additional_line_info_rec IN additional_line_info_rec_type ,
3784 X_return_status OUT NOCOPY VARCHAR2
3785 )
3786 IS
3787 l_debug_on BOOLEAN;
3788 --
3789 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME ||
3790 '.' || 'BULK_INSERT_DETAILS';
3791 l_fnd_global_user_id NUMBER := FND_GLOBAL.USER_ID;
3792 l_sysdate DATE;
3793 l_line_rec_count NUMBER;
3794 l_rec_inserted_count NUMBER;
3795 l_valid_ids wsh_util_core.Id_Tab_Type;
3796 l_invalid_ids wsh_util_core.Id_Tab_Type;
3797 l_first NUMBER;
3798 l_last NUMBER;
3799 l_count NUMBER;
3800 l_eligible_count NUMBER := 0;
3801 i NUMBER;
3802 -- HW OPM BUG#:3064890 HVOP for OPM
3803 -- HW OPMCONV. Removed OPM variable
3804
3805 l_del_det_id_tab OE_WSH_BULK_GRP.T_NUM := OE_WSH_BULK_GRP.T_NUM();
3806 l_detail_tab WSH_UTIL_CORE.id_tab_type; -- DBI Project
3807 l_dbi_rs VARCHAR2(1); -- Return Status from DBI API
3808 -- end of changes for 3064890
3809
3810 --OTM R12
3811 l_delivery_detail_tab WSH_ENTITY_INFO_TAB;
3812 l_return_status VARCHAR2(1);
3813 l_item_quantity_uom_tab WSH_UTIL_CORE.COLUMN_TAB_TYPE;
3814 l_gc3_is_installed VARCHAR2(1);
3815 l_tab_index NUMBER;
3816 --
3817 l_otm_installed VARCHAR2(1) ;
3818 e_success EXCEPTION;
3819
3820 BEGIN
3821 --
3822 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
3823 IF l_debug_on IS NULL
3824 THEN
3825 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
3826 END IF;
3827 --
3828 IF l_debug_on THEN
3829 wsh_debug_sv.push (l_module_name);
3830 END IF;
3831
3832 IF l_debug_on THEN
3833 WSH_DEBUG_SV.log(l_module_name,'number of rows inserting ',
3834 l_line_rec_count);
3835 WSH_DEBUG_SV.log(l_module_name,'p_index ', p_index);
3836 END IF;
3837
3838 l_otm_installed := WSH_UTIL_CORE.Get_Otm_Install_Profile_Value;
3839 IF l_otm_installed IN ( 'Y','P')
3840 AND NVL(p_action_prms.caller,'PO') <> 'OM'
3841 THEN
3842 RAISE e_success;
3843 END IF;
3844
3845 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
3846
3847 --OTM R12 initialize
3848 l_count := 0;
3849 l_tab_index := 1;
3850 i := 0;
3851 l_gc3_is_installed := WSH_UTIL_CORE.G_GC3_IS_INSTALLED;
3852 IF l_gc3_is_installed IS NULL THEN
3853 l_gc3_is_installed := WSH_UTIL_CORE.GC3_IS_INSTALLED;
3854 END IF;
3855 IF (l_gc3_is_installed = 'Y') THEN
3856 l_delivery_detail_tab := WSH_ENTITY_INFO_TAB();
3857 END IF;
3858 --
3859
3860 l_sysdate := SYSDATE;
3861 l_first := p_line_rec.line_id.FIRST; --always 1
3862
3863 --Added for Inbound logistics
3864
3865 IF p_index IS NULL THEN
3866 l_line_rec_count := p_line_rec.line_id.COUNT;
3867 l_first := p_line_rec.line_id.FIRST;
3868 l_last := l_line_rec_count;
3869 IF l_line_rec_count > 0 THEN
3870 l_del_det_id_tab.extend(l_line_rec_count);
3871 END IF;
3872 ELSE
3873 l_line_rec_count := 1;
3874 l_first := p_index;
3875 l_last := p_index;
3876 IF l_debug_on THEN
3877 WSH_DEBUG_SV.log(l_module_name,'requested_quantity of line being inserted is', p_line_rec.requested_quantity(p_index));
3878 END IF;
3879 END IF;
3880 IF l_debug_on THEN
3881 WSH_DEBUG_SV.log(l_module_name,'count of p_line_recs p_del det id ', p_line_rec.delivery_detail_id.count);
3882 WSH_DEBUG_SV.log(l_module_name,'l_first', l_first);
3883 WSH_DEBUG_SV.log(l_module_name,'l_last', l_last);
3884 END IF;
3885
3886
3887 FORALL i in l_first..l_last
3888 INSERT INTO wsh_delivery_details(
3889 source_code,
3890 source_header_id,
3891 source_line_id,
3892 customer_id,
3893 sold_to_contact_id,
3894 inventory_item_id,
3895 item_description,
3896 hazard_class_id,
3897 country_of_origin,
3898 ship_from_location_id,
3899 ship_to_location_id,
3900 ship_to_contact_id,
3901 ship_to_site_use_id,
3902 deliver_to_location_id,
3903 deliver_to_contact_id,
3904 deliver_to_site_use_id,
3905 intmed_ship_to_location_id,
3906 intmed_ship_to_contact_id,
3907 ship_tolerance_above,
3908 ship_tolerance_below,
3909 requested_quantity,
3910 requested_quantity_uom,
3911 subinventory,
3912 revision,
3913 date_requested,
3914 date_scheduled,
3915 master_container_item_id,
3916 detail_container_item_id,
3917 ship_method_code,
3918 carrier_id,
3919 freight_terms_code,
3920 shipment_priority_code,
3921 fob_code,
3922 customer_item_id,
3923 dep_plan_required_flag,
3924 customer_prod_seq,
3925 customer_dock_code,
3926 cust_model_serial_number,
3927 customer_job,
3928 customer_production_line,
3929 net_weight,
3930 weight_uom_code,
3931 volume,
3932 volume_uom_code,
3933 tp_attribute_category,
3934 tp_attribute1,
3935 tp_attribute2,
3936 tp_attribute3,
3937 tp_attribute4,
3938 tp_attribute5,
3939 tp_attribute6,
3940 tp_attribute7,
3941 tp_attribute8,
3942 tp_attribute9,
3943 tp_attribute10,
3944 tp_attribute11,
3945 tp_attribute12,
3946 tp_attribute13,
3947 tp_attribute14,
3948 tp_attribute15,
3949 attribute_category,
3950 attribute1,
3951 attribute2,
3952 attribute3,
3953 attribute4,
3954 attribute5,
3955 attribute6,
3956 attribute7,
3957 attribute8,
3958 attribute9,
3959 attribute10,
3960 attribute11,
3961 attribute12,
3962 attribute13,
3963 attribute14,
3964 attribute15,
3965 created_by,
3966 creation_date,
3967 last_update_date,
3968 last_update_login,
3969 last_updated_by,
3970 program_application_id,
3971 program_id,
3972 program_update_date,
3973 mvt_stat_status,
3974 organization_id,
3975 ship_set_id,
3976 arrival_set_id,
3977 ship_model_complete_flag,
3978 top_model_line_id,
3979 source_header_number,
3980 source_header_type_id,
3981 source_header_type_name,
3982 cust_po_number,
3983 ato_line_id,
3984 src_requested_quantity,
3985 src_requested_quantity_uom,
3986 cancelled_quantity,
3987 tracking_number,
3988 shipping_instructions,
3989 packing_instructions,
3990 project_id,
3991 task_id,
3992 org_id,
3993 oe_interfaced_flag,
3994 inv_interfaced_flag,
3995 source_line_number,
3996 inspection_flag,
3997 released_status,
3998 delivery_detail_id,
3999 container_flag,
4000 gross_weight,
4001 seal_code,
4002 unit_number,
4003 unit_price,
4004 currency_code,
4005 --freight_class_cat_id,
4006 --commodity_code_cat_id,
4007 preferred_grade,
4008 src_requested_quantity2,
4009 src_requested_quantity_uom2,
4010 requested_quantity2,
4011 cancelled_quantity2,
4012 requested_quantity_uom2,
4013 pickable_flag,
4014 original_subinventory,
4015 received_quantity,
4016 received_quantity2,
4017 source_line_set_id,
4018 line_direction,
4019 ignore_for_planning,
4020 earliest_pickup_date,
4021 latest_pickup_date,
4022 earliest_dropoff_date,
4023 latest_dropoff_date,
4024 source_document_type_id,
4025 service_level,
4026 mode_of_transport,
4027 source_blanket_reference_id,
4028 source_blanket_reference_num,
4029 vendor_id,
4030 party_id,
4031 ship_from_site_id,
4032 hold_code,
4033 supplier_item_number,
4034 po_shipment_line_id,
4035 po_shipment_line_number,
4036 shipping_control,
4037 source_line_type_code,
4038 po_revision_number,
4039 release_revision_number,
4040 WV_FROZEN_FLAG,
4041 UNIT_WEIGHT,
4042 UNIT_VOLUME
4043 ) VALUES (
4044 p_additional_line_info_rec.source_code,
4045 p_line_rec.header_id(i),
4046 p_line_rec.line_id(i),
4047 p_line_rec.sold_to_org_id(i),
4048 p_line_rec.sold_to_contact_id(i),
4049 p_line_rec.inventory_item_id(i),
4050 p_line_rec.item_description(i),
4051 p_line_rec.hazard_class_id(i),
4052 p_line_rec.country_of_origin(i),
4053 nvl(p_line_rec.ship_from_location_id(i),-1),
4054 p_line_rec.ship_to_location_id(i),
4055 p_line_rec.ship_to_contact_id(i),
4056 p_line_rec.ship_to_org_id(i),
4057 p_line_rec.deliver_to_location_id(i),
4058 p_line_rec.deliver_to_contact_id(i),
4059 p_line_rec.deliver_to_org_id(i),
4060 p_line_rec.intmed_ship_to_location_id(i),
4061 p_line_rec.intermed_ship_to_contact_id(i),
4062 p_line_rec.ship_tolerance_above(i),
4063 p_line_rec.ship_tolerance_below(i),
4064 nvl(p_line_rec.requested_quantity(i),-1),
4065 nvl ( p_line_rec.requested_quantity_uom(i), 'XX'),
4066 p_line_rec.subinventory(i),
4067 p_line_rec.revision(i),
4068 p_line_rec.request_date(i),
4069 p_line_rec.schedule_ship_date(i),
4070 p_additional_line_info_rec.master_container_item_id(i),
4071 p_additional_line_info_rec.detail_container_item_id(i),
4072 p_line_rec.shipping_method_code(i),
4073 p_line_rec.carrier_id(i),
4074 p_line_rec.freight_terms_code(i),
4075 p_line_rec.shipment_priority_code(i),
4076 p_line_rec.fob_point_code(i),
4077 p_line_rec.customer_item_id(i),
4078 p_line_rec.dep_plan_required_flag(i),
4079 p_line_rec.cust_production_seq_num(i),
4080 p_line_rec.customer_dock_code(i),
4081 p_line_rec.cust_model_serial_number(i),
4082 p_line_rec.customer_job(i),
4083 p_line_rec.customer_production_line(i),
4084 p_line_rec.net_weight(i),
4085 p_line_rec.weight_uom_code(i),
4086 p_line_rec.volume(i),
4087 p_line_rec.volume_uom_code(i),
4088 p_line_rec.TP_CONTEXT(i),
4089 p_line_rec.tp_attribute1(i),
4090 p_line_rec.tp_attribute2(i),
4091 p_line_rec.tp_attribute3(i),
4092 p_line_rec.tp_attribute4(i),
4093 p_line_rec.tp_attribute5(i),
4094 p_line_rec.tp_attribute6(i),
4095 p_line_rec.tp_attribute7(i),
4096 p_line_rec.tp_attribute8(i),
4097 p_line_rec.tp_attribute9(i),
4098 p_line_rec.tp_attribute10(i),
4099 p_line_rec.tp_attribute11(i),
4100 p_line_rec.tp_attribute12(i),
4101 p_line_rec.tp_attribute13(i),
4102 p_line_rec.tp_attribute14(i),
4103 p_line_rec.tp_attribute15(i),
4104 p_additional_line_info_rec.attribute_category(i),
4105 p_additional_line_info_rec.attribute1(i),
4106 p_additional_line_info_rec.attribute2(i),
4107 p_additional_line_info_rec.attribute3(i),
4108 p_additional_line_info_rec.attribute4(i),
4109 p_additional_line_info_rec.attribute5(i),
4110 p_additional_line_info_rec.attribute6(i),
4111 p_additional_line_info_rec.attribute7(i),
4112 p_additional_line_info_rec.attribute8(i),
4113 p_additional_line_info_rec.attribute9(i),
4114 p_additional_line_info_rec.attribute10(i),
4115 p_additional_line_info_rec.attribute11(i),
4116 p_additional_line_info_rec.attribute12(i),
4117 p_additional_line_info_rec.attribute13(i),
4118 p_additional_line_info_rec.attribute14(i),
4119 p_additional_line_info_rec.attribute15(i),
4120 l_FND_GLOBAL_USER_ID,
4121 l_SYSDATE,
4122 l_SYSDATE,
4123 l_FND_GLOBAL_USER_ID,
4124 l_FND_GLOBAL_USER_ID,
4125 NULL,
4126 NULL,
4127 NULL,
4128 p_line_rec.mvt_stat_status(i),
4129 p_line_rec.organization_id(i),
4130 p_line_rec.ship_set_id(i),
4131 p_line_rec.arrival_set_id(i),
4132 p_line_rec.ship_model_complete_flag(i),
4133 p_line_rec.top_model_line_id(i),
4134 p_line_rec.source_header_number(i),
4135 p_line_rec.source_header_type_id(i),
4136 p_line_rec.source_header_type_name(i),
4137 p_line_rec.cust_po_number(i),
4138 p_line_rec.ato_line_id(i),
4139 p_line_rec.ordered_quantity(i),
4140 p_line_rec.order_quantity_uom(i),
4141 p_additional_line_info_rec.cancelled_quantity(i),
4142 p_line_rec.tracking_number(i),
4143 p_line_rec.shipping_instructions(i),
4144 p_line_rec.packing_instructions(i),
4145 p_line_rec.project_id(i),
4146 p_line_rec.task_id(i),
4147 p_action_prms.org_id,
4148 decode(p_additional_line_info_rec.source_code,'OE','N','X'),
4149 nvl(p_additional_line_info_rec.inv_interfaced_flag(i),
4150 decode(p_line_rec.pickable_flag(i),'Y','N','X')),
4151 p_line_rec.source_line_number(i),
4152 decode (p_additional_line_info_rec.source_code, 'OKE' ,
4153 nvl (p_line_rec.inspection_flag(i), 'N') , 'N' ),
4154 p_additional_line_info_rec.released_status(i),
4155 wsh_delivery_details_s.nextval,
4156 'N',
4157 p_line_rec.gross_weight(i),
4158 p_line_rec.seal_code(i),
4159 p_line_rec.end_item_unit_number(i),
4160 p_line_rec.unit_list_price(i),
4161 p_line_rec.currency_code(i),
4162 --p_line_rec.freight_class_cat_id(i),
4163 --p_line_rec.commodity_code_cat_id(i),
4164 p_line_rec.preferred_grade(i),
4165 p_line_rec.ordered_quantity2(i),
4166 p_line_rec.ordered_quantity_uom2(i),
4167 p_line_rec.requested_quantity2(i),
4168 p_additional_line_info_rec.cancelled_quantity2(i),
4169 p_line_rec.requested_quantity_uom2(i),
4170 p_line_rec.pickable_flag(i),
4171 p_line_rec.original_subinventory(i),
4172 p_line_rec.received_quantity(i),
4173 p_line_rec.received_quantity2(i),
4174 p_line_rec.line_set_id(i),
4175 decode(p_additional_line_info_rec.source_code, 'OE', 'O', 'OKE', 'O',
4176 'PO',decode(p_line_rec.drop_ship_flag(i),'Y','D','I'),'O'),
4177 NVL(p_additional_line_info_rec.ignore_for_planning(i),'N'),
4178 p_additional_line_info_rec.earliest_pickup_date(i),
4179 p_additional_line_info_rec.latest_pickup_date(i),
4180 p_additional_line_info_rec.earliest_dropoff_date(i),
4181 p_additional_line_info_rec.latest_dropoff_date(i),
4182 p_line_rec.source_document_type_id(i),
4183 p_additional_line_info_rec.service_level(i),
4184 p_additional_line_info_rec.mode_of_transport(i),
4185 -- Added for Inbound Logistics
4186 p_line_rec.source_blanket_reference_id(i),
4187 p_line_rec.source_blanket_reference_num(i),
4188 p_line_rec.vendor_id(i),
4189 p_line_rec.vendor_party_id(i),
4190 p_line_rec.ship_from_site_id(i),
4191 p_line_rec.hold_code(i),
4192 p_line_rec.supplier_item_num(i),
4193 p_line_rec.po_shipment_line_id(i),
4194 p_line_rec.po_shipment_line_number(i),
4195 p_line_rec.shipping_control(i),
4196 p_line_rec.source_line_type_code(i),
4197 p_line_rec.po_revision(i),
4198 p_line_rec.release_revision(i),
4199 'N' , -- WV_FROZEN_FLAG
4200 p_line_rec.mtl_unit_weight(i),
4201 p_line_rec.mtl_unit_volume(i)
4202 )
4203 RETURNING DELIVERY_DETAIL_ID
4204 BULK COLLECT INTO l_del_det_id_tab;
4205 --BULK COLLECT INTO p_line_rec.delivery_detail_id;
4206
4207 IF l_debug_on THEN
4208 WSH_DEBUG_SV.log(l_module_name,'Count of l_del_det_id_tab' , l_del_det_id_tab.count);
4209 WSH_DEBUG_SV.log(l_module_name,'count of p_line_recs p_del det id after inert and before assignment', p_line_rec.delivery_detail_id.count);
4210 END IF;
4211 IF p_index is not null THEN
4212 p_line_rec.delivery_detail_id(p_index) := l_del_det_id_tab(l_del_det_id_tab.first);
4213 l_rec_inserted_count := l_del_det_id_tab.first;
4214 -- DBI Project, for p_index is not null
4215 l_detail_tab(1) := p_line_rec.delivery_detail_id(p_index);
4216 ELSE
4217 i := l_del_det_id_tab.FIRST;
4218 WHILE i IS NOT NULL LOOP
4219 p_line_rec.delivery_detail_id(i) := l_del_det_id_tab(i);
4220 l_detail_tab(i) := l_del_det_id_tab(i); -- DBI Project, change of datatypes requires this data transfer
4221 i := l_del_det_id_tab.NEXT(i);
4222 END LOOP;
4223 l_rec_inserted_count := l_del_det_id_tab.COUNT;
4224 END IF;
4225 IF l_debug_on THEN
4226 WSH_DEBUG_SV.log(l_module_name,'count of p_line_recs p_del det id after inert and after assignment', p_line_rec.delivery_detail_id.count);
4227 WSH_DEBUG_SV.log(l_module_name,'p_line_rec.shipping_eligible_flag count', p_line_rec.shipping_eligible_flag.count);
4228 END IF;
4229
4230 IF l_debug_on THEN
4231 WSH_DEBUG_SV.log(l_module_name,'number of rows inserted ',
4232 l_rec_inserted_count);
4233 WSH_DEBUG_SV.log(l_module_name,'l_line_rec_count', l_line_rec_count);
4234 WSH_DEBUG_SV.log(l_module_name,'p_index', p_index);
4235 END IF;
4236 IF l_rec_inserted_count <> l_line_rec_count THEN
4237 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4238 END IF;
4239
4240 -- DBI Project
4241 -- Insert of wsh_delivery_details, call DBI API after the insert.
4242 -- This API will also check for DBI Installed or not
4243 IF l_debug_on THEN
4244 WSH_DEBUG_SV.log(l_module_name,'Calling DBI API.Detail count-',l_detail_tab.count);
4245 END IF;
4246 WSH_INTEGRATION.DBI_Update_Detail_Log
4247 (p_delivery_detail_id_tab => l_detail_tab,
4248 p_dml_type => 'INSERT',
4249 x_return_status => l_dbi_rs);
4250
4251 IF l_debug_on THEN
4252 WSH_DEBUG_SV.log(l_module_name,'Return Status after DBI Call-',l_dbi_rs);
4253 END IF;
4254 IF l_dbi_rs = WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR THEN
4255 -- just pass this return status to caller API
4256 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4257 END IF;
4258 -- End of Code for DBI Project
4259 --
4260
4261
4262 -- HW OPM BUG#:3064890 HVOP for OPM
4263 -- Bulk updating for OPM lines
4264 -- Need to update opm inventory transaction by calling check_OPM_trans_for_so_line
4265 --Added for Inbound logistics
4266
4267 IF p_index IS NULL THEN
4268 l_first := p_line_rec.delivery_detail_id.FIRST;
4269 ELSE
4270 l_first := p_index;
4271 l_rec_inserted_count := p_index;
4272 --l_first := l_del_det_id_tab.first;
4273 --l_rec_inserted_count := l_del_det_id_tab.last;
4274 END IF;
4275
4276 FOR i in l_first..l_rec_inserted_count LOOP
4277
4278 IF l_debug_on THEN
4279 WSH_DEBUG_SV.log(l_module_name,'p_line_rec.shipping_eligible_flag(i)', p_line_rec.shipping_eligible_flag(i));
4280 END IF;
4281 IF p_line_rec.shipping_eligible_flag(i) = 'Y' THEN
4282 l_eligible_count := l_eligible_count + 1;
4283 END IF;
4284
4285 IF l_debug_on THEN
4286 WSH_DEBUG_SV.log(l_module_name,'p_line_rec.shipping_interfaced_flag(i)', p_line_rec.shipping_interfaced_flag(i));
4287 WSH_DEBUG_SV.log(l_module_name,'p_line_rec.organization_id(i)', p_line_rec.organization_id(i));
4288 WSH_DEBUG_SV.log(l_module_name,'p_additional_line_info_rec.source_code', p_additional_line_info_rec.source_code);
4289 END IF;
4290 IF p_line_rec.shipping_interfaced_flag(i) = 'Y' THEN --{
4291 IF l_debug_on THEN
4292 WSH_DEBUG_SV.logmsg(l_module_name,'Inside the if p_line_rec.shipping_interfaced_flag');
4293 END IF;
4294 --HW OPMCONV. Removed code forking
4295
4296 IF l_debug_on THEN
4297 WSH_DEBUG_SV.logmsg(l_module_name,'Assigning the valid_ids directly');
4298 END IF;
4299 l_valid_ids(l_valid_ids.COUNT + 1) := p_line_rec.delivery_detail_id(i);
4300
4301 --OTM R12
4302 --get the delivery detail information for the valid lines
4303 IF (l_gc3_is_installed = 'Y') THEN
4304 IF l_debug_on THEN
4305 WSH_DEBUG_SV.log(l_module_name,'Delivery detail number',l_tab_index);
4306 WSH_DEBUG_SV.log(l_module_name,'delivery detail id',p_line_rec.delivery_detail_id(i));
4307 WSH_DEBUG_SV.log(l_module_name,'inventory item id',p_line_rec.inventory_item_id(i));
4308 WSH_DEBUG_SV.log(l_module_name,'net weight',p_line_rec.net_weight(i));
4309 WSH_DEBUG_SV.log(l_module_name,'organization id',p_line_rec.organization_id(i));
4310 WSH_DEBUG_SV.log(l_module_name,'weight uom code',p_line_rec.weight_uom_code(i));
4311 WSH_DEBUG_SV.log(l_module_name,'requested quantity',p_line_rec.requested_quantity(i));
4312 WSH_DEBUG_SV.log(l_module_name,'ship from location id',p_line_rec.ship_from_location_id(i));
4313 WSH_DEBUG_SV.log(l_module_name,'requested quantity uom',p_line_rec.requested_quantity_uom(i));
4314 END IF;
4315
4316 l_delivery_detail_tab.EXTEND;
4317 l_delivery_detail_tab(l_tab_index) := WSH_ENTITY_INFO_REC(p_line_rec.delivery_detail_id(i),
4318 NULL,
4319 p_line_rec.inventory_item_id(i),
4320 p_line_rec.net_weight(i),
4321 0,
4322 p_line_rec.organization_id(i),
4323 p_line_rec.weight_uom_code(i),
4324 p_line_rec.requested_quantity(i),
4325 p_line_rec.ship_from_location_id(i),
4326 NULL);
4327 l_item_quantity_uom_tab(l_tab_index) := p_line_rec.requested_quantity_uom(i);
4328 l_tab_index := l_tab_index + 1;
4329 END IF;
4330 --END OTM R12
4331
4332 IF l_debug_on THEN
4333 WSH_DEBUG_SV.logmsg(l_module_name,'After Assigning the valid_ids directly');
4334 END IF;
4335
4336 ELSE -- of interfaced_flag }{
4337 IF l_debug_on THEN
4338 WSH_DEBUG_SV.logmsg(l_module_name,'Inside the eslse 2 portion');
4339 WSH_DEBUG_SV.log(l_module_name,'p_line_rec.delivery_detail_id(i)', p_line_rec.delivery_detail_id(i));
4340 END IF;
4341 l_invalid_ids(l_invalid_ids.COUNT + 1) := p_line_rec.delivery_detail_id(i);
4342 END IF; -- of interfaced_flag }
4343 IF l_debug_on THEN
4344 WSH_DEBUG_SV.logmsg(l_module_name,'Going to next record in the loop');
4345 END IF;
4346
4347
4348 END LOOP; -- of loop
4349
4350
4351 IF l_debug_on THEN
4352 WSH_DEBUG_SV.logmsg(l_module_name,'After the loop');
4353 END IF;
4354
4355 -- l_valid_ids is grater than 0, otherwise, this API would not
4356 -- even be called
4357 IF l_debug_on THEN
4358 WSH_DEBUG_SV.log(l_module_name,'number of invalid records ',
4359 l_invalid_ids.COUNT);
4360 WSH_DEBUG_SV.log(l_module_name,'number of valid records ',
4361 l_valid_ids.COUNT);
4362 END IF;
4363
4364 IF l_invalid_ids.COUNT > 0 THEN
4365
4366 l_first := l_invalid_ids.FIRST; --always 1
4367 l_count := l_invalid_ids.COUNT;
4368
4369 FORALL i IN l_first..l_count
4370 DELETE FROM WSH_DELIVERY_DETAILS
4371 WHERE delivery_detail_id = l_invalid_ids(i);
4372 --put debug message for the rowcount
4373
4374 END IF;
4375
4376 l_sysdate := SYSDATE;
4377
4378 l_first := l_valid_ids.FIRST; --always 1
4379 l_count := l_valid_ids.COUNT;
4380
4381 IF l_debug_on THEN
4382 WSH_DEBUG_SV.log(l_module_name,'l_first', l_first);
4383 WSH_DEBUG_SV.log(l_module_name,'l_count', l_count);
4384 END IF;
4385 FORALL I in l_first..l_count
4386 INSERT INTO wsh_delivery_assignments_v(
4387 delivery_assignment_id,
4388 delivery_detail_id,
4389 creation_date,
4390 created_by,
4391 last_update_date,
4392 last_updated_by,
4393 last_update_login,
4394 program_application_id,
4395 program_id,
4396 program_update_date
4397 ) values (
4398 wsh_delivery_assignments_s.nextval,
4399 l_valid_ids(i),
4400 l_SYSDATE,
4401 L_FND_GLOBAL_USER_ID,
4402 L_SYSDATE,
4403 L_FND_GLOBAL_USER_ID,
4404 L_FND_GLOBAL_USER_ID,
4405 NULL,
4406 NULL,
4407 NULL
4408 );
4409
4410 --put debug message about the row count
4411
4412 IF l_debug_on THEN
4413 WSH_DEBUG_SV.log(l_module_name,'After the insert');
4414 END IF;
4415 IF l_eligible_count <> l_valid_ids.COUNT THEN
4416 --return warning if there were some record that did not pass validations
4417 --For the case all the records were invalid, this API is
4418 --not even called
4419 RAISE wsh_util_core.G_EXC_WARNING;
4420 END IF;
4421
4422 --OTM R12 calling delivery detail splitter if records exist, l_tab_index incremented
4423 IF (l_gc3_is_installed = 'Y' AND l_tab_index > 1) THEN
4424 IF l_debug_on THEN
4425 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_DETAILS_SPLITTER.TMS_DELIVERY_DETAIL_SPLIT',WSH_DEBUG_SV.C_PROC_LEVEL);
4426 END IF;
4427
4428 WSH_DELIVERY_DETAILS_SPLITTER.tms_delivery_detail_split(
4429 p_detail_tab => l_delivery_detail_tab,
4430 p_item_quantity_uom_tab => l_item_quantity_uom_tab,
4431 x_return_status => l_return_status);
4432
4433 IF l_debug_on THEN
4434 wsh_debug_sv.log(l_module_name,'Return Status After Calling WSH_DELIVERY_DETAILS_SPLITTER.TMS_DELIVERY_DETAIL_SPLIT',l_return_status);
4435 END IF;
4436 -- we will not fail based on l_return_status here because
4437 -- we do not want to stop the flow
4438 -- if the detail doesn't split, it will be caught later in
4439 -- delivery splitting and will have exception on the detail
4440 IF (l_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
4441 IF l_debug_on THEN
4442 WSH_DEBUG_SV.logmsg(l_module_name, 'Delivery detail split failed' );
4443 END IF;
4444 END IF;
4445
4446 END IF;
4447 --END OTM R12
4448
4449 IF l_debug_on THEN
4450 WSH_DEBUG_SV.log(l_module_name,'x_return_status',x_return_status);
4451 WSH_DEBUG_SV.pop(l_module_name);
4452 END IF;
4453
4454 EXCEPTION
4455
4456 WHEN e_success THEN
4457 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
4458 --
4459 IF l_debug_on THEN
4460 WSH_DEBUG_SV.pop(l_module_name,'e_success');
4461 END IF;
4462
4463 WHEN FND_API.G_EXC_ERROR THEN
4464 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
4465 --
4466 IF l_debug_on THEN
4467 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_ERROR exception has '
4468 || 'occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
4469 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_ERROR');
4470 END IF;
4471 --
4472 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4473 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
4474 --
4475 IF l_debug_on THEN
4476 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. ' ||
4477 'Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
4478 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
4479 END IF;
4480
4481 WHEN WSH_UTIL_CORE.G_EXC_WARNING THEN
4482 x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
4483 --
4484 IF l_debug_on THEN
4485 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_UTIL_CORE.G_EXC_WARNING '||
4486 'exception has occured ',WSH_DEBUG_SV.C_EXCEP_LEVEL);
4487 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_UTIL_CORE.G_EXC_WARNING');
4488 END IF;
4489 --
4490
4491 WHEN OTHERS THEN
4492 IF l_debug_on THEN
4493 WSH_DEBUG_SV.log(l_module_name,'inside when others - count of p_line_recs p_del det id ', p_line_rec.delivery_detail_id.count);
4494 END IF;
4495 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
4496 wsh_util_core.default_handler('WSH_BULK_PROCESS_PVT.bulk_insert_details');
4497 --
4498 IF l_debug_on THEN
4499 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. '||
4500 'Oracle error message is '||
4501 SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
4502 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
4503 END IF;
4504
4505
4506 END bulk_insert_details;
4507
4508
4509 --========================================================================
4510 -- PROCEDURE : set_message
4511 --
4512 -- PARAMETERS: p_line_rec Line record
4513 -- p_index index for the line record
4514 -- p_caller caller OM, PO, OKE
4515 -- p_first_call pass 'T' to this API for the first time
4516 -- this API is called.
4517 -- X_stack_size_start this will return the fnd message
4518 -- stack size, if a 'T' is passed to
4519 -- the parameter p_first_call
4520 -- x_return_status return status
4521 -- COMMENT : This API should be called twice, once at the begin of
4522 -- the validation and once at the end. If the caller is OM
4523 -- this API will calculate the number of the messages that have
4524 -- been added to the fnd_message stack and put this number into
4525 -- table p_line_rec.error_message_count.
4526 -- If the caller is not OM, then if any errors should be logged
4527 -- for a certain line, this API would put one message at the begin
4528 -- saying which line, header number is being processed and once
4529 -- all the messages for this line has been put on the stack,
4530 -- another message indicates that the validation has finished for
4531 -- the line, header number.
4532 --
4533 --========================================================================
4534
4535
4536
4537 PROCEDURE Set_message(
4538 p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.Line_rec_type,
4539 p_index IN NUMBER,
4540 p_caller IN VARCHAR2,
4541 P_first_call IN VARCHAR2,
4542 X_stack_size_start IN OUT NOCOPY NUMBER,
4543 X_return_status OUT NOCOPY VARCHAR2
4544 )
4545 IS
4546 l_debug_on BOOLEAN;
4547 --
4548 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME ||
4549 '.' || 'SET_MESSAGE';
4550 l_msg_count NUMBER := 0;
4551 BEGIN
4552 --
4553 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
4554 IF l_debug_on IS NULL
4555 THEN
4556 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
4557 END IF;
4558 --
4559 IF l_debug_on THEN
4560 wsh_debug_sv.push (l_module_name);
4561 WSH_DEBUG_SV.log(l_module_name,'p_caller ',p_caller);
4562 WSH_DEBUG_SV.log(l_module_name,'p_index ',p_index);
4563 WSH_DEBUG_SV.log(l_module_name,'P_first_call ',P_first_call);
4564 WSH_DEBUG_SV.log(l_module_name,'X_stack_size_start ',X_stack_size_start);
4565 WSH_DEBUG_SV.log(l_module_name,'header_number ',
4566 p_line_rec.source_header_number(p_index));
4567 WSH_DEBUG_SV.log(l_module_name,'line_number ',
4568 p_line_rec.source_line_number(p_index));
4569 END IF;
4570 IF P_first_call = 'T' THEN --{
4571 IF p_caller <> 'OM' THEN
4572 FND_MESSAGE.SET_NAME('WSH','WSH_START_MESSAGING');
4573 FND_MESSAGE.SET_TOKEN('HEADER_NUMBER',
4574 p_line_rec.source_header_number(p_index));
4575 FND_MESSAGE.SET_TOKEN('LINE_NUMBER',
4576 p_line_rec.source_line_number(p_index));
4577 wsh_util_core.add_message(wsh_util_core.g_ret_sts_success,
4578 l_module_name);
4579 END IF;
4580 X_stack_size_start := FND_MSG_PUB.Count_Msg;
4581 IF l_debug_on THEN
4582 WSH_DEBUG_SV.log(l_module_name,'X_stack_size_start',
4583 X_stack_size_start);
4584 END IF;
4585 ELSE --}{
4586
4587 l_msg_count := FND_MSG_PUB.Count_Msg;
4588
4589 IF l_msg_count > X_stack_size_start THEN --{
4590 IF p_caller <> 'OM' THEN --{
4591 FND_MESSAGE.SET_NAME('WSH','WSH_END_MESSAGING');
4592 FND_MESSAGE.SET_TOKEN('HEADER_NUMBER',
4593 p_line_rec.source_header_number(p_index));
4594 FND_MESSAGE.SET_TOKEN('LINE_NUMBER',
4595 p_line_rec.source_line_number(p_index));
4596 wsh_util_core.add_message(wsh_util_core.g_ret_sts_success,
4597 l_module_name);
4598 ELSE --}{
4599 p_line_rec.error_message_count(p_index) := l_msg_count -
4600 X_stack_size_start;
4601 IF l_debug_on THEN
4602 WSH_DEBUG_SV.log(l_module_name,'OM message count',
4603 p_line_rec.error_message_count(p_index));
4604 END IF;
4605 END IF; --}
4606 ELSE --}{
4607 IF p_caller <> 'OM' THEN
4608 -- remove the previous message
4609 FND_MSG_PUB.Delete_Msg(X_stack_size_start);
4610 END IF;
4611 END IF; --}
4612 END IF; --}
4613 IF l_debug_on THEN
4614 WSH_DEBUG_SV.pop(l_module_name);
4615 END IF;
4616
4617 EXCEPTION
4618
4619 WHEN OTHERS THEN
4620 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
4621 wsh_util_core.default_handler('WSH_BULK_PROCESS_PVT.Set_message');
4622 --
4623 IF l_debug_on THEN
4624 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. '||
4625 'Oracle error message is '||
4626 SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
4627 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
4628 END IF;
4629
4630 END Set_message;
4631
4632
4633
4634 -- Added for Inbound Logistics
4635
4636
4637
4638 -- Start of comments
4639 -- API name : VALIDATE_MANDATORY_INFO
4640 -- Type : Public
4641 -- Pre-reqs : None.
4642 -- Function : This API checks for the validity of mandatory fields like
4643 -- 1.ordered_quantity
4644 -- 2.order_quantity_uom
4645 -- 3.organization_id
4646 -- 4.po_shipment_line_id
4647 -- 5.header_id
4648 -- 6.line_id
4649 -- 7.source_header_number
4650 -- 8.source_line_number
4651 -- 9.po_shipment_line_number
4652 -- 10.source_header_type_id
4653 -- 11.source_blanket_reference_id
4654 -- 12.source_blanket_reference_num
4655 -- 13.source_line_type_code
4656 -- 14.Ship_to_location_id
4657 -- 15.vendor_id
4658 -- 16.ship_from_site_id
4659 -- 17.org_id
4660 -- 18.source_header_type_name
4661 -- 19.shipping_control
4662 -- and sets a local variable to the name of the field which failed validity.
4663 -- Parameters :
4664 -- IN:
4665 -- p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.line_rec_type
4666 -- The input table of records, which contains the fields
4667 -- to be checked for validity.
4668 -- p_index IN NUMBER
4669 -- The index of the record of the i/p table of records
4670 -- namely p_line_rec. Only the fields of the record
4671 -- corresponding to this index are checked for validity.
4672 -- IN OUT:
4673 --
4674 -- OUT:
4675 -- x_return_status OUT NOCOPY VARCHAR2
4676 -- Version : 1.0
4677 -- Previous version 1.0
4678 -- Initial version 1.0
4679 -- End of comments
4680
4681
4682
4683 PROCEDURE validate_mandatory_info(
4684 p_line_rec IN OUT NOCOPY OE_WSH_BULK_GRP.line_rec_type,
4685 p_index IN NUMBER,
4686 x_return_status OUT NOCOPY VARCHAR2) IS
4687
4688
4689 l_exc_mandatory EXCEPTION;
4690 l_api_name CONSTANT VARCHAR2(30) := 'validate_mandatory_info';
4691 l_token VARCHAR2(200);
4692
4693 --
4694 l_debug_on BOOLEAN;
4695 --
4696 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'VALIDATE_MANDATORY_INFO';
4697 --
4698 BEGIN
4699 --
4700 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
4701 --
4702 IF l_debug_on IS NULL
4703 THEN
4704 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
4705 END IF;
4706 --
4707 --
4708 -- Debug Statements
4709 --
4710 IF l_debug_on THEN
4711 WSH_DEBUG_SV.push(l_module_name);
4712 --
4713 WSH_DEBUG_SV.log(l_module_name,'P_INDEX',P_INDEX);
4714 END IF;
4715 --
4716 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
4717
4718 IF p_line_rec.ordered_quantity( p_index) IS NULL THEN
4719 l_token := 'ORDERED QUANTITY';
4720 raise l_exc_mandatory;
4721 END IF;
4722
4723 IF p_line_rec.order_quantity_uom(p_index) IS NULL THEN
4724 l_token := 'ORDERED QUANTITY UOM ';
4725 raise l_exc_mandatory;
4726 END IF;
4727
4728 IF p_line_rec.organization_id(p_index) IS NULL THEN
4729 l_token := ' ORGANIZATION ID';
4730 raise l_exc_mandatory;
4731 END IF;
4732
4733 IF p_line_rec.po_shipment_line_id(p_index) IS NULL THEN
4734 l_token := 'PO LINE LOCATION ID';
4735 raise l_exc_mandatory;
4736 END IF;
4737
4738 IF p_line_rec.header_id(p_index) IS NULL THEN
4739 l_token := 'PO HEADER ID';
4740 raise l_exc_mandatory;
4741 END IF;
4742
4743 IF p_line_rec.line_id(p_index) IS NULL THEN
4744 l_token := 'PO LINE ID';
4745 raise l_exc_mandatory;
4746 END IF;
4747
4748 IF p_line_rec.source_header_number(p_index) IS NULL THEN
4749 l_token := 'PO HEADER NUMBER';
4750 raise l_exc_mandatory;
4751 END IF;
4752
4753 IF p_line_rec.ship_to_location_id(p_index) IS NULL THEN
4754 l_token := 'SHIP TO LOCATION';
4755 raise l_exc_mandatory;
4756 END IF;
4757
4758 IF p_line_rec.source_line_number(p_index) IS NULL THEN
4759 l_token := 'PO LINE NUMBER';
4760 raise l_exc_mandatory;
4761 END IF;
4762
4763 IF p_line_rec.po_shipment_line_number(p_index) IS NULL THEN
4764 l_token := 'PO LINE LOCATION NUMBER';
4765 raise l_exc_mandatory;
4766 END IF;
4767
4768 IF p_line_rec.source_header_type_id(p_index) IS NULL THEN
4769 l_token := ' SOURCE HEADER TYPE ID ';
4770 raise l_exc_mandatory;
4771 ELSE
4772
4773 --code for Bug # 3188208
4774 --source_header_type_id can have values of either 1 or 2.
4775 -- 1 means a non-blanket PO.
4776 -- 2 means a blanket PO.
4777 IF ( p_line_rec.source_header_type_id(p_index) <> 1 )AND
4778 ( p_line_rec.source_header_type_id(p_index) <> 2 ) THEN
4779 FND_MESSAGE.SET_NAME('WSH','WSH_IB_INVALID_SRC_HDR_TP');
4780 WSH_UTIL_CORE.Add_Message(WSH_UTIL_CORE.G_RET_STS_ERROR);
4781 RAISE FND_API.G_EXC_ERROR;
4782 END IF;
4783
4784
4785 -- If the PO is a non-blanket PO,then the fields 'source_blanket_reference_id '
4786 -- and 'source_blanket_reference_num' should be NULL.
4787 IF p_line_rec.source_header_type_id(p_index) = 1 THEN
4788 IF ( p_line_rec.source_blanket_reference_id(p_index) IS NOT NULL ) OR
4789 ( p_line_rec.source_blanket_reference_num(p_index) IS NOT NULL) THEN
4790 FND_MESSAGE.SET_NAME('WSH','WSH_IB_BLANKET_VAL_NOT_NULL');
4791 FND_MESSAGE.SET_TOKEN('PONUM',p_line_rec.source_header_number(p_index));
4792 WSH_UTIL_CORE.Add_Message(WSH_UTIL_CORE.G_RET_STS_ERROR);
4793 RAISE FND_API.G_EXC_ERROR;
4794 END IF;
4795 END IF;
4796 --end of code for Bug # 3188208
4797
4798 -- If the PO is a blanket PO,then the fields 'source_blanket_reference_id '
4799 -- and 'source_blanket_reference_num' should not be NULL.
4800 IF p_line_rec.source_header_type_id(p_index) = 2 THEN
4801 IF p_line_rec.source_blanket_reference_id(p_index) IS NULL THEN
4802 l_token := 'BLANKET REFERENCE_ID';
4803 raise l_exc_mandatory;
4804 END IF;
4805 IF p_line_rec.source_blanket_reference_num(p_index) IS NULL THEN
4806 l_token := 'BLANKET REFERENCE NUMBER';
4807 raise l_exc_mandatory;
4808 END IF;
4809 END IF;
4810
4811 END IF;
4812
4813 --Source line type should be either GB (Goods Based)or GB_OSP
4814 --(Goods Based Outside Processing).
4815 IF p_line_rec.source_line_type_code(p_index) IS NULL THEN
4816 l_token := 'SOURCE LINE TYPE CODE';
4817 raise l_exc_mandatory;
4818 ELSIF p_line_rec.source_line_type_code(p_index) <> 'GB' AND
4819 p_line_rec.source_line_type_code(p_index) <> 'GB_OSP' THEN
4820 FND_MESSAGE.SET_NAME('WSH','WSH_IB_INVALID_SOURCE_LINE_TYPE');
4821 WSH_UTIL_CORE.Add_Message(WSH_UTIL_CORE.G_RET_STS_ERROR);
4822 RAISE FND_API.G_EXC_ERROR;
4823 END IF;
4824
4825 --
4826 IF p_line_rec.vendor_id(p_index) IS NULL THEN
4827 l_token := 'VENDOR ID';
4828 raise l_exc_mandatory;
4829 END IF;
4830
4831 IF p_line_rec.ship_from_site_id(p_index) IS NULL THEN
4832 l_token := 'SHIP FROM SITE ID';
4833 raise l_exc_mandatory;
4834 END IF;
4835
4836 IF p_line_rec.org_id(p_index) IS NULL THEN
4837 l_token := 'ORG ID';
4838 raise l_exc_mandatory;
4839 END IF;
4840
4841 IF p_line_rec.source_header_type_name(p_index) IS NULL THEN
4842 l_token := 'SOURCE HEADER TYPE NAME';
4843 raise l_exc_mandatory;
4844 END IF;
4845
4846
4847 -- The 'shipping_control' should be either supplier/buyer for Inbound Logistics.
4848 IF p_line_rec.shipping_control(p_index) IS NULL THEN
4849 l_token := 'SHIPPING CONTROL';
4850 raise l_exc_mandatory;
4851 ELSIF p_line_rec.shipping_control(p_index) <> 'BUYER'
4852 AND p_line_rec.shipping_control(p_index) <> 'SUPPLIER' THEN
4853
4854 FND_MESSAGE.SET_NAME('WSH','WSH_IB_INVALID_SHIPPING_CNTRL');
4855 WSH_UTIL_CORE.Add_Message(WSH_UTIL_CORE.G_RET_STS_ERROR);
4856 RAISE FND_API.G_EXC_ERROR;
4857 END IF;
4858 --
4859
4860 --
4861 -- Debug Statements
4862 --
4863 IF l_debug_on THEN
4864 WSH_DEBUG_SV.pop(l_module_name);
4865 END IF;
4866 --
4867 EXCEPTION
4868 WHEN l_exc_mandatory THEN
4869 FND_MESSAGE.SET_NAME('WSH','WSH_REQUIRED_FIELD_NULL');
4870 FND_MESSAGE.SET_TOKEN('FIELD_NAME',l_token);
4871 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
4872 wsh_util_core.add_message(x_return_status,l_module_name);
4873
4874 --
4875 -- Debug Statements
4876 --
4877 IF l_debug_on THEN
4878 WSH_DEBUG_SV.logmsg(l_module_name,'L_EXC_MANDATORY exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
4879 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:L_EXC_MANDATORY');
4880 END IF;
4881 --
4882 WHEN FND_API.G_EXC_ERROR THEN
4883 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
4884
4885 --
4886 -- Debug Statements
4887 --
4888 IF l_debug_on THEN
4889 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
4890 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_ERROR');
4891 END IF;
4892 --
4893 WHEN OTHERS THEN
4894 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
4895 WSH_UTIL_CORE.DEFAULT_HANDLER('WSH_BULK_PROCESS_PVT.validate_mandatory_info',l_module_name);
4896
4897 --
4898 -- Debug Statements
4899 --
4900 IF l_debug_on THEN
4901 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
4902 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
4903 END IF;
4904 --
4905 END validate_mandatory_info;
4906
4907
4908 END WSH_BULK_PROCESS_PVT;
4909