1: PACKAGE BODY rcv_int_order_pp_pvt AS
2: /* $Header: RCVPPIOB.pls 120.12.12020000.2 2012/07/10 09:27:24 ptkumar ship $ */
3:
4: -- GLOBAL VARIABLES
5: g_asn_debug VARCHAR2(1) := asn_debug.is_debug_on; -- Bug 9152790
6: x_progress VARCHAR2(3);
7:
8: -- LOCAL PROCEDURES
9:
102: ) IS
103: x_count NUMBER;
104: BEGIN
105: IF p_header_record.header_record.receipt_header_id IS NOT NULL THEN
106: IF (g_asn_debug = 'Y') THEN
107: asn_debug.put_line('Shipment header Id has been provided');
108: END IF;
109:
110: RETURN;
103: x_count NUMBER;
104: BEGIN
105: IF p_header_record.header_record.receipt_header_id IS NOT NULL THEN
106: IF (g_asn_debug = 'Y') THEN
107: asn_debug.put_line('Shipment header Id has been provided');
108: END IF;
109:
110: RETURN;
111: END IF;
115: OR REPLACE(p_header_record.header_record.shipment_num,
116: ' ',
117: ''
118: ) IS NULL) THEN
119: IF (g_asn_debug = 'Y') THEN
120: asn_debug.put_line('Shipment num is still null');
121: /* Bug 4907179 */
122: asn_debug.put_line('Not able to default shipment_header_id, erroring out the transaction');
123: END IF;
116: ' ',
117: ''
118: ) IS NULL) THEN
119: IF (g_asn_debug = 'Y') THEN
120: asn_debug.put_line('Shipment num is still null');
121: /* Bug 4907179 */
122: asn_debug.put_line('Not able to default shipment_header_id, erroring out the transaction');
123: END IF;
124:
118: ) IS NULL) THEN
119: IF (g_asn_debug = 'Y') THEN
120: asn_debug.put_line('Shipment num is still null');
121: /* Bug 4907179 */
122: asn_debug.put_line('Not able to default shipment_header_id, erroring out the transaction');
123: END IF;
124:
125: /* Bug 4907179: Logging error in PO_INTERFACE_ERRORS table and erroring out the transaction, as
126: we are not able to default the shipment_header_id.
140: WHERE shipment_num = p_header_record.header_record.shipment_num
141: AND receipt_source_code IN('INVENTORY', 'INTERNAL ORDER');
142: EXCEPTION
143: WHEN OTHERS THEN
144: IF (g_asn_debug = 'Y') THEN
145: asn_debug.put_line('Exception in when others in default_shipment_info ');
146: END IF;
147:
148: rcv_error_pkg.set_sql_error_message('default_shipment_info', '000');
141: AND receipt_source_code IN('INVENTORY', 'INTERNAL ORDER');
142: EXCEPTION
143: WHEN OTHERS THEN
144: IF (g_asn_debug = 'Y') THEN
145: asn_debug.put_line('Exception in when others in default_shipment_info ');
146: END IF;
147:
148: rcv_error_pkg.set_sql_error_message('default_shipment_info', '000');
149: p_header_record.error_record.error_status := rcv_error_pkg.g_ret_sts_unexp_error;
154: p_header_record IN OUT NOCOPY rcv_roi_preprocessor.header_rec_type
155: ) IS
156: BEGIN
157: -- Bug 12591134: Start
158: IF (g_asn_debug = 'Y') THEN
159: asn_debug.put_line('enter update_header');
160: END IF;
161:
162: IF NVL(p_header_record.header_record.test_flag, 'N') = 'Y' THEN
155: ) IS
156: BEGIN
157: -- Bug 12591134: Start
158: IF (g_asn_debug = 'Y') THEN
159: asn_debug.put_line('enter update_header');
160: END IF;
161:
162: IF NVL(p_header_record.header_record.test_flag, 'N') = 'Y' THEN
163: IF (p_header_record.header_record.receipt_num IS NOT NULL) THEN
173: program_update_date = SYSDATE
174: WHERE shipment_header_id = p_header_record.header_record.receipt_header_id
175: AND receipt_num IS NULL;
176:
177: IF (g_asn_debug = 'Y') THEN
178: asn_debug.put_line('Updated receipt_num in RSH');
179: END IF;
180: EXCEPTION
181: WHEN NO_DATA_FOUND THEN NULL;
174: WHERE shipment_header_id = p_header_record.header_record.receipt_header_id
175: AND receipt_num IS NULL;
176:
177: IF (g_asn_debug = 'Y') THEN
178: asn_debug.put_line('Updated receipt_num in RSH');
179: END IF;
180: EXCEPTION
181: WHEN NO_DATA_FOUND THEN NULL;
182: END;
269: ) IS
270: BEGIN
271: x_progress := '000';
272:
273: IF (g_asn_debug = 'Y') THEN
274: asn_debug.put_line('enter internal order receiving line');
275: END IF;
276:
277: -- 1) derive ship to org info
270: BEGIN
271: x_progress := '000';
272:
273: IF (g_asn_debug = 'Y') THEN
274: asn_debug.put_line('enter internal order receiving line');
275: END IF;
276:
277: -- 1) derive ship to org info
278: rcv_roi_transaction.derive_ship_to_org_info(x_cascaded_table,
280: x_header_record
281: );
282: x_progress := '002';
283:
284: IF (g_asn_debug = 'Y') THEN
285: asn_debug.put_line('x_progress ' || x_progress);
286: END IF;
287:
288: x_progress := '010';
281: );
282: x_progress := '002';
283:
284: IF (g_asn_debug = 'Y') THEN
285: asn_debug.put_line('x_progress ' || x_progress);
286: END IF;
287:
288: x_progress := '010';
289: -- 5) derive item info
298: x_progress := '035';
299: -- 12) derive routing header info
300: rcv_roi_transaction.derive_routing_header_info(x_cascaded_table, n);
301: x_progress := '070';
302: asn_debug.put_line('progress in Internal Orders rcv : x progress = ' || x_progress);
303: -- derive auto transact code
304: rcv_roi_transaction.derive_auto_transact_code(x_cascaded_table, n);
305: -- 13) bug 3379550
306: x_progress := '071';
303: -- derive auto transact code
304: rcv_roi_transaction.derive_auto_transact_code(x_cascaded_table, n);
305: -- 13) bug 3379550
306: x_progress := '071';
307: asn_debug.put_line('progress in Internal Orders rcv : x progress = ' || x_progress);
308: /* Bug 3684984.
309: * We are getting all the values we used to get in the foll. code
310: * in the cursor in derive_io_rcv_line_qty.
311: derive_io_shipment_info(x_cascaded_table, n);
309: * We are getting all the values we used to get in the foll. code
310: * in the cursor in derive_io_rcv_line_qty.
311: derive_io_shipment_info(x_cascaded_table, n);
312: */
313: asn_debug.put_line('progress in Internal Orders rcv : before derive qty');
314: -- quantity > 0
315: derive_io_rcv_line_qty(x_cascaded_table,
316: n,
317: temp_cascaded_table
324: */
325: /* Bug3591830 - START */
326: rcv_roi_transaction.derive_to_locator_id(x_cascaded_table, n);
327: temp_cascaded_table(n).locator_id := x_cascaded_table(n).locator_id;
328: asn_debug.put_line('progress in Internal Orders rcv : after derive_to_locator_id -> locator_id = ' || temp_cascaded_table(n).locator_id);
329: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status,
330: 'LOCATOR_ID',
331: FALSE
332: );
339: temp_cascaded_table IN OUT NOCOPY rcv_roi_preprocessor.cascaded_trans_tab_type,
340: x_header_record IN rcv_roi_preprocessor.header_rec_type
341: ) IS
342: BEGIN
343: IF (g_asn_debug = 'Y') THEN
344: asn_debug.put_line('enter derive_io_trans_line ');
345: END IF;
346:
347: rcv_roi_transaction.derive_parent_id(x_cascaded_table, n);
340: x_header_record IN rcv_roi_preprocessor.header_rec_type
341: ) IS
342: BEGIN
343: IF (g_asn_debug = 'Y') THEN
344: asn_debug.put_line('enter derive_io_trans_line ');
345: END IF;
346:
347: rcv_roi_transaction.derive_parent_id(x_cascaded_table, n);
348: /* Derive the to_org_id */
351: x_header_record
352: );
353:
354: IF (x_cascaded_table(n).unit_of_measure IS NOT NULL) THEN
355: IF (g_asn_debug = 'Y') THEN
356: asn_debug.put_line('X_progress ' || x_progress);
357: END IF;
358:
359: SELECT muom.uom_code
352: );
353:
354: IF (x_cascaded_table(n).unit_of_measure IS NOT NULL) THEN
355: IF (g_asn_debug = 'Y') THEN
356: asn_debug.put_line('X_progress ' || x_progress);
357: END IF;
358:
359: SELECT muom.uom_code
360: INTO x_cascaded_table(n).uom_code
360: INTO x_cascaded_table(n).uom_code
361: FROM mtl_units_of_measure muom
362: WHERE muom.unit_of_measure = x_cascaded_table(n).unit_of_measure;
363: ELSE
364: IF (g_asn_debug = 'Y') THEN
365: asn_debug.put_line('uom_code not dereived as unit_of_measure is null');
366: END IF;
367: END IF;
368:
361: FROM mtl_units_of_measure muom
362: WHERE muom.unit_of_measure = x_cascaded_table(n).unit_of_measure;
363: ELSE
364: IF (g_asn_debug = 'Y') THEN
365: asn_debug.put_line('uom_code not dereived as unit_of_measure is null');
366: END IF;
367: END IF;
368:
369: x_progress := '026';
375: /* Bug#4037821 - START */
376: /* Derive the locator_id even in case of deliver transactions */
377: IF (x_cascaded_table(n).transaction_type IN ('TRANSFER','DELIVER')) THEN
378: IF (x_cascaded_table(n).transaction_type = 'TRANSFER') THEN
379: asn_debug.put_line('doing ship to location /locator derivations ');
380: rcv_roi_transaction.derive_location_info(x_cascaded_table, n);
381: rcv_roi_transaction.derive_from_locator_id(x_cascaded_table, n); -- WMS Change
382: END IF;
383: rcv_roi_transaction.derive_to_locator_id(x_cascaded_table, n); -- WMS Change
384: END IF;
385: /* Bug#4037821 - END */
386:
387: x_progress := '071';
388: asn_debug.put_line('progress in Internal Orders rcv : x progress = ' || x_progress);
389: derive_io_shipment_info(x_cascaded_table, n);
390: x_progress := '091';
391: rcv_roi_transaction.derive_reason_info(x_cascaded_table, n);
392: /* Auto_transact_code is null for all these transaction types */
403: temp_cascaded_table IN OUT NOCOPY rcv_roi_preprocessor.cascaded_trans_tab_type,
404: x_header_record IN rcv_roi_preprocessor.header_rec_type
405: ) IS
406: BEGIN
407: IF (g_asn_debug = 'Y') THEN
408: asn_debug.put_line('enter derive_correction_line ');
409: END IF;
410:
411: rcv_roi_transaction.derive_parent_id(x_cascaded_table, n);
404: x_header_record IN rcv_roi_preprocessor.header_rec_type
405: ) IS
406: BEGIN
407: IF (g_asn_debug = 'Y') THEN
408: asn_debug.put_line('enter derive_correction_line ');
409: END IF;
410:
411: rcv_roi_transaction.derive_parent_id(x_cascaded_table, n);
412: /* Derive the to_org_id */
415: x_header_record
416: );
417:
418: IF (x_cascaded_table(n).unit_of_measure IS NOT NULL) THEN
419: IF (g_asn_debug = 'Y') THEN
420: asn_debug.put_line('x_progress ' || x_progress);
421: END IF;
422:
423: SELECT muom.uom_code
416: );
417:
418: IF (x_cascaded_table(n).unit_of_measure IS NOT NULL) THEN
419: IF (g_asn_debug = 'Y') THEN
420: asn_debug.put_line('x_progress ' || x_progress);
421: END IF;
422:
423: SELECT muom.uom_code
424: INTO x_cascaded_table(n).uom_code
424: INTO x_cascaded_table(n).uom_code
425: FROM mtl_units_of_measure muom
426: WHERE muom.unit_of_measure = x_cascaded_table(n).unit_of_measure;
427: ELSE
428: IF (g_asn_debug = 'Y') THEN
429: asn_debug.put_line('uom_code not dereived as unit_of_measure is null');
430: END IF;
431: END IF;
432:
425: FROM mtl_units_of_measure muom
426: WHERE muom.unit_of_measure = x_cascaded_table(n).unit_of_measure;
427: ELSE
428: IF (g_asn_debug = 'Y') THEN
429: asn_debug.put_line('uom_code not dereived as unit_of_measure is null');
430: END IF;
431: END IF;
432:
433: x_progress := '071';
430: END IF;
431: END IF;
432:
433: x_progress := '071';
434: asn_debug.put_line('progress in Internal Orders rcv : x progress = ' || x_progress);
435: derive_io_shipment_info(x_cascaded_table, n);
436: x_progress := '091';
437: rcv_roi_transaction.derive_reason_info(x_cascaded_table, n);
438: /* Auto_transact_code is null for all these transaction types */
527: ) IS
528: l_parent_deliver_to_person_id NUMBER := null; --Bug#6375015
529: l_skip_validation NUMBER := 0; --Bug#6375015
530: BEGIN
531: IF (g_asn_debug = 'Y') THEN
532: asn_debug.put_line('Enter validate_io_receive_line');
533: END IF;
534:
535: x_progress := '000';
528: l_parent_deliver_to_person_id NUMBER := null; --Bug#6375015
529: l_skip_validation NUMBER := 0; --Bug#6375015
530: BEGIN
531: IF (g_asn_debug = 'Y') THEN
532: asn_debug.put_line('Enter validate_io_receive_line');
533: END IF;
534:
535: x_progress := '000';
536: rcv_roi_transaction.validate_shipment_source(x_cascaded_table, n); /* bug9705269 */
571: from the parent transaction.
572: */
573: /* code fix for the Bug:6375015 starts */
574: IF (x_cascaded_table(n).deliver_to_person_id is null) THEN
575: IF (g_asn_debug = 'Y') THEN
576: asn_debug.put_line('Inside deliver_to_person_id is null...');
577: END IF;
578:
579: IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
572: */
573: /* code fix for the Bug:6375015 starts */
574: IF (x_cascaded_table(n).deliver_to_person_id is null) THEN
575: IF (g_asn_debug = 'Y') THEN
576: asn_debug.put_line('Inside deliver_to_person_id is null...');
577: END IF;
578:
579: IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
580: --In case of transaction_type DELIVER, we need parent transaction.
580: --In case of transaction_type DELIVER, we need parent transaction.
581: --If this condition is not added, it will try to defalut the deliver_to_person
582: --of the parent transaction. But form is not behaving like that.
583: --So added this condition to default the deliver_to_person of the source document.
584: IF (g_asn_debug = 'Y') THEN
585: asn_debug.put_line('Transaction type is DELIVER...');
586: asn_debug.put_line('defaulting deliver_to_person_id from RSL...');
587: END IF;
588: get_deliver_to_person_from_rsl(x_cascaded_table,n);
581: --If this condition is not added, it will try to defalut the deliver_to_person
582: --of the parent transaction. But form is not behaving like that.
583: --So added this condition to default the deliver_to_person of the source document.
584: IF (g_asn_debug = 'Y') THEN
585: asn_debug.put_line('Transaction type is DELIVER...');
586: asn_debug.put_line('defaulting deliver_to_person_id from RSL...');
587: END IF;
588: get_deliver_to_person_from_rsl(x_cascaded_table,n);
589: IF (g_asn_debug = 'Y') THEN
582: --of the parent transaction. But form is not behaving like that.
583: --So added this condition to default the deliver_to_person of the source document.
584: IF (g_asn_debug = 'Y') THEN
585: asn_debug.put_line('Transaction type is DELIVER...');
586: asn_debug.put_line('defaulting deliver_to_person_id from RSL...');
587: END IF;
588: get_deliver_to_person_from_rsl(x_cascaded_table,n);
589: IF (g_asn_debug = 'Y') THEN
590: asn_debug.put_line('After call to get_deliver_to_person_from_rsl...');
585: asn_debug.put_line('Transaction type is DELIVER...');
586: asn_debug.put_line('defaulting deliver_to_person_id from RSL...');
587: END IF;
588: get_deliver_to_person_from_rsl(x_cascaded_table,n);
589: IF (g_asn_debug = 'Y') THEN
590: asn_debug.put_line('After call to get_deliver_to_person_from_rsl...');
591: END IF;
592: ELSIF (x_cascaded_table(n).parent_transaction_id is not null) THEN
593: IF (g_asn_debug = 'Y') THEN
586: asn_debug.put_line('defaulting deliver_to_person_id from RSL...');
587: END IF;
588: get_deliver_to_person_from_rsl(x_cascaded_table,n);
589: IF (g_asn_debug = 'Y') THEN
590: asn_debug.put_line('After call to get_deliver_to_person_from_rsl...');
591: END IF;
592: ELSIF (x_cascaded_table(n).parent_transaction_id is not null) THEN
593: IF (g_asn_debug = 'Y') THEN
594: asn_debug.put_line('Inside parent_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_transaction_id);
589: IF (g_asn_debug = 'Y') THEN
590: asn_debug.put_line('After call to get_deliver_to_person_from_rsl...');
591: END IF;
592: ELSIF (x_cascaded_table(n).parent_transaction_id is not null) THEN
593: IF (g_asn_debug = 'Y') THEN
594: asn_debug.put_line('Inside parent_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_transaction_id);
595: END IF;
596: l_parent_deliver_to_person_id := get_deliver_to_person_from_rt(x_cascaded_table,n);
597: --We can safely skip the validate_deliver_to_person call
590: asn_debug.put_line('After call to get_deliver_to_person_from_rsl...');
591: END IF;
592: ELSIF (x_cascaded_table(n).parent_transaction_id is not null) THEN
593: IF (g_asn_debug = 'Y') THEN
594: asn_debug.put_line('Inside parent_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_transaction_id);
595: END IF;
596: l_parent_deliver_to_person_id := get_deliver_to_person_from_rt(x_cascaded_table,n);
597: --We can safely skip the validate_deliver_to_person call
598: l_skip_validation := 1;
596: l_parent_deliver_to_person_id := get_deliver_to_person_from_rt(x_cascaded_table,n);
597: --We can safely skip the validate_deliver_to_person call
598: l_skip_validation := 1;
599: x_cascaded_table(n).deliver_to_person_id := l_parent_deliver_to_person_id;
600: IF (g_asn_debug = 'Y') THEN
601: asn_debug.put_line('deliver_to_person_is is set to :'||l_parent_deliver_to_person_id);
602: END IF;
603: ELSIF (x_cascaded_table(n).parent_interface_txn_id is not null) THEN
604: IF (g_asn_debug = 'Y') THEN
597: --We can safely skip the validate_deliver_to_person call
598: l_skip_validation := 1;
599: x_cascaded_table(n).deliver_to_person_id := l_parent_deliver_to_person_id;
600: IF (g_asn_debug = 'Y') THEN
601: asn_debug.put_line('deliver_to_person_is is set to :'||l_parent_deliver_to_person_id);
602: END IF;
603: ELSIF (x_cascaded_table(n).parent_interface_txn_id is not null) THEN
604: IF (g_asn_debug = 'Y') THEN
605: asn_debug.put_line('Inside parent_interface_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_interface_txn_id);
600: IF (g_asn_debug = 'Y') THEN
601: asn_debug.put_line('deliver_to_person_is is set to :'||l_parent_deliver_to_person_id);
602: END IF;
603: ELSIF (x_cascaded_table(n).parent_interface_txn_id is not null) THEN
604: IF (g_asn_debug = 'Y') THEN
605: asn_debug.put_line('Inside parent_interface_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_interface_txn_id);
606: END IF;
607: l_parent_deliver_to_person_id := get_deliver_to_person_from_rti(x_cascaded_table,n);
608: --We can safely skip the validate_deliver_to_person call
601: asn_debug.put_line('deliver_to_person_is is set to :'||l_parent_deliver_to_person_id);
602: END IF;
603: ELSIF (x_cascaded_table(n).parent_interface_txn_id is not null) THEN
604: IF (g_asn_debug = 'Y') THEN
605: asn_debug.put_line('Inside parent_interface_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_interface_txn_id);
606: END IF;
607: l_parent_deliver_to_person_id := get_deliver_to_person_from_rti(x_cascaded_table,n);
608: --We can safely skip the validate_deliver_to_person call
609: l_skip_validation := 1;
607: l_parent_deliver_to_person_id := get_deliver_to_person_from_rti(x_cascaded_table,n);
608: --We can safely skip the validate_deliver_to_person call
609: l_skip_validation := 1;
610: x_cascaded_table(n).deliver_to_person_id := l_parent_deliver_to_person_id;
611: IF (g_asn_debug = 'Y') THEN
612: asn_debug.put_line('deliver_to_person_is is set to :'||l_parent_deliver_to_person_id);
613: END IF;
614: ELSE--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
615: IF (g_asn_debug = 'Y') THEN
608: --We can safely skip the validate_deliver_to_person call
609: l_skip_validation := 1;
610: x_cascaded_table(n).deliver_to_person_id := l_parent_deliver_to_person_id;
611: IF (g_asn_debug = 'Y') THEN
612: asn_debug.put_line('deliver_to_person_is is set to :'||l_parent_deliver_to_person_id);
613: END IF;
614: ELSE--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
615: IF (g_asn_debug = 'Y') THEN
616: asn_debug.put_line('defaulting deliver_to_person_id from RSL...');
611: IF (g_asn_debug = 'Y') THEN
612: asn_debug.put_line('deliver_to_person_is is set to :'||l_parent_deliver_to_person_id);
613: END IF;
614: ELSE--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
615: IF (g_asn_debug = 'Y') THEN
616: asn_debug.put_line('defaulting deliver_to_person_id from RSL...');
617: END IF;
618: get_deliver_to_person_from_rsl(x_cascaded_table,n);
619: IF (g_asn_debug = 'Y') THEN
612: asn_debug.put_line('deliver_to_person_is is set to :'||l_parent_deliver_to_person_id);
613: END IF;
614: ELSE--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
615: IF (g_asn_debug = 'Y') THEN
616: asn_debug.put_line('defaulting deliver_to_person_id from RSL...');
617: END IF;
618: get_deliver_to_person_from_rsl(x_cascaded_table,n);
619: IF (g_asn_debug = 'Y') THEN
620: asn_debug.put_line('After call to get_deliver_to_person_from_rsl...');
615: IF (g_asn_debug = 'Y') THEN
616: asn_debug.put_line('defaulting deliver_to_person_id from RSL...');
617: END IF;
618: get_deliver_to_person_from_rsl(x_cascaded_table,n);
619: IF (g_asn_debug = 'Y') THEN
620: asn_debug.put_line('After call to get_deliver_to_person_from_rsl...');
621: END IF;
622: END IF;--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
623: ELSE--(x_cascaded_table(n).deliver_to_person_id is null)
616: asn_debug.put_line('defaulting deliver_to_person_id from RSL...');
617: END IF;
618: get_deliver_to_person_from_rsl(x_cascaded_table,n);
619: IF (g_asn_debug = 'Y') THEN
620: asn_debug.put_line('After call to get_deliver_to_person_from_rsl...');
621: END IF;
622: END IF;--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
623: ELSE--(x_cascaded_table(n).deliver_to_person_id is null)
624: IF (g_asn_debug = 'Y') THEN
620: asn_debug.put_line('After call to get_deliver_to_person_from_rsl...');
621: END IF;
622: END IF;--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
623: ELSE--(x_cascaded_table(n).deliver_to_person_id is null)
624: IF (g_asn_debug = 'Y') THEN
625: asn_debug.put_line('Inside deliver_to_person_id is not null and the value is :'||x_cascaded_table(n).deliver_to_person_id);
626: END IF;
627:
628: IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
621: END IF;
622: END IF;--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
623: ELSE--(x_cascaded_table(n).deliver_to_person_id is null)
624: IF (g_asn_debug = 'Y') THEN
625: asn_debug.put_line('Inside deliver_to_person_id is not null and the value is :'||x_cascaded_table(n).deliver_to_person_id);
626: END IF;
627:
628: IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
629: --In forms user can select any active deliver_to_person for DELIVER transaction.
630: --In case of transaction_type DELIVER, we need parent transaction.
631: --If this condition is not added, it will validate against the deliver_to_person mentioned
632: --the parent RECEIVE transaction. But form is not behaving like that.
633: --So, added this condition to skip deliver_to_person validation against parent txn
634: IF (g_asn_debug = 'Y') THEN
635: asn_debug.put_line('Transaction type is DELIVER...');
636: END IF;
637: ELSIF (x_cascaded_table(n).parent_transaction_id is not null) THEN
638: IF (g_asn_debug = 'Y') THEN
631: --If this condition is not added, it will validate against the deliver_to_person mentioned
632: --the parent RECEIVE transaction. But form is not behaving like that.
633: --So, added this condition to skip deliver_to_person validation against parent txn
634: IF (g_asn_debug = 'Y') THEN
635: asn_debug.put_line('Transaction type is DELIVER...');
636: END IF;
637: ELSIF (x_cascaded_table(n).parent_transaction_id is not null) THEN
638: IF (g_asn_debug = 'Y') THEN
639: asn_debug.put_line('Inside parent_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_transaction_id);
634: IF (g_asn_debug = 'Y') THEN
635: asn_debug.put_line('Transaction type is DELIVER...');
636: END IF;
637: ELSIF (x_cascaded_table(n).parent_transaction_id is not null) THEN
638: IF (g_asn_debug = 'Y') THEN
639: asn_debug.put_line('Inside parent_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_transaction_id);
640: END IF;
641: l_parent_deliver_to_person_id := get_deliver_to_person_from_rt(x_cascaded_table,n);
642: --We can safely skip the validate_deliver_to_person call, validation against
635: asn_debug.put_line('Transaction type is DELIVER...');
636: END IF;
637: ELSIF (x_cascaded_table(n).parent_transaction_id is not null) THEN
638: IF (g_asn_debug = 'Y') THEN
639: asn_debug.put_line('Inside parent_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_transaction_id);
640: END IF;
641: l_parent_deliver_to_person_id := get_deliver_to_person_from_rt(x_cascaded_table,n);
642: --We can safely skip the validate_deliver_to_person call, validation against
643: --parent transaction is handled here itself.
642: --We can safely skip the validate_deliver_to_person call, validation against
643: --parent transaction is handled here itself.
644: l_skip_validation := 1;
645: IF nvl(l_parent_deliver_to_person_id,-99) <> x_cascaded_table(n).deliver_to_person_id THEN
646: IF (g_asn_debug = 'Y') THEN
647: asn_debug.put_line('RTI.deliver_to_person_id is different to that of parent txn...');
648: END IF;
649: --deliver_to_person_id mismatches with the parent txn's deliver_to_person, so clear it off
650: x_cascaded_table(n).deliver_to_person_id := null;
643: --parent transaction is handled here itself.
644: l_skip_validation := 1;
645: IF nvl(l_parent_deliver_to_person_id,-99) <> x_cascaded_table(n).deliver_to_person_id THEN
646: IF (g_asn_debug = 'Y') THEN
647: asn_debug.put_line('RTI.deliver_to_person_id is different to that of parent txn...');
648: END IF;
649: --deliver_to_person_id mismatches with the parent txn's deliver_to_person, so clear it off
650: x_cascaded_table(n).deliver_to_person_id := null;
651: x_cascaded_table(n).deliver_to_person_name := null;
651: x_cascaded_table(n).deliver_to_person_name := null;
652:
653: --set the deliver_to_person_id to that of parent transaction
654: x_cascaded_table(n).deliver_to_person_id := l_parent_deliver_to_person_id;
655: IF (g_asn_debug = 'Y') THEN
656: asn_debug.put_line('deliver_to_person_is is set to that of parent RT txn');
657: END IF;
658: END IF;
659: ELSIF (x_cascaded_table(n).parent_interface_txn_id is not null) THEN
652:
653: --set the deliver_to_person_id to that of parent transaction
654: x_cascaded_table(n).deliver_to_person_id := l_parent_deliver_to_person_id;
655: IF (g_asn_debug = 'Y') THEN
656: asn_debug.put_line('deliver_to_person_is is set to that of parent RT txn');
657: END IF;
658: END IF;
659: ELSIF (x_cascaded_table(n).parent_interface_txn_id is not null) THEN
660: IF (g_asn_debug = 'Y') THEN
656: asn_debug.put_line('deliver_to_person_is is set to that of parent RT txn');
657: END IF;
658: END IF;
659: ELSIF (x_cascaded_table(n).parent_interface_txn_id is not null) THEN
660: IF (g_asn_debug = 'Y') THEN
661: asn_debug.put_line('Inside parent_interface_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_interface_txn_id);
662: END IF;
663: l_parent_deliver_to_person_id := get_deliver_to_person_from_rti(x_cascaded_table,n);
664: --We can safely skip the validate_deliver_to_person call, validation against
657: END IF;
658: END IF;
659: ELSIF (x_cascaded_table(n).parent_interface_txn_id is not null) THEN
660: IF (g_asn_debug = 'Y') THEN
661: asn_debug.put_line('Inside parent_interface_transaction_id.is not null and the value is:'||x_cascaded_table(n).parent_interface_txn_id);
662: END IF;
663: l_parent_deliver_to_person_id := get_deliver_to_person_from_rti(x_cascaded_table,n);
664: --We can safely skip the validate_deliver_to_person call, validation against
665: --parent transaction is handled here itself.
664: --We can safely skip the validate_deliver_to_person call, validation against
665: --parent transaction is handled here itself.
666: l_skip_validation := 1;
667: IF nvl(l_parent_deliver_to_person_id,-99) <> x_cascaded_table(n).deliver_to_person_id THEN
668: IF (g_asn_debug = 'Y') THEN
669: asn_debug.put_line('RTI.deliver_to_person_id is different to that of parent txn...');
670: END IF;
671: --deliver_to_person_id mismatches with the parent txn's deliver_to_person, so clear it off
672: x_cascaded_table(n).deliver_to_person_id := null;
665: --parent transaction is handled here itself.
666: l_skip_validation := 1;
667: IF nvl(l_parent_deliver_to_person_id,-99) <> x_cascaded_table(n).deliver_to_person_id THEN
668: IF (g_asn_debug = 'Y') THEN
669: asn_debug.put_line('RTI.deliver_to_person_id is different to that of parent txn...');
670: END IF;
671: --deliver_to_person_id mismatches with the parent txn's deliver_to_person, so clear it off
672: x_cascaded_table(n).deliver_to_person_id := null;
673: x_cascaded_table(n).deliver_to_person_name := null;
674:
675: --set the deliver_to_person_id to that of parent transaction
676: x_cascaded_table(n).deliver_to_person_id := l_parent_deliver_to_person_id;
677:
678: IF (g_asn_debug = 'Y') THEN
679: asn_debug.put_line('deliver_to_person_is is set to that of parent RT txn');
680: END IF;
681: END IF;
682: END IF;--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
675: --set the deliver_to_person_id to that of parent transaction
676: x_cascaded_table(n).deliver_to_person_id := l_parent_deliver_to_person_id;
677:
678: IF (g_asn_debug = 'Y') THEN
679: asn_debug.put_line('deliver_to_person_is is set to that of parent RT txn');
680: END IF;
681: END IF;
682: END IF;--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
683: END IF;--(x_cascaded_table(n).deliver_to_person_id is null)
682: END IF;--IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
683: END IF;--(x_cascaded_table(n).deliver_to_person_id is null)
684:
685: IF l_skip_validation = 0 THEN
686: IF (g_asn_debug = 'Y') THEN
687: asn_debug.put_line('validate_deliver_to_person is called');
688: END IF;
689: rcv_roi_transaction.validate_deliver_to_person(x_cascaded_table, n);
690: IF (g_asn_debug = 'Y') THEN
683: END IF;--(x_cascaded_table(n).deliver_to_person_id is null)
684:
685: IF l_skip_validation = 0 THEN
686: IF (g_asn_debug = 'Y') THEN
687: asn_debug.put_line('validate_deliver_to_person is called');
688: END IF;
689: rcv_roi_transaction.validate_deliver_to_person(x_cascaded_table, n);
690: IF (g_asn_debug = 'Y') THEN
691: asn_debug.put_line('After validate_deliver_to_person: ' || x_cascaded_table(n).error_status);
686: IF (g_asn_debug = 'Y') THEN
687: asn_debug.put_line('validate_deliver_to_person is called');
688: END IF;
689: rcv_roi_transaction.validate_deliver_to_person(x_cascaded_table, n);
690: IF (g_asn_debug = 'Y') THEN
691: asn_debug.put_line('After validate_deliver_to_person: ' || x_cascaded_table(n).error_status);
692: END IF;
693: ELSE
694: IF (g_asn_debug = 'Y') THEN
687: asn_debug.put_line('validate_deliver_to_person is called');
688: END IF;
689: rcv_roi_transaction.validate_deliver_to_person(x_cascaded_table, n);
690: IF (g_asn_debug = 'Y') THEN
691: asn_debug.put_line('After validate_deliver_to_person: ' || x_cascaded_table(n).error_status);
692: END IF;
693: ELSE
694: IF (g_asn_debug = 'Y') THEN
695: asn_debug.put_line('call to validate_deliver_to_person is skipped');
690: IF (g_asn_debug = 'Y') THEN
691: asn_debug.put_line('After validate_deliver_to_person: ' || x_cascaded_table(n).error_status);
692: END IF;
693: ELSE
694: IF (g_asn_debug = 'Y') THEN
695: asn_debug.put_line('call to validate_deliver_to_person is skipped');
696: END IF;
697: END IF;/* code fix for the Bug:6375015 ends */
698:
691: asn_debug.put_line('After validate_deliver_to_person: ' || x_cascaded_table(n).error_status);
692: END IF;
693: ELSE
694: IF (g_asn_debug = 'Y') THEN
695: asn_debug.put_line('call to validate_deliver_to_person is skipped');
696: END IF;
697: END IF;/* code fix for the Bug:6375015 ends */
698:
699: rcv_roi_transaction.validate_routing_record(x_cascaded_table, n);
850: l_shipment_header_id rcv_shipment_headers.shipment_header_id%TYPE; -- Bugfix 5201155
851: BEGIN
852: x_progress := '097';
853:
854: IF (g_asn_debug = 'Y') THEN
855: asn_debug.put_line('inside line qty calculation of int org rcv');
856: asn_debug.put_line('x_progress ' || x_progress);
857: END IF;
858:
851: BEGIN
852: x_progress := '097';
853:
854: IF (g_asn_debug = 'Y') THEN
855: asn_debug.put_line('inside line qty calculation of int org rcv');
856: asn_debug.put_line('x_progress ' || x_progress);
857: END IF;
858:
859: IF x_cascaded_table(n).error_status NOT IN('S', 'W') THEN
852: x_progress := '097';
853:
854: IF (g_asn_debug = 'Y') THEN
855: asn_debug.put_line('inside line qty calculation of int org rcv');
856: asn_debug.put_line('x_progress ' || x_progress);
857: END IF;
858:
859: IF x_cascaded_table(n).error_status NOT IN('S', 'W') THEN
860: RETURN;
860: RETURN;
861: END IF;
862:
863: IF x_cascaded_table(n).quantity <= 0 THEN --{
864: IF (g_asn_debug = 'Y') THEN
865: asn_debug.put_line('quantity is <= zero. cascade will fail');
866: END IF;
867:
868: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
861: END IF;
862:
863: IF x_cascaded_table(n).quantity <= 0 THEN --{
864: IF (g_asn_debug = 'Y') THEN
865: asn_debug.put_line('quantity is <= zero. cascade will fail');
866: END IF;
867:
868: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
869: rcv_error_pkg.set_error_message('RCV_ITEM_NO_SHIP_QTY', x_cascaded_table(n).error_message);
872: END IF; --} end qty > 0 check
873:
874: x_progress := '098';
875:
876: IF (g_asn_debug = 'Y') THEN
877: asn_debug.put_line('x_progress ' || x_progress);
878: asn_debug.put_line('the shipment info is = ' || TO_CHAR(x_cascaded_table(n).shipment_header_id) || ' num = ' || x_cascaded_table(n).shipment_num);
879: END IF;
880:
873:
874: x_progress := '098';
875:
876: IF (g_asn_debug = 'Y') THEN
877: asn_debug.put_line('x_progress ' || x_progress);
878: asn_debug.put_line('the shipment info is = ' || TO_CHAR(x_cascaded_table(n).shipment_header_id) || ' num = ' || x_cascaded_table(n).shipment_num);
879: END IF;
880:
881: -- as long as shipment num or shipment header id is specified we can continue
874: x_progress := '098';
875:
876: IF (g_asn_debug = 'Y') THEN
877: asn_debug.put_line('x_progress ' || x_progress);
878: asn_debug.put_line('the shipment info is = ' || TO_CHAR(x_cascaded_table(n).shipment_header_id) || ' num = ' || x_cascaded_table(n).shipment_num);
879: END IF;
880:
881: -- as long as shipment num or shipment header id is specified we can continue
882: IF ( x_cascaded_table(n).shipment_header_id IS NULL
881: -- as long as shipment num or shipment header id is specified we can continue
882: IF ( x_cascaded_table(n).shipment_header_id IS NULL
883: AND x_cascaded_table(n).shipment_num IS NULL) THEN
884: -- error_status and error_message are set after validate_quantity_shipped
885: IF (g_asn_debug = 'Y') THEN
886: asn_debug.put_line('no shipment num/shipment header specified ');
887: asn_debug.put_line('status = ' || x_cascaded_table(n).error_status);
888: END IF;
889:
882: IF ( x_cascaded_table(n).shipment_header_id IS NULL
883: AND x_cascaded_table(n).shipment_num IS NULL) THEN
884: -- error_status and error_message are set after validate_quantity_shipped
885: IF (g_asn_debug = 'Y') THEN
886: asn_debug.put_line('no shipment num/shipment header specified ');
887: asn_debug.put_line('status = ' || x_cascaded_table(n).error_status);
888: END IF;
889:
890: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
883: AND x_cascaded_table(n).shipment_num IS NULL) THEN
884: -- error_status and error_message are set after validate_quantity_shipped
885: IF (g_asn_debug = 'Y') THEN
886: asn_debug.put_line('no shipment num/shipment header specified ');
887: asn_debug.put_line('status = ' || x_cascaded_table(n).error_status);
888: END IF;
889:
890: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
891: rcv_error_pkg.set_error_message('RCV_IOT_NO_SHIP_INFO', x_cascaded_table(n).error_message);
894: END IF; -- } of (asn quantity_shipped was valid)
895:
896: -- copy record from main table to temp table
897:
898: IF (g_asn_debug = 'Y') THEN
899: asn_debug.put_line('copy record from main table to temp table');
900: END IF;
901:
902: current_n := 1;
895:
896: -- copy record from main table to temp table
897:
898: IF (g_asn_debug = 'Y') THEN
899: asn_debug.put_line('copy record from main table to temp table');
900: END IF;
901:
902: current_n := 1;
903: temp_cascaded_table(current_n) := x_cascaded_table(n);
904:
905: -- Bugfix 5201155
906: IF ( x_cascaded_table(n).shipment_header_id IS NULL
907: AND x_cascaded_table(n).shipment_num IS NOT NULL) THEN --{
908: IF (g_asn_debug = 'Y') THEN
909: asn_debug.put_line('Shipment header is not provided hence deriving shipment header id for shipment num ' || x_cascaded_table(n).shipment_num );
910: END IF;
911:
912: /* Bug:6313315
905: -- Bugfix 5201155
906: IF ( x_cascaded_table(n).shipment_header_id IS NULL
907: AND x_cascaded_table(n).shipment_num IS NOT NULL) THEN --{
908: IF (g_asn_debug = 'Y') THEN
909: asn_debug.put_line('Shipment header is not provided hence deriving shipment header id for shipment num ' || x_cascaded_table(n).shipment_num );
910: END IF;
911:
912: /* Bug:6313315
913: Added where clause condition rsh.receipt_source_code = 'INTERNAL ORDER'.
924: AND rsl.to_organization_id = NVL(temp_cascaded_table(current_n).to_organization_id, to_organization_id)
925: AND rsl.from_organization_id = NVL(temp_cascaded_table(current_n).from_organization_id, from_organization_id)
926: AND rsh.receipt_source_code = 'INTERNAL ORDER';--Bug: 6313315
927:
928: IF (g_asn_debug = 'Y') THEN
929: asn_debug.put_line('Shipment header = ' || l_shipment_header_id );
930: END IF;
931: EXCEPTION
932: WHEN NO_DATA_FOUND
925: AND rsl.from_organization_id = NVL(temp_cascaded_table(current_n).from_organization_id, from_organization_id)
926: AND rsh.receipt_source_code = 'INTERNAL ORDER';--Bug: 6313315
927:
928: IF (g_asn_debug = 'Y') THEN
929: asn_debug.put_line('Shipment header = ' || l_shipment_header_id );
930: END IF;
931: EXCEPTION
932: WHEN NO_DATA_FOUND
933: THEN
935: rcv_error_pkg.set_error_message('RCV_IOT_NO_SHIP_INFO', x_cascaded_table(n).error_message);
936: rcv_error_pkg.set_token('SHIPMENT_NUM', temp_cascaded_table(current_n).shipment_num);
937: rcv_error_pkg.log_interface_error('SHIPMENT_NUM');
938:
939: IF (g_asn_debug = 'Y') THEN
940: asn_debug.put_line(TO_CHAR(n));
941: asn_debug.put_line('No shipment_header_id found for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
942: asn_debug.put_line('error ' || x_progress);
943: END IF;
936: rcv_error_pkg.set_token('SHIPMENT_NUM', temp_cascaded_table(current_n).shipment_num);
937: rcv_error_pkg.log_interface_error('SHIPMENT_NUM');
938:
939: IF (g_asn_debug = 'Y') THEN
940: asn_debug.put_line(TO_CHAR(n));
941: asn_debug.put_line('No shipment_header_id found for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
942: asn_debug.put_line('error ' || x_progress);
943: END IF;
944: WHEN OTHERS
937: rcv_error_pkg.log_interface_error('SHIPMENT_NUM');
938:
939: IF (g_asn_debug = 'Y') THEN
940: asn_debug.put_line(TO_CHAR(n));
941: asn_debug.put_line('No shipment_header_id found for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
942: asn_debug.put_line('error ' || x_progress);
943: END IF;
944: WHEN OTHERS
945: THEN
938:
939: IF (g_asn_debug = 'Y') THEN
940: asn_debug.put_line(TO_CHAR(n));
941: asn_debug.put_line('No shipment_header_id found for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
942: asn_debug.put_line('error ' || x_progress);
943: END IF;
944: WHEN OTHERS
945: THEN
946: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_unexp_error;
947: rcv_error_pkg.set_sql_error_message('derive_int_org_rcv_line_qty', x_progress);
948: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
949: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
950:
951: IF (g_asn_debug = 'Y') THEN
952: asn_debug.put_line(TO_CHAR(n));
953: asn_debug.put_line('Error while selecting shipment_header_id for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
954: asn_debug.put_line(sqlerrm);
955: asn_debug.put_line('error ' || x_progress);
948: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
949: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
950:
951: IF (g_asn_debug = 'Y') THEN
952: asn_debug.put_line(TO_CHAR(n));
953: asn_debug.put_line('Error while selecting shipment_header_id for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
954: asn_debug.put_line(sqlerrm);
955: asn_debug.put_line('error ' || x_progress);
956: END IF;
949: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
950:
951: IF (g_asn_debug = 'Y') THEN
952: asn_debug.put_line(TO_CHAR(n));
953: asn_debug.put_line('Error while selecting shipment_header_id for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
954: asn_debug.put_line(sqlerrm);
955: asn_debug.put_line('error ' || x_progress);
956: END IF;
957: END;
950:
951: IF (g_asn_debug = 'Y') THEN
952: asn_debug.put_line(TO_CHAR(n));
953: asn_debug.put_line('Error while selecting shipment_header_id for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
954: asn_debug.put_line(sqlerrm);
955: asn_debug.put_line('error ' || x_progress);
956: END IF;
957: END;
958: ELSE
951: IF (g_asn_debug = 'Y') THEN
952: asn_debug.put_line(TO_CHAR(n));
953: asn_debug.put_line('Error while selecting shipment_header_id for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
954: asn_debug.put_line(sqlerrm);
955: asn_debug.put_line('error ' || x_progress);
956: END IF;
957: END;
958: ELSE
959: l_shipment_header_id := temp_cascaded_table(current_n).shipment_header_id;
960: END IF; -- } deriving shipment_header_id if it NULL from shipment_num
961: -- End of code for Bugfix 5201155
962:
963: -- get all rows which meet this condition
964: IF (g_asn_debug = 'Y') THEN
965: asn_debug.put_line('get all rows which meet this condition');
966: asn_debug.put_line('transaction type = ' || x_cascaded_table(n).transaction_type);
967: asn_debug.put_line('auto transact code = ' || x_cascaded_table(n).auto_transact_code);
968: END IF;
961: -- End of code for Bugfix 5201155
962:
963: -- get all rows which meet this condition
964: IF (g_asn_debug = 'Y') THEN
965: asn_debug.put_line('get all rows which meet this condition');
966: asn_debug.put_line('transaction type = ' || x_cascaded_table(n).transaction_type);
967: asn_debug.put_line('auto transact code = ' || x_cascaded_table(n).auto_transact_code);
968: END IF;
969:
962:
963: -- get all rows which meet this condition
964: IF (g_asn_debug = 'Y') THEN
965: asn_debug.put_line('get all rows which meet this condition');
966: asn_debug.put_line('transaction type = ' || x_cascaded_table(n).transaction_type);
967: asn_debug.put_line('auto transact code = ' || x_cascaded_table(n).auto_transact_code);
968: END IF;
969:
970: --{ open the cursors
963: -- get all rows which meet this condition
964: IF (g_asn_debug = 'Y') THEN
965: asn_debug.put_line('get all rows which meet this condition');
966: asn_debug.put_line('transaction type = ' || x_cascaded_table(n).transaction_type);
967: asn_debug.put_line('auto transact code = ' || x_cascaded_table(n).auto_transact_code);
968: END IF;
969:
970: --{ open the cursors
971: IF (g_asn_debug = 'Y') THEN
967: asn_debug.put_line('auto transact code = ' || x_cascaded_table(n).auto_transact_code);
968: END IF;
969:
970: --{ open the cursors
971: IF (g_asn_debug = 'Y') THEN
972: asn_debug.put_line('open shipment records');
973: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
974: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
975: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
968: END IF;
969:
970: --{ open the cursors
971: IF (g_asn_debug = 'Y') THEN
972: asn_debug.put_line('open shipment records');
973: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
974: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
975: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
976: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
969:
970: --{ open the cursors
971: IF (g_asn_debug = 'Y') THEN
972: asn_debug.put_line('open shipment records');
973: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
974: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
975: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
976: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
977: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
970: --{ open the cursors
971: IF (g_asn_debug = 'Y') THEN
972: asn_debug.put_line('open shipment records');
973: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
974: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
975: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
976: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
977: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
978: asn_debug.put_line('shipment line id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_line_id)); -- Bug 8374257
971: IF (g_asn_debug = 'Y') THEN
972: asn_debug.put_line('open shipment records');
973: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
974: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
975: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
976: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
977: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
978: asn_debug.put_line('shipment line id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_line_id)); -- Bug 8374257
979: asn_debug.put_line('proceed to open cursor');
972: asn_debug.put_line('open shipment records');
973: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
974: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
975: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
976: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
977: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
978: asn_debug.put_line('shipment line id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_line_id)); -- Bug 8374257
979: asn_debug.put_line('proceed to open cursor');
980: END IF;
973: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
974: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
975: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
976: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
977: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
978: asn_debug.put_line('shipment line id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_line_id)); -- Bug 8374257
979: asn_debug.put_line('proceed to open cursor');
980: END IF;
981:
974: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
975: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
976: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
977: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
978: asn_debug.put_line('shipment line id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_line_id)); -- Bug 8374257
979: asn_debug.put_line('proceed to open cursor');
980: END IF;
981:
982: OPEN shipments(-- temp_cascaded_table(current_n).shipment_header_id, -- Bugfix 5201155
975: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
976: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
977: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
978: asn_debug.put_line('shipment line id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_line_id)); -- Bug 8374257
979: asn_debug.put_line('proceed to open cursor');
980: END IF;
981:
982: OPEN shipments(-- temp_cascaded_table(current_n).shipment_header_id, -- Bugfix 5201155
983: -- temp_cascaded_table(current_n).shipment_num, -- Bugfix 5201155
1002:
1003: -- }
1004:
1005: -- assign shipped quantity to remaining quantity
1006: IF (g_asn_debug = 'Y') THEN
1007: asn_debug.put_line('assign shipped quantity to remaining quantity');
1008: asn_debug.put_line('pointer in temp_cascade ' || TO_CHAR(current_n));
1009: END IF;
1010:
1003: -- }
1004:
1005: -- assign shipped quantity to remaining quantity
1006: IF (g_asn_debug = 'Y') THEN
1007: asn_debug.put_line('assign shipped quantity to remaining quantity');
1008: asn_debug.put_line('pointer in temp_cascade ' || TO_CHAR(current_n));
1009: END IF;
1010:
1011: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1004:
1005: -- assign shipped quantity to remaining quantity
1006: IF (g_asn_debug = 'Y') THEN
1007: asn_debug.put_line('assign shipped quantity to remaining quantity');
1008: asn_debug.put_line('pointer in temp_cascade ' || TO_CHAR(current_n));
1009: END IF;
1010:
1011: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1012: x_remaining_qty_po_uom := 0;
1010:
1011: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1012: x_remaining_qty_po_uom := 0;
1013:
1014: IF (g_asn_debug = 'Y') THEN
1015: asn_debug.put_line('have assigned the quantity');
1016: END IF;
1017:
1018: -- calculate tax_amount_factor for calculating tax_amount for
1011: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1012: x_remaining_qty_po_uom := 0;
1013:
1014: IF (g_asn_debug = 'Y') THEN
1015: asn_debug.put_line('have assigned the quantity');
1016: END IF;
1017:
1018: -- calculate tax_amount_factor for calculating tax_amount for
1019: -- each cascaded line
1023: ELSE
1024: tax_amount_factor := 0;
1025: END IF;
1026:
1027: IF (g_asn_debug = 'Y') THEN
1028: asn_debug.put_line('tax factor ' || TO_CHAR(tax_amount_factor));
1029: asn_debug.put_line('shipped quantity : ' || TO_CHAR(x_remaining_quantity));
1030: END IF;
1031:
1024: tax_amount_factor := 0;
1025: END IF;
1026:
1027: IF (g_asn_debug = 'Y') THEN
1028: asn_debug.put_line('tax factor ' || TO_CHAR(tax_amount_factor));
1029: asn_debug.put_line('shipped quantity : ' || TO_CHAR(x_remaining_quantity));
1030: END IF;
1031:
1032: x_first_trans := TRUE;
1025: END IF;
1026:
1027: IF (g_asn_debug = 'Y') THEN
1028: asn_debug.put_line('tax factor ' || TO_CHAR(tax_amount_factor));
1029: asn_debug.put_line('shipped quantity : ' || TO_CHAR(x_remaining_quantity));
1030: END IF;
1031:
1032: x_first_trans := TRUE;
1033: transaction_ok := FALSE;
1036: */
1037: FETCH count_shipments INTO x_countshipmentrec;
1038: x_record_count := x_countshipmentrec.line_count;
1039:
1040: IF (g_asn_debug = 'Y') THEN
1041: asn_debug.put_line('before starting cascade');
1042: END IF;
1043:
1044: IF (g_asn_debug = 'Y') THEN
1037: FETCH count_shipments INTO x_countshipmentrec;
1038: x_record_count := x_countshipmentrec.line_count;
1039:
1040: IF (g_asn_debug = 'Y') THEN
1041: asn_debug.put_line('before starting cascade');
1042: END IF;
1043:
1044: IF (g_asn_debug = 'Y') THEN
1045: asn_debug.put_line('record count = ' || x_record_count);
1040: IF (g_asn_debug = 'Y') THEN
1041: asn_debug.put_line('before starting cascade');
1042: END IF;
1043:
1044: IF (g_asn_debug = 'Y') THEN
1045: asn_debug.put_line('record count = ' || x_record_count);
1046: END IF;
1047:
1048: LOOP --{ over the count of shipment records obtained
1041: asn_debug.put_line('before starting cascade');
1042: END IF;
1043:
1044: IF (g_asn_debug = 'Y') THEN
1045: asn_debug.put_line('record count = ' || x_record_count);
1046: END IF;
1047:
1048: LOOP --{ over the count of shipment records obtained
1049: IF (g_asn_debug = 'Y') THEN
1045: asn_debug.put_line('record count = ' || x_record_count);
1046: END IF;
1047:
1048: LOOP --{ over the count of shipment records obtained
1049: IF (g_asn_debug = 'Y') THEN
1050: asn_debug.put_line('remaining quantity asn uom ' || TO_CHAR(x_remaining_quantity));
1051: END IF;
1052:
1053: IF (g_asn_debug = 'Y') THEN
1046: END IF;
1047:
1048: LOOP --{ over the count of shipment records obtained
1049: IF (g_asn_debug = 'Y') THEN
1050: asn_debug.put_line('remaining quantity asn uom ' || TO_CHAR(x_remaining_quantity));
1051: END IF;
1052:
1053: IF (g_asn_debug = 'Y') THEN
1054: asn_debug.put_line('open shipments and fetch');
1049: IF (g_asn_debug = 'Y') THEN
1050: asn_debug.put_line('remaining quantity asn uom ' || TO_CHAR(x_remaining_quantity));
1051: END IF;
1052:
1053: IF (g_asn_debug = 'Y') THEN
1054: asn_debug.put_line('open shipments and fetch');
1055: END IF;
1056:
1057: /*
1050: asn_debug.put_line('remaining quantity asn uom ' || TO_CHAR(x_remaining_quantity));
1051: END IF;
1052:
1053: IF (g_asn_debug = 'Y') THEN
1054: asn_debug.put_line('open shipments and fetch');
1055: END IF;
1056:
1057: /*
1058: ** fetch the cursor
1057: /*
1058: ** fetch the cursor
1059: */
1060: --{
1061: IF (g_asn_debug = 'Y') THEN
1062: asn_debug.put_line('fetching shipments cursor');
1063: END IF;
1064:
1065: FETCH shipments INTO x_shipmentrec;
1058: ** fetch the cursor
1059: */
1060: --{
1061: IF (g_asn_debug = 'Y') THEN
1062: asn_debug.put_line('fetching shipments cursor');
1063: END IF;
1064:
1065: FETCH shipments INTO x_shipmentrec;
1066:
1072: END IF;
1073:
1074: rows_fetched := shipments%ROWCOUNT;
1075:
1076: IF (g_asn_debug = 'Y') THEN
1077: asn_debug.put_line('shipment rows fetched ' || TO_CHAR(rows_fetched));
1078: END IF;
1079:
1080: -- }
1073:
1074: rows_fetched := shipments%ROWCOUNT;
1075:
1076: IF (g_asn_debug = 'Y') THEN
1077: asn_debug.put_line('shipment rows fetched ' || TO_CHAR(rows_fetched));
1078: END IF;
1079:
1080: -- }
1081:
1081:
1082:
1083: IF ( lastrecord
1084: OR x_remaining_quantity <= 0) THEN --{
1085: IF (g_asn_debug = 'Y') THEN
1086: asn_debug.put_line('hit exit condition');
1087: END IF;
1088:
1089: IF NOT x_first_trans THEN
1082:
1083: IF ( lastrecord
1084: OR x_remaining_quantity <= 0) THEN --{
1085: IF (g_asn_debug = 'Y') THEN
1086: asn_debug.put_line('hit exit condition');
1087: END IF;
1088:
1089: IF NOT x_first_trans THEN
1090: -- x_first_trans has been reset which means some cascade has
1092: current_n := current_n - 1;
1093: END IF;
1094:
1095: -- do the tolerance act here
1096: IF (g_asn_debug = 'Y') THEN
1097: asn_debug.put_line('temp table pointer ' || TO_CHAR(current_n));
1098: asn_debug.put_line('check which condition has occured');
1099: END IF;
1100:
1093: END IF;
1094:
1095: -- do the tolerance act here
1096: IF (g_asn_debug = 'Y') THEN
1097: asn_debug.put_line('temp table pointer ' || TO_CHAR(current_n));
1098: asn_debug.put_line('check which condition has occured');
1099: END IF;
1100:
1101: -- lastrecord...we have run out of rows and we still have quantity to allocate
1094:
1095: -- do the tolerance act here
1096: IF (g_asn_debug = 'Y') THEN
1097: asn_debug.put_line('temp table pointer ' || TO_CHAR(current_n));
1098: asn_debug.put_line('check which condition has occured');
1099: END IF;
1100:
1101: -- lastrecord...we have run out of rows and we still have quantity to allocate
1102: IF x_remaining_quantity > 0 THEN --{
1099: END IF;
1100:
1101: -- lastrecord...we have run out of rows and we still have quantity to allocate
1102: IF x_remaining_quantity > 0 THEN --{
1103: IF (g_asn_debug = 'Y') THEN
1104: asn_debug.put_line('There is quantity remaining');
1105: asn_debug.put_line('Need to check qty tolerances');
1106: END IF;
1107:
1100:
1101: -- lastrecord...we have run out of rows and we still have quantity to allocate
1102: IF x_remaining_quantity > 0 THEN --{
1103: IF (g_asn_debug = 'Y') THEN
1104: asn_debug.put_line('There is quantity remaining');
1105: asn_debug.put_line('Need to check qty tolerances');
1106: END IF;
1107:
1108: IF rows_fetched > 0
1101: -- lastrecord...we have run out of rows and we still have quantity to allocate
1102: IF x_remaining_quantity > 0 THEN --{
1103: IF (g_asn_debug = 'Y') THEN
1104: asn_debug.put_line('There is quantity remaining');
1105: asn_debug.put_line('Need to check qty tolerances');
1106: END IF;
1107:
1108: IF rows_fetched > 0
1109: AND NOT x_first_trans THEN --{
1106: END IF;
1107:
1108: IF rows_fetched > 0
1109: AND NOT x_first_trans THEN --{
1110: IF (g_asn_debug = 'Y') THEN
1111: asn_debug.put_line(' in internal order transfer rcv Extra Quantity ' || TO_CHAR(x_remaining_quantity));
1112: END IF;
1113:
1114: IF (g_asn_debug = 'Y') THEN
1107:
1108: IF rows_fetched > 0
1109: AND NOT x_first_trans THEN --{
1110: IF (g_asn_debug = 'Y') THEN
1111: asn_debug.put_line(' in internal order transfer rcv Extra Quantity ' || TO_CHAR(x_remaining_quantity));
1112: END IF;
1113:
1114: IF (g_asn_debug = 'Y') THEN
1115: asn_debug.put_line('delete the temp table ');
1110: IF (g_asn_debug = 'Y') THEN
1111: asn_debug.put_line(' in internal order transfer rcv Extra Quantity ' || TO_CHAR(x_remaining_quantity));
1112: END IF;
1113:
1114: IF (g_asn_debug = 'Y') THEN
1115: asn_debug.put_line('delete the temp table ');
1116: END IF;
1117:
1118: IF temp_cascaded_table.COUNT > 0 THEN
1111: asn_debug.put_line(' in internal order transfer rcv Extra Quantity ' || TO_CHAR(x_remaining_quantity));
1112: END IF;
1113:
1114: IF (g_asn_debug = 'Y') THEN
1115: asn_debug.put_line('delete the temp table ');
1116: END IF;
1117:
1118: IF temp_cascaded_table.COUNT > 0 THEN
1119: FOR i IN 1 .. temp_cascaded_table.COUNT LOOP
1120: temp_cascaded_table.DELETE(i);
1121: END LOOP;
1122: END IF;
1123:
1124: IF (g_asn_debug = 'Y') THEN
1125: asn_debug.put_line('Need to insert a row into po_interface_errors for transfer');
1126: END IF;
1127:
1128: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
1121: END LOOP;
1122: END IF;
1123:
1124: IF (g_asn_debug = 'Y') THEN
1125: asn_debug.put_line('Need to insert a row into po_interface_errors for transfer');
1126: END IF;
1127:
1128: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
1129: rcv_error_pkg.set_error_message('RCV_SHIP_QTY_OVER_TOLERANCE', x_cascaded_table(n).error_message);
1131: rcv_error_pkg.set_token('QTY_B', x_cascaded_table(n).quantity - x_remaining_quantity);
1132: rcv_error_pkg.log_interface_error('QUANTITY');
1133: ELSE --}{ else for rows fetched = 0 OR x_first_trans = true
1134: IF rows_fetched = 0 THEN
1135: IF (g_asn_debug = 'Y') THEN
1136: asn_debug.put_line('No rows were retrieved from cursor.');
1137: END IF;
1138: ELSIF x_first_trans THEN
1139: IF (g_asn_debug = 'Y') THEN
1132: rcv_error_pkg.log_interface_error('QUANTITY');
1133: ELSE --}{ else for rows fetched = 0 OR x_first_trans = true
1134: IF rows_fetched = 0 THEN
1135: IF (g_asn_debug = 'Y') THEN
1136: asn_debug.put_line('No rows were retrieved from cursor.');
1137: END IF;
1138: ELSIF x_first_trans THEN
1139: IF (g_asn_debug = 'Y') THEN
1140: asn_debug.put_line('No rows were cascaded');
1135: IF (g_asn_debug = 'Y') THEN
1136: asn_debug.put_line('No rows were retrieved from cursor.');
1137: END IF;
1138: ELSIF x_first_trans THEN
1139: IF (g_asn_debug = 'Y') THEN
1140: asn_debug.put_line('No rows were cascaded');
1141: END IF;
1142: END IF;
1143:
1136: asn_debug.put_line('No rows were retrieved from cursor.');
1137: END IF;
1138: ELSIF x_first_trans THEN
1139: IF (g_asn_debug = 'Y') THEN
1140: asn_debug.put_line('No rows were cascaded');
1141: END IF;
1142: END IF;
1143:
1144: -- 1) should we check to see why no rows were fetched ??
1160: -- all the rows in the temp cascaded table
1161: -- will be deleted
1162: -- as we cannot over/under receive against a inter-org transfer receive
1163: ELSE -- }{
1164: IF (g_asn_debug = 'Y') THEN
1165: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
1166: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
1167: END IF;
1168: END IF; --} ends the check for whether last record has been reached
1161: -- will be deleted
1162: -- as we cannot over/under receive against a inter-org transfer receive
1163: ELSE -- }{
1164: IF (g_asn_debug = 'Y') THEN
1165: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
1166: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
1167: END IF;
1168: END IF; --} ends the check for whether last record has been reached
1169:
1162: -- as we cannot over/under receive against a inter-org transfer receive
1163: ELSE -- }{
1164: IF (g_asn_debug = 'Y') THEN
1165: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
1166: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
1167: END IF;
1168: END IF; --} ends the check for whether last record has been reached
1169:
1170: -- close cursors
1168: END IF; --} ends the check for whether last record has been reached
1169:
1170: -- close cursors
1171:
1172: IF (g_asn_debug = 'Y') THEN
1173: asn_debug.put_line('close cursors shipments, count_shipments');
1174: END IF;
1175:
1176: IF shipments%ISOPEN THEN
1169:
1170: -- close cursors
1171:
1172: IF (g_asn_debug = 'Y') THEN
1173: asn_debug.put_line('close cursors shipments, count_shipments');
1174: END IF;
1175:
1176: IF shipments%ISOPEN THEN
1177: CLOSE shipments;
1185: END IF; --} matches lastrecord or x_remaining_quantity <= 0
1186:
1187: -- eliminate the row if it fails the date check
1188:
1189: IF (g_asn_debug = 'Y') THEN
1190: asn_debug.put_line('count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
1191: asn_debug.put_line('cursor record ' || TO_CHAR(rows_fetched));
1192: asn_debug.put_line('int org rcv : calling get available qty');
1193: END IF;
1186:
1187: -- eliminate the row if it fails the date check
1188:
1189: IF (g_asn_debug = 'Y') THEN
1190: asn_debug.put_line('count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
1191: asn_debug.put_line('cursor record ' || TO_CHAR(rows_fetched));
1192: asn_debug.put_line('int org rcv : calling get available qty');
1193: END IF;
1194:
1187: -- eliminate the row if it fails the date check
1188:
1189: IF (g_asn_debug = 'Y') THEN
1190: asn_debug.put_line('count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
1191: asn_debug.put_line('cursor record ' || TO_CHAR(rows_fetched));
1192: asn_debug.put_line('int org rcv : calling get available qty');
1193: END IF;
1194:
1195: -- removed rcv_transactions_interface_sv.check_date_tolerance;
1188:
1189: IF (g_asn_debug = 'Y') THEN
1190: asn_debug.put_line('count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
1191: asn_debug.put_line('cursor record ' || TO_CHAR(rows_fetched));
1192: asn_debug.put_line('int org rcv : calling get available qty');
1193: END IF;
1194:
1195: -- removed rcv_transactions_interface_sv.check_date_tolerance;
1196: -- removed check shipto_location enforcement
1214: ** that is available for allocation by this interface transaction
1215: ** the available qty can only be found from rsl
1216: ** the else condition should never arise : confirm from priya ??
1217: */
1218: IF (g_asn_debug = 'Y') THEN
1219: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
1220: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
1221: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
1222: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
1215: ** the available qty can only be found from rsl
1216: ** the else condition should never arise : confirm from priya ??
1217: */
1218: IF (g_asn_debug = 'Y') THEN
1219: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
1220: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
1221: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
1222: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
1223: asn_debug.put_line('receipt source code' || x_cascaded_table(n).receipt_source_code);
1216: ** the else condition should never arise : confirm from priya ??
1217: */
1218: IF (g_asn_debug = 'Y') THEN
1219: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
1220: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
1221: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
1222: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
1223: asn_debug.put_line('receipt source code' || x_cascaded_table(n).receipt_source_code);
1224: END IF;
1217: */
1218: IF (g_asn_debug = 'Y') THEN
1219: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
1220: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
1221: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
1222: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
1223: asn_debug.put_line('receipt source code' || x_cascaded_table(n).receipt_source_code);
1224: END IF;
1225:
1218: IF (g_asn_debug = 'Y') THEN
1219: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
1220: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
1221: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
1222: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
1223: asn_debug.put_line('receipt source code' || x_cascaded_table(n).receipt_source_code);
1224: END IF;
1225:
1226: IF ( x_cascaded_table(n).transaction_type = 'RECEIVE'
1219: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
1220: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
1221: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
1222: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
1223: asn_debug.put_line('receipt source code' || x_cascaded_table(n).receipt_source_code);
1224: END IF;
1225:
1226: IF ( x_cascaded_table(n).transaction_type = 'RECEIVE'
1227: AND NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') IN('RECEIVE', 'DELIVER')) THEN --{
1257: END LOOP;
1258: END IF;
1259: END IF; --}
1260:
1261: IF (g_asn_debug = 'Y') THEN
1262: asn_debug.put_line('after call to get_available quantity');
1263: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1264: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1265: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1258: END IF;
1259: END IF; --}
1260:
1261: IF (g_asn_debug = 'Y') THEN
1262: asn_debug.put_line('after call to get_available quantity');
1263: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1264: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1265: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1266: asn_debug.put_line(' Already allocated qty now in terms of shipment rec uom is ' || already_allocated_qty);
1259: END IF; --}
1260:
1261: IF (g_asn_debug = 'Y') THEN
1262: asn_debug.put_line('after call to get_available quantity');
1263: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1264: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1265: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1266: asn_debug.put_line(' Already allocated qty now in terms of shipment rec uom is ' || already_allocated_qty);
1267: END IF;
1260:
1261: IF (g_asn_debug = 'Y') THEN
1262: asn_debug.put_line('after call to get_available quantity');
1263: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1264: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1265: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1266: asn_debug.put_line(' Already allocated qty now in terms of shipment rec uom is ' || already_allocated_qty);
1267: END IF;
1268:
1261: IF (g_asn_debug = 'Y') THEN
1262: asn_debug.put_line('after call to get_available quantity');
1263: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1264: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1265: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1266: asn_debug.put_line(' Already allocated qty now in terms of shipment rec uom is ' || already_allocated_qty);
1267: END IF;
1268:
1269: -- if qty has already been allocated then reduce available and tolerable
1262: asn_debug.put_line('after call to get_available quantity');
1263: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1264: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1265: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1266: asn_debug.put_line(' Already allocated qty now in terms of shipment rec uom is ' || already_allocated_qty);
1267: END IF;
1268:
1269: -- if qty has already been allocated then reduce available and tolerable
1270: -- qty by the allocated amount
1280: IF x_tolerable_qty < 0 THEN
1281: x_tolerable_qty := 0;
1282: END IF;
1283:
1284: IF (g_asn_debug = 'Y') THEN
1285: asn_debug.put_line('have some allocated quantity. will reduce qty');
1286: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
1287: asn_debug.put_line('after reducing by allocated qty');
1288: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1281: x_tolerable_qty := 0;
1282: END IF;
1283:
1284: IF (g_asn_debug = 'Y') THEN
1285: asn_debug.put_line('have some allocated quantity. will reduce qty');
1286: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
1287: asn_debug.put_line('after reducing by allocated qty');
1288: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1289: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1282: END IF;
1283:
1284: IF (g_asn_debug = 'Y') THEN
1285: asn_debug.put_line('have some allocated quantity. will reduce qty');
1286: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
1287: asn_debug.put_line('after reducing by allocated qty');
1288: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1289: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1290: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1283:
1284: IF (g_asn_debug = 'Y') THEN
1285: asn_debug.put_line('have some allocated quantity. will reduce qty');
1286: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
1287: asn_debug.put_line('after reducing by allocated qty');
1288: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1289: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1290: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1291: END IF;
1284: IF (g_asn_debug = 'Y') THEN
1285: asn_debug.put_line('have some allocated quantity. will reduce qty');
1286: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
1287: asn_debug.put_line('after reducing by allocated qty');
1288: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1289: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1290: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1291: END IF;
1292: END IF; --}
1285: asn_debug.put_line('have some allocated quantity. will reduce qty');
1286: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
1287: asn_debug.put_line('after reducing by allocated qty');
1288: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1289: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1290: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1291: END IF;
1292: END IF; --}
1293: -- we can use the first record since the item_id and uom are not going to change
1286: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
1287: asn_debug.put_line('after reducing by allocated qty');
1288: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
1289: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
1290: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
1291: END IF;
1292: END IF; --}
1293: -- we can use the first record since the item_id and uom are not going to change
1294: -- check that we can convert between asn-> po uom
1303: x_shipmentrec.unit_of_measure
1304: );
1305:
1306: IF x_remaining_qty_rsl_uom = 0 THEN --{ -- no point continuing
1307: IF (g_asn_debug = 'Y') THEN
1308: asn_debug.put_line('need an error message in the interface tables');
1309: asn_debug.put_line('cannot interconvert between diff uoms');
1310: END IF;
1311: ELSE -- we have converted the qty between uoms succesfully } {
1304: );
1305:
1306: IF x_remaining_qty_rsl_uom = 0 THEN --{ -- no point continuing
1307: IF (g_asn_debug = 'Y') THEN
1308: asn_debug.put_line('need an error message in the interface tables');
1309: asn_debug.put_line('cannot interconvert between diff uoms');
1310: END IF;
1311: ELSE -- we have converted the qty between uoms succesfully } {
1312: IF (g_asn_debug = 'Y') THEN
1305:
1306: IF x_remaining_qty_rsl_uom = 0 THEN --{ -- no point continuing
1307: IF (g_asn_debug = 'Y') THEN
1308: asn_debug.put_line('need an error message in the interface tables');
1309: asn_debug.put_line('cannot interconvert between diff uoms');
1310: END IF;
1311: ELSE -- we have converted the qty between uoms succesfully } {
1312: IF (g_asn_debug = 'Y') THEN
1313: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
1308: asn_debug.put_line('need an error message in the interface tables');
1309: asn_debug.put_line('cannot interconvert between diff uoms');
1310: END IF;
1311: ELSE -- we have converted the qty between uoms succesfully } {
1312: IF (g_asn_debug = 'Y') THEN
1313: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
1314: asn_debug.put_line('current asn quantity ' || TO_CHAR(x_remaining_quantity));
1315: asn_debug.put_line('current asn uom ' || temp_cascaded_table(1).unit_of_measure);
1316: asn_debug.put_line('converted rsl uom quantity ' || TO_CHAR(x_remaining_qty_rsl_uom));
1309: asn_debug.put_line('cannot interconvert between diff uoms');
1310: END IF;
1311: ELSE -- we have converted the qty between uoms succesfully } {
1312: IF (g_asn_debug = 'Y') THEN
1313: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
1314: asn_debug.put_line('current asn quantity ' || TO_CHAR(x_remaining_quantity));
1315: asn_debug.put_line('current asn uom ' || temp_cascaded_table(1).unit_of_measure);
1316: asn_debug.put_line('converted rsl uom quantity ' || TO_CHAR(x_remaining_qty_rsl_uom));
1317: END IF;
1310: END IF;
1311: ELSE -- we have converted the qty between uoms succesfully } {
1312: IF (g_asn_debug = 'Y') THEN
1313: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
1314: asn_debug.put_line('current asn quantity ' || TO_CHAR(x_remaining_quantity));
1315: asn_debug.put_line('current asn uom ' || temp_cascaded_table(1).unit_of_measure);
1316: asn_debug.put_line('converted rsl uom quantity ' || TO_CHAR(x_remaining_qty_rsl_uom));
1317: END IF;
1318:
1311: ELSE -- we have converted the qty between uoms succesfully } {
1312: IF (g_asn_debug = 'Y') THEN
1313: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
1314: asn_debug.put_line('current asn quantity ' || TO_CHAR(x_remaining_quantity));
1315: asn_debug.put_line('current asn uom ' || temp_cascaded_table(1).unit_of_measure);
1316: asn_debug.put_line('converted rsl uom quantity ' || TO_CHAR(x_remaining_qty_rsl_uom));
1317: END IF;
1318:
1319: IF x_converted_trx_qty > 0 THEN --{
1312: IF (g_asn_debug = 'Y') THEN
1313: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
1314: asn_debug.put_line('current asn quantity ' || TO_CHAR(x_remaining_quantity));
1315: asn_debug.put_line('current asn uom ' || temp_cascaded_table(1).unit_of_measure);
1316: asn_debug.put_line('converted rsl uom quantity ' || TO_CHAR(x_remaining_qty_rsl_uom));
1317: END IF;
1318:
1319: IF x_converted_trx_qty > 0 THEN --{
1320: IF (x_converted_trx_qty < x_remaining_qty_rsl_uom) THEN -- compare like uoms {
1317: END IF;
1318:
1319: IF x_converted_trx_qty > 0 THEN --{
1320: IF (x_converted_trx_qty < x_remaining_qty_rsl_uom) THEN -- compare like uoms {
1321: IF (g_asn_debug = 'Y') THEN
1322: asn_debug.put_line('total qty available to be received is less than remaining qty');
1323: END IF;
1324:
1325: x_remaining_qty_rsl_uom := x_remaining_qty_rsl_uom - x_converted_trx_qty;
1318:
1319: IF x_converted_trx_qty > 0 THEN --{
1320: IF (x_converted_trx_qty < x_remaining_qty_rsl_uom) THEN -- compare like uoms {
1321: IF (g_asn_debug = 'Y') THEN
1322: asn_debug.put_line('total qty available to be received is less than remaining qty');
1323: END IF;
1324:
1325: x_remaining_qty_rsl_uom := x_remaining_qty_rsl_uom - x_converted_trx_qty;
1326: -- change rsl uom qty to uom of first line in cascaded table so both qtys are in sync
1338: END IF;
1339: -- Bug 13744041: End
1340: insert_into_table := TRUE;
1341: ELSE --} {
1342: IF (g_asn_debug = 'Y') THEN
1343: asn_debug.put_line('total qty available to be received is > remaining qty ');
1344: END IF;
1345:
1346: x_converted_trx_qty := x_remaining_qty_rsl_uom;
1339: -- Bug 13744041: End
1340: insert_into_table := TRUE;
1341: ELSE --} {
1342: IF (g_asn_debug = 'Y') THEN
1343: asn_debug.put_line('total qty available to be received is > remaining qty ');
1344: END IF;
1345:
1346: x_converted_trx_qty := x_remaining_qty_rsl_uom;
1347: insert_into_table := TRUE;
1350: END IF; --}
1351: ELSE -- no qty for this record but if last row we need it } {
1352: IF rows_fetched = x_record_count THEN --{ last row needs to be inserted anyway
1353: -- so that the row can be used based on qty tolerance checks
1354: IF (g_asn_debug = 'Y') THEN
1355: asn_debug.put_line('quantity is less then 0 but last record');
1356: END IF;
1357:
1358: insert_into_table := TRUE;
1351: ELSE -- no qty for this record but if last row we need it } {
1352: IF rows_fetched = x_record_count THEN --{ last row needs to be inserted anyway
1353: -- so that the row can be used based on qty tolerance checks
1354: IF (g_asn_debug = 'Y') THEN
1355: asn_debug.put_line('quantity is less then 0 but last record');
1356: END IF;
1357:
1358: insert_into_table := TRUE;
1359: x_converted_trx_qty := 0;
1357:
1358: insert_into_table := TRUE;
1359: x_converted_trx_qty := 0;
1360: ELSE --} {
1361: IF (g_asn_debug = 'Y') THEN
1362: asn_debug.put_line('<= 0 quantity but more records in cursor');
1363: END IF;
1364:
1365: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
1358: insert_into_table := TRUE;
1359: x_converted_trx_qty := 0;
1360: ELSE --} {
1361: IF (g_asn_debug = 'Y') THEN
1362: asn_debug.put_line('<= 0 quantity but more records in cursor');
1363: END IF;
1364:
1365: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
1366:
1363: END IF;
1364:
1365: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
1366:
1367: IF (g_asn_debug = 'Y') THEN
1368: asn_debug.put_line('we have to deal with remaining_qty > 0 and x_converted_trx_qty -ve');
1369: END IF;
1370:
1371: insert_into_table := FALSE;
1364:
1365: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
1366:
1367: IF (g_asn_debug = 'Y') THEN
1368: asn_debug.put_line('we have to deal with remaining_qty > 0 and x_converted_trx_qty -ve');
1369: END IF;
1370:
1371: insert_into_table := FALSE;
1372: END IF; --}
1374: END IF; --} remaining_qty_po_uom <> 0
1375:
1376: IF insert_into_table THEN --{
1377: IF (x_first_trans) THEN --{
1378: IF (g_asn_debug = 'Y') THEN
1379: asn_debug.put_line('first time ' || TO_CHAR(current_n));
1380: END IF;
1381:
1382: x_first_trans := FALSE;
1375:
1376: IF insert_into_table THEN --{
1377: IF (x_first_trans) THEN --{
1378: IF (g_asn_debug = 'Y') THEN
1379: asn_debug.put_line('first time ' || TO_CHAR(current_n));
1380: END IF;
1381:
1382: x_first_trans := FALSE;
1383: ELSE --} { not x_first_trans
1380: END IF;
1381:
1382: x_first_trans := FALSE;
1383: ELSE --} { not x_first_trans
1384: IF (g_asn_debug = 'Y') THEN
1385: asn_debug.put_line('next time ' || TO_CHAR(current_n));
1386: END IF;
1387:
1388: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
1381:
1382: x_first_trans := FALSE;
1383: ELSE --} { not x_first_trans
1384: IF (g_asn_debug = 'Y') THEN
1385: asn_debug.put_line('next time ' || TO_CHAR(current_n));
1386: END IF;
1387:
1388: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
1389: END IF; --} matches x_first_transfer
1403: ELSE
1404: temp_cascaded_table(current_n).quantity := round (x_converted_trx_qty,5); -- Bug 13744041
1405: END IF;
1406:
1407: IF (g_asn_debug = 'Y') THEN
1408: asn_debug.put_line('Transaction qty in terms of the transaction uom is ' || temp_cascaded_table(current_n).quantity);
1409: END IF;
1410:
1411: -- primary qty in primary uom
1404: temp_cascaded_table(current_n).quantity := round (x_converted_trx_qty,5); -- Bug 13744041
1405: END IF;
1406:
1407: IF (g_asn_debug = 'Y') THEN
1408: asn_debug.put_line('Transaction qty in terms of the transaction uom is ' || temp_cascaded_table(current_n).quantity);
1409: END IF;
1410:
1411: -- primary qty in primary uom
1412: IF (temp_cascaded_table(current_n).primary_unit_of_measure <> x_shipmentrec.unit_of_measure) THEN
1418: temp_cascaded_table(current_n).primary_quantity := round (temp_cascaded_table(current_n).primary_quantity,5); -- Bug 13744041
1419: ELSE
1420: temp_cascaded_table(current_n).primary_quantity := round(x_converted_trx_qty,5); -- Bug 13744041
1421:
1422: IF (g_asn_debug = 'Y') THEN
1423: asn_debug.put_line('Transaction qty in terms of the primary uom is ' || temp_cascaded_table(current_n).primary_quantity);
1424: END IF;
1425:
1426: temp_cascaded_table(current_n).inspection_status_code := 'NOT INSPECTED';
1419: ELSE
1420: temp_cascaded_table(current_n).primary_quantity := round(x_converted_trx_qty,5); -- Bug 13744041
1421:
1422: IF (g_asn_debug = 'Y') THEN
1423: asn_debug.put_line('Transaction qty in terms of the primary uom is ' || temp_cascaded_table(current_n).primary_quantity);
1424: END IF;
1425:
1426: temp_cascaded_table(current_n).inspection_status_code := 'NOT INSPECTED';
1427: temp_cascaded_table(current_n).interface_source_code := 'RCV';
1427: temp_cascaded_table(current_n).interface_source_code := 'RCV';
1428: -- temp_cascaded_table(current_n).currency_code := x_shipmentrec.currency_code;
1429: temp_cascaded_table(current_n).tax_amount := ROUND(temp_cascaded_table(current_n).quantity * tax_amount_factor, 4);
1430:
1431: IF (g_asn_debug = 'Y') THEN
1432: asn_debug.put_line('current tax amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1433: END IF;
1434:
1435: -- confirm the data in rsh and rsl for the provided info
1428: -- temp_cascaded_table(current_n).currency_code := x_shipmentrec.currency_code;
1429: temp_cascaded_table(current_n).tax_amount := ROUND(temp_cascaded_table(current_n).quantity * tax_amount_factor, 4);
1430:
1431: IF (g_asn_debug = 'Y') THEN
1432: asn_debug.put_line('current tax amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1433: END IF;
1434:
1435: -- confirm the data in rsh and rsl for the provided info
1436: IF (g_asn_debug = 'Y') THEN
1432: asn_debug.put_line('current tax amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1433: END IF;
1434:
1435: -- confirm the data in rsh and rsl for the provided info
1436: IF (g_asn_debug = 'Y') THEN
1437: asn_debug.put_line( 'rsl : cat '
1438: || x_shipmentrec.category_id
1439: || ' item desc '
1440: || x_shipmentrec.item_description
1433: END IF;
1434:
1435: -- confirm the data in rsh and rsl for the provided info
1436: IF (g_asn_debug = 'Y') THEN
1437: asn_debug.put_line( 'rsl : cat '
1438: || x_shipmentrec.category_id
1439: || ' item desc '
1440: || x_shipmentrec.item_description
1441: || ' header '
1521: EXCEPTION
1522: WHEN NO_DATA_FOUND THEN
1523: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
1524:
1525: IF (g_asn_debug = 'Y') THEN
1526: asn_debug.put_line('the deliver to person entered in po is currently inactive');
1527: asn_debug.put_line(' so it is cleared off');
1528: END IF;
1529: WHEN OTHERS THEN
1522: WHEN NO_DATA_FOUND THEN
1523: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
1524:
1525: IF (g_asn_debug = 'Y') THEN
1526: asn_debug.put_line('the deliver to person entered in po is currently inactive');
1527: asn_debug.put_line(' so it is cleared off');
1528: END IF;
1529: WHEN OTHERS THEN
1530: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
1523: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
1524:
1525: IF (g_asn_debug = 'Y') THEN
1526: asn_debug.put_line('the deliver to person entered in po is currently inactive');
1527: asn_debug.put_line(' so it is cleared off');
1528: END IF;
1529: WHEN OTHERS THEN
1530: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
1531:
1528: END IF;
1529: WHEN OTHERS THEN
1530: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
1531:
1532: IF (g_asn_debug = 'Y') THEN
1533: asn_debug.put_line('some exception has occured');
1534: asn_debug.put_line('this exception is due to the po deliver to person');
1535: asn_debug.put_line('the deliver to person is optional');
1536: asn_debug.put_line('so cleared off the deliver to person');
1529: WHEN OTHERS THEN
1530: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
1531:
1532: IF (g_asn_debug = 'Y') THEN
1533: asn_debug.put_line('some exception has occured');
1534: asn_debug.put_line('this exception is due to the po deliver to person');
1535: asn_debug.put_line('the deliver to person is optional');
1536: asn_debug.put_line('so cleared off the deliver to person');
1537: END IF;
1530: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
1531:
1532: IF (g_asn_debug = 'Y') THEN
1533: asn_debug.put_line('some exception has occured');
1534: asn_debug.put_line('this exception is due to the po deliver to person');
1535: asn_debug.put_line('the deliver to person is optional');
1536: asn_debug.put_line('so cleared off the deliver to person');
1537: END IF;
1538: END;
1531:
1532: IF (g_asn_debug = 'Y') THEN
1533: asn_debug.put_line('some exception has occured');
1534: asn_debug.put_line('this exception is due to the po deliver to person');
1535: asn_debug.put_line('the deliver to person is optional');
1536: asn_debug.put_line('so cleared off the deliver to person');
1537: END IF;
1538: END;
1539: END IF; --}
1532: IF (g_asn_debug = 'Y') THEN
1533: asn_debug.put_line('some exception has occured');
1534: asn_debug.put_line('this exception is due to the po deliver to person');
1535: asn_debug.put_line('the deliver to person is optional');
1536: asn_debug.put_line('so cleared off the deliver to person');
1537: END IF;
1538: END;
1539: END IF; --}
1540: END IF; --}
1550: END IF; --} matches txn not deliver
1551:
1552: current_n := current_n + 1;
1553:
1554: IF (g_asn_debug = 'Y') THEN
1555: asn_debug.put_line('increment pointer by 1 ' || TO_CHAR(current_n));
1556: END IF;
1557: END IF; --} matches if insert into table
1558: END IF; --} matches shipmentdistributionrec.receipt_days_exception_code = none
1551:
1552: current_n := current_n + 1;
1553:
1554: IF (g_asn_debug = 'Y') THEN
1555: asn_debug.put_line('increment pointer by 1 ' || TO_CHAR(current_n));
1556: END IF;
1557: END IF; --} matches if insert into table
1558: END IF; --} matches shipmentdistributionrec.receipt_days_exception_code = none
1559: END LOOP; --}
1579: IF count_shipments%ISOPEN THEN
1580: CLOSE count_shipments;
1581: END IF;
1582:
1583: IF (g_asn_debug = 'Y') THEN
1584: asn_debug.put_line('exit derive_io_rcv_line_qty');
1585: END IF;
1586: EXCEPTION
1587: WHEN rcv_error_pkg.e_fatal_error THEN
1580: CLOSE count_shipments;
1581: END IF;
1582:
1583: IF (g_asn_debug = 'Y') THEN
1584: asn_debug.put_line('exit derive_io_rcv_line_qty');
1585: END IF;
1586: EXCEPTION
1587: WHEN rcv_error_pkg.e_fatal_error THEN
1588: IF shipments%ISOPEN THEN
1604: rcv_error_pkg.set_sql_error_message('derive_io_rcv_line_qty', x_progress);
1605: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_unexp_error;
1606: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
1607:
1608: IF (g_asn_debug = 'Y') THEN
1609: asn_debug.put_line(TO_CHAR(n));
1610: asn_debug.put_line(SQLERRM);
1611: asn_debug.put_line('error ' || x_progress);
1612: END IF;
1605: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_unexp_error;
1606: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
1607:
1608: IF (g_asn_debug = 'Y') THEN
1609: asn_debug.put_line(TO_CHAR(n));
1610: asn_debug.put_line(SQLERRM);
1611: asn_debug.put_line('error ' || x_progress);
1612: END IF;
1613: END derive_io_rcv_line_qty;
1606: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
1607:
1608: IF (g_asn_debug = 'Y') THEN
1609: asn_debug.put_line(TO_CHAR(n));
1610: asn_debug.put_line(SQLERRM);
1611: asn_debug.put_line('error ' || x_progress);
1612: END IF;
1613: END derive_io_rcv_line_qty;
1614:
1607:
1608: IF (g_asn_debug = 'Y') THEN
1609: asn_debug.put_line(TO_CHAR(n));
1610: asn_debug.put_line(SQLERRM);
1611: asn_debug.put_line('error ' || x_progress);
1612: END IF;
1613: END derive_io_rcv_line_qty;
1614:
1615: PROCEDURE derive_trans_del_line_quantity(
1729: l_deliver_to_person_id NUMBER;
1730: l_rsl_count NUMBER;
1731: BEGIN
1732: --At this point shipment_line_id would haven been defaulted/derived
1733: IF (g_asn_debug = 'Y') THEN
1734: asn_debug.put_line('Inside get_deliver_to_person_from_rsl...');
1735: END IF;
1736: IF (x_cascaded_table(n).shipment_line_id is not null) THEN
1737: IF (g_asn_debug = 'Y') THEN
1730: l_rsl_count NUMBER;
1731: BEGIN
1732: --At this point shipment_line_id would haven been defaulted/derived
1733: IF (g_asn_debug = 'Y') THEN
1734: asn_debug.put_line('Inside get_deliver_to_person_from_rsl...');
1735: END IF;
1736: IF (x_cascaded_table(n).shipment_line_id is not null) THEN
1737: IF (g_asn_debug = 'Y') THEN
1738: asn_debug.put_line('Inside rsl is not null..rsl value :'||x_cascaded_table(n).shipment_line_id);
1733: IF (g_asn_debug = 'Y') THEN
1734: asn_debug.put_line('Inside get_deliver_to_person_from_rsl...');
1735: END IF;
1736: IF (x_cascaded_table(n).shipment_line_id is not null) THEN
1737: IF (g_asn_debug = 'Y') THEN
1738: asn_debug.put_line('Inside rsl is not null..rsl value :'||x_cascaded_table(n).shipment_line_id);
1739: END IF;
1740:
1741: BEGIN
1734: asn_debug.put_line('Inside get_deliver_to_person_from_rsl...');
1735: END IF;
1736: IF (x_cascaded_table(n).shipment_line_id is not null) THEN
1737: IF (g_asn_debug = 'Y') THEN
1738: asn_debug.put_line('Inside rsl is not null..rsl value :'||x_cascaded_table(n).shipment_line_id);
1739: END IF;
1740:
1741: BEGIN
1742: select deliver_to_person_id
1744: from rcv_shipment_lines
1745: where shipment_line_id = x_cascaded_table(n).shipment_line_id;
1746:
1747: x_cascaded_table(n).deliver_to_person_id := l_deliver_to_person_id;
1748: IF (g_asn_debug = 'Y') THEN
1749: asn_debug.put_line('defaulted deliver_to_person_id as:'||l_deliver_to_person_id);
1750: END IF;
1751: EXCEPTION
1752: WHEN OTHERS then
1745: where shipment_line_id = x_cascaded_table(n).shipment_line_id;
1746:
1747: x_cascaded_table(n).deliver_to_person_id := l_deliver_to_person_id;
1748: IF (g_asn_debug = 'Y') THEN
1749: asn_debug.put_line('defaulted deliver_to_person_id as:'||l_deliver_to_person_id);
1750: END IF;
1751: EXCEPTION
1752: WHEN OTHERS then
1753: IF (g_asn_debug = 'Y') THEN
1749: asn_debug.put_line('defaulted deliver_to_person_id as:'||l_deliver_to_person_id);
1750: END IF;
1751: EXCEPTION
1752: WHEN OTHERS then
1753: IF (g_asn_debug = 'Y') THEN
1754: asn_debug.put_line('Exception occured while getting deliver_to_person_id thru rsl');
1755: END IF;
1756: END;
1757: ELSIF (x_cascaded_table(n).shipment_header_id is not null) THEN
1750: END IF;
1751: EXCEPTION
1752: WHEN OTHERS then
1753: IF (g_asn_debug = 'Y') THEN
1754: asn_debug.put_line('Exception occured while getting deliver_to_person_id thru rsl');
1755: END IF;
1756: END;
1757: ELSIF (x_cascaded_table(n).shipment_header_id is not null) THEN
1758: IF (g_asn_debug = 'Y') THEN
1754: asn_debug.put_line('Exception occured while getting deliver_to_person_id thru rsl');
1755: END IF;
1756: END;
1757: ELSIF (x_cascaded_table(n).shipment_header_id is not null) THEN
1758: IF (g_asn_debug = 'Y') THEN
1759: asn_debug.put_line('Inside rsh not null..rsh value :'||x_cascaded_table(n).shipment_header_id);
1760: END IF;
1761:
1762: BEGIN
1755: END IF;
1756: END;
1757: ELSIF (x_cascaded_table(n).shipment_header_id is not null) THEN
1758: IF (g_asn_debug = 'Y') THEN
1759: asn_debug.put_line('Inside rsh not null..rsh value :'||x_cascaded_table(n).shipment_header_id);
1760: END IF;
1761:
1762: BEGIN
1763: select count(shipment_line_id)
1764: into l_rsl_count
1765: from rcv_shipment_lines
1766: where shipment_header_id = x_cascaded_table(n).shipment_header_id;
1767:
1768: IF (g_asn_debug = 'Y') THEN
1769: asn_debug.put_line('Inside rsh not null..l_rsl_count:'||l_rsl_count);
1770: END IF;
1771:
1772: IF l_rsl_count = 1 THEN
1765: from rcv_shipment_lines
1766: where shipment_header_id = x_cascaded_table(n).shipment_header_id;
1767:
1768: IF (g_asn_debug = 'Y') THEN
1769: asn_debug.put_line('Inside rsh not null..l_rsl_count:'||l_rsl_count);
1770: END IF;
1771:
1772: IF l_rsl_count = 1 THEN
1773: select deliver_to_person_id
1774: into l_deliver_to_person_id
1775: from rcv_shipment_lines
1776: where shipment_header_id = x_cascaded_table(n).shipment_header_id;
1777: x_cascaded_table(n).deliver_to_person_id := l_deliver_to_person_id;
1778: IF (g_asn_debug = 'Y') THEN
1779: asn_debug.put_line('defaulted deliver_to_person_id as:'||l_deliver_to_person_id);
1780: END IF;
1781: ELSE--l_rsl_count = 1
1782: IF (g_asn_debug = 'Y') THEN
1775: from rcv_shipment_lines
1776: where shipment_header_id = x_cascaded_table(n).shipment_header_id;
1777: x_cascaded_table(n).deliver_to_person_id := l_deliver_to_person_id;
1778: IF (g_asn_debug = 'Y') THEN
1779: asn_debug.put_line('defaulted deliver_to_person_id as:'||l_deliver_to_person_id);
1780: END IF;
1781: ELSE--l_rsl_count = 1
1782: IF (g_asn_debug = 'Y') THEN
1783: asn_debug.put_line('deliver_to_person_id not defalued as rsh has more than 1 rsl');
1778: IF (g_asn_debug = 'Y') THEN
1779: asn_debug.put_line('defaulted deliver_to_person_id as:'||l_deliver_to_person_id);
1780: END IF;
1781: ELSE--l_rsl_count = 1
1782: IF (g_asn_debug = 'Y') THEN
1783: asn_debug.put_line('deliver_to_person_id not defalued as rsh has more than 1 rsl');
1784: END IF;
1785: END IF;--l_rsl_count = 1
1786: EXCEPTION
1779: asn_debug.put_line('defaulted deliver_to_person_id as:'||l_deliver_to_person_id);
1780: END IF;
1781: ELSE--l_rsl_count = 1
1782: IF (g_asn_debug = 'Y') THEN
1783: asn_debug.put_line('deliver_to_person_id not defalued as rsh has more than 1 rsl');
1784: END IF;
1785: END IF;--l_rsl_count = 1
1786: EXCEPTION
1787: WHEN OTHERS then
1784: END IF;
1785: END IF;--l_rsl_count = 1
1786: EXCEPTION
1787: WHEN OTHERS then
1788: IF (g_asn_debug = 'Y') THEN
1789: asn_debug.put_line('Exception occured while getting deliver_to_person_id thru rsh');
1790: END IF;
1791: END;
1792: END IF;--(x_cascaded_table(n).shipment_line_id is not null)
1785: END IF;--l_rsl_count = 1
1786: EXCEPTION
1787: WHEN OTHERS then
1788: IF (g_asn_debug = 'Y') THEN
1789: asn_debug.put_line('Exception occured while getting deliver_to_person_id thru rsh');
1790: END IF;
1791: END;
1792: END IF;--(x_cascaded_table(n).shipment_line_id is not null)
1793: END get_deliver_to_person_from_rsl;
1806: into l_parent_deliver_to_person_id
1807: from rcv_transactions
1808: where transaction_id = x_cascaded_table(n).parent_transaction_id;
1809:
1810: IF (g_asn_debug = 'Y') THEN
1811: asn_debug.put_line('Got deliver_to_person_id of parent txn as:'||l_parent_deliver_to_person_id);
1812: END IF;
1813: return l_parent_deliver_to_person_id;
1814: EXCEPTION
1807: from rcv_transactions
1808: where transaction_id = x_cascaded_table(n).parent_transaction_id;
1809:
1810: IF (g_asn_debug = 'Y') THEN
1811: asn_debug.put_line('Got deliver_to_person_id of parent txn as:'||l_parent_deliver_to_person_id);
1812: END IF;
1813: return l_parent_deliver_to_person_id;
1814: EXCEPTION
1815: WHEN OTHERS then
1812: END IF;
1813: return l_parent_deliver_to_person_id;
1814: EXCEPTION
1815: WHEN OTHERS then
1816: IF (g_asn_debug = 'Y') THEN
1817: asn_debug.put_line('Exception occured in get_deliver_to_person_from_rt');
1818: END IF;
1819: return null;
1820: END get_deliver_to_person_from_rt;
1813: return l_parent_deliver_to_person_id;
1814: EXCEPTION
1815: WHEN OTHERS then
1816: IF (g_asn_debug = 'Y') THEN
1817: asn_debug.put_line('Exception occured in get_deliver_to_person_from_rt');
1818: END IF;
1819: return null;
1820: END get_deliver_to_person_from_rt;
1821:
1834: into l_parent_deliver_to_person_id
1835: from rcv_transactions_interface
1836: where interface_transaction_id = x_cascaded_table(n).parent_transaction_id;
1837:
1838: IF (g_asn_debug = 'Y') THEN
1839: asn_debug.put_line('Got deliver_to_person_id of parent txn as:'||l_parent_deliver_to_person_id);
1840: END IF;
1841: return l_parent_deliver_to_person_id;
1842: EXCEPTION
1835: from rcv_transactions_interface
1836: where interface_transaction_id = x_cascaded_table(n).parent_transaction_id;
1837:
1838: IF (g_asn_debug = 'Y') THEN
1839: asn_debug.put_line('Got deliver_to_person_id of parent txn as:'||l_parent_deliver_to_person_id);
1840: END IF;
1841: return l_parent_deliver_to_person_id;
1842: EXCEPTION
1843: WHEN OTHERS then
1840: END IF;
1841: return l_parent_deliver_to_person_id;
1842: EXCEPTION
1843: WHEN OTHERS then
1844: IF (g_asn_debug = 'Y') THEN
1845: asn_debug.put_line('Exception occured in get_deliver_to_person_from_rti');
1846: END IF;
1847: return null;
1848: END get_deliver_to_person_from_rti;
1841: return l_parent_deliver_to_person_id;
1842: EXCEPTION
1843: WHEN OTHERS then
1844: IF (g_asn_debug = 'Y') THEN
1845: asn_debug.put_line('Exception occured in get_deliver_to_person_from_rti');
1846: END IF;
1847: return null;
1848: END get_deliver_to_person_from_rti;
1849: