1: PACKAGE BODY rcv_transactions_interface_sv AS
2: /* $Header: RCVTISVB.pls 120.3 2007/12/12 19:47:04 vthevark ship $*/
3:
4: -- Read the profile option that enables/disables the debug log
5: g_asn_debug VARCHAR2(1) := NVL(fnd_profile.VALUE('RCV_DEBUG_MODE'), 'N');
6: cascaded_table rcv_shipment_object_sv.cascaded_trans_tab_type;
7: transaction_record rcv_shipment_line_sv.transaction_record_type;
8: item_id_record rcv_shipment_line_sv.item_id_record_type;
9: document_num_record rcv_shipment_line_sv.document_num_record_type;
362: x_allow_rate_override VARCHAR2(1);
363: /* Bug# 1548597 */
364: x_secondary_available_qty NUMBER := 0;
365: BEGIN
366: IF (g_asn_debug = 'Y') THEN
367: asn_debug.put_line('Enter derive_shipment_line');
368: asn_debug.put_line('Current pointer in actual table ' || TO_CHAR(n));
369: asn_debug.put_line('Current error status ' || x_cascaded_table(n).error_status);
370: asn_debug.put_line('To Organization Id ' || NVL(TO_CHAR(x_cascaded_table(n).to_organization_id), 'DUH'));
363: /* Bug# 1548597 */
364: x_secondary_available_qty NUMBER := 0;
365: BEGIN
366: IF (g_asn_debug = 'Y') THEN
367: asn_debug.put_line('Enter derive_shipment_line');
368: asn_debug.put_line('Current pointer in actual table ' || TO_CHAR(n));
369: asn_debug.put_line('Current error status ' || x_cascaded_table(n).error_status);
370: asn_debug.put_line('To Organization Id ' || NVL(TO_CHAR(x_cascaded_table(n).to_organization_id), 'DUH'));
371: asn_debug.put_line('To Organization Code ' || NVL(x_cascaded_table(n).to_organization_code, 'XMA'));
364: x_secondary_available_qty NUMBER := 0;
365: BEGIN
366: IF (g_asn_debug = 'Y') THEN
367: asn_debug.put_line('Enter derive_shipment_line');
368: asn_debug.put_line('Current pointer in actual table ' || TO_CHAR(n));
369: asn_debug.put_line('Current error status ' || x_cascaded_table(n).error_status);
370: asn_debug.put_line('To Organization Id ' || NVL(TO_CHAR(x_cascaded_table(n).to_organization_id), 'DUH'));
371: asn_debug.put_line('To Organization Code ' || NVL(x_cascaded_table(n).to_organization_code, 'XMA'));
372: END IF;
365: BEGIN
366: IF (g_asn_debug = 'Y') THEN
367: asn_debug.put_line('Enter derive_shipment_line');
368: asn_debug.put_line('Current pointer in actual table ' || TO_CHAR(n));
369: asn_debug.put_line('Current error status ' || x_cascaded_table(n).error_status);
370: asn_debug.put_line('To Organization Id ' || NVL(TO_CHAR(x_cascaded_table(n).to_organization_id), 'DUH'));
371: asn_debug.put_line('To Organization Code ' || NVL(x_cascaded_table(n).to_organization_code, 'XMA'));
372: END IF;
373:
366: IF (g_asn_debug = 'Y') THEN
367: asn_debug.put_line('Enter derive_shipment_line');
368: asn_debug.put_line('Current pointer in actual table ' || TO_CHAR(n));
369: asn_debug.put_line('Current error status ' || x_cascaded_table(n).error_status);
370: asn_debug.put_line('To Organization Id ' || NVL(TO_CHAR(x_cascaded_table(n).to_organization_id), 'DUH'));
371: asn_debug.put_line('To Organization Code ' || NVL(x_cascaded_table(n).to_organization_code, 'XMA'));
372: END IF;
373:
374: /* 1887728- Getting the profile option value based on the user_id,
367: asn_debug.put_line('Enter derive_shipment_line');
368: asn_debug.put_line('Current pointer in actual table ' || TO_CHAR(n));
369: asn_debug.put_line('Current error status ' || x_cascaded_table(n).error_status);
370: asn_debug.put_line('To Organization Id ' || NVL(TO_CHAR(x_cascaded_table(n).to_organization_id), 'DUH'));
371: asn_debug.put_line('To Organization Code ' || NVL(x_cascaded_table(n).to_organization_code, 'XMA'));
372: END IF;
373:
374: /* 1887728- Getting the profile option value based on the user_id,
375: resp_id,appl_id
384: x_include_closed_po,
385: defined
386: );
387:
388: IF (g_asn_debug = 'Y') THEN
389: asn_debug.put_line('Include closed PO profile value ' || x_include_closed_po);
390: END IF;
391:
392: x_progress := '000';
385: defined
386: );
387:
388: IF (g_asn_debug = 'Y') THEN
389: asn_debug.put_line('Include closed PO profile value ' || x_include_closed_po);
390: END IF;
391:
392: x_progress := '000';
393:
394: -- default org from header in case it is null at the line level
395:
396: IF x_cascaded_table(n).to_organization_code IS NULL
397: AND x_cascaded_table(n).error_status IN('S', 'W') THEN
398: IF (g_asn_debug = 'Y') THEN
399: asn_debug.put_line('Attempting to default the org from the ship to location');
400: END IF;
401:
402: IF (x_cascaded_table(n).ship_to_location_code IS NOT NULL) THEN
395:
396: IF x_cascaded_table(n).to_organization_code IS NULL
397: AND x_cascaded_table(n).error_status IN('S', 'W') THEN
398: IF (g_asn_debug = 'Y') THEN
399: asn_debug.put_line('Attempting to default the org from the ship to location');
400: END IF;
401:
402: IF (x_cascaded_table(n).ship_to_location_code IS NOT NULL) THEN
403: SELECT MAX(org.organization_code)
408: AND hl.inventory_organization_id = org.organization_id;
409:
410: x_cascaded_table(n).to_organization_code := x_to_organization_code;
411:
412: IF (g_asn_debug = 'Y') THEN
413: asn_debug.put_line('Set Org Code using location code = ' || x_cascaded_table(n).to_organization_code);
414: END IF;
415: END IF;
416:
409:
410: x_cascaded_table(n).to_organization_code := x_to_organization_code;
411:
412: IF (g_asn_debug = 'Y') THEN
413: asn_debug.put_line('Set Org Code using location code = ' || x_cascaded_table(n).to_organization_code);
414: END IF;
415: END IF;
416:
417: IF (x_cascaded_table(n).to_organization_code IS NULL) THEN
414: END IF;
415: END IF;
416:
417: IF (x_cascaded_table(n).to_organization_code IS NULL) THEN
418: IF (g_asn_debug = 'Y') THEN
419: asn_debug.put_line('Will default org change DUH to ' || x_header_record.header_record.ship_to_organization_code);
420: END IF;
421:
422: x_cascaded_table(n).to_organization_code := x_header_record.header_record.ship_to_organization_code;
415: END IF;
416:
417: IF (x_cascaded_table(n).to_organization_code IS NULL) THEN
418: IF (g_asn_debug = 'Y') THEN
419: asn_debug.put_line('Will default org change DUH to ' || x_header_record.header_record.ship_to_organization_code);
420: END IF;
421:
422: x_cascaded_table(n).to_organization_code := x_header_record.header_record.ship_to_organization_code;
423: END IF;
427:
428: IF (x_cascaded_table(n).error_status IN('S', 'W'))
429: AND ( x_cascaded_table(n).to_organization_id IS NULL
430: AND x_cascaded_table(n).to_organization_code IS NOT NULL) THEN
431: IF (g_asn_debug = 'Y') THEN
432: asn_debug.put_line('X_Progress ' || x_progress);
433: END IF;
434:
435: ship_to_org_record.organization_code := x_cascaded_table(n).to_organization_code;
428: IF (x_cascaded_table(n).error_status IN('S', 'W'))
429: AND ( x_cascaded_table(n).to_organization_id IS NULL
430: AND x_cascaded_table(n).to_organization_code IS NOT NULL) THEN
431: IF (g_asn_debug = 'Y') THEN
432: asn_debug.put_line('X_Progress ' || x_progress);
433: END IF;
434:
435: ship_to_org_record.organization_code := x_cascaded_table(n).to_organization_code;
436: ship_to_org_record.organization_id := x_cascaded_table(n).to_organization_id;
436: ship_to_org_record.organization_id := x_cascaded_table(n).to_organization_id;
437: ship_to_org_record.error_record.error_status := 'S';
438: ship_to_org_record.error_record.error_message := NULL;
439:
440: IF (g_asn_debug = 'Y') THEN
441: asn_debug.put_line('Into Derive Organization Record Procedure');
442: END IF;
443:
444: po_orgs_sv.derive_org_info(ship_to_org_record);
437: ship_to_org_record.error_record.error_status := 'S';
438: ship_to_org_record.error_record.error_message := NULL;
439:
440: IF (g_asn_debug = 'Y') THEN
441: asn_debug.put_line('Into Derive Organization Record Procedure');
442: END IF;
443:
444: po_orgs_sv.derive_org_info(ship_to_org_record);
445:
442: END IF;
443:
444: po_orgs_sv.derive_org_info(ship_to_org_record);
445:
446: IF (g_asn_debug = 'Y') THEN
447: asn_debug.put_line('Debug Output after organization procedure');
448: asn_debug.put_line(ship_to_org_record.organization_code);
449: asn_debug.put_line(TO_CHAR(ship_to_org_record.organization_id));
450: asn_debug.put_line(ship_to_org_record.error_record.error_status);
443:
444: po_orgs_sv.derive_org_info(ship_to_org_record);
445:
446: IF (g_asn_debug = 'Y') THEN
447: asn_debug.put_line('Debug Output after organization procedure');
448: asn_debug.put_line(ship_to_org_record.organization_code);
449: asn_debug.put_line(TO_CHAR(ship_to_org_record.organization_id));
450: asn_debug.put_line(ship_to_org_record.error_record.error_status);
451: asn_debug.put_line('Debug organization output over');
444: po_orgs_sv.derive_org_info(ship_to_org_record);
445:
446: IF (g_asn_debug = 'Y') THEN
447: asn_debug.put_line('Debug Output after organization procedure');
448: asn_debug.put_line(ship_to_org_record.organization_code);
449: asn_debug.put_line(TO_CHAR(ship_to_org_record.organization_id));
450: asn_debug.put_line(ship_to_org_record.error_record.error_status);
451: asn_debug.put_line('Debug organization output over');
452: END IF;
445:
446: IF (g_asn_debug = 'Y') THEN
447: asn_debug.put_line('Debug Output after organization procedure');
448: asn_debug.put_line(ship_to_org_record.organization_code);
449: asn_debug.put_line(TO_CHAR(ship_to_org_record.organization_id));
450: asn_debug.put_line(ship_to_org_record.error_record.error_status);
451: asn_debug.put_line('Debug organization output over');
452: END IF;
453:
446: IF (g_asn_debug = 'Y') THEN
447: asn_debug.put_line('Debug Output after organization procedure');
448: asn_debug.put_line(ship_to_org_record.organization_code);
449: asn_debug.put_line(TO_CHAR(ship_to_org_record.organization_id));
450: asn_debug.put_line(ship_to_org_record.error_record.error_status);
451: asn_debug.put_line('Debug organization output over');
452: END IF;
453:
454: x_cascaded_table(n).to_organization_code := ship_to_org_record.organization_code;
447: asn_debug.put_line('Debug Output after organization procedure');
448: asn_debug.put_line(ship_to_org_record.organization_code);
449: asn_debug.put_line(TO_CHAR(ship_to_org_record.organization_id));
450: asn_debug.put_line(ship_to_org_record.error_record.error_status);
451: asn_debug.put_line('Debug organization output over');
452: END IF;
453:
454: x_cascaded_table(n).to_organization_code := ship_to_org_record.organization_code;
455: x_cascaded_table(n).to_organization_id := ship_to_org_record.organization_id;
459:
460: /* Derive Vendor Information */
461: x_progress := '002';
462:
463: IF (g_asn_debug = 'Y') THEN
464: asn_debug.put_line('X_progress ' || x_progress);
465: END IF;
466:
467: IF (x_cascaded_table(n).error_status IN('S', 'W')) THEN
460: /* Derive Vendor Information */
461: x_progress := '002';
462:
463: IF (g_asn_debug = 'Y') THEN
464: asn_debug.put_line('X_progress ' || x_progress);
465: END IF;
466:
467: IF (x_cascaded_table(n).error_status IN('S', 'W')) THEN
468: IF ( x_cascaded_table(n).vendor_name IS NOT NULL
473: vendor_record.vendor_id := x_cascaded_table(n).vendor_id;
474: vendor_record.error_record.error_message := x_cascaded_table(n).error_message;
475: vendor_record.error_record.error_status := x_cascaded_table(n).error_status;
476:
477: IF (g_asn_debug = 'Y') THEN
478: asn_debug.put_line('In Vendor Procedure');
479: END IF;
480:
481: po_vendors_sv.derive_vendor_info(vendor_record);
474: vendor_record.error_record.error_message := x_cascaded_table(n).error_message;
475: vendor_record.error_record.error_status := x_cascaded_table(n).error_status;
476:
477: IF (g_asn_debug = 'Y') THEN
478: asn_debug.put_line('In Vendor Procedure');
479: END IF;
480:
481: po_vendors_sv.derive_vendor_info(vendor_record);
482:
479: END IF;
480:
481: po_vendors_sv.derive_vendor_info(vendor_record);
482:
483: IF (g_asn_debug = 'Y') THEN
484: asn_debug.put_line(TO_CHAR(vendor_record.vendor_id));
485: asn_debug.put_line(vendor_record.vendor_name);
486: asn_debug.put_line(vendor_record.vendor_num);
487: asn_debug.put_line(vendor_record.error_record.error_status);
480:
481: po_vendors_sv.derive_vendor_info(vendor_record);
482:
483: IF (g_asn_debug = 'Y') THEN
484: asn_debug.put_line(TO_CHAR(vendor_record.vendor_id));
485: asn_debug.put_line(vendor_record.vendor_name);
486: asn_debug.put_line(vendor_record.vendor_num);
487: asn_debug.put_line(vendor_record.error_record.error_status);
488: asn_debug.put_line(vendor_record.error_record.error_message);
481: po_vendors_sv.derive_vendor_info(vendor_record);
482:
483: IF (g_asn_debug = 'Y') THEN
484: asn_debug.put_line(TO_CHAR(vendor_record.vendor_id));
485: asn_debug.put_line(vendor_record.vendor_name);
486: asn_debug.put_line(vendor_record.vendor_num);
487: asn_debug.put_line(vendor_record.error_record.error_status);
488: asn_debug.put_line(vendor_record.error_record.error_message);
489: END IF;
482:
483: IF (g_asn_debug = 'Y') THEN
484: asn_debug.put_line(TO_CHAR(vendor_record.vendor_id));
485: asn_debug.put_line(vendor_record.vendor_name);
486: asn_debug.put_line(vendor_record.vendor_num);
487: asn_debug.put_line(vendor_record.error_record.error_status);
488: asn_debug.put_line(vendor_record.error_record.error_message);
489: END IF;
490:
483: IF (g_asn_debug = 'Y') THEN
484: asn_debug.put_line(TO_CHAR(vendor_record.vendor_id));
485: asn_debug.put_line(vendor_record.vendor_name);
486: asn_debug.put_line(vendor_record.vendor_num);
487: asn_debug.put_line(vendor_record.error_record.error_status);
488: asn_debug.put_line(vendor_record.error_record.error_message);
489: END IF;
490:
491: x_cascaded_table(n).vendor_name := vendor_record.vendor_name;
484: asn_debug.put_line(TO_CHAR(vendor_record.vendor_id));
485: asn_debug.put_line(vendor_record.vendor_name);
486: asn_debug.put_line(vendor_record.vendor_num);
487: asn_debug.put_line(vendor_record.error_record.error_status);
488: asn_debug.put_line(vendor_record.error_record.error_message);
489: END IF;
490:
491: x_cascaded_table(n).vendor_name := vendor_record.vendor_name;
492: x_cascaded_table(n).vendor_num := vendor_record.vendor_num;
501: /* UK1 -> vendor_site_id
502: UK2 -> vendor_site_code + vendor_id + org_id */
503: x_progress := '004';
504:
505: IF (g_asn_debug = 'Y') THEN
506: asn_debug.put_line('X_progress ' || x_progress);
507: END IF;
508:
509: IF x_cascaded_table(n).error_status IN('S', 'W')
502: UK2 -> vendor_site_code + vendor_id + org_id */
503: x_progress := '004';
504:
505: IF (g_asn_debug = 'Y') THEN
506: asn_debug.put_line('X_progress ' || x_progress);
507: END IF;
508:
509: IF x_cascaded_table(n).error_status IN('S', 'W')
510: AND ( x_cascaded_table(n).vendor_site_code IS NOT NULL
515: vendor_site_record.organization_id := x_cascaded_table(n).to_organization_id;
516: vendor_site_record.error_record.error_message := x_cascaded_table(n).error_message;
517: vendor_site_record.error_record.error_status := x_cascaded_table(n).error_status;
518:
519: IF (g_asn_debug = 'Y') THEN
520: asn_debug.put_line('In Vendor Site Procedure');
521: END IF;
522:
523: po_vendor_sites_sv.derive_vendor_site_info(vendor_site_record);
516: vendor_site_record.error_record.error_message := x_cascaded_table(n).error_message;
517: vendor_site_record.error_record.error_status := x_cascaded_table(n).error_status;
518:
519: IF (g_asn_debug = 'Y') THEN
520: asn_debug.put_line('In Vendor Site Procedure');
521: END IF;
522:
523: po_vendor_sites_sv.derive_vendor_site_info(vendor_site_record);
524:
521: END IF;
522:
523: po_vendor_sites_sv.derive_vendor_site_info(vendor_site_record);
524:
525: IF (g_asn_debug = 'Y') THEN
526: asn_debug.put_line(vendor_site_record.vendor_site_code);
527: asn_debug.put_line(vendor_site_record.vendor_site_id);
528: END IF;
529:
522:
523: po_vendor_sites_sv.derive_vendor_site_info(vendor_site_record);
524:
525: IF (g_asn_debug = 'Y') THEN
526: asn_debug.put_line(vendor_site_record.vendor_site_code);
527: asn_debug.put_line(vendor_site_record.vendor_site_id);
528: END IF;
529:
530: x_cascaded_table(n).vendor_site_code := vendor_site_record.vendor_site_code;
523: po_vendor_sites_sv.derive_vendor_site_info(vendor_site_record);
524:
525: IF (g_asn_debug = 'Y') THEN
526: asn_debug.put_line(vendor_site_record.vendor_site_code);
527: asn_debug.put_line(vendor_site_record.vendor_site_id);
528: END IF;
529:
530: x_cascaded_table(n).vendor_site_code := vendor_site_record.vendor_site_code;
531: x_cascaded_table(n).vendor_id := vendor_site_record.vendor_id;
536: END IF;
537:
538: x_progress := '005';
539:
540: IF (g_asn_debug = 'Y') THEN
541: asn_debug.put_line('X_progress ' || x_progress);
542: END IF;
543:
544: IF (x_cascaded_table(n).error_status IN('S', 'W'))
537:
538: x_progress := '005';
539:
540: IF (g_asn_debug = 'Y') THEN
541: asn_debug.put_line('X_progress ' || x_progress);
542: END IF;
543:
544: IF (x_cascaded_table(n).error_status IN('S', 'W'))
545: AND ( x_cascaded_table(n).po_header_id IS NULL
543:
544: IF (x_cascaded_table(n).error_status IN('S', 'W'))
545: AND ( x_cascaded_table(n).po_header_id IS NULL
546: AND x_cascaded_table(n).document_num IS NOT NULL) THEN
547: IF (g_asn_debug = 'Y') THEN
548: asn_debug.put_line('X_progress ' || x_progress);
549: END IF;
550:
551: document_num_record.document_num := x_cascaded_table(n).document_num;
544: IF (x_cascaded_table(n).error_status IN('S', 'W'))
545: AND ( x_cascaded_table(n).po_header_id IS NULL
546: AND x_cascaded_table(n).document_num IS NOT NULL) THEN
547: IF (g_asn_debug = 'Y') THEN
548: asn_debug.put_line('X_progress ' || x_progress);
549: END IF;
550:
551: document_num_record.document_num := x_cascaded_table(n).document_num;
552: document_num_record.error_record.error_status := 'S';
551: document_num_record.document_num := x_cascaded_table(n).document_num;
552: document_num_record.error_record.error_status := 'S';
553: document_num_record.error_record.error_message := NULL;
554:
555: IF (g_asn_debug = 'Y') THEN
556: asn_debug.put_line('Derive po_header_id');
557: END IF;
558:
559: rcv_transactions_interface_sv.get_po_header_id(document_num_record);
552: document_num_record.error_record.error_status := 'S';
553: document_num_record.error_record.error_message := NULL;
554:
555: IF (g_asn_debug = 'Y') THEN
556: asn_debug.put_line('Derive po_header_id');
557: END IF;
558:
559: rcv_transactions_interface_sv.get_po_header_id(document_num_record);
560: x_cascaded_table(n).po_header_id := document_num_record.po_header_id;
560: x_cascaded_table(n).po_header_id := document_num_record.po_header_id;
561: x_cascaded_table(n).error_status := document_num_record.error_record.error_status;
562: rcv_error_pkg.set_error_message(document_num_record.error_record.error_message, x_cascaded_table(n).error_message);
563:
564: IF (g_asn_debug = 'Y') THEN
565: asn_debug.put_line(TO_CHAR(x_cascaded_table(n).po_header_id));
566: END IF;
567:
568: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status,
561: x_cascaded_table(n).error_status := document_num_record.error_record.error_status;
562: rcv_error_pkg.set_error_message(document_num_record.error_record.error_message, x_cascaded_table(n).error_message);
563:
564: IF (g_asn_debug = 'Y') THEN
565: asn_debug.put_line(TO_CHAR(x_cascaded_table(n).po_header_id));
566: END IF;
567:
568: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status,
569: 'DOCUMENT_NUM',
575:
576: IF (x_cascaded_table(n).error_status IN('S', 'W'))
577: AND ( x_cascaded_table(n).item_id IS NULL
578: AND (x_cascaded_table(n).item_num IS NOT NULL)) THEN
579: IF (g_asn_debug = 'Y') THEN
580: asn_debug.put_line('X_progress ' || x_progress);
581: END IF;
582:
583: item_id_record.item_num := x_cascaded_table(n).item_num;
576: IF (x_cascaded_table(n).error_status IN('S', 'W'))
577: AND ( x_cascaded_table(n).item_id IS NULL
578: AND (x_cascaded_table(n).item_num IS NOT NULL)) THEN
579: IF (g_asn_debug = 'Y') THEN
580: asn_debug.put_line('X_progress ' || x_progress);
581: END IF;
582:
583: item_id_record.item_num := x_cascaded_table(n).item_num;
584: item_id_record.vendor_item_num := NULL; -- x_cascaded_table(n).vendor_item_num;
585: item_id_record.to_organization_id := x_cascaded_table(n).to_organization_id;
586: item_id_record.error_record.error_status := 'S';
587: item_id_record.error_record.error_message := NULL;
588:
589: IF (g_asn_debug = 'Y') THEN
590: asn_debug.put_line('Derive item_id');
591: END IF;
592:
593: rcv_transactions_interface_sv.get_item_id(item_id_record);
586: item_id_record.error_record.error_status := 'S';
587: item_id_record.error_record.error_message := NULL;
588:
589: IF (g_asn_debug = 'Y') THEN
590: asn_debug.put_line('Derive item_id');
591: END IF;
592:
593: rcv_transactions_interface_sv.get_item_id(item_id_record);
594: x_cascaded_table(n).item_id := item_id_record.item_id;
615:
616: IF (x_cascaded_table(n).error_status IN('S', 'W'))
617: AND ( x_cascaded_table(n).substitute_item_id IS NULL
618: AND (x_cascaded_table(n).substitute_item_num IS NOT NULL)) THEN
619: IF (g_asn_debug = 'Y') THEN
620: asn_debug.put_line('X_progress ' || x_progress);
621: END IF;
622:
623: sub_item_id_record.substitute_item_num := x_cascaded_table(n).substitute_item_num;
616: IF (x_cascaded_table(n).error_status IN('S', 'W'))
617: AND ( x_cascaded_table(n).substitute_item_id IS NULL
618: AND (x_cascaded_table(n).substitute_item_num IS NOT NULL)) THEN
619: IF (g_asn_debug = 'Y') THEN
620: asn_debug.put_line('X_progress ' || x_progress);
621: END IF;
622:
623: sub_item_id_record.substitute_item_num := x_cascaded_table(n).substitute_item_num;
624: sub_item_id_record.vendor_item_num := NULL; -- x_cascaded_table(n).vendor_item_num;
624: sub_item_id_record.vendor_item_num := NULL; -- x_cascaded_table(n).vendor_item_num;
625: sub_item_id_record.error_record.error_status := 'S';
626: sub_item_id_record.error_record.error_message := NULL;
627:
628: IF (g_asn_debug = 'Y') THEN
629: asn_debug.put_line('Derive Substitute Item Id');
630: END IF;
631:
632: rcv_transactions_interface_sv.get_sub_item_id(sub_item_id_record);
625: sub_item_id_record.error_record.error_status := 'S';
626: sub_item_id_record.error_record.error_message := NULL;
627:
628: IF (g_asn_debug = 'Y') THEN
629: asn_debug.put_line('Derive Substitute Item Id');
630: END IF;
631:
632: rcv_transactions_interface_sv.get_sub_item_id(sub_item_id_record);
633: x_cascaded_table(n).substitute_item_id := sub_item_id_record.substitute_item_id;
637: 'SUBSTITUTE_ITEM_NUM',
638: FALSE
639: );
640:
641: IF (g_asn_debug = 'Y') THEN
642: asn_debug.put_line(TO_CHAR(x_cascaded_table(n).substitute_item_id));
643: END IF;
644: END IF;
645:
638: FALSE
639: );
640:
641: IF (g_asn_debug = 'Y') THEN
642: asn_debug.put_line(TO_CHAR(x_cascaded_table(n).substitute_item_id));
643: END IF;
644: END IF;
645:
646: x_progress := '020';
648: IF (x_cascaded_table(n).error_status IN('S', 'W'))
649: AND ( x_cascaded_table(n).po_line_id IS NULL
650: AND x_cascaded_table(n).po_header_id IS NOT NULL
651: AND x_cascaded_table(n).document_line_num IS NOT NULL) THEN
652: IF (g_asn_debug = 'Y') THEN
653: asn_debug.put_line('X_progress ' || x_progress);
654: END IF;
655:
656: po_line_id_record.po_header_id := x_cascaded_table(n).po_header_id;
649: AND ( x_cascaded_table(n).po_line_id IS NULL
650: AND x_cascaded_table(n).po_header_id IS NOT NULL
651: AND x_cascaded_table(n).document_line_num IS NOT NULL) THEN
652: IF (g_asn_debug = 'Y') THEN
653: asn_debug.put_line('X_progress ' || x_progress);
654: END IF;
655:
656: po_line_id_record.po_header_id := x_cascaded_table(n).po_header_id;
657: po_line_id_record.document_line_num := x_cascaded_table(n).document_line_num;
659: po_line_id_record.item_id := x_cascaded_table(n).item_id;
660: po_line_id_record.error_record.error_status := 'S';
661: po_line_id_record.error_record.error_message := NULL;
662:
663: IF (g_asn_debug = 'Y') THEN
664: asn_debug.put_line('Derive po_line_id');
665: END IF;
666:
667: rcv_transactions_interface_sv.get_po_line_id(po_line_id_record);
660: po_line_id_record.error_record.error_status := 'S';
661: po_line_id_record.error_record.error_message := NULL;
662:
663: IF (g_asn_debug = 'Y') THEN
664: asn_debug.put_line('Derive po_line_id');
665: END IF;
666:
667: rcv_transactions_interface_sv.get_po_line_id(po_line_id_record);
668:
677: 'DOCUMENT_LINE_NUM',
678: FALSE
679: );
680:
681: IF (g_asn_debug = 'Y') THEN
682: asn_debug.put_line(TO_CHAR(x_cascaded_table(n).po_line_id));
683: END IF;
684: END IF;
685:
678: FALSE
679: );
680:
681: IF (g_asn_debug = 'Y') THEN
682: asn_debug.put_line(TO_CHAR(x_cascaded_table(n).po_line_id));
683: END IF;
684: END IF;
685:
686: -- Get the primary uom in case item_id was determined on the basis of the po_line_id
699: FROM mtl_system_items
700: WHERE mtl_system_items.inventory_item_id = x_cascaded_table(n).item_id
701: AND mtl_system_items.organization_id = x_cascaded_table(n).to_organization_id;
702:
703: IF (g_asn_debug = 'Y') THEN
704: asn_debug.put_line('Primary UOM: ' || x_cascaded_table(n).primary_unit_of_measure);
705: END IF;
706: EXCEPTION
707: WHEN NO_DATA_FOUND THEN
700: WHERE mtl_system_items.inventory_item_id = x_cascaded_table(n).item_id
701: AND mtl_system_items.organization_id = x_cascaded_table(n).to_organization_id;
702:
703: IF (g_asn_debug = 'Y') THEN
704: asn_debug.put_line('Primary UOM: ' || x_cascaded_table(n).primary_unit_of_measure);
705: END IF;
706: EXCEPTION
707: WHEN NO_DATA_FOUND THEN
708: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_warning;
710: rcv_error_pkg.set_token('PRIMARY_UNIT', '');
711: rcv_error_pkg.set_token('SHIPMENT_UNIT', '');
712: rcv_error_pkg.log_interface_warning('ITEM_ID');
713:
714: IF (g_asn_debug = 'Y') THEN
715: asn_debug.put_line('Primary UOM error');
716: END IF;
717: END;
718: END IF;
711: rcv_error_pkg.set_token('SHIPMENT_UNIT', '');
712: rcv_error_pkg.log_interface_warning('ITEM_ID');
713:
714: IF (g_asn_debug = 'Y') THEN
715: asn_debug.put_line('Primary UOM error');
716: END IF;
717: END;
718: END IF;
719:
727: /* Bug 2020269 : uom_code needs to be derived from unit_of_measure
728: entered in rcv_transactions_interface.
729: */
730: IF (x_cascaded_table(n).unit_of_measure IS NOT NULL) THEN
731: IF (g_asn_debug = 'Y') THEN
732: asn_debug.put_line('X_progress ' || x_progress);
733: END IF;
734:
735: SELECT muom.uom_code
728: entered in rcv_transactions_interface.
729: */
730: IF (x_cascaded_table(n).unit_of_measure IS NOT NULL) THEN
731: IF (g_asn_debug = 'Y') THEN
732: asn_debug.put_line('X_progress ' || x_progress);
733: END IF;
734:
735: SELECT muom.uom_code
736: INTO x_cascaded_table(n).uom_code
736: INTO x_cascaded_table(n).uom_code
737: FROM mtl_units_of_measure muom
738: WHERE muom.unit_of_measure = x_cascaded_table(n).unit_of_measure;
739: ELSE
740: IF (g_asn_debug = 'Y') THEN
741: asn_debug.put_line('uom_code not dereived as unit_of_measure is null');
742: END IF;
743: END IF;
744:
737: FROM mtl_units_of_measure muom
738: WHERE muom.unit_of_measure = x_cascaded_table(n).unit_of_measure;
739: ELSE
740: IF (g_asn_debug = 'Y') THEN
741: asn_debug.put_line('uom_code not dereived as unit_of_measure is null');
742: END IF;
743: END IF;
744:
745: x_progress := '026';
747: IF (x_cascaded_table(n).error_status IN('S', 'W'))
748: AND x_cascaded_table(n).po_release_id IS NULL
749: AND -- Maybe we need an or with shipnum,relnum
750: x_cascaded_table(n).po_header_id IS NOT NULL THEN
751: IF (g_asn_debug = 'Y') THEN
752: asn_debug.put_line('X_progress ' || x_progress);
753: END IF;
754:
755: release_id_record.po_header_id := x_cascaded_table(n).po_header_id;
748: AND x_cascaded_table(n).po_release_id IS NULL
749: AND -- Maybe we need an or with shipnum,relnum
750: x_cascaded_table(n).po_header_id IS NOT NULL THEN
751: IF (g_asn_debug = 'Y') THEN
752: asn_debug.put_line('X_progress ' || x_progress);
753: END IF;
754:
755: release_id_record.po_header_id := x_cascaded_table(n).po_header_id;
756: release_id_record.release_num := x_cascaded_table(n).release_num;
758: release_id_record.shipment_num := x_cascaded_table(n).document_shipment_line_num;
759: release_id_record.error_record.error_status := 'S';
760: release_id_record.error_record.error_message := NULL;
761:
762: IF (g_asn_debug = 'Y') THEN
763: asn_debug.put_line('Derive po_line_location_id, shipment_num, po_release_id');
764: END IF;
765:
766: IF (g_asn_debug = 'Y') THEN
759: release_id_record.error_record.error_status := 'S';
760: release_id_record.error_record.error_message := NULL;
761:
762: IF (g_asn_debug = 'Y') THEN
763: asn_debug.put_line('Derive po_line_location_id, shipment_num, po_release_id');
764: END IF;
765:
766: IF (g_asn_debug = 'Y') THEN
767: asn_debug.put_line('### po_header_id ' || release_id_record.po_header_id);
762: IF (g_asn_debug = 'Y') THEN
763: asn_debug.put_line('Derive po_line_location_id, shipment_num, po_release_id');
764: END IF;
765:
766: IF (g_asn_debug = 'Y') THEN
767: asn_debug.put_line('### po_header_id ' || release_id_record.po_header_id);
768: asn_debug.put_line('### release_num ' || release_id_record.release_num);
769: asn_debug.put_line('### po_line_id ' || release_id_record.po_line_id);
770: asn_debug.put_line('### shipment_num ' || release_id_record.shipment_num);
763: asn_debug.put_line('Derive po_line_location_id, shipment_num, po_release_id');
764: END IF;
765:
766: IF (g_asn_debug = 'Y') THEN
767: asn_debug.put_line('### po_header_id ' || release_id_record.po_header_id);
768: asn_debug.put_line('### release_num ' || release_id_record.release_num);
769: asn_debug.put_line('### po_line_id ' || release_id_record.po_line_id);
770: asn_debug.put_line('### shipment_num ' || release_id_record.shipment_num);
771: asn_debug.put_line('### po_rel_id ' || release_id_record.po_release_id);
764: END IF;
765:
766: IF (g_asn_debug = 'Y') THEN
767: asn_debug.put_line('### po_header_id ' || release_id_record.po_header_id);
768: asn_debug.put_line('### release_num ' || release_id_record.release_num);
769: asn_debug.put_line('### po_line_id ' || release_id_record.po_line_id);
770: asn_debug.put_line('### shipment_num ' || release_id_record.shipment_num);
771: asn_debug.put_line('### po_rel_id ' || release_id_record.po_release_id);
772: END IF;
765:
766: IF (g_asn_debug = 'Y') THEN
767: asn_debug.put_line('### po_header_id ' || release_id_record.po_header_id);
768: asn_debug.put_line('### release_num ' || release_id_record.release_num);
769: asn_debug.put_line('### po_line_id ' || release_id_record.po_line_id);
770: asn_debug.put_line('### shipment_num ' || release_id_record.shipment_num);
771: asn_debug.put_line('### po_rel_id ' || release_id_record.po_release_id);
772: END IF;
773:
766: IF (g_asn_debug = 'Y') THEN
767: asn_debug.put_line('### po_header_id ' || release_id_record.po_header_id);
768: asn_debug.put_line('### release_num ' || release_id_record.release_num);
769: asn_debug.put_line('### po_line_id ' || release_id_record.po_line_id);
770: asn_debug.put_line('### shipment_num ' || release_id_record.shipment_num);
771: asn_debug.put_line('### po_rel_id ' || release_id_record.po_release_id);
772: END IF;
773:
774: po_releases_sv4.get_po_release_id(release_id_record);
767: asn_debug.put_line('### po_header_id ' || release_id_record.po_header_id);
768: asn_debug.put_line('### release_num ' || release_id_record.release_num);
769: asn_debug.put_line('### po_line_id ' || release_id_record.po_line_id);
770: asn_debug.put_line('### shipment_num ' || release_id_record.shipment_num);
771: asn_debug.put_line('### po_rel_id ' || release_id_record.po_release_id);
772: END IF;
773:
774: po_releases_sv4.get_po_release_id(release_id_record);
775:
772: END IF;
773:
774: po_releases_sv4.get_po_release_id(release_id_record);
775:
776: IF (g_asn_debug = 'Y') THEN
777: asn_debug.put_line('^^^ po_header_id ' || release_id_record.po_header_id);
778: asn_debug.put_line('^^^ release_num ' || release_id_record.release_num);
779: asn_debug.put_line('^^^ po_line_id ' || release_id_record.po_line_id);
780: asn_debug.put_line('^^^ shipment_num ' || release_id_record.shipment_num);
773:
774: po_releases_sv4.get_po_release_id(release_id_record);
775:
776: IF (g_asn_debug = 'Y') THEN
777: asn_debug.put_line('^^^ po_header_id ' || release_id_record.po_header_id);
778: asn_debug.put_line('^^^ release_num ' || release_id_record.release_num);
779: asn_debug.put_line('^^^ po_line_id ' || release_id_record.po_line_id);
780: asn_debug.put_line('^^^ shipment_num ' || release_id_record.shipment_num);
781: asn_debug.put_line('^^^ po_rel_id ' || release_id_record.po_release_id);
774: po_releases_sv4.get_po_release_id(release_id_record);
775:
776: IF (g_asn_debug = 'Y') THEN
777: asn_debug.put_line('^^^ po_header_id ' || release_id_record.po_header_id);
778: asn_debug.put_line('^^^ release_num ' || release_id_record.release_num);
779: asn_debug.put_line('^^^ po_line_id ' || release_id_record.po_line_id);
780: asn_debug.put_line('^^^ shipment_num ' || release_id_record.shipment_num);
781: asn_debug.put_line('^^^ po_rel_id ' || release_id_record.po_release_id);
782: END IF;
775:
776: IF (g_asn_debug = 'Y') THEN
777: asn_debug.put_line('^^^ po_header_id ' || release_id_record.po_header_id);
778: asn_debug.put_line('^^^ release_num ' || release_id_record.release_num);
779: asn_debug.put_line('^^^ po_line_id ' || release_id_record.po_line_id);
780: asn_debug.put_line('^^^ shipment_num ' || release_id_record.shipment_num);
781: asn_debug.put_line('^^^ po_rel_id ' || release_id_record.po_release_id);
782: END IF;
783:
776: IF (g_asn_debug = 'Y') THEN
777: asn_debug.put_line('^^^ po_header_id ' || release_id_record.po_header_id);
778: asn_debug.put_line('^^^ release_num ' || release_id_record.release_num);
779: asn_debug.put_line('^^^ po_line_id ' || release_id_record.po_line_id);
780: asn_debug.put_line('^^^ shipment_num ' || release_id_record.shipment_num);
781: asn_debug.put_line('^^^ po_rel_id ' || release_id_record.po_release_id);
782: END IF;
783:
784: IF x_cascaded_table(n).po_line_location_id IS NULL THEN
777: asn_debug.put_line('^^^ po_header_id ' || release_id_record.po_header_id);
778: asn_debug.put_line('^^^ release_num ' || release_id_record.release_num);
779: asn_debug.put_line('^^^ po_line_id ' || release_id_record.po_line_id);
780: asn_debug.put_line('^^^ shipment_num ' || release_id_record.shipment_num);
781: asn_debug.put_line('^^^ po_rel_id ' || release_id_record.po_release_id);
782: END IF;
783:
784: IF x_cascaded_table(n).po_line_location_id IS NULL THEN
785: x_cascaded_table(n).po_line_location_id := release_id_record.po_line_location_id;
783:
784: IF x_cascaded_table(n).po_line_location_id IS NULL THEN
785: x_cascaded_table(n).po_line_location_id := release_id_record.po_line_location_id;
786:
787: IF (g_asn_debug = 'Y') THEN
788: asn_debug.put_line('PO_LINE_LOCATION_ID ' || TO_CHAR(x_cascaded_table(n).po_line_location_id));
789: END IF;
790: END IF;
791:
784: IF x_cascaded_table(n).po_line_location_id IS NULL THEN
785: x_cascaded_table(n).po_line_location_id := release_id_record.po_line_location_id;
786:
787: IF (g_asn_debug = 'Y') THEN
788: asn_debug.put_line('PO_LINE_LOCATION_ID ' || TO_CHAR(x_cascaded_table(n).po_line_location_id));
789: END IF;
790: END IF;
791:
792: IF x_cascaded_table(n).document_shipment_line_num IS NULL THEN
791:
792: IF x_cascaded_table(n).document_shipment_line_num IS NULL THEN
793: x_cascaded_table(n).document_shipment_line_num := release_id_record.shipment_num;
794:
795: IF (g_asn_debug = 'Y') THEN
796: asn_debug.put_line('DOCUMENT_SHIPMENT_NUM ' || TO_CHAR(x_cascaded_table(n).document_shipment_line_num));
797: END IF;
798: END IF;
799:
792: IF x_cascaded_table(n).document_shipment_line_num IS NULL THEN
793: x_cascaded_table(n).document_shipment_line_num := release_id_record.shipment_num;
794:
795: IF (g_asn_debug = 'Y') THEN
796: asn_debug.put_line('DOCUMENT_SHIPMENT_NUM ' || TO_CHAR(x_cascaded_table(n).document_shipment_line_num));
797: END IF;
798: END IF;
799:
800: x_cascaded_table(n).po_release_id := release_id_record.po_release_id;
809: 'DOCUMENT_LINE_NUM',
810: FALSE
811: );
812:
813: IF (g_asn_debug = 'Y') THEN
814: asn_debug.put_line('PO_RELEASE_ID ' || TO_CHAR(x_cascaded_table(n).po_release_id));
815: END IF;
816: END IF;
817:
810: FALSE
811: );
812:
813: IF (g_asn_debug = 'Y') THEN
814: asn_debug.put_line('PO_RELEASE_ID ' || TO_CHAR(x_cascaded_table(n).po_release_id));
815: END IF;
816: END IF;
817:
818: x_progress := '030';
819:
820: IF (x_cascaded_table(n).error_status IN('S', 'W'))
821: AND ( x_cascaded_table(n).from_organization_id IS NULL
822: AND x_cascaded_table(n).from_organization_code IS NOT NULL) THEN
823: IF (g_asn_debug = 'Y') THEN
824: asn_debug.put_line('X_progress ' || x_progress);
825: END IF;
826:
827: ship_to_org_record.organization_code := x_cascaded_table(n).from_organization_code;
820: IF (x_cascaded_table(n).error_status IN('S', 'W'))
821: AND ( x_cascaded_table(n).from_organization_id IS NULL
822: AND x_cascaded_table(n).from_organization_code IS NOT NULL) THEN
823: IF (g_asn_debug = 'Y') THEN
824: asn_debug.put_line('X_progress ' || x_progress);
825: END IF;
826:
827: ship_to_org_record.organization_code := x_cascaded_table(n).from_organization_code;
828: ship_to_org_record.organization_id := x_cascaded_table(n).from_organization_id;
828: ship_to_org_record.organization_id := x_cascaded_table(n).from_organization_id;
829: ship_to_org_record.error_record.error_status := 'S';
830: ship_to_org_record.error_record.error_message := NULL;
831:
832: IF (g_asn_debug = 'Y') THEN
833: asn_debug.put_line('In From Organization Procedure');
834: END IF;
835:
836: po_orgs_sv.derive_org_info(ship_to_org_record);
829: ship_to_org_record.error_record.error_status := 'S';
830: ship_to_org_record.error_record.error_message := NULL;
831:
832: IF (g_asn_debug = 'Y') THEN
833: asn_debug.put_line('In From Organization Procedure');
834: END IF;
835:
836: po_orgs_sv.derive_org_info(ship_to_org_record);
837:
834: END IF;
835:
836: po_orgs_sv.derive_org_info(ship_to_org_record);
837:
838: IF (g_asn_debug = 'Y') THEN
839: asn_debug.put_line('From organization code ' || ship_to_org_record.organization_code);
840: asn_debug.put_line('From organization id ' || TO_CHAR(ship_to_org_record.organization_id));
841: asn_debug.put_line('From organization error status ' || ship_to_org_record.error_record.error_status);
842: END IF;
835:
836: po_orgs_sv.derive_org_info(ship_to_org_record);
837:
838: IF (g_asn_debug = 'Y') THEN
839: asn_debug.put_line('From organization code ' || ship_to_org_record.organization_code);
840: asn_debug.put_line('From organization id ' || TO_CHAR(ship_to_org_record.organization_id));
841: asn_debug.put_line('From organization error status ' || ship_to_org_record.error_record.error_status);
842: END IF;
843:
836: po_orgs_sv.derive_org_info(ship_to_org_record);
837:
838: IF (g_asn_debug = 'Y') THEN
839: asn_debug.put_line('From organization code ' || ship_to_org_record.organization_code);
840: asn_debug.put_line('From organization id ' || TO_CHAR(ship_to_org_record.organization_id));
841: asn_debug.put_line('From organization error status ' || ship_to_org_record.error_record.error_status);
842: END IF;
843:
844: x_cascaded_table(n).from_organization_code := ship_to_org_record.organization_code;
837:
838: IF (g_asn_debug = 'Y') THEN
839: asn_debug.put_line('From organization code ' || ship_to_org_record.organization_code);
840: asn_debug.put_line('From organization id ' || TO_CHAR(ship_to_org_record.organization_id));
841: asn_debug.put_line('From organization error status ' || ship_to_org_record.error_record.error_status);
842: END IF;
843:
844: x_cascaded_table(n).from_organization_code := ship_to_org_record.organization_code;
845: x_cascaded_table(n).from_organization_id := ship_to_org_record.organization_id;
855:
856: IF (x_cascaded_table(n).error_status IN('S', 'W'))
857: AND ( x_cascaded_table(n).intransit_owning_org_id IS NULL
858: AND x_cascaded_table(n).intransit_owning_org_code IS NOT NULL) THEN
859: IF (g_asn_debug = 'Y') THEN
860: asn_debug.put_line('X_progress ' || x_progress);
861: END IF;
862:
863: ship_to_org_record.organization_code := x_cascaded_table(n).intransit_owning_org_code;
856: IF (x_cascaded_table(n).error_status IN('S', 'W'))
857: AND ( x_cascaded_table(n).intransit_owning_org_id IS NULL
858: AND x_cascaded_table(n).intransit_owning_org_code IS NOT NULL) THEN
859: IF (g_asn_debug = 'Y') THEN
860: asn_debug.put_line('X_progress ' || x_progress);
861: END IF;
862:
863: ship_to_org_record.organization_code := x_cascaded_table(n).intransit_owning_org_code;
864: ship_to_org_record.organization_id := x_cascaded_table(n).intransit_owning_org_id;
864: ship_to_org_record.organization_id := x_cascaded_table(n).intransit_owning_org_id;
865: ship_to_org_record.error_record.error_status := 'S';
866: ship_to_org_record.error_record.error_message := NULL;
867:
868: IF (g_asn_debug = 'Y') THEN
869: asn_debug.put_line('In Intransit Owning Org Record Procedure');
870: END IF;
871:
872: po_orgs_sv.derive_org_info(ship_to_org_record);
865: ship_to_org_record.error_record.error_status := 'S';
866: ship_to_org_record.error_record.error_message := NULL;
867:
868: IF (g_asn_debug = 'Y') THEN
869: asn_debug.put_line('In Intransit Owning Org Record Procedure');
870: END IF;
871:
872: po_orgs_sv.derive_org_info(ship_to_org_record);
873:
870: END IF;
871:
872: po_orgs_sv.derive_org_info(ship_to_org_record);
873:
874: IF (g_asn_debug = 'Y') THEN
875: asn_debug.put_line('Intransit organization code ' || ship_to_org_record.organization_code);
876: asn_debug.put_line('Intransit organization id ' || TO_CHAR(ship_to_org_record.organization_id));
877: asn_debug.put_line('Intransit error status ' || ship_to_org_record.error_record.error_status);
878: END IF;
871:
872: po_orgs_sv.derive_org_info(ship_to_org_record);
873:
874: IF (g_asn_debug = 'Y') THEN
875: asn_debug.put_line('Intransit organization code ' || ship_to_org_record.organization_code);
876: asn_debug.put_line('Intransit organization id ' || TO_CHAR(ship_to_org_record.organization_id));
877: asn_debug.put_line('Intransit error status ' || ship_to_org_record.error_record.error_status);
878: END IF;
879:
872: po_orgs_sv.derive_org_info(ship_to_org_record);
873:
874: IF (g_asn_debug = 'Y') THEN
875: asn_debug.put_line('Intransit organization code ' || ship_to_org_record.organization_code);
876: asn_debug.put_line('Intransit organization id ' || TO_CHAR(ship_to_org_record.organization_id));
877: asn_debug.put_line('Intransit error status ' || ship_to_org_record.error_record.error_status);
878: END IF;
879:
880: x_cascaded_table(n).intransit_owning_org_code := ship_to_org_record.organization_code;
873:
874: IF (g_asn_debug = 'Y') THEN
875: asn_debug.put_line('Intransit organization code ' || ship_to_org_record.organization_code);
876: asn_debug.put_line('Intransit organization id ' || TO_CHAR(ship_to_org_record.organization_id));
877: asn_debug.put_line('Intransit error status ' || ship_to_org_record.error_record.error_status);
878: END IF;
879:
880: x_cascaded_table(n).intransit_owning_org_code := ship_to_org_record.organization_code;
881: x_cascaded_table(n).intransit_owning_org_id := ship_to_org_record.organization_id;
891:
892: IF (x_cascaded_table(n).error_status IN('S', 'W'))
893: AND ( x_cascaded_table(n).location_id IS NULL
894: AND x_cascaded_table(n).location_code IS NOT NULL) THEN
895: IF (g_asn_debug = 'Y') THEN
896: asn_debug.put_line('X_progress ' || x_progress);
897: END IF;
898:
899: location_id_record.location_code := x_cascaded_table(n).location_code;
892: IF (x_cascaded_table(n).error_status IN('S', 'W'))
893: AND ( x_cascaded_table(n).location_id IS NULL
894: AND x_cascaded_table(n).location_code IS NOT NULL) THEN
895: IF (g_asn_debug = 'Y') THEN
896: asn_debug.put_line('X_progress ' || x_progress);
897: END IF;
898:
899: location_id_record.location_code := x_cascaded_table(n).location_code;
900: location_id_record.error_record.error_status := 'S';
899: location_id_record.location_code := x_cascaded_table(n).location_code;
900: location_id_record.error_record.error_status := 'S';
901: location_id_record.error_record.error_message := NULL;
902:
903: IF (g_asn_debug = 'Y') THEN
904: asn_debug.put_line('Derive location_id');
905: END IF;
906:
907: rcv_transactions_interface_sv.get_location_id(location_id_record);
900: location_id_record.error_record.error_status := 'S';
901: location_id_record.error_record.error_message := NULL;
902:
903: IF (g_asn_debug = 'Y') THEN
904: asn_debug.put_line('Derive location_id');
905: END IF;
906:
907: rcv_transactions_interface_sv.get_location_id(location_id_record);
908: x_cascaded_table(n).location_id := location_id_record.location_id;
920:
921: IF (x_cascaded_table(n).error_status IN('S', 'W'))
922: AND ( x_cascaded_table(n).ship_to_location_id IS NULL
923: AND x_cascaded_table(n).ship_to_location_code IS NOT NULL) THEN
924: IF (g_asn_debug = 'Y') THEN
925: asn_debug.put_line('X_progress ' || x_progress);
926: END IF;
927:
928: location_id_record.location_code := x_cascaded_table(n).ship_to_location_code;
921: IF (x_cascaded_table(n).error_status IN('S', 'W'))
922: AND ( x_cascaded_table(n).ship_to_location_id IS NULL
923: AND x_cascaded_table(n).ship_to_location_code IS NOT NULL) THEN
924: IF (g_asn_debug = 'Y') THEN
925: asn_debug.put_line('X_progress ' || x_progress);
926: END IF;
927:
928: location_id_record.location_code := x_cascaded_table(n).ship_to_location_code;
929: location_id_record.error_record.error_status := 'S';
928: location_id_record.location_code := x_cascaded_table(n).ship_to_location_code;
929: location_id_record.error_record.error_status := 'S';
930: location_id_record.error_record.error_message := NULL;
931:
932: IF (g_asn_debug = 'Y') THEN
933: asn_debug.put_line('Derive ship to location_id');
934: END IF;
935:
936: rcv_transactions_interface_sv.get_location_id(location_id_record);
929: location_id_record.error_record.error_status := 'S';
930: location_id_record.error_record.error_message := NULL;
931:
932: IF (g_asn_debug = 'Y') THEN
933: asn_debug.put_line('Derive ship to location_id');
934: END IF;
935:
936: rcv_transactions_interface_sv.get_location_id(location_id_record);
937: x_cascaded_table(n).ship_to_location_id := location_id_record.location_id;
947:
948: IF (x_cascaded_table(n).error_status IN('S', 'W'))
949: AND ( x_cascaded_table(n).routing_header_id IS NULL
950: AND x_cascaded_table(n).routing_code IS NOT NULL) THEN
951: IF (g_asn_debug = 'Y') THEN
952: asn_debug.put_line('X_progress ' || x_progress);
953: END IF;
954:
955: routing_header_id_record.routing_code := x_cascaded_table(n).routing_code;
948: IF (x_cascaded_table(n).error_status IN('S', 'W'))
949: AND ( x_cascaded_table(n).routing_header_id IS NULL
950: AND x_cascaded_table(n).routing_code IS NOT NULL) THEN
951: IF (g_asn_debug = 'Y') THEN
952: asn_debug.put_line('X_progress ' || x_progress);
953: END IF;
954:
955: routing_header_id_record.routing_code := x_cascaded_table(n).routing_code;
956: routing_header_id_record.error_record.error_status := 'S';
955: routing_header_id_record.routing_code := x_cascaded_table(n).routing_code;
956: routing_header_id_record.error_record.error_status := 'S';
957: routing_header_id_record.error_record.error_message := NULL;
958:
959: IF (g_asn_debug = 'Y') THEN
960: asn_debug.put_line('Derive routing_header_id');
961: END IF;
962:
963: rcv_transactions_interface_sv.get_routing_header_id(routing_header_id_record);
956: routing_header_id_record.error_record.error_status := 'S';
957: routing_header_id_record.error_record.error_message := NULL;
958:
959: IF (g_asn_debug = 'Y') THEN
960: asn_debug.put_line('Derive routing_header_id');
961: END IF;
962:
963: rcv_transactions_interface_sv.get_routing_header_id(routing_header_id_record);
964: x_cascaded_table(n).routing_header_id := routing_header_id_record.routing_header_id;
974:
975: IF (x_cascaded_table(n).error_status IN('S', 'W'))
976: AND ( x_cascaded_table(n).routing_step_id IS NULL
977: AND x_cascaded_table(n).routing_step IS NOT NULL) THEN
978: IF (g_asn_debug = 'Y') THEN
979: asn_debug.put_line('X_progress ' || x_progress);
980: END IF;
981:
982: routing_step_id_record.routing_step := x_cascaded_table(n).routing_step;
975: IF (x_cascaded_table(n).error_status IN('S', 'W'))
976: AND ( x_cascaded_table(n).routing_step_id IS NULL
977: AND x_cascaded_table(n).routing_step IS NOT NULL) THEN
978: IF (g_asn_debug = 'Y') THEN
979: asn_debug.put_line('X_progress ' || x_progress);
980: END IF;
981:
982: routing_step_id_record.routing_step := x_cascaded_table(n).routing_step;
983: routing_step_id_record.error_record.error_status := 'S';
982: routing_step_id_record.routing_step := x_cascaded_table(n).routing_step;
983: routing_step_id_record.error_record.error_status := 'S';
984: routing_step_id_record.error_record.error_message := NULL;
985:
986: IF (g_asn_debug = 'Y') THEN
987: asn_debug.put_line('Derive routing Step Id');
988: END IF;
989:
990: rcv_transactions_interface_sv.get_routing_step_id(routing_step_id_record);
983: routing_step_id_record.error_record.error_status := 'S';
984: routing_step_id_record.error_record.error_message := NULL;
985:
986: IF (g_asn_debug = 'Y') THEN
987: asn_debug.put_line('Derive routing Step Id');
988: END IF;
989:
990: rcv_transactions_interface_sv.get_routing_step_id(routing_step_id_record);
991: x_cascaded_table(n).routing_step_id := routing_step_id_record.routing_step_id;
1001:
1002: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1003: AND ( x_cascaded_table(n).deliver_to_person_id IS NULL
1004: AND x_cascaded_table(n).deliver_to_person_name IS NOT NULL) THEN
1005: IF (g_asn_debug = 'Y') THEN
1006: asn_debug.put_line('X_progress ' || x_progress);
1007: END IF;
1008:
1009: employee_id_record.employee_name := x_cascaded_table(n).deliver_to_person_name;
1002: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1003: AND ( x_cascaded_table(n).deliver_to_person_id IS NULL
1004: AND x_cascaded_table(n).deliver_to_person_name IS NOT NULL) THEN
1005: IF (g_asn_debug = 'Y') THEN
1006: asn_debug.put_line('X_progress ' || x_progress);
1007: END IF;
1008:
1009: employee_id_record.employee_name := x_cascaded_table(n).deliver_to_person_name;
1010: employee_id_record.employee_id := x_cascaded_table(n).deliver_to_person_id;
1010: employee_id_record.employee_id := x_cascaded_table(n).deliver_to_person_id;
1011: employee_id_record.error_record.error_status := 'S';
1012: employee_id_record.error_record.error_message := NULL;
1013:
1014: IF (g_asn_debug = 'Y') THEN
1015: asn_debug.put_line('In Derive deliver_to_person_id Information');
1016: END IF;
1017:
1018: po_employees_sv.derive_employee_info(employee_id_record);
1011: employee_id_record.error_record.error_status := 'S';
1012: employee_id_record.error_record.error_message := NULL;
1013:
1014: IF (g_asn_debug = 'Y') THEN
1015: asn_debug.put_line('In Derive deliver_to_person_id Information');
1016: END IF;
1017:
1018: po_employees_sv.derive_employee_info(employee_id_record);
1019:
1016: END IF;
1017:
1018: po_employees_sv.derive_employee_info(employee_id_record);
1019:
1020: IF (g_asn_debug = 'Y') THEN
1021: asn_debug.put_line('Employee name ' || employee_id_record.employee_name);
1022: asn_debug.put_line('Employee id ' || TO_CHAR(employee_id_record.employee_id));
1023: asn_debug.put_line('Employee error status ' || employee_id_record.error_record.error_status);
1024: END IF;
1017:
1018: po_employees_sv.derive_employee_info(employee_id_record);
1019:
1020: IF (g_asn_debug = 'Y') THEN
1021: asn_debug.put_line('Employee name ' || employee_id_record.employee_name);
1022: asn_debug.put_line('Employee id ' || TO_CHAR(employee_id_record.employee_id));
1023: asn_debug.put_line('Employee error status ' || employee_id_record.error_record.error_status);
1024: END IF;
1025:
1018: po_employees_sv.derive_employee_info(employee_id_record);
1019:
1020: IF (g_asn_debug = 'Y') THEN
1021: asn_debug.put_line('Employee name ' || employee_id_record.employee_name);
1022: asn_debug.put_line('Employee id ' || TO_CHAR(employee_id_record.employee_id));
1023: asn_debug.put_line('Employee error status ' || employee_id_record.error_record.error_status);
1024: END IF;
1025:
1026: x_cascaded_table(n).deliver_to_person_name := employee_id_record.employee_name;
1019:
1020: IF (g_asn_debug = 'Y') THEN
1021: asn_debug.put_line('Employee name ' || employee_id_record.employee_name);
1022: asn_debug.put_line('Employee id ' || TO_CHAR(employee_id_record.employee_id));
1023: asn_debug.put_line('Employee error status ' || employee_id_record.error_record.error_status);
1024: END IF;
1025:
1026: x_cascaded_table(n).deliver_to_person_name := employee_id_record.employee_name;
1027: x_cascaded_table(n).deliver_to_person_id := employee_id_record.employee_id;
1037:
1038: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1039: AND ( x_cascaded_table(n).deliver_to_location_id IS NULL
1040: AND x_cascaded_table(n).deliver_to_location_code IS NOT NULL) THEN
1041: IF (g_asn_debug = 'Y') THEN
1042: asn_debug.put_line('X_progress ' || x_progress);
1043: END IF;
1044:
1045: location_id_record.location_code := x_cascaded_table(n).deliver_to_location_code;
1038: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1039: AND ( x_cascaded_table(n).deliver_to_location_id IS NULL
1040: AND x_cascaded_table(n).deliver_to_location_code IS NOT NULL) THEN
1041: IF (g_asn_debug = 'Y') THEN
1042: asn_debug.put_line('X_progress ' || x_progress);
1043: END IF;
1044:
1045: location_id_record.location_code := x_cascaded_table(n).deliver_to_location_code;
1046: location_id_record.error_record.error_status := 'S';
1045: location_id_record.location_code := x_cascaded_table(n).deliver_to_location_code;
1046: location_id_record.error_record.error_status := 'S';
1047: location_id_record.error_record.error_message := NULL;
1048:
1049: IF (g_asn_debug = 'Y') THEN
1050: asn_debug.put_line('Derive deliver_to_location_id');
1051: END IF;
1052:
1053: rcv_transactions_interface_sv.get_location_id(location_id_record);
1046: location_id_record.error_record.error_status := 'S';
1047: location_id_record.error_record.error_message := NULL;
1048:
1049: IF (g_asn_debug = 'Y') THEN
1050: asn_debug.put_line('Derive deliver_to_location_id');
1051: END IF;
1052:
1053: rcv_transactions_interface_sv.get_location_id(location_id_record);
1054: x_cascaded_table(n).deliver_to_location_id := location_id_record.location_id;
1064:
1065: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1066: AND ( x_cascaded_table(n).locator_id IS NULL
1067: AND x_cascaded_table(n).LOCATOR IS NOT NULL) THEN
1068: IF (g_asn_debug = 'Y') THEN
1069: asn_debug.put_line('X_progress ' || x_progress);
1070: END IF;
1071:
1072: locator_id_record.LOCATOR := x_cascaded_table(n).LOCATOR;
1065: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1066: AND ( x_cascaded_table(n).locator_id IS NULL
1067: AND x_cascaded_table(n).LOCATOR IS NOT NULL) THEN
1068: IF (g_asn_debug = 'Y') THEN
1069: asn_debug.put_line('X_progress ' || x_progress);
1070: END IF;
1071:
1072: locator_id_record.LOCATOR := x_cascaded_table(n).LOCATOR;
1073: locator_id_record.subinventory := x_cascaded_table(n).subinventory;
1074: locator_id_record.to_organization_id := x_cascaded_table(n).to_organization_id;
1075: locator_id_record.error_record.error_status := 'S';
1076: locator_id_record.error_record.error_message := NULL;
1077:
1078: IF (g_asn_debug = 'Y') THEN
1079: asn_debug.put_line('Derive locator_id for ' || x_cascaded_table(n).LOCATOR);
1080: asn_debug.put_line(' subinventory is ' || x_cascaded_table(n).subinventory);
1081: END IF;
1082:
1075: locator_id_record.error_record.error_status := 'S';
1076: locator_id_record.error_record.error_message := NULL;
1077:
1078: IF (g_asn_debug = 'Y') THEN
1079: asn_debug.put_line('Derive locator_id for ' || x_cascaded_table(n).LOCATOR);
1080: asn_debug.put_line(' subinventory is ' || x_cascaded_table(n).subinventory);
1081: END IF;
1082:
1083: /*
1076: locator_id_record.error_record.error_message := NULL;
1077:
1078: IF (g_asn_debug = 'Y') THEN
1079: asn_debug.put_line('Derive locator_id for ' || x_cascaded_table(n).LOCATOR);
1080: asn_debug.put_line(' subinventory is ' || x_cascaded_table(n).subinventory);
1081: END IF;
1082:
1083: /*
1084: * bug 724495 add derivation of locator in the preprocessor
1097:
1098: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1099: AND ( x_cascaded_table(n).reason_id IS NULL
1100: AND x_cascaded_table(n).reason_name IS NOT NULL) THEN
1101: IF (g_asn_debug = 'Y') THEN
1102: asn_debug.put_line('X_progress ' || x_progress);
1103: END IF;
1104:
1105: reason_id_record.reason_name := x_cascaded_table(n).reason_name;
1098: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1099: AND ( x_cascaded_table(n).reason_id IS NULL
1100: AND x_cascaded_table(n).reason_name IS NOT NULL) THEN
1101: IF (g_asn_debug = 'Y') THEN
1102: asn_debug.put_line('X_progress ' || x_progress);
1103: END IF;
1104:
1105: reason_id_record.reason_name := x_cascaded_table(n).reason_name;
1106: reason_id_record.error_record.error_status := 'S';
1105: reason_id_record.reason_name := x_cascaded_table(n).reason_name;
1106: reason_id_record.error_record.error_status := 'S';
1107: reason_id_record.error_record.error_message := NULL;
1108:
1109: IF (g_asn_debug = 'Y') THEN
1110: asn_debug.put_line('Derive Reason_id');
1111: END IF;
1112:
1113: rcv_transactions_interface_sv.get_reason_id(reason_id_record);
1106: reason_id_record.error_record.error_status := 'S';
1107: reason_id_record.error_record.error_message := NULL;
1108:
1109: IF (g_asn_debug = 'Y') THEN
1110: asn_debug.put_line('Derive Reason_id');
1111: END IF;
1112:
1113: rcv_transactions_interface_sv.get_reason_id(reason_id_record);
1114: x_cascaded_table(n).reason_id := reason_id_record.reason_id;
1125: -- Derive auto_transact_code from transaction_type if it is null
1126:
1127: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1128: AND x_cascaded_table(n).auto_transact_code IS NULL THEN
1129: IF (g_asn_debug = 'Y') THEN
1130: asn_debug.put_line('X_progress ' || x_progress);
1131: asn_debug.put_line('Setting auto_transact_code to transaction_type ' || x_cascaded_table(n).transaction_type);
1132: END IF;
1133:
1126:
1127: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1128: AND x_cascaded_table(n).auto_transact_code IS NULL THEN
1129: IF (g_asn_debug = 'Y') THEN
1130: asn_debug.put_line('X_progress ' || x_progress);
1131: asn_debug.put_line('Setting auto_transact_code to transaction_type ' || x_cascaded_table(n).transaction_type);
1132: END IF;
1133:
1134: x_cascaded_table(n).auto_transact_code := x_cascaded_table(n).transaction_type;
1127: IF (x_cascaded_table(n).error_status IN('S', 'W'))
1128: AND x_cascaded_table(n).auto_transact_code IS NULL THEN
1129: IF (g_asn_debug = 'Y') THEN
1130: asn_debug.put_line('X_progress ' || x_progress);
1131: asn_debug.put_line('Setting auto_transact_code to transaction_type ' || x_cascaded_table(n).transaction_type);
1132: END IF;
1133:
1134: x_cascaded_table(n).auto_transact_code := x_cascaded_table(n).transaction_type;
1135: END IF;
1139: -- Change transaction type based on combination of
1140: -- transaction_type and auto_transact_code
1141:
1142: IF (x_cascaded_table(n).error_status IN('S', 'W')) THEN
1143: IF (g_asn_debug = 'Y') THEN
1144: asn_debug.put_line('X_progress ' || x_progress);
1145: END IF;
1146:
1147: IF x_cascaded_table(n).transaction_type = 'SHIP'
1140: -- transaction_type and auto_transact_code
1141:
1142: IF (x_cascaded_table(n).error_status IN('S', 'W')) THEN
1143: IF (g_asn_debug = 'Y') THEN
1144: asn_debug.put_line('X_progress ' || x_progress);
1145: END IF;
1146:
1147: IF x_cascaded_table(n).transaction_type = 'SHIP'
1148: AND x_cascaded_table(n).auto_transact_code = 'DELIVER' THEN
1145: END IF;
1146:
1147: IF x_cascaded_table(n).transaction_type = 'SHIP'
1148: AND x_cascaded_table(n).auto_transact_code = 'DELIVER' THEN
1149: IF (g_asn_debug = 'Y') THEN
1150: asn_debug.put_line('Changing the transaction_type to RECEIVE FROM SHIP');
1151: END IF;
1152:
1153: x_cascaded_table(n).transaction_type := 'RECEIVE';
1146:
1147: IF x_cascaded_table(n).transaction_type = 'SHIP'
1148: AND x_cascaded_table(n).auto_transact_code = 'DELIVER' THEN
1149: IF (g_asn_debug = 'Y') THEN
1150: asn_debug.put_line('Changing the transaction_type to RECEIVE FROM SHIP');
1151: END IF;
1152:
1153: x_cascaded_table(n).transaction_type := 'RECEIVE';
1154: END IF;
1157: -- Check whether Qty > 0
1158:
1159: x_progress := '097';
1160:
1161: IF (g_asn_debug = 'Y') THEN
1162: asn_debug.put_line('X_progress ' || x_progress);
1163: END IF;
1164:
1165: IF x_cascaded_table(n).error_status IN('S', 'W')
1158:
1159: x_progress := '097';
1160:
1161: IF (g_asn_debug = 'Y') THEN
1162: asn_debug.put_line('X_progress ' || x_progress);
1163: END IF;
1164:
1165: IF x_cascaded_table(n).error_status IN('S', 'W')
1166: AND x_cascaded_table(n).quantity <= 0 THEN
1163: END IF;
1164:
1165: IF x_cascaded_table(n).error_status IN('S', 'W')
1166: AND x_cascaded_table(n).quantity <= 0 THEN
1167: IF (g_asn_debug = 'Y') THEN
1168: asn_debug.put_line('Quantity is <= zero. Cascade will fail');
1169: END IF;
1170:
1171: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
1164:
1165: IF x_cascaded_table(n).error_status IN('S', 'W')
1166: AND x_cascaded_table(n).quantity <= 0 THEN
1167: IF (g_asn_debug = 'Y') THEN
1168: asn_debug.put_line('Quantity is <= zero. Cascade will fail');
1169: END IF;
1170:
1171: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
1172: rcv_error_pkg.set_error_message('RCV_ITEM_NO_SHIP_QTY', x_cascaded_table(n).error_message);
1185: such a way that the ROI validation does'nt error out when
1186: po_line_id is populated for one time items. */
1187: x_progress := '098';
1188:
1189: IF (g_asn_debug = 'Y') THEN
1190: asn_debug.put_line('X_progress ' || x_progress);
1191: END IF;
1192:
1193: IF ( x_cascaded_table(n).po_header_id IS NOT NULL
1186: po_line_id is populated for one time items. */
1187: x_progress := '098';
1188:
1189: IF (g_asn_debug = 'Y') THEN
1190: asn_debug.put_line('X_progress ' || x_progress);
1191: END IF;
1192:
1193: IF ( x_cascaded_table(n).po_header_id IS NOT NULL
1194: AND ( x_cascaded_table(n).item_id IS NOT NULL
1198: AND x_cascaded_table(n).error_status IN('S', 'W')
1199: ) THEN
1200: -- Copy record from main table to temp table
1201:
1202: IF (g_asn_debug = 'Y') THEN
1203: asn_debug.put_line('Copy record from main table to temp table');
1204: END IF;
1205:
1206: current_n := 1;
1199: ) THEN
1200: -- Copy record from main table to temp table
1201:
1202: IF (g_asn_debug = 'Y') THEN
1203: asn_debug.put_line('Copy record from main table to temp table');
1204: END IF;
1205:
1206: current_n := 1;
1207: temp_cascaded_table(current_n) := x_cascaded_table(n);
1206: current_n := 1;
1207: temp_cascaded_table(current_n) := x_cascaded_table(n);
1208:
1209: -- Get all rows which meet this condition
1210: IF (g_asn_debug = 'Y') THEN
1211: asn_debug.put_line('Get all rows which meet this condition');
1212: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
1213: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
1214: END IF;
1207: temp_cascaded_table(current_n) := x_cascaded_table(n);
1208:
1209: -- Get all rows which meet this condition
1210: IF (g_asn_debug = 'Y') THEN
1211: asn_debug.put_line('Get all rows which meet this condition');
1212: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
1213: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
1214: END IF;
1215:
1208:
1209: -- Get all rows which meet this condition
1210: IF (g_asn_debug = 'Y') THEN
1211: asn_debug.put_line('Get all rows which meet this condition');
1212: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
1213: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
1214: END IF;
1215:
1216: -- bug 1362237 Deriving the document_line_num
1209: -- Get all rows which meet this condition
1210: IF (g_asn_debug = 'Y') THEN
1211: asn_debug.put_line('Get all rows which meet this condition');
1212: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
1213: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
1214: END IF;
1215:
1216: -- bug 1362237 Deriving the document_line_num
1217: -- and document_shipment_line_num when line_id and/or line_location_id
1225: FROM po_lines
1226: WHERE po_line_id = temp_cascaded_table(current_n).po_line_id;
1227: EXCEPTION
1228: WHEN OTHERS THEN
1229: IF (g_asn_debug = 'Y') THEN
1230: asn_debug.put_line('wrong po_line_id entered in rcv_transactions_interface');
1231: END IF;
1232: END;
1233: END IF;
1226: WHERE po_line_id = temp_cascaded_table(current_n).po_line_id;
1227: EXCEPTION
1228: WHEN OTHERS THEN
1229: IF (g_asn_debug = 'Y') THEN
1230: asn_debug.put_line('wrong po_line_id entered in rcv_transactions_interface');
1231: END IF;
1232: END;
1233: END IF;
1234:
1240: FROM po_line_locations
1241: WHERE line_location_id = temp_cascaded_table(current_n).po_line_location_id;
1242: EXCEPTION
1243: WHEN OTHERS THEN
1244: IF (g_asn_debug = 'Y') THEN
1245: asn_debug.put_line('wrong po_line_location_id entered in rcv_transactions_interface');
1246: END IF;
1247: END;
1248: END IF;
1241: WHERE line_location_id = temp_cascaded_table(current_n).po_line_location_id;
1242: EXCEPTION
1243: WHEN OTHERS THEN
1244: IF (g_asn_debug = 'Y') THEN
1245: asn_debug.put_line('wrong po_line_location_id entered in rcv_transactions_interface');
1246: END IF;
1247: END;
1248: END IF;
1249:
1255: FROM po_distributions
1256: WHERE po_distribution_id = temp_cascaded_table(current_n).po_distribution_id;
1257: EXCEPTION
1258: WHEN OTHERS THEN
1259: IF (g_asn_debug = 'Y') THEN
1260: asn_debug.put_line('wrong po_distribution_id entered in rcv_transactions_interface');
1261: END IF;
1262: END;
1263: END IF;
1256: WHERE po_distribution_id = temp_cascaded_table(current_n).po_distribution_id;
1257: EXCEPTION
1258: WHEN OTHERS THEN
1259: IF (g_asn_debug = 'Y') THEN
1260: asn_debug.put_line('wrong po_distribution_id entered in rcv_transactions_interface');
1261: END IF;
1262: END;
1263: END IF;
1264:
1280: performed at a different location.
1281: */
1282: IF ( x_cascaded_table(n).transaction_type <> 'DELIVER'
1283: AND NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') <> 'DELIVER') THEN
1284: IF (g_asn_debug = 'Y') THEN
1285: asn_debug.put_line('Open Shipment records');
1286: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1287: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1288: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1281: */
1282: IF ( x_cascaded_table(n).transaction_type <> 'DELIVER'
1283: AND NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') <> 'DELIVER') THEN
1284: IF (g_asn_debug = 'Y') THEN
1285: asn_debug.put_line('Open Shipment records');
1286: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1287: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1288: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1289: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1282: IF ( x_cascaded_table(n).transaction_type <> 'DELIVER'
1283: AND NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') <> 'DELIVER') THEN
1284: IF (g_asn_debug = 'Y') THEN
1285: asn_debug.put_line('Open Shipment records');
1286: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1287: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1288: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1289: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1290: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1283: AND NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') <> 'DELIVER') THEN
1284: IF (g_asn_debug = 'Y') THEN
1285: asn_debug.put_line('Open Shipment records');
1286: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1287: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1288: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1289: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1290: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1291: asn_debug.put_line('PO LINE LOCATION ID ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1284: IF (g_asn_debug = 'Y') THEN
1285: asn_debug.put_line('Open Shipment records');
1286: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1287: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1288: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1289: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1290: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1291: asn_debug.put_line('PO LINE LOCATION ID ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1292: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1285: asn_debug.put_line('Open Shipment records');
1286: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1287: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1288: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1289: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1290: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1291: asn_debug.put_line('PO LINE LOCATION ID ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1292: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1293: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1286: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1287: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1288: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1289: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1290: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1291: asn_debug.put_line('PO LINE LOCATION ID ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1292: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1293: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1294: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1287: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1288: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1289: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1290: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1291: asn_debug.put_line('PO LINE LOCATION ID ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1292: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1293: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1294: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1295: asn_debug.put_line('Proceed to open cursor');
1288: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1289: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1290: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1291: asn_debug.put_line('PO LINE LOCATION ID ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1292: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1293: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1294: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1295: asn_debug.put_line('Proceed to open cursor');
1296: END IF;
1289: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1290: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1291: asn_debug.put_line('PO LINE LOCATION ID ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1292: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1293: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1294: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1295: asn_debug.put_line('Proceed to open cursor');
1296: END IF;
1297:
1290: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1291: asn_debug.put_line('PO LINE LOCATION ID ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1292: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1293: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1294: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1295: asn_debug.put_line('Proceed to open cursor');
1296: END IF;
1297:
1298: /* Bug 2208664 : Nullified the ship_to_location_id when calling
1291: asn_debug.put_line('PO LINE LOCATION ID ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1292: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1293: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1294: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1295: asn_debug.put_line('Proceed to open cursor');
1296: END IF;
1297:
1298: /* Bug 2208664 : Nullified the ship_to_location_id when calling
1299: the cursors shipments, count_shipments, distributions and
1328: temp_cascaded_table(current_n).vendor_item_num
1329: );
1330: ELSIF( x_cascaded_table(n).transaction_type = 'DELIVER'
1331: OR NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') = 'DELIVER') THEN
1332: IF (g_asn_debug = 'Y') THEN
1333: asn_debug.put_line('Open Distribution records');
1334: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1335: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1336: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1329: );
1330: ELSIF( x_cascaded_table(n).transaction_type = 'DELIVER'
1331: OR NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') = 'DELIVER') THEN
1332: IF (g_asn_debug = 'Y') THEN
1333: asn_debug.put_line('Open Distribution records');
1334: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1335: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1336: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1337: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1330: ELSIF( x_cascaded_table(n).transaction_type = 'DELIVER'
1331: OR NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') = 'DELIVER') THEN
1332: IF (g_asn_debug = 'Y') THEN
1333: asn_debug.put_line('Open Distribution records');
1334: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1335: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1336: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1337: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1338: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1331: OR NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') = 'DELIVER') THEN
1332: IF (g_asn_debug = 'Y') THEN
1333: asn_debug.put_line('Open Distribution records');
1334: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1335: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1336: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1337: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1338: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1339: asn_debug.put_line('Distribution num ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1332: IF (g_asn_debug = 'Y') THEN
1333: asn_debug.put_line('Open Distribution records');
1334: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1335: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1336: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1337: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1338: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1339: asn_debug.put_line('Distribution num ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1340: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1333: asn_debug.put_line('Open Distribution records');
1334: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1335: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1336: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1337: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1338: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1339: asn_debug.put_line('Distribution num ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1340: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1341: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1334: asn_debug.put_line('PO Header id ' || TO_CHAR(temp_cascaded_table(current_n).po_header_id));
1335: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1336: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1337: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1338: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1339: asn_debug.put_line('Distribution num ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1340: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1341: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1342: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1335: asn_debug.put_line('Item Id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1336: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1337: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1338: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1339: asn_debug.put_line('Distribution num ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1340: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1341: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1342: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1343: asn_debug.put_line('Proceed to open cursor');
1336: asn_debug.put_line('PO Line Num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
1337: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1338: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1339: asn_debug.put_line('Distribution num ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1340: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1341: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1342: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1343: asn_debug.put_line('Proceed to open cursor');
1344: END IF;
1337: asn_debug.put_line('PO Release Id ' || TO_CHAR(temp_cascaded_table(current_n).po_release_id));
1338: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1339: asn_debug.put_line('Distribution num ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1340: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1341: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1342: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1343: asn_debug.put_line('Proceed to open cursor');
1344: END IF;
1345:
1338: asn_debug.put_line('Shipment Line num ' || TO_CHAR(temp_cascaded_table(current_n).document_shipment_line_num));
1339: asn_debug.put_line('Distribution num ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1340: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1341: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1342: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1343: asn_debug.put_line('Proceed to open cursor');
1344: END IF;
1345:
1346: OPEN distributions(temp_cascaded_table(current_n).po_header_id,
1339: asn_debug.put_line('Distribution num ' || TO_CHAR(temp_cascaded_table(current_n).document_distribution_num));
1340: asn_debug.put_line('Ship To Organization ID ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
1341: asn_debug.put_line('Ship To Location Id ' || TO_CHAR(NVL(temp_cascaded_table(current_n).ship_to_location_id, x_header_record.header_record.location_id)));
1342: asn_debug.put_line('Vendor Item Num ' || temp_cascaded_table(current_n).vendor_item_num);
1343: asn_debug.put_line('Proceed to open cursor');
1344: END IF;
1345:
1346: OPEN distributions(temp_cascaded_table(current_n).po_header_id,
1347: temp_cascaded_table(current_n).item_id,
1373: );
1374: END IF;
1375:
1376: -- Assign shipped quantity to remaining quantity
1377: IF (g_asn_debug = 'Y') THEN
1378: asn_debug.put_line('Assign shipped quantity to remaining quantity');
1379: asn_debug.put_line('Pointer in temp_cascade ' || TO_CHAR(current_n));
1380: END IF;
1381:
1374: END IF;
1375:
1376: -- Assign shipped quantity to remaining quantity
1377: IF (g_asn_debug = 'Y') THEN
1378: asn_debug.put_line('Assign shipped quantity to remaining quantity');
1379: asn_debug.put_line('Pointer in temp_cascade ' || TO_CHAR(current_n));
1380: END IF;
1381:
1382: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1375:
1376: -- Assign shipped quantity to remaining quantity
1377: IF (g_asn_debug = 'Y') THEN
1378: asn_debug.put_line('Assign shipped quantity to remaining quantity');
1379: asn_debug.put_line('Pointer in temp_cascade ' || TO_CHAR(current_n));
1380: END IF;
1381:
1382: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1383: x_bkp_qty := x_remaining_quantity; -- used for decrementing cum qty for first record
1382: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1383: x_bkp_qty := x_remaining_quantity; -- used for decrementing cum qty for first record
1384: x_remaining_qty_po_uom := 0;
1385:
1386: IF (g_asn_debug = 'Y') THEN
1387: asn_debug.put_line('Have assigned the quantity');
1388: END IF;
1389:
1390: -- Calculate tax_amount_factor for calculating tax_amount for
1383: x_bkp_qty := x_remaining_quantity; -- used for decrementing cum qty for first record
1384: x_remaining_qty_po_uom := 0;
1385:
1386: IF (g_asn_debug = 'Y') THEN
1387: asn_debug.put_line('Have assigned the quantity');
1388: END IF;
1389:
1390: -- Calculate tax_amount_factor for calculating tax_amount for
1391: -- each cascaded line
1395: ELSE
1396: tax_amount_factor := 0;
1397: END IF;
1398:
1399: IF (g_asn_debug = 'Y') THEN
1400: asn_debug.put_line('Tax Factor ' || TO_CHAR(tax_amount_factor));
1401: asn_debug.put_line('Shipped Quantity : ' || TO_CHAR(x_remaining_quantity));
1402: END IF;
1403:
1396: tax_amount_factor := 0;
1397: END IF;
1398:
1399: IF (g_asn_debug = 'Y') THEN
1400: asn_debug.put_line('Tax Factor ' || TO_CHAR(tax_amount_factor));
1401: asn_debug.put_line('Shipped Quantity : ' || TO_CHAR(x_remaining_quantity));
1402: END IF;
1403:
1404: x_first_trans := TRUE;
1397: END IF;
1398:
1399: IF (g_asn_debug = 'Y') THEN
1400: asn_debug.put_line('Tax Factor ' || TO_CHAR(tax_amount_factor));
1401: asn_debug.put_line('Shipped Quantity : ' || TO_CHAR(x_remaining_quantity));
1402: END IF;
1403:
1404: x_first_trans := TRUE;
1405: transaction_ok := FALSE;
1414: ELSE
1415: FETCH count_distributions INTO x_record_count;
1416: END IF;
1417:
1418: IF (g_asn_debug = 'Y') THEN
1419: asn_debug.put_line('Before starting Cascade');
1420: END IF;
1421:
1422: IF (g_asn_debug = 'Y') THEN
1415: FETCH count_distributions INTO x_record_count;
1416: END IF;
1417:
1418: IF (g_asn_debug = 'Y') THEN
1419: asn_debug.put_line('Before starting Cascade');
1420: END IF;
1421:
1422: IF (g_asn_debug = 'Y') THEN
1423: asn_debug.put_line('Record Count = ' || x_record_count);
1418: IF (g_asn_debug = 'Y') THEN
1419: asn_debug.put_line('Before starting Cascade');
1420: END IF;
1421:
1422: IF (g_asn_debug = 'Y') THEN
1423: asn_debug.put_line('Record Count = ' || x_record_count);
1424: END IF;
1425:
1426: LOOP
1419: asn_debug.put_line('Before starting Cascade');
1420: END IF;
1421:
1422: IF (g_asn_debug = 'Y') THEN
1423: asn_debug.put_line('Record Count = ' || x_record_count);
1424: END IF;
1425:
1426: LOOP
1427: IF (g_asn_debug = 'Y') THEN
1423: asn_debug.put_line('Record Count = ' || x_record_count);
1424: END IF;
1425:
1426: LOOP
1427: IF (g_asn_debug = 'Y') THEN
1428: asn_debug.put_line('Backup Qty ' || TO_CHAR(x_bkp_qty));
1429: asn_debug.put_line('Remaining Quantity ASN UOM ' || TO_CHAR(x_remaining_quantity));
1430: END IF;
1431:
1424: END IF;
1425:
1426: LOOP
1427: IF (g_asn_debug = 'Y') THEN
1428: asn_debug.put_line('Backup Qty ' || TO_CHAR(x_bkp_qty));
1429: asn_debug.put_line('Remaining Quantity ASN UOM ' || TO_CHAR(x_remaining_quantity));
1430: END IF;
1431:
1432: IF (g_asn_debug = 'Y') THEN
1425:
1426: LOOP
1427: IF (g_asn_debug = 'Y') THEN
1428: asn_debug.put_line('Backup Qty ' || TO_CHAR(x_bkp_qty));
1429: asn_debug.put_line('Remaining Quantity ASN UOM ' || TO_CHAR(x_remaining_quantity));
1430: END IF;
1431:
1432: IF (g_asn_debug = 'Y') THEN
1433: asn_debug.put_line('open shipments and fetch');
1428: asn_debug.put_line('Backup Qty ' || TO_CHAR(x_bkp_qty));
1429: asn_debug.put_line('Remaining Quantity ASN UOM ' || TO_CHAR(x_remaining_quantity));
1430: END IF;
1431:
1432: IF (g_asn_debug = 'Y') THEN
1433: asn_debug.put_line('open shipments and fetch');
1434: END IF;
1435:
1436: /*
1429: asn_debug.put_line('Remaining Quantity ASN UOM ' || TO_CHAR(x_remaining_quantity));
1430: END IF;
1431:
1432: IF (g_asn_debug = 'Y') THEN
1433: asn_debug.put_line('open shipments and fetch');
1434: END IF;
1435:
1436: /*
1437: ** Fetch the appropriate record
1435:
1436: /*
1437: ** Fetch the appropriate record
1438: */
1439: IF (g_asn_debug = 'Y') THEN
1440: asn_debug.put_line('DEBUG: transaction_type = ' || x_cascaded_table(n).transaction_type);
1441: END IF;
1442:
1443: IF ( x_cascaded_table(n).transaction_type <> 'DELIVER'
1436: /*
1437: ** Fetch the appropriate record
1438: */
1439: IF (g_asn_debug = 'Y') THEN
1440: asn_debug.put_line('DEBUG: transaction_type = ' || x_cascaded_table(n).transaction_type);
1441: END IF;
1442:
1443: IF ( x_cascaded_table(n).transaction_type <> 'DELIVER'
1444: AND NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') <> 'DELIVER') THEN
1441: END IF;
1442:
1443: IF ( x_cascaded_table(n).transaction_type <> 'DELIVER'
1444: AND NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') <> 'DELIVER') THEN
1445: IF (g_asn_debug = 'Y') THEN
1446: asn_debug.put_line('Fetching Shipments Cursor');
1447: END IF;
1448:
1449: FETCH shipments INTO x_shipmentdistributionrec;
1442:
1443: IF ( x_cascaded_table(n).transaction_type <> 'DELIVER'
1444: AND NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') <> 'DELIVER') THEN
1445: IF (g_asn_debug = 'Y') THEN
1446: asn_debug.put_line('Fetching Shipments Cursor');
1447: END IF;
1448:
1449: FETCH shipments INTO x_shipmentdistributionrec;
1450:
1456: END IF;
1457:
1458: rows_fetched := shipments%ROWCOUNT;
1459:
1460: IF (g_asn_debug = 'Y') THEN
1461: asn_debug.put_line('Shipment Rows fetched ' || TO_CHAR(rows_fetched));
1462: END IF;
1463: ELSE
1464: IF (g_asn_debug = 'Y') THEN
1457:
1458: rows_fetched := shipments%ROWCOUNT;
1459:
1460: IF (g_asn_debug = 'Y') THEN
1461: asn_debug.put_line('Shipment Rows fetched ' || TO_CHAR(rows_fetched));
1462: END IF;
1463: ELSE
1464: IF (g_asn_debug = 'Y') THEN
1465: asn_debug.put_line('Fetching Distributions Cursor');
1460: IF (g_asn_debug = 'Y') THEN
1461: asn_debug.put_line('Shipment Rows fetched ' || TO_CHAR(rows_fetched));
1462: END IF;
1463: ELSE
1464: IF (g_asn_debug = 'Y') THEN
1465: asn_debug.put_line('Fetching Distributions Cursor');
1466: END IF;
1467:
1468: FETCH distributions INTO x_shipmentdistributionrec;
1461: asn_debug.put_line('Shipment Rows fetched ' || TO_CHAR(rows_fetched));
1462: END IF;
1463: ELSE
1464: IF (g_asn_debug = 'Y') THEN
1465: asn_debug.put_line('Fetching Distributions Cursor');
1466: END IF;
1467:
1468: FETCH distributions INTO x_shipmentdistributionrec;
1469:
1475: END IF;
1476:
1477: rows_fetched := distributions%ROWCOUNT;
1478:
1479: IF (g_asn_debug = 'Y') THEN
1480: asn_debug.put_line('Distribution Rows fetched ' || TO_CHAR(rows_fetched));
1481: END IF;
1482: END IF;
1483:
1476:
1477: rows_fetched := distributions%ROWCOUNT;
1478:
1479: IF (g_asn_debug = 'Y') THEN
1480: asn_debug.put_line('Distribution Rows fetched ' || TO_CHAR(rows_fetched));
1481: END IF;
1482: END IF;
1483:
1484: IF ( lastrecord
1482: END IF;
1483:
1484: IF ( lastrecord
1485: OR x_remaining_quantity <= 0) THEN
1486: IF (g_asn_debug = 'Y') THEN
1487: asn_debug.put_line('Hit exit condition');
1488: END IF;
1489:
1490: IF NOT x_first_trans THEN -- x_first_trans has been reset which means some cascade has
1483:
1484: IF ( lastrecord
1485: OR x_remaining_quantity <= 0) THEN
1486: IF (g_asn_debug = 'Y') THEN
1487: asn_debug.put_line('Hit exit condition');
1488: END IF;
1489:
1490: IF NOT x_first_trans THEN -- x_first_trans has been reset which means some cascade has
1491: -- happened. Otherwise current_n = 1
1492: current_n := current_n - 1;
1493: END IF;
1494:
1495: -- do the tolerance act here
1496: IF (g_asn_debug = 'Y') THEN
1497: asn_debug.put_line('Temp table pointer ' || TO_CHAR(current_n));
1498: asn_debug.put_line('Check which condition has occured');
1499: END IF;
1500:
1493: END IF;
1494:
1495: -- do the tolerance act here
1496: IF (g_asn_debug = 'Y') THEN
1497: asn_debug.put_line('Temp table pointer ' || TO_CHAR(current_n));
1498: asn_debug.put_line('Check which condition has occured');
1499: END IF;
1500:
1501: -- lastrecord...we have run out of rows and we still have quantity to allocate
1494:
1495: -- do the tolerance act here
1496: IF (g_asn_debug = 'Y') THEN
1497: asn_debug.put_line('Temp table pointer ' || TO_CHAR(current_n));
1498: asn_debug.put_line('Check which condition has occured');
1499: END IF;
1500:
1501: -- lastrecord...we have run out of rows and we still have quantity to allocate
1502: IF x_remaining_quantity > 0 THEN
1499: END IF;
1500:
1501: -- lastrecord...we have run out of rows and we still have quantity to allocate
1502: IF x_remaining_quantity > 0 THEN
1503: IF (g_asn_debug = 'Y') THEN
1504: asn_debug.put_line('There is quantity remaining');
1505: asn_debug.put_line('Need to check qty tolerances');
1506: END IF;
1507:
1500:
1501: -- lastrecord...we have run out of rows and we still have quantity to allocate
1502: IF x_remaining_quantity > 0 THEN
1503: IF (g_asn_debug = 'Y') THEN
1504: asn_debug.put_line('There is quantity remaining');
1505: asn_debug.put_line('Need to check qty tolerances');
1506: END IF;
1507:
1508: IF rows_fetched > 0
1501: -- lastrecord...we have run out of rows and we still have quantity to allocate
1502: IF x_remaining_quantity > 0 THEN
1503: IF (g_asn_debug = 'Y') THEN
1504: asn_debug.put_line('There is quantity remaining');
1505: asn_debug.put_line('Need to check qty tolerances');
1506: END IF;
1507:
1508: IF rows_fetched > 0
1509: AND NOT x_first_trans THEN -- we had got atleast some rows from our shipments cursor
1512: INTO x_qty_rcv_exception_code
1513: FROM po_line_locations
1514: WHERE line_location_id = temp_cascaded_table(current_n).po_line_location_id;
1515:
1516: IF (g_asn_debug = 'Y') THEN
1517: asn_debug.put_line('Qty tolerance exception code ' || NVL(x_qty_rcv_exception_code, 'NONE1'));
1518: END IF;
1519:
1520: IF x_qty_rcv_exception_code IN('NONE', 'WARNING') THEN
1513: FROM po_line_locations
1514: WHERE line_location_id = temp_cascaded_table(current_n).po_line_location_id;
1515:
1516: IF (g_asn_debug = 'Y') THEN
1517: asn_debug.put_line('Qty tolerance exception code ' || NVL(x_qty_rcv_exception_code, 'NONE1'));
1518: END IF;
1519:
1520: IF x_qty_rcv_exception_code IN('NONE', 'WARNING') THEN
1521: /* Bug# 1807842 */
1519:
1520: IF x_qty_rcv_exception_code IN('NONE', 'WARNING') THEN
1521: /* Bug# 1807842 */
1522: IF (temp_cascaded_table(current_n).quantity < x_converted_trx_qty) THEN
1523: IF (g_asn_debug = 'Y') THEN
1524: asn_debug.put_line('Tolerable quantity ' || TO_CHAR(x_converted_trx_qty));
1525: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1526: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1527: asn_debug.put_line('Assign remaining ASN UOM qty ' || TO_CHAR(x_remaining_quantity) || ' to last record');
1520: IF x_qty_rcv_exception_code IN('NONE', 'WARNING') THEN
1521: /* Bug# 1807842 */
1522: IF (temp_cascaded_table(current_n).quantity < x_converted_trx_qty) THEN
1523: IF (g_asn_debug = 'Y') THEN
1524: asn_debug.put_line('Tolerable quantity ' || TO_CHAR(x_converted_trx_qty));
1525: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1526: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1527: asn_debug.put_line('Assign remaining ASN UOM qty ' || TO_CHAR(x_remaining_quantity) || ' to last record');
1528: asn_debug.put_line('Assign remaining PO UOM qty ' || TO_CHAR(x_remaining_qty_po_uom) || ' to last record');
1521: /* Bug# 1807842 */
1522: IF (temp_cascaded_table(current_n).quantity < x_converted_trx_qty) THEN
1523: IF (g_asn_debug = 'Y') THEN
1524: asn_debug.put_line('Tolerable quantity ' || TO_CHAR(x_converted_trx_qty));
1525: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1526: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1527: asn_debug.put_line('Assign remaining ASN UOM qty ' || TO_CHAR(x_remaining_quantity) || ' to last record');
1528: asn_debug.put_line('Assign remaining PO UOM qty ' || TO_CHAR(x_remaining_qty_po_uom) || ' to last record');
1529: END IF;
1522: IF (temp_cascaded_table(current_n).quantity < x_converted_trx_qty) THEN
1523: IF (g_asn_debug = 'Y') THEN
1524: asn_debug.put_line('Tolerable quantity ' || TO_CHAR(x_converted_trx_qty));
1525: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1526: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1527: asn_debug.put_line('Assign remaining ASN UOM qty ' || TO_CHAR(x_remaining_quantity) || ' to last record');
1528: asn_debug.put_line('Assign remaining PO UOM qty ' || TO_CHAR(x_remaining_qty_po_uom) || ' to last record');
1529: END IF;
1530:
1523: IF (g_asn_debug = 'Y') THEN
1524: asn_debug.put_line('Tolerable quantity ' || TO_CHAR(x_converted_trx_qty));
1525: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1526: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1527: asn_debug.put_line('Assign remaining ASN UOM qty ' || TO_CHAR(x_remaining_quantity) || ' to last record');
1528: asn_debug.put_line('Assign remaining PO UOM qty ' || TO_CHAR(x_remaining_qty_po_uom) || ' to last record');
1529: END IF;
1530:
1531: temp_cascaded_table(current_n).quantity := temp_cascaded_table(current_n).quantity + x_remaining_quantity;
1524: asn_debug.put_line('Tolerable quantity ' || TO_CHAR(x_converted_trx_qty));
1525: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1526: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1527: asn_debug.put_line('Assign remaining ASN UOM qty ' || TO_CHAR(x_remaining_quantity) || ' to last record');
1528: asn_debug.put_line('Assign remaining PO UOM qty ' || TO_CHAR(x_remaining_qty_po_uom) || ' to last record');
1529: END IF;
1530:
1531: temp_cascaded_table(current_n).quantity := temp_cascaded_table(current_n).quantity + x_remaining_quantity;
1532: temp_cascaded_table(current_n).quantity_shipped := temp_cascaded_table(current_n).quantity_shipped + x_remaining_quantity;
1545: END IF;
1546:
1547: temp_cascaded_table(current_n).tax_amount := ROUND(temp_cascaded_table(current_n).quantity * tax_amount_factor, 6);
1548:
1549: IF (g_asn_debug = 'Y') THEN
1550: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1551: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1552: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1553: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1546:
1547: temp_cascaded_table(current_n).tax_amount := ROUND(temp_cascaded_table(current_n).quantity * tax_amount_factor, 6);
1548:
1549: IF (g_asn_debug = 'Y') THEN
1550: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1551: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1552: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1553: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1554: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1547: temp_cascaded_table(current_n).tax_amount := ROUND(temp_cascaded_table(current_n).quantity * tax_amount_factor, 6);
1548:
1549: IF (g_asn_debug = 'Y') THEN
1550: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1551: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1552: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1553: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1554: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1555: END IF;
1548:
1549: IF (g_asn_debug = 'Y') THEN
1550: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1551: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1552: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1553: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1554: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1555: END IF;
1556:
1549: IF (g_asn_debug = 'Y') THEN
1550: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1551: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1552: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1553: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1554: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1555: END IF;
1556:
1557: IF x_qty_rcv_exception_code = 'WARNING' THEN
1550: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1551: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1552: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1553: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1554: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1555: END IF;
1556:
1557: IF x_qty_rcv_exception_code = 'WARNING' THEN
1558: IF (g_asn_debug = 'Y') THEN
1554: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1555: END IF;
1556:
1557: IF x_qty_rcv_exception_code = 'WARNING' THEN
1558: IF (g_asn_debug = 'Y') THEN
1559: asn_debug.put_line('IN WARNING');
1560: END IF;
1561:
1562: temp_cascaded_table(current_n).error_status := 'W';
1555: END IF;
1556:
1557: IF x_qty_rcv_exception_code = 'WARNING' THEN
1558: IF (g_asn_debug = 'Y') THEN
1559: asn_debug.put_line('IN WARNING');
1560: END IF;
1561:
1562: temp_cascaded_table(current_n).error_status := 'W';
1563: temp_cascaded_table(current_n).error_message := 'RCV_SHIP_QTY_OVER_TOLERANCE';
1561:
1562: temp_cascaded_table(current_n).error_status := 'W';
1563: temp_cascaded_table(current_n).error_message := 'RCV_SHIP_QTY_OVER_TOLERANCE';
1564:
1565: IF (g_asn_debug = 'Y') THEN
1566: asn_debug.put_line('Group Id ' || TO_CHAR(temp_cascaded_table(current_n).GROUP_ID));
1567: asn_debug.put_line('Header Interface Id ' || TO_CHAR(temp_cascaded_table(current_n).header_interface_id));
1568: asn_debug.put_line('IN Trans Id ' || TO_CHAR(temp_cascaded_table(current_n).interface_transaction_id));
1569: END IF;
1562: temp_cascaded_table(current_n).error_status := 'W';
1563: temp_cascaded_table(current_n).error_message := 'RCV_SHIP_QTY_OVER_TOLERANCE';
1564:
1565: IF (g_asn_debug = 'Y') THEN
1566: asn_debug.put_line('Group Id ' || TO_CHAR(temp_cascaded_table(current_n).GROUP_ID));
1567: asn_debug.put_line('Header Interface Id ' || TO_CHAR(temp_cascaded_table(current_n).header_interface_id));
1568: asn_debug.put_line('IN Trans Id ' || TO_CHAR(temp_cascaded_table(current_n).interface_transaction_id));
1569: END IF;
1570:
1563: temp_cascaded_table(current_n).error_message := 'RCV_SHIP_QTY_OVER_TOLERANCE';
1564:
1565: IF (g_asn_debug = 'Y') THEN
1566: asn_debug.put_line('Group Id ' || TO_CHAR(temp_cascaded_table(current_n).GROUP_ID));
1567: asn_debug.put_line('Header Interface Id ' || TO_CHAR(temp_cascaded_table(current_n).header_interface_id));
1568: asn_debug.put_line('IN Trans Id ' || TO_CHAR(temp_cascaded_table(current_n).interface_transaction_id));
1569: END IF;
1570:
1571: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_warning;
1564:
1565: IF (g_asn_debug = 'Y') THEN
1566: asn_debug.put_line('Group Id ' || TO_CHAR(temp_cascaded_table(current_n).GROUP_ID));
1567: asn_debug.put_line('Header Interface Id ' || TO_CHAR(temp_cascaded_table(current_n).header_interface_id));
1568: asn_debug.put_line('IN Trans Id ' || TO_CHAR(temp_cascaded_table(current_n).interface_transaction_id));
1569: END IF;
1570:
1571: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_warning;
1572: rcv_error_pkg.set_error_message('RCV_SHIP_QTY_OVER_TOLERANCE', x_cascaded_table(n).error_message);
1573: rcv_error_pkg.set_token('QTY_A', temp_cascaded_table(current_n).quantity);
1574: rcv_error_pkg.set_token('QTY_B', temp_cascaded_table(current_n).quantity - x_remaining_quantity);
1575: rcv_error_pkg.log_interface_warning('QUANTITY');
1576:
1577: IF (g_asn_debug = 'Y') THEN
1578: asn_debug.put_line('Error Status ' || temp_cascaded_table(current_n).error_status);
1579: asn_debug.put_line('Error message ' || temp_cascaded_table(current_n).error_message);
1580: asn_debug.put_line('Need to insert into po_interface_errors');
1581: END IF;
1574: rcv_error_pkg.set_token('QTY_B', temp_cascaded_table(current_n).quantity - x_remaining_quantity);
1575: rcv_error_pkg.log_interface_warning('QUANTITY');
1576:
1577: IF (g_asn_debug = 'Y') THEN
1578: asn_debug.put_line('Error Status ' || temp_cascaded_table(current_n).error_status);
1579: asn_debug.put_line('Error message ' || temp_cascaded_table(current_n).error_message);
1580: asn_debug.put_line('Need to insert into po_interface_errors');
1581: END IF;
1582: END IF;
1575: rcv_error_pkg.log_interface_warning('QUANTITY');
1576:
1577: IF (g_asn_debug = 'Y') THEN
1578: asn_debug.put_line('Error Status ' || temp_cascaded_table(current_n).error_status);
1579: asn_debug.put_line('Error message ' || temp_cascaded_table(current_n).error_message);
1580: asn_debug.put_line('Need to insert into po_interface_errors');
1581: END IF;
1582: END IF;
1583:
1576:
1577: IF (g_asn_debug = 'Y') THEN
1578: asn_debug.put_line('Error Status ' || temp_cascaded_table(current_n).error_status);
1579: asn_debug.put_line('Error message ' || temp_cascaded_table(current_n).error_message);
1580: asn_debug.put_line('Need to insert into po_interface_errors');
1581: END IF;
1582: END IF;
1583:
1584: IF (g_asn_debug = 'Y') THEN
1580: asn_debug.put_line('Need to insert into po_interface_errors');
1581: END IF;
1582: END IF;
1583:
1584: IF (g_asn_debug = 'Y') THEN
1585: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1586: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1587: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1588: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1581: END IF;
1582: END IF;
1583:
1584: IF (g_asn_debug = 'Y') THEN
1585: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1586: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1587: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1588: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1589: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1582: END IF;
1583:
1584: IF (g_asn_debug = 'Y') THEN
1585: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1586: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1587: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1588: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1589: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1590: END IF;
1583:
1584: IF (g_asn_debug = 'Y') THEN
1585: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1586: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1587: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1588: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1589: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1590: END IF;
1591: ELSIF x_qty_rcv_exception_code = 'REJECT' THEN
1584: IF (g_asn_debug = 'Y') THEN
1585: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1586: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1587: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1588: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1589: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1590: END IF;
1591: ELSIF x_qty_rcv_exception_code = 'REJECT' THEN
1592: IF (g_asn_debug = 'Y') THEN
1585: asn_debug.put_line('Current quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity));
1586: asn_debug.put_line('Current shipped quantity ' || TO_CHAR(temp_cascaded_table(current_n).quantity_shipped));
1587: asn_debug.put_line('Current source document quantity ' || TO_CHAR(temp_cascaded_table(current_n).source_doc_quantity));
1588: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1589: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1590: END IF;
1591: ELSIF x_qty_rcv_exception_code = 'REJECT' THEN
1592: IF (g_asn_debug = 'Y') THEN
1593: asn_debug.put_line('Extra ASN UOM Quantity ' || TO_CHAR(x_remaining_quantity));
1588: asn_debug.put_line('Current primary quantity ' || TO_CHAR(temp_cascaded_table(current_n).primary_quantity));
1589: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1590: END IF;
1591: ELSIF x_qty_rcv_exception_code = 'REJECT' THEN
1592: IF (g_asn_debug = 'Y') THEN
1593: asn_debug.put_line('Extra ASN UOM Quantity ' || TO_CHAR(x_remaining_quantity));
1594: asn_debug.put_line('Extra PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
1595: END IF;
1596:
1589: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
1590: END IF;
1591: ELSIF x_qty_rcv_exception_code = 'REJECT' THEN
1592: IF (g_asn_debug = 'Y') THEN
1593: asn_debug.put_line('Extra ASN UOM Quantity ' || TO_CHAR(x_remaining_quantity));
1594: asn_debug.put_line('Extra PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
1595: END IF;
1596:
1597: IF (g_asn_debug = 'Y') THEN
1590: END IF;
1591: ELSIF x_qty_rcv_exception_code = 'REJECT' THEN
1592: IF (g_asn_debug = 'Y') THEN
1593: asn_debug.put_line('Extra ASN UOM Quantity ' || TO_CHAR(x_remaining_quantity));
1594: asn_debug.put_line('Extra PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
1595: END IF;
1596:
1597: IF (g_asn_debug = 'Y') THEN
1598: asn_debug.put_line('delete the temp table ');
1593: asn_debug.put_line('Extra ASN UOM Quantity ' || TO_CHAR(x_remaining_quantity));
1594: asn_debug.put_line('Extra PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
1595: END IF;
1596:
1597: IF (g_asn_debug = 'Y') THEN
1598: asn_debug.put_line('delete the temp table ');
1599: END IF;
1600:
1601: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
1594: asn_debug.put_line('Extra PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
1595: END IF;
1596:
1597: IF (g_asn_debug = 'Y') THEN
1598: asn_debug.put_line('delete the temp table ');
1599: END IF;
1600:
1601: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
1602: rcv_error_pkg.set_error_message('RCV_SHIP_QTY_OVER_TOLERANCE', x_cascaded_table(n).error_message);
1609: temp_cascaded_table.DELETE(i);
1610: END LOOP;
1611: END IF;
1612:
1613: IF (g_asn_debug = 'Y') THEN
1614: asn_debug.put_line('mark the actual table with error status');
1615: asn_debug.put_line('Error Status ' || x_cascaded_table(n).error_status);
1616: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
1617: END IF;
1610: END LOOP;
1611: END IF;
1612:
1613: IF (g_asn_debug = 'Y') THEN
1614: asn_debug.put_line('mark the actual table with error status');
1615: asn_debug.put_line('Error Status ' || x_cascaded_table(n).error_status);
1616: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
1617: END IF;
1618:
1611: END IF;
1612:
1613: IF (g_asn_debug = 'Y') THEN
1614: asn_debug.put_line('mark the actual table with error status');
1615: asn_debug.put_line('Error Status ' || x_cascaded_table(n).error_status);
1616: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
1617: END IF;
1618:
1619: IF (g_asn_debug = 'Y') THEN
1612:
1613: IF (g_asn_debug = 'Y') THEN
1614: asn_debug.put_line('mark the actual table with error status');
1615: asn_debug.put_line('Error Status ' || x_cascaded_table(n).error_status);
1616: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
1617: END IF;
1618:
1619: IF (g_asn_debug = 'Y') THEN
1620: asn_debug.put_line('Need to insert a row into po_interface_errors');
1615: asn_debug.put_line('Error Status ' || x_cascaded_table(n).error_status);
1616: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
1617: END IF;
1618:
1619: IF (g_asn_debug = 'Y') THEN
1620: asn_debug.put_line('Need to insert a row into po_interface_errors');
1621: END IF;
1622: END IF;
1623: ELSE
1616: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
1617: END IF;
1618:
1619: IF (g_asn_debug = 'Y') THEN
1620: asn_debug.put_line('Need to insert a row into po_interface_errors');
1621: END IF;
1622: END IF;
1623: ELSE
1624: IF rows_fetched = 0 THEN
1621: END IF;
1622: END IF;
1623: ELSE
1624: IF rows_fetched = 0 THEN
1625: IF (g_asn_debug = 'Y') THEN
1626: asn_debug.put_line('No rows were retrieved from cursor.');
1627: END IF;
1628: ELSIF x_first_trans THEN
1629: IF (g_asn_debug = 'Y') THEN
1622: END IF;
1623: ELSE
1624: IF rows_fetched = 0 THEN
1625: IF (g_asn_debug = 'Y') THEN
1626: asn_debug.put_line('No rows were retrieved from cursor.');
1627: END IF;
1628: ELSIF x_first_trans THEN
1629: IF (g_asn_debug = 'Y') THEN
1630: asn_debug.put_line('No rows were cascaded');
1625: IF (g_asn_debug = 'Y') THEN
1626: asn_debug.put_line('No rows were retrieved from cursor.');
1627: END IF;
1628: ELSIF x_first_trans THEN
1629: IF (g_asn_debug = 'Y') THEN
1630: asn_debug.put_line('No rows were cascaded');
1631: END IF;
1632: END IF;
1633:
1626: asn_debug.put_line('No rows were retrieved from cursor.');
1627: END IF;
1628: ELSIF x_first_trans THEN
1629: IF (g_asn_debug = 'Y') THEN
1630: asn_debug.put_line('No rows were cascaded');
1631: END IF;
1632: END IF;
1633:
1634: x_temp_count := 1;
1809: END LOOP;
1810: END IF;
1811: END IF;
1812: ELSE
1813: IF (g_asn_debug = 'Y') THEN
1814: asn_debug.put_line('Remaining ASN UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
1815: asn_debug.put_line('Remaining PO UOM quantity is zero ' || TO_CHAR(x_remaining_qty_po_uom));
1816: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
1817: END IF;
1810: END IF;
1811: END IF;
1812: ELSE
1813: IF (g_asn_debug = 'Y') THEN
1814: asn_debug.put_line('Remaining ASN UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
1815: asn_debug.put_line('Remaining PO UOM quantity is zero ' || TO_CHAR(x_remaining_qty_po_uom));
1816: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
1817: END IF;
1818: END IF;
1811: END IF;
1812: ELSE
1813: IF (g_asn_debug = 'Y') THEN
1814: asn_debug.put_line('Remaining ASN UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
1815: asn_debug.put_line('Remaining PO UOM quantity is zero ' || TO_CHAR(x_remaining_qty_po_uom));
1816: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
1817: END IF;
1818: END IF;
1819:
1812: ELSE
1813: IF (g_asn_debug = 'Y') THEN
1814: asn_debug.put_line('Remaining ASN UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
1815: asn_debug.put_line('Remaining PO UOM quantity is zero ' || TO_CHAR(x_remaining_qty_po_uom));
1816: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
1817: END IF;
1818: END IF;
1819:
1820: -- close cursors
1817: END IF;
1818: END IF;
1819:
1820: -- close cursors
1821: IF (g_asn_debug = 'Y') THEN
1822: asn_debug.put_line('Close cursors shipments, count_shipments, distributions, count_disributions');
1823: END IF;
1824:
1825: IF shipments%ISOPEN THEN
1818: END IF;
1819:
1820: -- close cursors
1821: IF (g_asn_debug = 'Y') THEN
1822: asn_debug.put_line('Close cursors shipments, count_shipments, distributions, count_disributions');
1823: END IF;
1824:
1825: IF shipments%ISOPEN THEN
1826: CLOSE shipments;
1842: END IF;
1843:
1844: -- eliminate the row if it fails the date check
1845:
1846: IF (g_asn_debug = 'Y') THEN
1847: asn_debug.put_line('Count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
1848: asn_debug.put_line('Cursor record ' || TO_CHAR(rows_fetched));
1849: asn_debug.put_line('Check date tolerance');
1850: END IF;
1843:
1844: -- eliminate the row if it fails the date check
1845:
1846: IF (g_asn_debug = 'Y') THEN
1847: asn_debug.put_line('Count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
1848: asn_debug.put_line('Cursor record ' || TO_CHAR(rows_fetched));
1849: asn_debug.put_line('Check date tolerance');
1850: END IF;
1851:
1844: -- eliminate the row if it fails the date check
1845:
1846: IF (g_asn_debug = 'Y') THEN
1847: asn_debug.put_line('Count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
1848: asn_debug.put_line('Cursor record ' || TO_CHAR(rows_fetched));
1849: asn_debug.put_line('Check date tolerance');
1850: END IF;
1851:
1852: check_date_tolerance(NVL(temp_cascaded_table(1).expected_receipt_date, x_header_record.header_record.expected_receipt_date), -- Bug 487222
1845:
1846: IF (g_asn_debug = 'Y') THEN
1847: asn_debug.put_line('Count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
1848: asn_debug.put_line('Cursor record ' || TO_CHAR(rows_fetched));
1849: asn_debug.put_line('Check date tolerance');
1850: END IF;
1851:
1852: check_date_tolerance(NVL(temp_cascaded_table(1).expected_receipt_date, x_header_record.header_record.expected_receipt_date), -- Bug 487222
1853: x_shipmentdistributionrec.promised_date,
1863: rcv_error_pkg.set_token('DELIVERY DATE', NVL(temp_cascaded_table(1).expected_receipt_date, x_header_record.header_record.expected_receipt_date));
1864: rcv_error_pkg.log_interface_error('EXPECTED_RECEIPT_DATE', FALSE);
1865: END IF;
1866:
1867: IF (g_asn_debug = 'Y') THEN
1868: asn_debug.put_line('Days exception Code ' || NVL(x_shipmentdistributionrec.receipt_days_exception_code, 'XXX'));
1869: END IF;
1870:
1871: -- Check shipto_location enforcement
1864: rcv_error_pkg.log_interface_error('EXPECTED_RECEIPT_DATE', FALSE);
1865: END IF;
1866:
1867: IF (g_asn_debug = 'Y') THEN
1868: asn_debug.put_line('Days exception Code ' || NVL(x_shipmentdistributionrec.receipt_days_exception_code, 'XXX'));
1869: END IF;
1870:
1871: -- Check shipto_location enforcement
1872:
1874: NVL(temp_cascaded_table(1).ship_to_location_id, x_header_record.header_record.location_id),
1875: x_shipmentdistributionrec.enforce_ship_to_location_code
1876: );
1877:
1878: IF (g_asn_debug = 'Y') THEN
1879: asn_debug.put_line('Enforce ShipToLocation ' || NVL(x_shipmentdistributionrec.enforce_ship_to_location_code, 'XXX'));
1880: END IF;
1881:
1882: /* Bug 2208664 : Enter error message in po_interface_errors if enforce_ship_to_location_code is 'WARNING', and
1875: x_shipmentdistributionrec.enforce_ship_to_location_code
1876: );
1877:
1878: IF (g_asn_debug = 'Y') THEN
1879: asn_debug.put_line('Enforce ShipToLocation ' || NVL(x_shipmentdistributionrec.enforce_ship_to_location_code, 'XXX'));
1880: END IF;
1881:
1882: /* Bug 2208664 : Enter error message in po_interface_errors if enforce_ship_to_location_code is 'WARNING', and
1883: Enter error message in po_interface_errors if enforce_ship_to_location_code is 'REJECT' and error out
1918: IF (x_first_trans)
1919: AND temp_cascaded_table(current_n).item_id IS NULL THEN
1920: temp_cascaded_table(current_n).item_id := x_shipmentdistributionrec.item_id;
1921:
1922: IF (g_asn_debug = 'Y') THEN
1923: asn_debug.put_line('Cursor Item Id is ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1924: END IF;
1925:
1926: /* Start Bug# 3193969 - For one time items or EAM items which donot have an
1919: AND temp_cascaded_table(current_n).item_id IS NULL THEN
1920: temp_cascaded_table(current_n).item_id := x_shipmentdistributionrec.item_id;
1921:
1922: IF (g_asn_debug = 'Y') THEN
1923: asn_debug.put_line('Cursor Item Id is ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
1924: END IF;
1925:
1926: /* Start Bug# 3193969 - For one time items or EAM items which donot have an
1927: item_id, primary uom should be the base uom of the class to which the
1936: WHERE tuom.unit_of_measure = temp_cascaded_table(current_n).unit_of_measure
1937: AND tuom.uom_class = muom.uom_class
1938: AND muom.base_uom_flag = 'Y';
1939:
1940: IF (g_asn_debug = 'Y') THEN
1941: asn_debug.put_line('Transaction UOM: ' || temp_cascaded_table(current_n).unit_of_measure);
1942: asn_debug.put_line('Primary UOM for one time item: ' || temp_cascaded_table(current_n).primary_unit_of_measure);
1943: END IF;
1944: EXCEPTION
1937: AND tuom.uom_class = muom.uom_class
1938: AND muom.base_uom_flag = 'Y';
1939:
1940: IF (g_asn_debug = 'Y') THEN
1941: asn_debug.put_line('Transaction UOM: ' || temp_cascaded_table(current_n).unit_of_measure);
1942: asn_debug.put_line('Primary UOM for one time item: ' || temp_cascaded_table(current_n).primary_unit_of_measure);
1943: END IF;
1944: EXCEPTION
1945: WHEN NO_DATA_FOUND THEN
1938: AND muom.base_uom_flag = 'Y';
1939:
1940: IF (g_asn_debug = 'Y') THEN
1941: asn_debug.put_line('Transaction UOM: ' || temp_cascaded_table(current_n).unit_of_measure);
1942: asn_debug.put_line('Primary UOM for one time item: ' || temp_cascaded_table(current_n).primary_unit_of_measure);
1943: END IF;
1944: EXCEPTION
1945: WHEN NO_DATA_FOUND THEN
1946: temp_cascaded_table(current_n).error_status := 'W';
1945: WHEN NO_DATA_FOUND THEN
1946: temp_cascaded_table(current_n).error_status := 'W';
1947: temp_cascaded_table(current_n).error_message := 'Need an error message';
1948:
1949: IF (g_asn_debug = 'Y') THEN
1950: asn_debug.put_line('Primary UOM error for one time items');
1951: END IF;
1952: END;
1953: ELSE
1946: temp_cascaded_table(current_n).error_status := 'W';
1947: temp_cascaded_table(current_n).error_message := 'Need an error message';
1948:
1949: IF (g_asn_debug = 'Y') THEN
1950: asn_debug.put_line('Primary UOM error for one time items');
1951: END IF;
1952: END;
1953: ELSE
1954: BEGIN
1957: FROM mtl_system_items
1958: WHERE mtl_system_items.inventory_item_id = temp_cascaded_table(current_n).item_id
1959: AND mtl_system_items.organization_id = temp_cascaded_table(current_n).to_organization_id;
1960:
1961: IF (g_asn_debug = 'Y') THEN
1962: asn_debug.put_line('Primary UOM: ' || temp_cascaded_table(current_n).primary_unit_of_measure);
1963: END IF;
1964: EXCEPTION
1965: WHEN NO_DATA_FOUND THEN
1958: WHERE mtl_system_items.inventory_item_id = temp_cascaded_table(current_n).item_id
1959: AND mtl_system_items.organization_id = temp_cascaded_table(current_n).to_organization_id;
1960:
1961: IF (g_asn_debug = 'Y') THEN
1962: asn_debug.put_line('Primary UOM: ' || temp_cascaded_table(current_n).primary_unit_of_measure);
1963: END IF;
1964: EXCEPTION
1965: WHEN NO_DATA_FOUND THEN
1966: temp_cascaded_table(current_n).error_status := 'W';
1965: WHEN NO_DATA_FOUND THEN
1966: temp_cascaded_table(current_n).error_status := 'W';
1967: temp_cascaded_table(current_n).error_message := 'Need an error message';
1968:
1969: IF (g_asn_debug = 'Y') THEN
1970: asn_debug.put_line('Primary UOM error');
1971: END IF;
1972: END;
1973: END IF;
1966: temp_cascaded_table(current_n).error_status := 'W';
1967: temp_cascaded_table(current_n).error_message := 'Need an error message';
1968:
1969: IF (g_asn_debug = 'Y') THEN
1970: asn_debug.put_line('Primary UOM error');
1971: END IF;
1972: END;
1973: END IF;
1974: END IF;
2043: END LOOP;
2044: END IF;
2045: END IF;
2046:
2047: IF (g_asn_debug = 'Y') THEN
2048: asn_debug.put_line('After call to get_available quantity');
2049: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2050: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2051: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2044: END IF;
2045: END IF;
2046:
2047: IF (g_asn_debug = 'Y') THEN
2048: asn_debug.put_line('After call to get_available quantity');
2049: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2050: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2051: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2052: asn_debug.put_line('Pointer to temp table ' || TO_CHAR(current_n));
2045: END IF;
2046:
2047: IF (g_asn_debug = 'Y') THEN
2048: asn_debug.put_line('After call to get_available quantity');
2049: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2050: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2051: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2052: asn_debug.put_line('Pointer to temp table ' || TO_CHAR(current_n));
2053: END IF;
2046:
2047: IF (g_asn_debug = 'Y') THEN
2048: asn_debug.put_line('After call to get_available quantity');
2049: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2050: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2051: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2052: asn_debug.put_line('Pointer to temp table ' || TO_CHAR(current_n));
2053: END IF;
2054:
2047: IF (g_asn_debug = 'Y') THEN
2048: asn_debug.put_line('After call to get_available quantity');
2049: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2050: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2051: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2052: asn_debug.put_line('Pointer to temp table ' || TO_CHAR(current_n));
2053: END IF;
2054:
2055: -- if qty has already been allocated then reduce available and tolerable
2048: asn_debug.put_line('After call to get_available quantity');
2049: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2050: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2051: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2052: asn_debug.put_line('Pointer to temp table ' || TO_CHAR(current_n));
2053: END IF;
2054:
2055: -- if qty has already been allocated then reduce available and tolerable
2056: -- qty by the allocated amount
2066: IF x_tolerable_qty < 0 THEN
2067: x_tolerable_qty := 0;
2068: END IF;
2069:
2070: IF (g_asn_debug = 'Y') THEN
2071: asn_debug.put_line('Have some allocated quantity. Will reduce qty');
2072: asn_debug.put_line('Allocated Qty ' || TO_CHAR(already_allocated_qty));
2073: asn_debug.put_line('After reducing by allocated qty');
2074: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2067: x_tolerable_qty := 0;
2068: END IF;
2069:
2070: IF (g_asn_debug = 'Y') THEN
2071: asn_debug.put_line('Have some allocated quantity. Will reduce qty');
2072: asn_debug.put_line('Allocated Qty ' || TO_CHAR(already_allocated_qty));
2073: asn_debug.put_line('After reducing by allocated qty');
2074: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2075: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2068: END IF;
2069:
2070: IF (g_asn_debug = 'Y') THEN
2071: asn_debug.put_line('Have some allocated quantity. Will reduce qty');
2072: asn_debug.put_line('Allocated Qty ' || TO_CHAR(already_allocated_qty));
2073: asn_debug.put_line('After reducing by allocated qty');
2074: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2075: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2076: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2069:
2070: IF (g_asn_debug = 'Y') THEN
2071: asn_debug.put_line('Have some allocated quantity. Will reduce qty');
2072: asn_debug.put_line('Allocated Qty ' || TO_CHAR(already_allocated_qty));
2073: asn_debug.put_line('After reducing by allocated qty');
2074: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2075: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2076: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2077: asn_debug.put_line('Pointer to temp table ' || TO_CHAR(current_n));
2070: IF (g_asn_debug = 'Y') THEN
2071: asn_debug.put_line('Have some allocated quantity. Will reduce qty');
2072: asn_debug.put_line('Allocated Qty ' || TO_CHAR(already_allocated_qty));
2073: asn_debug.put_line('After reducing by allocated qty');
2074: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2075: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2076: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2077: asn_debug.put_line('Pointer to temp table ' || TO_CHAR(current_n));
2078: END IF;
2071: asn_debug.put_line('Have some allocated quantity. Will reduce qty');
2072: asn_debug.put_line('Allocated Qty ' || TO_CHAR(already_allocated_qty));
2073: asn_debug.put_line('After reducing by allocated qty');
2074: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2075: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2076: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2077: asn_debug.put_line('Pointer to temp table ' || TO_CHAR(current_n));
2078: END IF;
2079: END IF;
2072: asn_debug.put_line('Allocated Qty ' || TO_CHAR(already_allocated_qty));
2073: asn_debug.put_line('After reducing by allocated qty');
2074: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2075: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2076: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2077: asn_debug.put_line('Pointer to temp table ' || TO_CHAR(current_n));
2078: END IF;
2079: END IF;
2080:
2073: asn_debug.put_line('After reducing by allocated qty');
2074: asn_debug.put_line('Available Quantity ' || TO_CHAR(x_converted_trx_qty));
2075: asn_debug.put_line('Tolerable Quantity ' || TO_CHAR(x_tolerable_qty));
2076: asn_debug.put_line('Already Shipped Quantity ' || TO_CHAR(NVL(x_shipmentdistributionrec.quantity_shipped, 0)));
2077: asn_debug.put_line('Pointer to temp table ' || TO_CHAR(current_n));
2078: END IF;
2079: END IF;
2080:
2081: -- We can use the first record since the item_id and uom are not going to change
2109: OR -- no point in going further for this record
2110: po_asn_uom_qty = 0
2111: OR -- as we cannot convert between the ASN -> PO uoms
2112: po_primary_uom_qty = 0 THEN -- PO -> ASN uom, PO -> PRIMARY UOM
2113: IF (g_asn_debug = 'Y') THEN
2114: asn_debug.put_line('Need an error message in the interface tables');
2115: asn_debug.put_line('Cannot interconvert between diff UOMs');
2116: asn_debug.put_line('This po_line cannot be used as the uoms ');
2117: asn_debug.put_line(temp_cascaded_table(1).unit_of_measure || ' ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2110: po_asn_uom_qty = 0
2111: OR -- as we cannot convert between the ASN -> PO uoms
2112: po_primary_uom_qty = 0 THEN -- PO -> ASN uom, PO -> PRIMARY UOM
2113: IF (g_asn_debug = 'Y') THEN
2114: asn_debug.put_line('Need an error message in the interface tables');
2115: asn_debug.put_line('Cannot interconvert between diff UOMs');
2116: asn_debug.put_line('This po_line cannot be used as the uoms ');
2117: asn_debug.put_line(temp_cascaded_table(1).unit_of_measure || ' ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2118: asn_debug.put_line('cannot be converted for item ' || TO_CHAR(temp_cascaded_table(1).item_id));
2111: OR -- as we cannot convert between the ASN -> PO uoms
2112: po_primary_uom_qty = 0 THEN -- PO -> ASN uom, PO -> PRIMARY UOM
2113: IF (g_asn_debug = 'Y') THEN
2114: asn_debug.put_line('Need an error message in the interface tables');
2115: asn_debug.put_line('Cannot interconvert between diff UOMs');
2116: asn_debug.put_line('This po_line cannot be used as the uoms ');
2117: asn_debug.put_line(temp_cascaded_table(1).unit_of_measure || ' ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2118: asn_debug.put_line('cannot be converted for item ' || TO_CHAR(temp_cascaded_table(1).item_id));
2119: END IF;
2112: po_primary_uom_qty = 0 THEN -- PO -> ASN uom, PO -> PRIMARY UOM
2113: IF (g_asn_debug = 'Y') THEN
2114: asn_debug.put_line('Need an error message in the interface tables');
2115: asn_debug.put_line('Cannot interconvert between diff UOMs');
2116: asn_debug.put_line('This po_line cannot be used as the uoms ');
2117: asn_debug.put_line(temp_cascaded_table(1).unit_of_measure || ' ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2118: asn_debug.put_line('cannot be converted for item ' || TO_CHAR(temp_cascaded_table(1).item_id));
2119: END IF;
2120: ELSE -- we have converted the qty between uoms succesfully
2113: IF (g_asn_debug = 'Y') THEN
2114: asn_debug.put_line('Need an error message in the interface tables');
2115: asn_debug.put_line('Cannot interconvert between diff UOMs');
2116: asn_debug.put_line('This po_line cannot be used as the uoms ');
2117: asn_debug.put_line(temp_cascaded_table(1).unit_of_measure || ' ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2118: asn_debug.put_line('cannot be converted for item ' || TO_CHAR(temp_cascaded_table(1).item_id));
2119: END IF;
2120: ELSE -- we have converted the qty between uoms succesfully
2121: IF (g_asn_debug = 'Y') THEN
2114: asn_debug.put_line('Need an error message in the interface tables');
2115: asn_debug.put_line('Cannot interconvert between diff UOMs');
2116: asn_debug.put_line('This po_line cannot be used as the uoms ');
2117: asn_debug.put_line(temp_cascaded_table(1).unit_of_measure || ' ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2118: asn_debug.put_line('cannot be converted for item ' || TO_CHAR(temp_cascaded_table(1).item_id));
2119: END IF;
2120: ELSE -- we have converted the qty between uoms succesfully
2121: IF (g_asn_debug = 'Y') THEN
2122: asn_debug.put_line('Current Item Id ' || TO_CHAR(temp_cascaded_table(1).item_id));
2117: asn_debug.put_line(temp_cascaded_table(1).unit_of_measure || ' ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2118: asn_debug.put_line('cannot be converted for item ' || TO_CHAR(temp_cascaded_table(1).item_id));
2119: END IF;
2120: ELSE -- we have converted the qty between uoms succesfully
2121: IF (g_asn_debug = 'Y') THEN
2122: asn_debug.put_line('Current Item Id ' || TO_CHAR(temp_cascaded_table(1).item_id));
2123: asn_debug.put_line('Current ASN Quantity ' || TO_CHAR(x_remaining_quantity));
2124: asn_debug.put_line('Current ASN UOM ' || temp_cascaded_table(1).unit_of_measure);
2125: asn_debug.put_line('Converted PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
2118: asn_debug.put_line('cannot be converted for item ' || TO_CHAR(temp_cascaded_table(1).item_id));
2119: END IF;
2120: ELSE -- we have converted the qty between uoms succesfully
2121: IF (g_asn_debug = 'Y') THEN
2122: asn_debug.put_line('Current Item Id ' || TO_CHAR(temp_cascaded_table(1).item_id));
2123: asn_debug.put_line('Current ASN Quantity ' || TO_CHAR(x_remaining_quantity));
2124: asn_debug.put_line('Current ASN UOM ' || temp_cascaded_table(1).unit_of_measure);
2125: asn_debug.put_line('Converted PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
2126: asn_debug.put_line('PO UOM ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2119: END IF;
2120: ELSE -- we have converted the qty between uoms succesfully
2121: IF (g_asn_debug = 'Y') THEN
2122: asn_debug.put_line('Current Item Id ' || TO_CHAR(temp_cascaded_table(1).item_id));
2123: asn_debug.put_line('Current ASN Quantity ' || TO_CHAR(x_remaining_quantity));
2124: asn_debug.put_line('Current ASN UOM ' || temp_cascaded_table(1).unit_of_measure);
2125: asn_debug.put_line('Converted PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
2126: asn_debug.put_line('PO UOM ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2127: END IF;
2120: ELSE -- we have converted the qty between uoms succesfully
2121: IF (g_asn_debug = 'Y') THEN
2122: asn_debug.put_line('Current Item Id ' || TO_CHAR(temp_cascaded_table(1).item_id));
2123: asn_debug.put_line('Current ASN Quantity ' || TO_CHAR(x_remaining_quantity));
2124: asn_debug.put_line('Current ASN UOM ' || temp_cascaded_table(1).unit_of_measure);
2125: asn_debug.put_line('Converted PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
2126: asn_debug.put_line('PO UOM ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2127: END IF;
2128:
2121: IF (g_asn_debug = 'Y') THEN
2122: asn_debug.put_line('Current Item Id ' || TO_CHAR(temp_cascaded_table(1).item_id));
2123: asn_debug.put_line('Current ASN Quantity ' || TO_CHAR(x_remaining_quantity));
2124: asn_debug.put_line('Current ASN UOM ' || temp_cascaded_table(1).unit_of_measure);
2125: asn_debug.put_line('Converted PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
2126: asn_debug.put_line('PO UOM ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2127: END IF;
2128:
2129: -- If last row set available = tolerable - shipped
2122: asn_debug.put_line('Current Item Id ' || TO_CHAR(temp_cascaded_table(1).item_id));
2123: asn_debug.put_line('Current ASN Quantity ' || TO_CHAR(x_remaining_quantity));
2124: asn_debug.put_line('Current ASN UOM ' || temp_cascaded_table(1).unit_of_measure);
2125: asn_debug.put_line('Converted PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
2126: asn_debug.put_line('PO UOM ' || x_shipmentdistributionrec.unit_meas_lookup_code);
2127: END IF;
2128:
2129: -- If last row set available = tolerable - shipped
2130: -- else = available - shipped
2135: */
2136: IF rows_fetched = x_record_count THEN
2137: x_converted_trx_qty := x_tolerable_qty - NVL(x_shipmentdistributionrec.quantity_shipped, 0);
2138:
2139: IF (g_asn_debug = 'Y') THEN
2140: asn_debug.put_line('Last Row : ' || TO_CHAR(x_converted_trx_qty));
2141: END IF;
2142: ELSE
2143: x_converted_trx_qty := x_converted_trx_qty - NVL(x_shipmentdistributionrec.quantity_shipped, 0);
2136: IF rows_fetched = x_record_count THEN
2137: x_converted_trx_qty := x_tolerable_qty - NVL(x_shipmentdistributionrec.quantity_shipped, 0);
2138:
2139: IF (g_asn_debug = 'Y') THEN
2140: asn_debug.put_line('Last Row : ' || TO_CHAR(x_converted_trx_qty));
2141: END IF;
2142: ELSE
2143: x_converted_trx_qty := x_converted_trx_qty - NVL(x_shipmentdistributionrec.quantity_shipped, 0);
2144:
2141: END IF;
2142: ELSE
2143: x_converted_trx_qty := x_converted_trx_qty - NVL(x_shipmentdistributionrec.quantity_shipped, 0);
2144:
2145: IF (g_asn_debug = 'Y') THEN
2146: asn_debug.put_line('Not Last Row : ' || TO_CHAR(x_converted_trx_qty));
2147: END IF;
2148: END IF;
2149:
2142: ELSE
2143: x_converted_trx_qty := x_converted_trx_qty - NVL(x_shipmentdistributionrec.quantity_shipped, 0);
2144:
2145: IF (g_asn_debug = 'Y') THEN
2146: asn_debug.put_line('Not Last Row : ' || TO_CHAR(x_converted_trx_qty));
2147: END IF;
2148: END IF;
2149:
2150: IF x_converted_trx_qty > 0 THEN
2148: END IF;
2149:
2150: IF x_converted_trx_qty > 0 THEN
2151: IF (x_converted_trx_qty < x_remaining_qty_po_uom) THEN -- compare like uoms
2152: IF (g_asn_debug = 'Y') THEN
2153: asn_debug.put_line('We are in > Qty branch');
2154: END IF;
2155:
2156: x_remaining_qty_po_uom := x_remaining_qty_po_uom - x_converted_trx_qty;
2149:
2150: IF x_converted_trx_qty > 0 THEN
2151: IF (x_converted_trx_qty < x_remaining_qty_po_uom) THEN -- compare like uoms
2152: IF (g_asn_debug = 'Y') THEN
2153: asn_debug.put_line('We are in > Qty branch');
2154: END IF;
2155:
2156: x_remaining_qty_po_uom := x_remaining_qty_po_uom - x_converted_trx_qty;
2157: -- change asn uom qty so both qtys are in sync
2162: temp_cascaded_table(1).unit_of_measure
2163: );
2164: insert_into_table := TRUE;
2165: ELSE
2166: IF (g_asn_debug = 'Y') THEN
2167: asn_debug.put_line('We are in <= Qty branch ');
2168: END IF;
2169:
2170: x_converted_trx_qty := x_remaining_qty_po_uom;
2163: );
2164: insert_into_table := TRUE;
2165: ELSE
2166: IF (g_asn_debug = 'Y') THEN
2167: asn_debug.put_line('We are in <= Qty branch ');
2168: END IF;
2169:
2170: x_converted_trx_qty := x_remaining_qty_po_uom;
2171: insert_into_table := TRUE;
2175: ELSE -- no qty for this record but if last row we need it
2176: IF rows_fetched = x_record_count THEN -- last row needs to be inserted anyway
2177: -- so that the row can be used based on qty tolerance
2178: -- checks
2179: IF (g_asn_debug = 'Y') THEN
2180: asn_debug.put_line('Quantity is less then 0 but last record');
2181: END IF;
2182:
2183: insert_into_table := TRUE;
2176: IF rows_fetched = x_record_count THEN -- last row needs to be inserted anyway
2177: -- so that the row can be used based on qty tolerance
2178: -- checks
2179: IF (g_asn_debug = 'Y') THEN
2180: asn_debug.put_line('Quantity is less then 0 but last record');
2181: END IF;
2182:
2183: insert_into_table := TRUE;
2184: x_converted_trx_qty := 0;
2182:
2183: insert_into_table := TRUE;
2184: x_converted_trx_qty := 0;
2185: ELSE
2186: IF (g_asn_debug = 'Y') THEN
2187: asn_debug.put_line('<= 0 Quantity but more records in cursor');
2188: END IF;
2189:
2190: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
2183: insert_into_table := TRUE;
2184: x_converted_trx_qty := 0;
2185: ELSE
2186: IF (g_asn_debug = 'Y') THEN
2187: asn_debug.put_line('<= 0 Quantity but more records in cursor');
2188: END IF;
2189:
2190: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
2191:
2188: END IF;
2189:
2190: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
2191:
2192: IF (g_asn_debug = 'Y') THEN
2193: asn_debug.put_line('We have to deal with remaining_qty > 0 and x_converted_trx_qty -ve');
2194: END IF;
2195:
2196: insert_into_table := FALSE;
2189:
2190: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
2191:
2192: IF (g_asn_debug = 'Y') THEN
2193: asn_debug.put_line('We have to deal with remaining_qty > 0 and x_converted_trx_qty -ve');
2194: END IF;
2195:
2196: insert_into_table := FALSE;
2197: END IF;
2199: END IF; -- remaining_qty_po_uom <> 0
2200:
2201: IF insert_into_table THEN
2202: IF (x_first_trans) THEN
2203: IF (g_asn_debug = 'Y') THEN
2204: asn_debug.put_line('First Time ' || TO_CHAR(current_n));
2205: END IF;
2206:
2207: x_first_trans := FALSE;
2200:
2201: IF insert_into_table THEN
2202: IF (x_first_trans) THEN
2203: IF (g_asn_debug = 'Y') THEN
2204: asn_debug.put_line('First Time ' || TO_CHAR(current_n));
2205: END IF;
2206:
2207: x_first_trans := FALSE;
2208:
2206:
2207: x_first_trans := FALSE;
2208:
2209: IF NVL(temp_cascaded_table(current_n).vendor_cum_shipped_qty, 0) <> 0 THEN
2210: IF (g_asn_debug = 'Y') THEN
2211: asn_debug.put_line('The cum qty from vendor is ' || TO_CHAR(temp_cascaded_table(current_n).vendor_cum_shipped_qty));
2212: END IF;
2213:
2214: /* The vendor sends us cum_qty which also includes the current shipment ???.
2207: x_first_trans := FALSE;
2208:
2209: IF NVL(temp_cascaded_table(current_n).vendor_cum_shipped_qty, 0) <> 0 THEN
2210: IF (g_asn_debug = 'Y') THEN
2211: asn_debug.put_line('The cum qty from vendor is ' || TO_CHAR(temp_cascaded_table(current_n).vendor_cum_shipped_qty));
2212: END IF;
2213:
2214: /* The vendor sends us cum_qty which also includes the current shipment ???.
2215: We need to allocate the correct cum_qty to each row as the cascade happens
2224: temp_cascaded_table(current_n).item_id,
2225: temp_cascaded_table(current_n).primary_unit_of_measure
2226: );
2227:
2228: IF (g_asn_debug = 'Y') THEN
2229: asn_debug.put_line('Cum qty - current shipment ' || TO_CHAR(temp_cascaded_table(current_n).vendor_cum_shipped_qty));
2230: END IF;
2231: END IF;
2232: ELSE
2225: temp_cascaded_table(current_n).primary_unit_of_measure
2226: );
2227:
2228: IF (g_asn_debug = 'Y') THEN
2229: asn_debug.put_line('Cum qty - current shipment ' || TO_CHAR(temp_cascaded_table(current_n).vendor_cum_shipped_qty));
2230: END IF;
2231: END IF;
2232: ELSE
2233: IF (g_asn_debug = 'Y') THEN
2229: asn_debug.put_line('Cum qty - current shipment ' || TO_CHAR(temp_cascaded_table(current_n).vendor_cum_shipped_qty));
2230: END IF;
2231: END IF;
2232: ELSE
2233: IF (g_asn_debug = 'Y') THEN
2234: asn_debug.put_line('Next Time ' || TO_CHAR(current_n));
2235: END IF;
2236:
2237: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
2230: END IF;
2231: END IF;
2232: ELSE
2233: IF (g_asn_debug = 'Y') THEN
2234: asn_debug.put_line('Next Time ' || TO_CHAR(current_n));
2235: END IF;
2236:
2237: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
2238: END IF;
2277: temp_cascaded_table(current_n).currency_code := x_shipmentdistributionrec.currency_code;
2278: temp_cascaded_table(current_n).po_unit_price := x_shipmentdistributionrec.unit_price;
2279: temp_cascaded_table(current_n).tax_amount := ROUND(temp_cascaded_table(current_n).quantity * tax_amount_factor, 4);
2280:
2281: IF (g_asn_debug = 'Y') THEN
2282: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
2283: END IF;
2284:
2285: temp_cascaded_table(current_n).category_id := x_shipmentdistributionrec.category_id;
2278: temp_cascaded_table(current_n).po_unit_price := x_shipmentdistributionrec.unit_price;
2279: temp_cascaded_table(current_n).tax_amount := ROUND(temp_cascaded_table(current_n).quantity * tax_amount_factor, 4);
2280:
2281: IF (g_asn_debug = 'Y') THEN
2282: asn_debug.put_line('Current Tax Amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
2283: END IF;
2284:
2285: temp_cascaded_table(current_n).category_id := x_shipmentdistributionrec.category_id;
2286: temp_cascaded_table(current_n).item_description := x_shipmentdistributionrec.item_description;
2293: temp_cascaded_table(current_n).po_line_id := x_shipmentdistributionrec.po_line_id;
2294: temp_cascaded_table(current_n).po_line_location_id := x_shipmentdistributionrec.line_location_id;
2295:
2296: IF x_shipmentdistributionrec.enforce_ship_to_location_code = 'WARNING' THEN
2297: IF (g_asn_debug = 'Y') THEN
2298: asn_debug.put_line('Message to warn about different shiptolocations');
2299: END IF;
2300: END IF;
2301:
2294: temp_cascaded_table(current_n).po_line_location_id := x_shipmentdistributionrec.line_location_id;
2295:
2296: IF x_shipmentdistributionrec.enforce_ship_to_location_code = 'WARNING' THEN
2297: IF (g_asn_debug = 'Y') THEN
2298: asn_debug.put_line('Message to warn about different shiptolocations');
2299: END IF;
2300: END IF;
2301:
2302: /* Bug 1845702
2403: EXCEPTION
2404: WHEN NO_DATA_FOUND THEN
2405: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2406:
2407: IF (g_asn_debug = 'Y') THEN
2408: asn_debug.put_line('The deliver to person entered in PO is currently inactive');
2409: asn_debug.put_line(' So it is cleared off');
2410: END IF;
2411: WHEN OTHERS THEN
2404: WHEN NO_DATA_FOUND THEN
2405: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2406:
2407: IF (g_asn_debug = 'Y') THEN
2408: asn_debug.put_line('The deliver to person entered in PO is currently inactive');
2409: asn_debug.put_line(' So it is cleared off');
2410: END IF;
2411: WHEN OTHERS THEN
2412: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2405: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2406:
2407: IF (g_asn_debug = 'Y') THEN
2408: asn_debug.put_line('The deliver to person entered in PO is currently inactive');
2409: asn_debug.put_line(' So it is cleared off');
2410: END IF;
2411: WHEN OTHERS THEN
2412: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2413:
2410: END IF;
2411: WHEN OTHERS THEN
2412: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2413:
2414: IF (g_asn_debug = 'Y') THEN
2415: asn_debug.put_line('Some exception has occured');
2416: asn_debug.put_line('This exception is due to the PO deliver to person');
2417: asn_debug.put_line('The deliver to person is optional');
2418: asn_debug.put_line('So cleared off the deliver to person');
2411: WHEN OTHERS THEN
2412: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2413:
2414: IF (g_asn_debug = 'Y') THEN
2415: asn_debug.put_line('Some exception has occured');
2416: asn_debug.put_line('This exception is due to the PO deliver to person');
2417: asn_debug.put_line('The deliver to person is optional');
2418: asn_debug.put_line('So cleared off the deliver to person');
2419: END IF;
2412: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2413:
2414: IF (g_asn_debug = 'Y') THEN
2415: asn_debug.put_line('Some exception has occured');
2416: asn_debug.put_line('This exception is due to the PO deliver to person');
2417: asn_debug.put_line('The deliver to person is optional');
2418: asn_debug.put_line('So cleared off the deliver to person');
2419: END IF;
2420: END;
2413:
2414: IF (g_asn_debug = 'Y') THEN
2415: asn_debug.put_line('Some exception has occured');
2416: asn_debug.put_line('This exception is due to the PO deliver to person');
2417: asn_debug.put_line('The deliver to person is optional');
2418: asn_debug.put_line('So cleared off the deliver to person');
2419: END IF;
2420: END;
2421: END IF;
2414: IF (g_asn_debug = 'Y') THEN
2415: asn_debug.put_line('Some exception has occured');
2416: asn_debug.put_line('This exception is due to the PO deliver to person');
2417: asn_debug.put_line('The deliver to person is optional');
2418: asn_debug.put_line('So cleared off the deliver to person');
2419: END IF;
2420: END;
2421: END IF;
2422: END IF;
2439: END IF;
2440:
2441: current_n := current_n + 1;
2442:
2443: IF (g_asn_debug = 'Y') THEN
2444: asn_debug.put_line('Increment pointer by 1 ' || TO_CHAR(current_n));
2445: END IF;
2446: END IF;
2447: END IF;
2440:
2441: current_n := current_n + 1;
2442:
2443: IF (g_asn_debug = 'Y') THEN
2444: asn_debug.put_line('Increment pointer by 1 ' || TO_CHAR(current_n));
2445: END IF;
2446: END IF;
2447: END IF;
2448: END LOOP;
2449: -- current_n := current_n - 1; -- point to the last row in the record structure before going back
2450:
2451: ELSE
2452: -- error_status and error_message are set after validate_quantity_shipped
2453: IF (g_asn_debug = 'Y') THEN
2454: asn_debug.put_line('No po_header_id/item_id ');
2455: END IF;
2456:
2457: IF (g_asn_debug = 'Y') THEN
2450:
2451: ELSE
2452: -- error_status and error_message are set after validate_quantity_shipped
2453: IF (g_asn_debug = 'Y') THEN
2454: asn_debug.put_line('No po_header_id/item_id ');
2455: END IF;
2456:
2457: IF (g_asn_debug = 'Y') THEN
2458: asn_debug.put_line('Status = ' || x_cascaded_table(n).error_status);
2453: IF (g_asn_debug = 'Y') THEN
2454: asn_debug.put_line('No po_header_id/item_id ');
2455: END IF;
2456:
2457: IF (g_asn_debug = 'Y') THEN
2458: asn_debug.put_line('Status = ' || x_cascaded_table(n).error_status);
2459: END IF;
2460:
2461: IF x_cascaded_table(n).error_status IN('S', 'W', 'F') THEN
2454: asn_debug.put_line('No po_header_id/item_id ');
2455: END IF;
2456:
2457: IF (g_asn_debug = 'Y') THEN
2458: asn_debug.put_line('Status = ' || x_cascaded_table(n).error_status);
2459: END IF;
2460:
2461: IF x_cascaded_table(n).error_status IN('S', 'W', 'F') THEN
2462: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
2487: IF count_distributions%ISOPEN THEN
2488: CLOSE count_distributions;
2489: END IF;
2490:
2491: IF (g_asn_debug = 'Y') THEN
2492: asn_debug.put_line('Exit derive_shipment_line');
2493: END IF;
2494: EXCEPTION
2495: WHEN OTHERS THEN
2488: CLOSE count_distributions;
2489: END IF;
2490:
2491: IF (g_asn_debug = 'Y') THEN
2492: asn_debug.put_line('Exit derive_shipment_line');
2493: END IF;
2494: EXCEPTION
2495: WHEN OTHERS THEN
2496: IF shipments%ISOPEN THEN
2510: END IF;
2511:
2512: x_cascaded_table(n).error_status := 'F';
2513:
2514: IF (g_asn_debug = 'Y') THEN
2515: asn_debug.put_line(TO_CHAR(n));
2516: asn_debug.put_line(SQLERRM);
2517: asn_debug.put_line('error ' || x_progress);
2518: END IF;
2511:
2512: x_cascaded_table(n).error_status := 'F';
2513:
2514: IF (g_asn_debug = 'Y') THEN
2515: asn_debug.put_line(TO_CHAR(n));
2516: asn_debug.put_line(SQLERRM);
2517: asn_debug.put_line('error ' || x_progress);
2518: END IF;
2519: END derive_shipment_line;
2512: x_cascaded_table(n).error_status := 'F';
2513:
2514: IF (g_asn_debug = 'Y') THEN
2515: asn_debug.put_line(TO_CHAR(n));
2516: asn_debug.put_line(SQLERRM);
2517: asn_debug.put_line('error ' || x_progress);
2518: END IF;
2519: END derive_shipment_line;
2520:
2513:
2514: IF (g_asn_debug = 'Y') THEN
2515: asn_debug.put_line(TO_CHAR(n));
2516: asn_debug.put_line(SQLERRM);
2517: asn_debug.put_line('error ' || x_progress);
2518: END IF;
2519: END derive_shipment_line;
2520:
2521: /*===========================================================================
2570: AND pll.shipment_type IN('STANDARD', 'BLANKET', 'SCHEDULED');
2571:
2572: default_po_info shipments%ROWTYPE;
2573: BEGIN
2574: IF (g_asn_debug = 'Y') THEN
2575: asn_debug.put_line('Enter default_shipment_line');
2576: END IF;
2577:
2578: x_progress := '000';
2571:
2572: default_po_info shipments%ROWTYPE;
2573: BEGIN
2574: IF (g_asn_debug = 'Y') THEN
2575: asn_debug.put_line('Enter default_shipment_line');
2576: END IF;
2577:
2578: x_progress := '000';
2579: -- set default_shipment_line values
2583:
2584: IF x_cascaded_table(n).receipt_source_code IS NULL THEN
2585: x_cascaded_table(n).receipt_source_code := NVL(x_header_record.header_record.receipt_source_code, 'VENDOR');
2586:
2587: IF (g_asn_debug = 'Y') THEN
2588: asn_debug.put_line('Defaulting from HEADER RECEIPT_SOURCE_CODE ' || x_cascaded_table(n).receipt_source_code);
2589: END IF;
2590: END IF;
2591:
2584: IF x_cascaded_table(n).receipt_source_code IS NULL THEN
2585: x_cascaded_table(n).receipt_source_code := NVL(x_header_record.header_record.receipt_source_code, 'VENDOR');
2586:
2587: IF (g_asn_debug = 'Y') THEN
2588: asn_debug.put_line('Defaulting from HEADER RECEIPT_SOURCE_CODE ' || x_cascaded_table(n).receipt_source_code);
2589: END IF;
2590: END IF;
2591:
2592: IF x_cascaded_table(n).source_document_code IS NULL THEN
2591:
2592: IF x_cascaded_table(n).source_document_code IS NULL THEN
2593: x_cascaded_table(n).source_document_code := 'PO';
2594:
2595: IF (g_asn_debug = 'Y') THEN
2596: asn_debug.put_line('Defaulting SOURCE_DOCUMENT_CODE ' || x_cascaded_table(n).source_document_code);
2597: END IF;
2598: END IF;
2599:
2592: IF x_cascaded_table(n).source_document_code IS NULL THEN
2593: x_cascaded_table(n).source_document_code := 'PO';
2594:
2595: IF (g_asn_debug = 'Y') THEN
2596: asn_debug.put_line('Defaulting SOURCE_DOCUMENT_CODE ' || x_cascaded_table(n).source_document_code);
2597: END IF;
2598: END IF;
2599:
2600: /* Fix for bug 2564646.
2609: OR ( x_cascaded_table(n).destination_type_code = 'INVENTORY'
2610: AND x_cascaded_table(n).auto_transact_code = 'RECEIVE') THEN
2611: x_cascaded_table(n).destination_type_code := 'RECEIVING';
2612:
2613: IF (g_asn_debug = 'Y') THEN
2614: asn_debug.put_line('Defaulting DESTINATION_TYPE_CODE ' || x_cascaded_table(n).destination_type_code);
2615: END IF;
2616: END IF;
2617:
2610: AND x_cascaded_table(n).auto_transact_code = 'RECEIVE') THEN
2611: x_cascaded_table(n).destination_type_code := 'RECEIVING';
2612:
2613: IF (g_asn_debug = 'Y') THEN
2614: asn_debug.put_line('Defaulting DESTINATION_TYPE_CODE ' || x_cascaded_table(n).destination_type_code);
2615: END IF;
2616: END IF;
2617:
2618: IF x_cascaded_table(n).transaction_type IS NULL THEN
2617:
2618: IF x_cascaded_table(n).transaction_type IS NULL THEN
2619: x_cascaded_table(n).transaction_type := 'SHIP';
2620:
2621: IF (g_asn_debug = 'Y') THEN
2622: asn_debug.put_line('Defaulting TRANSACTION_TYPE ' || x_cascaded_table(n).transaction_type);
2623: END IF;
2624: END IF;
2625:
2618: IF x_cascaded_table(n).transaction_type IS NULL THEN
2619: x_cascaded_table(n).transaction_type := 'SHIP';
2620:
2621: IF (g_asn_debug = 'Y') THEN
2622: asn_debug.put_line('Defaulting TRANSACTION_TYPE ' || x_cascaded_table(n).transaction_type);
2623: END IF;
2624: END IF;
2625:
2626: IF x_cascaded_table(n).processing_mode_code IS NULL THEN
2625:
2626: IF x_cascaded_table(n).processing_mode_code IS NULL THEN
2627: x_cascaded_table(n).processing_mode_code := 'BATCH';
2628:
2629: IF (g_asn_debug = 'Y') THEN
2630: asn_debug.put_line('Defaulting PROCESSING_MODE_CODE ' || x_cascaded_table(n).processing_mode_code);
2631: END IF;
2632: END IF;
2633:
2626: IF x_cascaded_table(n).processing_mode_code IS NULL THEN
2627: x_cascaded_table(n).processing_mode_code := 'BATCH';
2628:
2629: IF (g_asn_debug = 'Y') THEN
2630: asn_debug.put_line('Defaulting PROCESSING_MODE_CODE ' || x_cascaded_table(n).processing_mode_code);
2631: END IF;
2632: END IF;
2633:
2634: x_cascaded_table(n).processing_status_code := 'RUNNING';
2637: -- This has to be set to running otherwise C code in rvtbm
2638: -- will not pick it up
2639: x_cascaded_table(n).processing_status_code := 'RUNNING';
2640:
2641: IF (g_asn_debug = 'Y') THEN
2642: asn_debug.put_line('Defaulting PROCESSING_STATUS_CODE ' || x_cascaded_table(n).processing_status_code);
2643: END IF;
2644: END IF;
2645:
2638: -- will not pick it up
2639: x_cascaded_table(n).processing_status_code := 'RUNNING';
2640:
2641: IF (g_asn_debug = 'Y') THEN
2642: asn_debug.put_line('Defaulting PROCESSING_STATUS_CODE ' || x_cascaded_table(n).processing_status_code);
2643: END IF;
2644: END IF;
2645:
2646: IF x_cascaded_table(n).transaction_status_code IS NULL THEN
2645:
2646: IF x_cascaded_table(n).transaction_status_code IS NULL THEN
2647: x_cascaded_table(n).transaction_status_code := 'PENDING';
2648:
2649: IF (g_asn_debug = 'Y') THEN
2650: asn_debug.put_line('Defaulting TRANSACTION_STATUS_CODE ' || x_cascaded_table(n).transaction_status_code);
2651: END IF;
2652: END IF;
2653:
2646: IF x_cascaded_table(n).transaction_status_code IS NULL THEN
2647: x_cascaded_table(n).transaction_status_code := 'PENDING';
2648:
2649: IF (g_asn_debug = 'Y') THEN
2650: asn_debug.put_line('Defaulting TRANSACTION_STATUS_CODE ' || x_cascaded_table(n).transaction_status_code);
2651: END IF;
2652: END IF;
2653:
2654: -- Default auto_transact_code if it is null
2653:
2654: -- Default auto_transact_code if it is null
2655:
2656: IF x_cascaded_table(n).auto_transact_code IS NULL THEN
2657: IF (g_asn_debug = 'Y') THEN
2658: asn_debug.put_line('Setting auto_transact_code to transaction_type ' || x_cascaded_table(n).transaction_type);
2659: END IF;
2660:
2661: x_cascaded_table(n).auto_transact_code := x_cascaded_table(n).transaction_type;
2654: -- Default auto_transact_code if it is null
2655:
2656: IF x_cascaded_table(n).auto_transact_code IS NULL THEN
2657: IF (g_asn_debug = 'Y') THEN
2658: asn_debug.put_line('Setting auto_transact_code to transaction_type ' || x_cascaded_table(n).transaction_type);
2659: END IF;
2660:
2661: x_cascaded_table(n).auto_transact_code := x_cascaded_table(n).transaction_type;
2662: END IF;
2669: x_cascaded_table(n).vendor_id := x_header_record.header_record.vendor_id;
2670: x_cascaded_table(n).vendor_name := x_header_record.header_record.vendor_name;
2671: x_cascaded_table(n).vendor_num := x_header_record.header_record.vendor_num;
2672:
2673: IF (g_asn_debug = 'Y') THEN
2674: asn_debug.put_line('Defaulting from HEADER VENDOR_ID ' || TO_CHAR(x_cascaded_table(n).vendor_id));
2675: asn_debug.put_line('Defaulting from HEADER VENDOR_NAME ' || x_cascaded_table(n).vendor_name);
2676: asn_debug.put_line('Defaulting from HEADER VENDOR_NUM ' || x_cascaded_table(n).vendor_num);
2677: END IF;
2670: x_cascaded_table(n).vendor_name := x_header_record.header_record.vendor_name;
2671: x_cascaded_table(n).vendor_num := x_header_record.header_record.vendor_num;
2672:
2673: IF (g_asn_debug = 'Y') THEN
2674: asn_debug.put_line('Defaulting from HEADER VENDOR_ID ' || TO_CHAR(x_cascaded_table(n).vendor_id));
2675: asn_debug.put_line('Defaulting from HEADER VENDOR_NAME ' || x_cascaded_table(n).vendor_name);
2676: asn_debug.put_line('Defaulting from HEADER VENDOR_NUM ' || x_cascaded_table(n).vendor_num);
2677: END IF;
2678: END IF;
2671: x_cascaded_table(n).vendor_num := x_header_record.header_record.vendor_num;
2672:
2673: IF (g_asn_debug = 'Y') THEN
2674: asn_debug.put_line('Defaulting from HEADER VENDOR_ID ' || TO_CHAR(x_cascaded_table(n).vendor_id));
2675: asn_debug.put_line('Defaulting from HEADER VENDOR_NAME ' || x_cascaded_table(n).vendor_name);
2676: asn_debug.put_line('Defaulting from HEADER VENDOR_NUM ' || x_cascaded_table(n).vendor_num);
2677: END IF;
2678: END IF;
2679:
2672:
2673: IF (g_asn_debug = 'Y') THEN
2674: asn_debug.put_line('Defaulting from HEADER VENDOR_ID ' || TO_CHAR(x_cascaded_table(n).vendor_id));
2675: asn_debug.put_line('Defaulting from HEADER VENDOR_NAME ' || x_cascaded_table(n).vendor_name);
2676: asn_debug.put_line('Defaulting from HEADER VENDOR_NUM ' || x_cascaded_table(n).vendor_num);
2677: END IF;
2678: END IF;
2679:
2680: -- default only if all attributes are null
2708: x_cascaded_table(n).vendor_site_id := x_vendor_site_id;
2709: x_cascaded_table(n).vendor_site_code := x_vendor_site_code;
2710: END IF;
2711:
2712: IF (g_asn_debug = 'Y') THEN
2713: asn_debug.put_line('Defaulting from HEADER VENDOR_SITE_ID ' || TO_CHAR(x_cascaded_table(n).vendor_site_id));
2714: asn_debug.put_line('Defaulting from HEADER VENDOR_SITE_CODE ' || x_cascaded_table(n).vendor_site_code);
2715: END IF;
2716: END IF;
2709: x_cascaded_table(n).vendor_site_code := x_vendor_site_code;
2710: END IF;
2711:
2712: IF (g_asn_debug = 'Y') THEN
2713: asn_debug.put_line('Defaulting from HEADER VENDOR_SITE_ID ' || TO_CHAR(x_cascaded_table(n).vendor_site_id));
2714: asn_debug.put_line('Defaulting from HEADER VENDOR_SITE_CODE ' || x_cascaded_table(n).vendor_site_code);
2715: END IF;
2716: END IF;
2717:
2710: END IF;
2711:
2712: IF (g_asn_debug = 'Y') THEN
2713: asn_debug.put_line('Defaulting from HEADER VENDOR_SITE_ID ' || TO_CHAR(x_cascaded_table(n).vendor_site_id));
2714: asn_debug.put_line('Defaulting from HEADER VENDOR_SITE_CODE ' || x_cascaded_table(n).vendor_site_code);
2715: END IF;
2716: END IF;
2717:
2718: -- default only if all attributes are null
2721: AND x_cascaded_table(n).from_organization_code IS NULL THEN
2722: x_cascaded_table(n).from_organization_id := x_header_record.header_record.from_organization_id;
2723: x_cascaded_table(n).from_organization_code := x_header_record.header_record.from_organization_code;
2724:
2725: IF (g_asn_debug = 'Y') THEN
2726: asn_debug.put_line('Defaulting from HEADER FROM_ORGANIZATION_ID ' || TO_CHAR(x_cascaded_table(n).from_organization_id));
2727: asn_debug.put_line('Defaulting from HEADER FROM_ORGANIZATION_CODE ' || x_cascaded_table(n).from_organization_code);
2728: END IF;
2729: END IF;
2722: x_cascaded_table(n).from_organization_id := x_header_record.header_record.from_organization_id;
2723: x_cascaded_table(n).from_organization_code := x_header_record.header_record.from_organization_code;
2724:
2725: IF (g_asn_debug = 'Y') THEN
2726: asn_debug.put_line('Defaulting from HEADER FROM_ORGANIZATION_ID ' || TO_CHAR(x_cascaded_table(n).from_organization_id));
2727: asn_debug.put_line('Defaulting from HEADER FROM_ORGANIZATION_CODE ' || x_cascaded_table(n).from_organization_code);
2728: END IF;
2729: END IF;
2730:
2723: x_cascaded_table(n).from_organization_code := x_header_record.header_record.from_organization_code;
2724:
2725: IF (g_asn_debug = 'Y') THEN
2726: asn_debug.put_line('Defaulting from HEADER FROM_ORGANIZATION_ID ' || TO_CHAR(x_cascaded_table(n).from_organization_id));
2727: asn_debug.put_line('Defaulting from HEADER FROM_ORGANIZATION_CODE ' || x_cascaded_table(n).from_organization_code);
2728: END IF;
2729: END IF;
2730:
2731: -- default only if all attributes are null
2734: AND x_cascaded_table(n).to_organization_code IS NULL THEN
2735: x_cascaded_table(n).to_organization_id := x_header_record.header_record.ship_to_organization_id;
2736: x_cascaded_table(n).to_organization_code := x_header_record.header_record.ship_to_organization_code;
2737:
2738: IF (g_asn_debug = 'Y') THEN
2739: asn_debug.put_line('Defaulting from HEADER TO_ORGANIZATION_ID ' || TO_CHAR(x_cascaded_table(n).to_organization_id));
2740: asn_debug.put_line('Defaulting from HEADER TO_ORGANIZATION_CODE ' || x_cascaded_table(n).to_organization_code);
2741: END IF;
2742: END IF;
2735: x_cascaded_table(n).to_organization_id := x_header_record.header_record.ship_to_organization_id;
2736: x_cascaded_table(n).to_organization_code := x_header_record.header_record.ship_to_organization_code;
2737:
2738: IF (g_asn_debug = 'Y') THEN
2739: asn_debug.put_line('Defaulting from HEADER TO_ORGANIZATION_ID ' || TO_CHAR(x_cascaded_table(n).to_organization_id));
2740: asn_debug.put_line('Defaulting from HEADER TO_ORGANIZATION_CODE ' || x_cascaded_table(n).to_organization_code);
2741: END IF;
2742: END IF;
2743:
2736: x_cascaded_table(n).to_organization_code := x_header_record.header_record.ship_to_organization_code;
2737:
2738: IF (g_asn_debug = 'Y') THEN
2739: asn_debug.put_line('Defaulting from HEADER TO_ORGANIZATION_ID ' || TO_CHAR(x_cascaded_table(n).to_organization_id));
2740: asn_debug.put_line('Defaulting from HEADER TO_ORGANIZATION_CODE ' || x_cascaded_table(n).to_organization_code);
2741: END IF;
2742: END IF;
2743:
2744: -- default only if all attributes are null
2751: x_cascaded_table(n).currency_conversion_type := x_header_record.header_record.conversion_rate_type;
2752: x_cascaded_table(n).currency_conversion_rate := x_header_record.header_record.conversion_rate;
2753: x_cascaded_table(n).currency_conversion_date := x_header_record.header_record.conversion_rate_date;
2754:
2755: IF (g_asn_debug = 'Y') THEN
2756: asn_debug.put_line('Defaulting from HEADER CURRENCY_CODE ' || x_cascaded_table(n).currency_code);
2757: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_TYPE ' || x_cascaded_table(n).currency_conversion_type);
2758: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_RATE ' || TO_CHAR(x_cascaded_table(n).currency_conversion_rate));
2759: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_DATE ' || TO_CHAR(x_cascaded_table(n).currency_conversion_date, 'DD/MM/YYYY'));
2752: x_cascaded_table(n).currency_conversion_rate := x_header_record.header_record.conversion_rate;
2753: x_cascaded_table(n).currency_conversion_date := x_header_record.header_record.conversion_rate_date;
2754:
2755: IF (g_asn_debug = 'Y') THEN
2756: asn_debug.put_line('Defaulting from HEADER CURRENCY_CODE ' || x_cascaded_table(n).currency_code);
2757: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_TYPE ' || x_cascaded_table(n).currency_conversion_type);
2758: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_RATE ' || TO_CHAR(x_cascaded_table(n).currency_conversion_rate));
2759: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_DATE ' || TO_CHAR(x_cascaded_table(n).currency_conversion_date, 'DD/MM/YYYY'));
2760: END IF;
2753: x_cascaded_table(n).currency_conversion_date := x_header_record.header_record.conversion_rate_date;
2754:
2755: IF (g_asn_debug = 'Y') THEN
2756: asn_debug.put_line('Defaulting from HEADER CURRENCY_CODE ' || x_cascaded_table(n).currency_code);
2757: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_TYPE ' || x_cascaded_table(n).currency_conversion_type);
2758: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_RATE ' || TO_CHAR(x_cascaded_table(n).currency_conversion_rate));
2759: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_DATE ' || TO_CHAR(x_cascaded_table(n).currency_conversion_date, 'DD/MM/YYYY'));
2760: END IF;
2761: END IF;
2754:
2755: IF (g_asn_debug = 'Y') THEN
2756: asn_debug.put_line('Defaulting from HEADER CURRENCY_CODE ' || x_cascaded_table(n).currency_code);
2757: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_TYPE ' || x_cascaded_table(n).currency_conversion_type);
2758: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_RATE ' || TO_CHAR(x_cascaded_table(n).currency_conversion_rate));
2759: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_DATE ' || TO_CHAR(x_cascaded_table(n).currency_conversion_date, 'DD/MM/YYYY'));
2760: END IF;
2761: END IF;
2762:
2755: IF (g_asn_debug = 'Y') THEN
2756: asn_debug.put_line('Defaulting from HEADER CURRENCY_CODE ' || x_cascaded_table(n).currency_code);
2757: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_TYPE ' || x_cascaded_table(n).currency_conversion_type);
2758: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_RATE ' || TO_CHAR(x_cascaded_table(n).currency_conversion_rate));
2759: asn_debug.put_line('Defaulting from HEADER CURRENCY_CONVERSION_DATE ' || TO_CHAR(x_cascaded_table(n).currency_conversion_date, 'DD/MM/YYYY'));
2760: END IF;
2761: END IF;
2762:
2763: IF ( x_cascaded_table(n).ship_to_location_id IS NULL
2764: AND x_cascaded_table(n).ship_to_location_code IS NULL) THEN -- Check this with George
2765: x_cascaded_table(n).ship_to_location_code := x_header_record.header_record.location_code;
2766: x_cascaded_table(n).ship_to_location_id := x_header_record.header_record.location_id;
2767:
2768: IF (g_asn_debug = 'Y') THEN
2769: asn_debug.put_line('Defaulting from HEADER LOCATION_ID ' || TO_CHAR(x_cascaded_table(n).location_id));
2770: END IF;
2771: END IF;
2772:
2765: x_cascaded_table(n).ship_to_location_code := x_header_record.header_record.location_code;
2766: x_cascaded_table(n).ship_to_location_id := x_header_record.header_record.location_id;
2767:
2768: IF (g_asn_debug = 'Y') THEN
2769: asn_debug.put_line('Defaulting from HEADER LOCATION_ID ' || TO_CHAR(x_cascaded_table(n).location_id));
2770: END IF;
2771: END IF;
2772:
2773: IF x_cascaded_table(n).shipment_num IS NULL THEN
2772:
2773: IF x_cascaded_table(n).shipment_num IS NULL THEN
2774: x_cascaded_table(n).shipment_num := x_header_record.header_record.shipment_num;
2775:
2776: IF (g_asn_debug = 'Y') THEN
2777: asn_debug.put_line('Defaulting from HEADER SHIPMENT_NUM ' || x_cascaded_table(n).shipment_num);
2778: END IF;
2779: END IF;
2780:
2773: IF x_cascaded_table(n).shipment_num IS NULL THEN
2774: x_cascaded_table(n).shipment_num := x_header_record.header_record.shipment_num;
2775:
2776: IF (g_asn_debug = 'Y') THEN
2777: asn_debug.put_line('Defaulting from HEADER SHIPMENT_NUM ' || x_cascaded_table(n).shipment_num);
2778: END IF;
2779: END IF;
2780:
2781: IF x_cascaded_table(n).freight_carrier_code IS NULL THEN
2780:
2781: IF x_cascaded_table(n).freight_carrier_code IS NULL THEN
2782: x_cascaded_table(n).freight_carrier_code := x_header_record.header_record.freight_carrier_code;
2783:
2784: IF (g_asn_debug = 'Y') THEN
2785: asn_debug.put_line('Defaulting from HEADER FREIGHT_CARRIER_CODE ' || x_cascaded_table(n).freight_carrier_code);
2786: END IF;
2787: END IF;
2788:
2781: IF x_cascaded_table(n).freight_carrier_code IS NULL THEN
2782: x_cascaded_table(n).freight_carrier_code := x_header_record.header_record.freight_carrier_code;
2783:
2784: IF (g_asn_debug = 'Y') THEN
2785: asn_debug.put_line('Defaulting from HEADER FREIGHT_CARRIER_CODE ' || x_cascaded_table(n).freight_carrier_code);
2786: END IF;
2787: END IF;
2788:
2789: IF x_cascaded_table(n).bill_of_lading IS NULL THEN
2788:
2789: IF x_cascaded_table(n).bill_of_lading IS NULL THEN
2790: x_cascaded_table(n).bill_of_lading := x_header_record.header_record.bill_of_lading;
2791:
2792: IF (g_asn_debug = 'Y') THEN
2793: asn_debug.put_line('Defaulting from HEADER BILL_OF_LADING ' || x_cascaded_table(n).bill_of_lading);
2794: END IF;
2795: END IF;
2796:
2789: IF x_cascaded_table(n).bill_of_lading IS NULL THEN
2790: x_cascaded_table(n).bill_of_lading := x_header_record.header_record.bill_of_lading;
2791:
2792: IF (g_asn_debug = 'Y') THEN
2793: asn_debug.put_line('Defaulting from HEADER BILL_OF_LADING ' || x_cascaded_table(n).bill_of_lading);
2794: END IF;
2795: END IF;
2796:
2797: IF x_cascaded_table(n).packing_slip IS NULL THEN
2796:
2797: IF x_cascaded_table(n).packing_slip IS NULL THEN
2798: x_cascaded_table(n).packing_slip := x_header_record.header_record.packing_slip;
2799:
2800: IF (g_asn_debug = 'Y') THEN
2801: asn_debug.put_line('Defaulting from HEADER PACKING_SLIP ' || x_cascaded_table(n).packing_slip);
2802: END IF;
2803: END IF;
2804:
2797: IF x_cascaded_table(n).packing_slip IS NULL THEN
2798: x_cascaded_table(n).packing_slip := x_header_record.header_record.packing_slip;
2799:
2800: IF (g_asn_debug = 'Y') THEN
2801: asn_debug.put_line('Defaulting from HEADER PACKING_SLIP ' || x_cascaded_table(n).packing_slip);
2802: END IF;
2803: END IF;
2804:
2805: IF x_cascaded_table(n).shipped_date IS NULL THEN
2804:
2805: IF x_cascaded_table(n).shipped_date IS NULL THEN
2806: x_cascaded_table(n).shipped_date := x_header_record.header_record.shipped_date;
2807:
2808: IF (g_asn_debug = 'Y') THEN
2809: asn_debug.put_line('Defaulting from HEADER SHIPPED_DATE ' || TO_CHAR(x_cascaded_table(n).shipped_date, 'DD/MM/YYYY'));
2810: END IF;
2811: END IF;
2812:
2805: IF x_cascaded_table(n).shipped_date IS NULL THEN
2806: x_cascaded_table(n).shipped_date := x_header_record.header_record.shipped_date;
2807:
2808: IF (g_asn_debug = 'Y') THEN
2809: asn_debug.put_line('Defaulting from HEADER SHIPPED_DATE ' || TO_CHAR(x_cascaded_table(n).shipped_date, 'DD/MM/YYYY'));
2810: END IF;
2811: END IF;
2812:
2813: IF x_cascaded_table(n).expected_receipt_date IS NULL THEN
2812:
2813: IF x_cascaded_table(n).expected_receipt_date IS NULL THEN
2814: x_cascaded_table(n).expected_receipt_date := x_header_record.header_record.expected_receipt_date;
2815:
2816: IF (g_asn_debug = 'Y') THEN
2817: asn_debug.put_line('Defaulting from HEADER EXPECTED_RECEIPT_DATE ' || TO_CHAR(x_cascaded_table(n).expected_receipt_date, 'DD/MM/YYYY'));
2818: END IF;
2819: END IF;
2820:
2813: IF x_cascaded_table(n).expected_receipt_date IS NULL THEN
2814: x_cascaded_table(n).expected_receipt_date := x_header_record.header_record.expected_receipt_date;
2815:
2816: IF (g_asn_debug = 'Y') THEN
2817: asn_debug.put_line('Defaulting from HEADER EXPECTED_RECEIPT_DATE ' || TO_CHAR(x_cascaded_table(n).expected_receipt_date, 'DD/MM/YYYY'));
2818: END IF;
2819: END IF;
2820:
2821: IF x_cascaded_table(n).num_of_containers IS NULL THEN
2820:
2821: IF x_cascaded_table(n).num_of_containers IS NULL THEN
2822: x_cascaded_table(n).num_of_containers := x_header_record.header_record.num_of_containers;
2823:
2824: IF (g_asn_debug = 'Y') THEN
2825: asn_debug.put_line('Defaulting from HEADER NUM_OF_CONTAINERS ' || TO_CHAR(x_cascaded_table(n).num_of_containers));
2826: END IF;
2827: END IF;
2828:
2821: IF x_cascaded_table(n).num_of_containers IS NULL THEN
2822: x_cascaded_table(n).num_of_containers := x_header_record.header_record.num_of_containers;
2823:
2824: IF (g_asn_debug = 'Y') THEN
2825: asn_debug.put_line('Defaulting from HEADER NUM_OF_CONTAINERS ' || TO_CHAR(x_cascaded_table(n).num_of_containers));
2826: END IF;
2827: END IF;
2828:
2829: IF x_cascaded_table(n).waybill_airbill_num IS NULL THEN
2828:
2829: IF x_cascaded_table(n).waybill_airbill_num IS NULL THEN
2830: x_cascaded_table(n).waybill_airbill_num := x_header_record.header_record.waybill_airbill_num;
2831:
2832: IF (g_asn_debug = 'Y') THEN
2833: asn_debug.put_line('Defaulting from HEADER WAYBILL_AIRBILL_NUM ' || x_cascaded_table(n).waybill_airbill_num);
2834: END IF;
2835: END IF;
2836:
2829: IF x_cascaded_table(n).waybill_airbill_num IS NULL THEN
2830: x_cascaded_table(n).waybill_airbill_num := x_header_record.header_record.waybill_airbill_num;
2831:
2832: IF (g_asn_debug = 'Y') THEN
2833: asn_debug.put_line('Defaulting from HEADER WAYBILL_AIRBILL_NUM ' || x_cascaded_table(n).waybill_airbill_num);
2834: END IF;
2835: END IF;
2836:
2837: IF x_cascaded_table(n).tax_name IS NULL THEN
2836:
2837: IF x_cascaded_table(n).tax_name IS NULL THEN
2838: x_cascaded_table(n).tax_name := x_header_record.header_record.tax_name;
2839:
2840: IF (g_asn_debug = 'Y') THEN
2841: asn_debug.put_line('Defaulting from HEADER TAX_NAME ' || x_cascaded_table(n).tax_name);
2842: END IF;
2843: END IF;
2844:
2837: IF x_cascaded_table(n).tax_name IS NULL THEN
2838: x_cascaded_table(n).tax_name := x_header_record.header_record.tax_name;
2839:
2840: IF (g_asn_debug = 'Y') THEN
2841: asn_debug.put_line('Defaulting from HEADER TAX_NAME ' || x_cascaded_table(n).tax_name);
2842: END IF;
2843: END IF;
2844:
2845: IF x_cascaded_table(n).item_revision IS NULL THEN
2842: END IF;
2843: END IF;
2844:
2845: IF x_cascaded_table(n).item_revision IS NULL THEN
2846: IF (g_asn_debug = 'Y') THEN
2847: asn_debug.put_line('Enter defaulting item revision');
2848: END IF;
2849:
2850: item_id_record.item_id := x_cascaded_table(n).item_id;
2843: END IF;
2844:
2845: IF x_cascaded_table(n).item_revision IS NULL THEN
2846: IF (g_asn_debug = 'Y') THEN
2847: asn_debug.put_line('Enter defaulting item revision');
2848: END IF;
2849:
2850: item_id_record.item_id := x_cascaded_table(n).item_id;
2851: item_id_record.po_line_id := x_cascaded_table(n).po_line_id;
2856: item_id_record.error_record.error_message := NULL;
2857: default_item_revision(item_id_record);
2858: x_cascaded_table(n).item_revision := item_id_record.item_revision;
2859:
2860: IF (g_asn_debug = 'Y') THEN
2861: asn_debug.put_line(NVL(item_id_record.item_revision, 'Item Revision is null'));
2862: END IF;
2863:
2864: x_cascaded_table(n).error_status := item_id_record.error_record.error_status;
2857: default_item_revision(item_id_record);
2858: x_cascaded_table(n).item_revision := item_id_record.item_revision;
2859:
2860: IF (g_asn_debug = 'Y') THEN
2861: asn_debug.put_line(NVL(item_id_record.item_revision, 'Item Revision is null'));
2862: END IF;
2863:
2864: x_cascaded_table(n).error_status := item_id_record.error_record.error_status;
2865: rcv_error_pkg.set_error_message(item_id_record.error_record.error_message, x_cascaded_table(n).error_message);
2880: AND x_cascaded_table(n).to_organization_code IS NULL)
2881: OR x_cascaded_table(n).document_shipment_line_num IS NULL
2882: OR ( x_cascaded_table(n).routing_header_id IS NULL
2883: AND x_cascaded_table(n).routing_code IS NULL) THEN
2884: IF (g_asn_debug = 'Y') THEN
2885: asn_debug.put_line('Defaulting values from PO ');
2886: END IF;
2887:
2888: OPEN shipments(x_cascaded_table(n).po_header_id,
2881: OR x_cascaded_table(n).document_shipment_line_num IS NULL
2882: OR ( x_cascaded_table(n).routing_header_id IS NULL
2883: AND x_cascaded_table(n).routing_code IS NULL) THEN
2884: IF (g_asn_debug = 'Y') THEN
2885: asn_debug.put_line('Defaulting values from PO ');
2886: END IF;
2887:
2888: OPEN shipments(x_cascaded_table(n).po_header_id,
2889: x_cascaded_table(n).po_line_id,
2892: FETCH shipments INTO default_po_info;
2893:
2894: IF shipments%FOUND THEN
2895: IF x_cascaded_table(n).po_revision_num IS NULL THEN
2896: IF (g_asn_debug = 'Y') THEN
2897: asn_debug.put_line('Defaulting PO HEADER revision num ' || default_po_info.revision_num);
2898: END IF;
2899:
2900: x_cascaded_table(n).po_revision_num := default_po_info.revision_num;
2893:
2894: IF shipments%FOUND THEN
2895: IF x_cascaded_table(n).po_revision_num IS NULL THEN
2896: IF (g_asn_debug = 'Y') THEN
2897: asn_debug.put_line('Defaulting PO HEADER revision num ' || default_po_info.revision_num);
2898: END IF;
2899:
2900: x_cascaded_table(n).po_revision_num := default_po_info.revision_num;
2901: END IF;
2900: x_cascaded_table(n).po_revision_num := default_po_info.revision_num;
2901: END IF;
2902:
2903: IF x_cascaded_table(n).document_line_num IS NULL THEN
2904: IF (g_asn_debug = 'Y') THEN
2905: asn_debug.put_line('Defaulting po line num ' || TO_CHAR(default_po_info.line_num));
2906: END IF;
2907:
2908: x_cascaded_table(n).document_line_num := default_po_info.line_num;
2901: END IF;
2902:
2903: IF x_cascaded_table(n).document_line_num IS NULL THEN
2904: IF (g_asn_debug = 'Y') THEN
2905: asn_debug.put_line('Defaulting po line num ' || TO_CHAR(default_po_info.line_num));
2906: END IF;
2907:
2908: x_cascaded_table(n).document_line_num := default_po_info.line_num;
2909: END IF;
2908: x_cascaded_table(n).document_line_num := default_po_info.line_num;
2909: END IF;
2910:
2911: IF x_cascaded_table(n).item_description IS NULL THEN
2912: IF (g_asn_debug = 'Y') THEN
2913: asn_debug.put_line('Defaulting item description from PO ' || default_po_info.item_description);
2914: END IF;
2915:
2916: x_cascaded_table(n).item_description := default_po_info.item_description;
2909: END IF;
2910:
2911: IF x_cascaded_table(n).item_description IS NULL THEN
2912: IF (g_asn_debug = 'Y') THEN
2913: asn_debug.put_line('Defaulting item description from PO ' || default_po_info.item_description);
2914: END IF;
2915:
2916: x_cascaded_table(n).item_description := default_po_info.item_description;
2917: END IF;
2917: END IF;
2918:
2919: IF x_cascaded_table(n).tax_name IS NULL
2920: AND default_po_info.tax_code_id IS NOT NULL THEN
2921: IF (g_asn_debug = 'Y') THEN
2922: asn_debug.put_line('Defaulting tax name based on PO ' || TO_CHAR(default_po_info.tax_code_id));
2923: END IF;
2924:
2925: -- Need to join to ap_tax_codes to get tax_name
2918:
2919: IF x_cascaded_table(n).tax_name IS NULL
2920: AND default_po_info.tax_code_id IS NOT NULL THEN
2921: IF (g_asn_debug = 'Y') THEN
2922: asn_debug.put_line('Defaulting tax name based on PO ' || TO_CHAR(default_po_info.tax_code_id));
2923: END IF;
2924:
2925: -- Need to join to ap_tax_codes to get tax_name
2926:
2932:
2933: x_cascaded_table(n).tax_name := x_tax_name;
2934: EXCEPTION
2935: WHEN OTHERS THEN
2936: IF (g_asn_debug = 'Y') THEN
2937: asn_debug.put_line('Some error occured in the tax name derivation');
2938: END IF;
2939: END;
2940: END IF;
2933: x_cascaded_table(n).tax_name := x_tax_name;
2934: EXCEPTION
2935: WHEN OTHERS THEN
2936: IF (g_asn_debug = 'Y') THEN
2937: asn_debug.put_line('Some error occured in the tax name derivation');
2938: END IF;
2939: END;
2940: END IF;
2941:
2940: END IF;
2941:
2942: --FRKHAN 12/18/98 default country of origin from PO
2943: IF x_cascaded_table(n).country_of_origin_code IS NULL THEN
2944: IF (g_asn_debug = 'Y') THEN
2945: asn_debug.put_line('Defaulting country of origin from PO ' || default_po_info.country_of_origin_code);
2946: END IF;
2947:
2948: x_cascaded_table(n).country_of_origin_code := default_po_info.country_of_origin_code;
2941:
2942: --FRKHAN 12/18/98 default country of origin from PO
2943: IF x_cascaded_table(n).country_of_origin_code IS NULL THEN
2944: IF (g_asn_debug = 'Y') THEN
2945: asn_debug.put_line('Defaulting country of origin from PO ' || default_po_info.country_of_origin_code);
2946: END IF;
2947:
2948: x_cascaded_table(n).country_of_origin_code := default_po_info.country_of_origin_code;
2949: END IF;
2948: x_cascaded_table(n).country_of_origin_code := default_po_info.country_of_origin_code;
2949: END IF;
2950:
2951: IF x_cascaded_table(n).po_release_id IS NULL THEN
2952: IF (g_asn_debug = 'Y') THEN
2953: asn_debug.put_line('Defaulting PO Release ID from PO ' || TO_CHAR(default_po_info.po_release_id));
2954: END IF;
2955:
2956: x_cascaded_table(n).po_release_id := default_po_info.po_release_id;
2949: END IF;
2950:
2951: IF x_cascaded_table(n).po_release_id IS NULL THEN
2952: IF (g_asn_debug = 'Y') THEN
2953: asn_debug.put_line('Defaulting PO Release ID from PO ' || TO_CHAR(default_po_info.po_release_id));
2954: END IF;
2955:
2956: x_cascaded_table(n).po_release_id := default_po_info.po_release_id;
2957: END IF;
2956: x_cascaded_table(n).po_release_id := default_po_info.po_release_id;
2957: END IF;
2958:
2959: IF x_cascaded_table(n).ship_to_location_id IS NULL THEN
2960: IF (g_asn_debug = 'Y') THEN
2961: asn_debug.put_line('Defaulting PO ship_to_location_id ' || TO_CHAR(default_po_info.ship_to_location_id));
2962: END IF;
2963:
2964: x_cascaded_table(n).ship_to_location_id := default_po_info.ship_to_location_id;
2957: END IF;
2958:
2959: IF x_cascaded_table(n).ship_to_location_id IS NULL THEN
2960: IF (g_asn_debug = 'Y') THEN
2961: asn_debug.put_line('Defaulting PO ship_to_location_id ' || TO_CHAR(default_po_info.ship_to_location_id));
2962: END IF;
2963:
2964: x_cascaded_table(n).ship_to_location_id := default_po_info.ship_to_location_id;
2965: END IF;
2964: x_cascaded_table(n).ship_to_location_id := default_po_info.ship_to_location_id;
2965: END IF;
2966:
2967: IF x_cascaded_table(n).to_organization_id IS NULL THEN
2968: IF (g_asn_debug = 'Y') THEN
2969: asn_debug.put_line('Defaulting PO to_organization_id ' || TO_CHAR(default_po_info.ship_to_organization_id));
2970: END IF;
2971:
2972: x_cascaded_table(n).to_organization_id := default_po_info.ship_to_organization_id;
2965: END IF;
2966:
2967: IF x_cascaded_table(n).to_organization_id IS NULL THEN
2968: IF (g_asn_debug = 'Y') THEN
2969: asn_debug.put_line('Defaulting PO to_organization_id ' || TO_CHAR(default_po_info.ship_to_organization_id));
2970: END IF;
2971:
2972: x_cascaded_table(n).to_organization_id := default_po_info.ship_to_organization_id;
2973: END IF;
2972: x_cascaded_table(n).to_organization_id := default_po_info.ship_to_organization_id;
2973: END IF;
2974:
2975: IF x_cascaded_table(n).document_shipment_line_num IS NULL THEN
2976: IF (g_asn_debug = 'Y') THEN
2977: asn_debug.put_line('Defaulting PO shipment_line_num ' || TO_CHAR(default_po_info.shipment_num));
2978: END IF;
2979:
2980: x_cascaded_table(n).document_shipment_line_num := default_po_info.shipment_num;
2973: END IF;
2974:
2975: IF x_cascaded_table(n).document_shipment_line_num IS NULL THEN
2976: IF (g_asn_debug = 'Y') THEN
2977: asn_debug.put_line('Defaulting PO shipment_line_num ' || TO_CHAR(default_po_info.shipment_num));
2978: END IF;
2979:
2980: x_cascaded_table(n).document_shipment_line_num := default_po_info.shipment_num;
2981: END IF;
2980: x_cascaded_table(n).document_shipment_line_num := default_po_info.shipment_num;
2981: END IF;
2982:
2983: IF x_cascaded_table(n).routing_header_id IS NULL THEN
2984: IF (g_asn_debug = 'Y') THEN
2985: asn_debug.put_line('Defaulting PO routing_header_id ' || TO_CHAR(default_po_info.receiving_routing_id));
2986: END IF;
2987:
2988: x_cascaded_table(n).routing_header_id := default_po_info.receiving_routing_id;
2981: END IF;
2982:
2983: IF x_cascaded_table(n).routing_header_id IS NULL THEN
2984: IF (g_asn_debug = 'Y') THEN
2985: asn_debug.put_line('Defaulting PO routing_header_id ' || TO_CHAR(default_po_info.receiving_routing_id));
2986: END IF;
2987:
2988: x_cascaded_table(n).routing_header_id := default_po_info.receiving_routing_id;
2989: END IF;
2989: END IF;
2990: END IF;
2991: END IF;
2992:
2993: IF (g_asn_debug = 'Y') THEN
2994: asn_debug.put_line('Primary UOM = ' || x_cascaded_table(n).primary_unit_of_measure);
2995: END IF;
2996:
2997: /*
2990: END IF;
2991: END IF;
2992:
2993: IF (g_asn_debug = 'Y') THEN
2994: asn_debug.put_line('Primary UOM = ' || x_cascaded_table(n).primary_unit_of_measure);
2995: END IF;
2996:
2997: /*
2998: ** Default the subinventory and locator if they have not been set either through the interface
3018: x_cascaded_table(n).item_id,
3019: x_cascaded_table(n).subinventory
3020: );
3021:
3022: IF (g_asn_debug = 'Y') THEN
3023: asn_debug.put_line('Defaulting subinventory from item: Sub = ' || x_cascaded_table(n).subinventory);
3024: END IF;
3025: END IF; -- (X_cascaded_table(n).subinventory IS NULL)
3026:
3019: x_cascaded_table(n).subinventory
3020: );
3021:
3022: IF (g_asn_debug = 'Y') THEN
3023: asn_debug.put_line('Defaulting subinventory from item: Sub = ' || x_cascaded_table(n).subinventory);
3024: END IF;
3025: END IF; -- (X_cascaded_table(n).subinventory IS NULL)
3026:
3027: /*
3036: x_cascaded_table(n).item_id,
3037: x_locator_control
3038: );
3039:
3040: IF (g_asn_debug = 'Y') THEN
3041: asn_debug.put_line('Locator Control = ' || TO_CHAR(x_locator_control));
3042: END IF;
3043:
3044: /*
3037: x_locator_control
3038: );
3039:
3040: IF (g_asn_debug = 'Y') THEN
3041: asn_debug.put_line('Locator Control = ' || TO_CHAR(x_locator_control));
3042: END IF;
3043:
3044: /*
3045: ** If locator control is 2 which means it is under predefined
3055: x_cascaded_table(n).subinventory,
3056: x_cascaded_table(n).locator_id
3057: );
3058:
3059: IF (g_asn_debug = 'Y') THEN
3060: asn_debug.put_line('Defaulting locator from Sub: Locator_id = ' || TO_CHAR(x_cascaded_table(n).locator_id));
3061: END IF;
3062: END IF;
3063: END IF;
3056: x_cascaded_table(n).locator_id
3057: );
3058:
3059: IF (g_asn_debug = 'Y') THEN
3060: asn_debug.put_line('Defaulting locator from Sub: Locator_id = ' || TO_CHAR(x_cascaded_table(n).locator_id));
3061: END IF;
3062: END IF;
3063: END IF;
3064:
3101: ELSE
3102: x_cascaded_table(n).location_id := x_cascaded_table(n).ship_to_location_id;
3103: END IF;
3104:
3105: IF (g_asn_debug = 'Y') THEN
3106: asn_debug.put_line('Set Location_id = ' || TO_CHAR(x_cascaded_table(n).location_id));
3107: END IF;
3108:
3109: IF x_cascaded_table(n).waybill_airbill_num IS NULL THEN
3102: x_cascaded_table(n).location_id := x_cascaded_table(n).ship_to_location_id;
3103: END IF;
3104:
3105: IF (g_asn_debug = 'Y') THEN
3106: asn_debug.put_line('Set Location_id = ' || TO_CHAR(x_cascaded_table(n).location_id));
3107: END IF;
3108:
3109: IF x_cascaded_table(n).waybill_airbill_num IS NULL THEN
3110: x_cascaded_table(n).waybill_airbill_num := x_header_record.header_record.waybill_airbill_num;
3108:
3109: IF x_cascaded_table(n).waybill_airbill_num IS NULL THEN
3110: x_cascaded_table(n).waybill_airbill_num := x_header_record.header_record.waybill_airbill_num;
3111:
3112: IF (g_asn_debug = 'Y') THEN
3113: asn_debug.put_line('Defaulting from HEADER WAYBILL_AIRBILL_NUM ' || x_cascaded_table(n).waybill_airbill_num);
3114: END IF;
3115: END IF;
3116:
3109: IF x_cascaded_table(n).waybill_airbill_num IS NULL THEN
3110: x_cascaded_table(n).waybill_airbill_num := x_header_record.header_record.waybill_airbill_num;
3111:
3112: IF (g_asn_debug = 'Y') THEN
3113: asn_debug.put_line('Defaulting from HEADER WAYBILL_AIRBILL_NUM ' || x_cascaded_table(n).waybill_airbill_num);
3114: END IF;
3115: END IF;
3116:
3117: -- if not a one-time purchase item
3148: -- end if;
3149:
3150: x_progress := '010';
3151:
3152: IF (g_asn_debug = 'Y') THEN
3153: asn_debug.put_line('Exit default_shipment_line');
3154: END IF;
3155: END default_shipment_line;
3156:
3149:
3150: x_progress := '010';
3151:
3152: IF (g_asn_debug = 'Y') THEN
3153: asn_debug.put_line('Exit default_shipment_line');
3154: END IF;
3155: END default_shipment_line;
3156:
3157: /*===========================================================================
3174: IF (x_cascaded_table(n).error_status NOT IN('S', 'W')) THEN
3175: RETURN;
3176: END IF;
3177:
3178: IF (g_asn_debug = 'Y') THEN
3179: asn_debug.put_line('Enter validate_shipment_line');
3180: END IF;
3181:
3182: x_progress := '000';
3175: RETURN;
3176: END IF;
3177:
3178: IF (g_asn_debug = 'Y') THEN
3179: asn_debug.put_line('Enter validate_shipment_line');
3180: END IF;
3181:
3182: x_progress := '000';
3183:
3222: EXCEPTION
3223: WHEN NO_DATA_FOUND THEN
3224: NULL;
3225:
3226: IF (g_asn_debug = 'Y') THEN
3227: asn_debug.put_line('Set of books id not defined');
3228: END IF;
3229: END;
3230:
3223: WHEN NO_DATA_FOUND THEN
3224: NULL;
3225:
3226: IF (g_asn_debug = 'Y') THEN
3227: asn_debug.put_line('Set of books id not defined');
3228: END IF;
3229: END;
3230:
3231: BEGIN
3286: rcv_error_pkg.set_error_message(quantity_invoiced_record.error_record.error_message, x_cascaded_table(n).error_message);
3287: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'QUANTITY_INVOICED');
3288: END IF;
3289:
3290: IF (g_asn_debug = 'Y') THEN
3291: asn_debug.put_line('Before call to validate UOM');
3292: asn_debug.put_line('Quantity ' || TO_CHAR(x_cascaded_table(n).quantity));
3293: END IF;
3294:
3287: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'QUANTITY_INVOICED');
3288: END IF;
3289:
3290: IF (g_asn_debug = 'Y') THEN
3291: asn_debug.put_line('Before call to validate UOM');
3292: asn_debug.put_line('Quantity ' || TO_CHAR(x_cascaded_table(n).quantity));
3293: END IF;
3294:
3295: uom_record.quantity_shipped := x_cascaded_table(n).quantity;
3288: END IF;
3289:
3290: IF (g_asn_debug = 'Y') THEN
3291: asn_debug.put_line('Before call to validate UOM');
3292: asn_debug.put_line('Quantity ' || TO_CHAR(x_cascaded_table(n).quantity));
3293: END IF;
3294:
3295: uom_record.quantity_shipped := x_cascaded_table(n).quantity;
3296: uom_record.unit_of_measure := x_cascaded_table(n).unit_of_measure;
3301: uom_record.primary_unit_of_measure := x_cascaded_table(n).primary_unit_of_measure;
3302: uom_record.error_record.error_status := 'S';
3303: uom_record.error_record.error_message := NULL;
3304:
3305: IF (g_asn_debug = 'Y') THEN
3306: asn_debug.put_line('Validating UOM');
3307: END IF;
3308:
3309: rcv_transactions_interface_sv1.validate_uom(uom_record);
3302: uom_record.error_record.error_status := 'S';
3303: uom_record.error_record.error_message := NULL;
3304:
3305: IF (g_asn_debug = 'Y') THEN
3306: asn_debug.put_line('Validating UOM');
3307: END IF;
3308:
3309: rcv_transactions_interface_sv1.validate_uom(uom_record);
3310: x_cascaded_table(n).error_status := uom_record.error_record.error_status;
3321: item_id_record.use_mtl_serial := x_cascaded_table(n).use_mtl_serial;
3322: item_id_record.error_record.error_status := 'S';
3323: item_id_record.error_record.error_message := NULL;
3324:
3325: IF (g_asn_debug = 'Y') THEN
3326: asn_debug.put_line('Validating Item');
3327: asn_debug.put_line(TO_CHAR(x_cascaded_table(n).item_id));
3328: END IF;
3329:
3322: item_id_record.error_record.error_status := 'S';
3323: item_id_record.error_record.error_message := NULL;
3324:
3325: IF (g_asn_debug = 'Y') THEN
3326: asn_debug.put_line('Validating Item');
3327: asn_debug.put_line(TO_CHAR(x_cascaded_table(n).item_id));
3328: END IF;
3329:
3330: /*
3323: item_id_record.error_record.error_message := NULL;
3324:
3325: IF (g_asn_debug = 'Y') THEN
3326: asn_debug.put_line('Validating Item');
3327: asn_debug.put_line(TO_CHAR(x_cascaded_table(n).item_id));
3328: END IF;
3329:
3330: /*
3331: ** If this is a one time item shipment and you've matched up based on a
3346: item_id_record.item_description := x_cascaded_table(n).item_description;
3347: item_id_record.error_record.error_status := 'S';
3348: item_id_record.error_record.error_message := NULL;
3349:
3350: IF (g_asn_debug = 'Y') THEN
3351: asn_debug.put_line('Validating Item Description ' || x_cascaded_table(n).item_description);
3352: END IF;
3353:
3354: rcv_transactions_interface_sv1.validate_item_description(item_id_record);
3347: item_id_record.error_record.error_status := 'S';
3348: item_id_record.error_record.error_message := NULL;
3349:
3350: IF (g_asn_debug = 'Y') THEN
3351: asn_debug.put_line('Validating Item Description ' || x_cascaded_table(n).item_description);
3352: END IF;
3353:
3354: rcv_transactions_interface_sv1.validate_item_description(item_id_record);
3355: x_cascaded_table(n).error_status := item_id_record.error_record.error_status;
3354: rcv_transactions_interface_sv1.validate_item_description(item_id_record);
3355: x_cascaded_table(n).error_status := item_id_record.error_record.error_status;
3356: rcv_error_pkg.set_error_message(item_id_record.error_record.error_message, x_cascaded_table(n).error_message);
3357:
3358: IF (g_asn_debug = 'Y') THEN
3359: asn_debug.put_line('Error status after validate item description ' || x_cascaded_table(n).error_status);
3360: END IF;
3361:
3362: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'ITEM_DESCRIPTION');
3355: x_cascaded_table(n).error_status := item_id_record.error_record.error_status;
3356: rcv_error_pkg.set_error_message(item_id_record.error_record.error_message, x_cascaded_table(n).error_message);
3357:
3358: IF (g_asn_debug = 'Y') THEN
3359: asn_debug.put_line('Error status after validate item description ' || x_cascaded_table(n).error_status);
3360: END IF;
3361:
3362: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'ITEM_DESCRIPTION');
3363:
3369: sub_item_id_record.vendor_id := x_cascaded_table(n).vendor_id;
3370: sub_item_id_record.error_record.error_status := 'S';
3371: sub_item_id_record.error_record.error_message := NULL;
3372:
3373: IF (g_asn_debug = 'Y') THEN
3374: asn_debug.put_line('Validating Substitute Item');
3375: END IF;
3376:
3377: /* Added the check on po shipments allow_substitute_receipt flag - Bug 3009663. */
3370: sub_item_id_record.error_record.error_status := 'S';
3371: sub_item_id_record.error_record.error_message := NULL;
3372:
3373: IF (g_asn_debug = 'Y') THEN
3374: asn_debug.put_line('Validating Substitute Item');
3375: END IF;
3376:
3377: /* Added the check on po shipments allow_substitute_receipt flag - Bug 3009663. */
3378: BEGIN
3381: FROM po_line_locations pll
3382: WHERE pll.line_location_id = x_cascaded_table(n).po_line_location_id;
3383: EXCEPTION
3384: WHEN OTHERS THEN
3385: IF (g_asn_debug = 'Y') THEN
3386: asn_debug.put_line('Hit an exception');
3387: asn_debug.put_line(SQLERRM);
3388: asn_debug.put_line(' While validating substitute item');
3389: END IF;
3382: WHERE pll.line_location_id = x_cascaded_table(n).po_line_location_id;
3383: EXCEPTION
3384: WHEN OTHERS THEN
3385: IF (g_asn_debug = 'Y') THEN
3386: asn_debug.put_line('Hit an exception');
3387: asn_debug.put_line(SQLERRM);
3388: asn_debug.put_line(' While validating substitute item');
3389: END IF;
3390:
3383: EXCEPTION
3384: WHEN OTHERS THEN
3385: IF (g_asn_debug = 'Y') THEN
3386: asn_debug.put_line('Hit an exception');
3387: asn_debug.put_line(SQLERRM);
3388: asn_debug.put_line(' While validating substitute item');
3389: END IF;
3390:
3391: rcv_error_pkg.set_sql_error_message('validate_shipment_line', x_progress);
3384: WHEN OTHERS THEN
3385: IF (g_asn_debug = 'Y') THEN
3386: asn_debug.put_line('Hit an exception');
3387: asn_debug.put_line(SQLERRM);
3388: asn_debug.put_line(' While validating substitute item');
3389: END IF;
3390:
3391: rcv_error_pkg.set_sql_error_message('validate_shipment_line', x_progress);
3392: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
3392: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
3393: rcv_error_pkg.log_interface_error('PO_LINE_LOCATION_ID');
3394: END;
3395:
3396: IF (g_asn_debug = 'Y') THEN
3397: asn_debug.put_line('Allow substitute receipts flag in PO shipments ' || x_allow_substitute_receipts);
3398: END IF;
3399:
3400: IF (x_allow_substitute_receipts = 'Y') THEN
3393: rcv_error_pkg.log_interface_error('PO_LINE_LOCATION_ID');
3394: END;
3395:
3396: IF (g_asn_debug = 'Y') THEN
3397: asn_debug.put_line('Allow substitute receipts flag in PO shipments ' || x_allow_substitute_receipts);
3398: END IF;
3399:
3400: IF (x_allow_substitute_receipts = 'Y') THEN
3401: rcv_transactions_interface_sv1.validate_substitute_item(sub_item_id_record);
3417: item_revision_record.item_id := x_cascaded_table(n).item_id;
3418: item_revision_record.error_record.error_status := 'S';
3419: item_revision_record.error_record.error_message := NULL;
3420:
3421: IF (g_asn_debug = 'Y') THEN
3422: asn_debug.put_line('Validating Item Revision');
3423: END IF;
3424:
3425: rcv_transactions_interface_sv1.validate_item_revision(item_revision_record);
3418: item_revision_record.error_record.error_status := 'S';
3419: item_revision_record.error_record.error_message := NULL;
3420:
3421: IF (g_asn_debug = 'Y') THEN
3422: asn_debug.put_line('Validating Item Revision');
3423: END IF;
3424:
3425: rcv_transactions_interface_sv1.validate_item_revision(item_revision_record);
3426: x_cascaded_table(n).error_status := item_revision_record.error_record.error_status;
3435: freight_carrier_record.po_header_id := x_cascaded_table(n).po_header_id;
3436: freight_carrier_record.error_record.error_status := 'S';
3437: freight_carrier_record.error_record.error_message := NULL;
3438:
3439: IF (g_asn_debug = 'Y') THEN
3440: asn_debug.put_line('Validating Freight Carrier');
3441: END IF;
3442:
3443: rcv_transactions_interface_sv1.validate_freight_carrier(freight_carrier_record);
3436: freight_carrier_record.error_record.error_status := 'S';
3437: freight_carrier_record.error_record.error_message := NULL;
3438:
3439: IF (g_asn_debug = 'Y') THEN
3440: asn_debug.put_line('Validating Freight Carrier');
3441: END IF;
3442:
3443: rcv_transactions_interface_sv1.validate_freight_carrier(freight_carrier_record);
3444: x_cascaded_table(n).error_status := freight_carrier_record.error_record.error_status;
3453: po_lookup_code_record.lookup_type := 'RCV DESTINATION TYPE';
3454: po_lookup_code_record.error_record.error_status := 'S';
3455: po_lookup_code_record.error_record.error_message := NULL;
3456:
3457: IF (g_asn_debug = 'Y') THEN
3458: asn_debug.put_line('Validating Destination Type Code');
3459: END IF;
3460:
3461: rcv_transactions_interface_sv1.validate_po_lookup_code(po_lookup_code_record);
3454: po_lookup_code_record.error_record.error_status := 'S';
3455: po_lookup_code_record.error_record.error_message := NULL;
3456:
3457: IF (g_asn_debug = 'Y') THEN
3458: asn_debug.put_line('Validating Destination Type Code');
3459: END IF;
3460:
3461: rcv_transactions_interface_sv1.validate_po_lookup_code(po_lookup_code_record);
3462: x_cascaded_table(n).error_status := po_lookup_code_record.error_record.error_status;
3472: location_record.transaction_date := x_cascaded_table(n).transaction_date;
3473: location_record.error_record.error_status := 'S';
3474: location_record.error_record.error_message := NULL;
3475:
3476: IF (g_asn_debug = 'Y') THEN
3477: asn_debug.put_line('Validating Ship To Location');
3478: END IF;
3479:
3480: rcv_transactions_interface_sv1.validate_location(location_record);
3473: location_record.error_record.error_status := 'S';
3474: location_record.error_record.error_message := NULL;
3475:
3476: IF (g_asn_debug = 'Y') THEN
3477: asn_debug.put_line('Validating Ship To Location');
3478: END IF;
3479:
3480: rcv_transactions_interface_sv1.validate_location(location_record);
3481: x_cascaded_table(n).error_status := location_record.error_record.error_status;
3490: employee_record.transaction_date := x_cascaded_table(n).transaction_date;
3491: employee_record.error_record.error_status := 'S';
3492: employee_record.error_record.error_message := NULL;
3493:
3494: IF (g_asn_debug = 'Y') THEN
3495: asn_debug.put_line('Validating Deliver to Person');
3496: END IF;
3497:
3498: rcv_transactions_interface_sv1.validate_employee(employee_record);
3491: employee_record.error_record.error_status := 'S';
3492: employee_record.error_record.error_message := NULL;
3493:
3494: IF (g_asn_debug = 'Y') THEN
3495: asn_debug.put_line('Validating Deliver to Person');
3496: END IF;
3497:
3498: rcv_transactions_interface_sv1.validate_employee(employee_record);
3499: x_cascaded_table(n).error_status := employee_record.error_record.error_status;
3512: ** Validate routing record bug 639750
3513: */
3514: IF ( x_cascaded_table(n).transaction_type = 'DELIVER'
3515: OR NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') = 'DELIVER') THEN
3516: IF (g_asn_debug = 'Y') THEN
3517: asn_debug.put_line('Validating routing_header_id');
3518: END IF;
3519:
3520: /* 1 is Standard Receipt, 2 is Inspection Required */
3513: */
3514: IF ( x_cascaded_table(n).transaction_type = 'DELIVER'
3515: OR NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') = 'DELIVER') THEN
3516: IF (g_asn_debug = 'Y') THEN
3517: asn_debug.put_line('Validating routing_header_id');
3518: END IF;
3519:
3520: /* 1 is Standard Receipt, 2 is Inspection Required */
3521: IF ( (x_cascaded_table(n).routing_header_id) IN(1, 2)
3539: location_record.transaction_date := x_cascaded_table(n).transaction_date;
3540: location_record.error_record.error_status := 'S';
3541: location_record.error_record.error_message := NULL;
3542:
3543: IF (g_asn_debug = 'Y') THEN
3544: asn_debug.put_line('Validating Deliver To Location');
3545: END IF;
3546:
3547: rcv_transactions_interface_sv1.validate_location(location_record);
3540: location_record.error_record.error_status := 'S';
3541: location_record.error_record.error_message := NULL;
3542:
3543: IF (g_asn_debug = 'Y') THEN
3544: asn_debug.put_line('Validating Deliver To Location');
3545: END IF;
3546:
3547: rcv_transactions_interface_sv1.validate_location(location_record);
3548: x_cascaded_table(n).error_status := location_record.error_record.error_status;
3564: subinventory_record.transaction_date := x_cascaded_table(n).transaction_date;
3565: subinventory_record.error_record.error_status := 'S';
3566: subinventory_record.error_record.error_message := NULL;
3567:
3568: IF (g_asn_debug = 'Y') THEN
3569: asn_debug.put_line('Validating Subinventory');
3570: END IF;
3571:
3572: rcv_transactions_interface_sv1.validate_subinventory(subinventory_record);
3565: subinventory_record.error_record.error_status := 'S';
3566: subinventory_record.error_record.error_message := NULL;
3567:
3568: IF (g_asn_debug = 'Y') THEN
3569: asn_debug.put_line('Validating Subinventory');
3570: END IF;
3571:
3572: rcv_transactions_interface_sv1.validate_subinventory(subinventory_record);
3573: x_cascaded_table(n).error_status := subinventory_record.error_record.error_status;
3581: /*
3582: ** Validate locator if inventory destination or if not inventory
3583: ** destintion make sure to null out the locator_id
3584: */
3585: IF (g_asn_debug = 'Y') THEN
3586: asn_debug.put_line('Trx Type = ' || x_cascaded_table(n).transaction_type || 'Auto Trx Code = ' || x_cascaded_table(n).auto_transact_code);
3587: END IF;
3588:
3589: IF ( x_cascaded_table(n).transaction_type = 'DELIVER'
3582: ** Validate locator if inventory destination or if not inventory
3583: ** destintion make sure to null out the locator_id
3584: */
3585: IF (g_asn_debug = 'Y') THEN
3586: asn_debug.put_line('Trx Type = ' || x_cascaded_table(n).transaction_type || 'Auto Trx Code = ' || x_cascaded_table(n).auto_transact_code);
3587: END IF;
3588:
3589: IF ( x_cascaded_table(n).transaction_type = 'DELIVER'
3590: OR NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') = 'DELIVER') THEN
3587: END IF;
3588:
3589: IF ( x_cascaded_table(n).transaction_type = 'DELIVER'
3590: OR NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') = 'DELIVER') THEN
3591: IF (g_asn_debug = 'Y') THEN
3592: asn_debug.put_line('Valid Loc - Destination Type Code = ' || x_cascaded_table(n).destination_type_code);
3593: END IF;
3594:
3595: IF (x_cascaded_table(n).destination_type_code = 'INVENTORY') THEN
3588:
3589: IF ( x_cascaded_table(n).transaction_type = 'DELIVER'
3590: OR NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') = 'DELIVER') THEN
3591: IF (g_asn_debug = 'Y') THEN
3592: asn_debug.put_line('Valid Loc - Destination Type Code = ' || x_cascaded_table(n).destination_type_code);
3593: END IF;
3594:
3595: IF (x_cascaded_table(n).destination_type_code = 'INVENTORY') THEN
3596: locator_record.locator_id := x_cascaded_table(n).locator_id;
3599: locator_record.destination_type_code := x_cascaded_table(n).destination_type_code;
3600: locator_record.item_id := x_cascaded_table(n).item_id;
3601: locator_record.transaction_date := x_cascaded_table(n).transaction_date;
3602:
3603: IF (g_asn_debug = 'Y') THEN
3604: asn_debug.put_line('Locator = ' || TO_CHAR(locator_record.locator_id));
3605: asn_debug.put_line('Subinventory = ' || locator_record.subinventory);
3606: asn_debug.put_line('To Org = ' || locator_record.to_organization_id);
3607: asn_debug.put_line('Dest Type = ' || locator_record.destination_type_code);
3600: locator_record.item_id := x_cascaded_table(n).item_id;
3601: locator_record.transaction_date := x_cascaded_table(n).transaction_date;
3602:
3603: IF (g_asn_debug = 'Y') THEN
3604: asn_debug.put_line('Locator = ' || TO_CHAR(locator_record.locator_id));
3605: asn_debug.put_line('Subinventory = ' || locator_record.subinventory);
3606: asn_debug.put_line('To Org = ' || locator_record.to_organization_id);
3607: asn_debug.put_line('Dest Type = ' || locator_record.destination_type_code);
3608: asn_debug.put_line('Item Id = ' || locator_record.item_id);
3601: locator_record.transaction_date := x_cascaded_table(n).transaction_date;
3602:
3603: IF (g_asn_debug = 'Y') THEN
3604: asn_debug.put_line('Locator = ' || TO_CHAR(locator_record.locator_id));
3605: asn_debug.put_line('Subinventory = ' || locator_record.subinventory);
3606: asn_debug.put_line('To Org = ' || locator_record.to_organization_id);
3607: asn_debug.put_line('Dest Type = ' || locator_record.destination_type_code);
3608: asn_debug.put_line('Item Id = ' || locator_record.item_id);
3609: END IF;
3602:
3603: IF (g_asn_debug = 'Y') THEN
3604: asn_debug.put_line('Locator = ' || TO_CHAR(locator_record.locator_id));
3605: asn_debug.put_line('Subinventory = ' || locator_record.subinventory);
3606: asn_debug.put_line('To Org = ' || locator_record.to_organization_id);
3607: asn_debug.put_line('Dest Type = ' || locator_record.destination_type_code);
3608: asn_debug.put_line('Item Id = ' || locator_record.item_id);
3609: END IF;
3610:
3603: IF (g_asn_debug = 'Y') THEN
3604: asn_debug.put_line('Locator = ' || TO_CHAR(locator_record.locator_id));
3605: asn_debug.put_line('Subinventory = ' || locator_record.subinventory);
3606: asn_debug.put_line('To Org = ' || locator_record.to_organization_id);
3607: asn_debug.put_line('Dest Type = ' || locator_record.destination_type_code);
3608: asn_debug.put_line('Item Id = ' || locator_record.item_id);
3609: END IF;
3610:
3611: locator_record.error_record.error_status := 'S';
3604: asn_debug.put_line('Locator = ' || TO_CHAR(locator_record.locator_id));
3605: asn_debug.put_line('Subinventory = ' || locator_record.subinventory);
3606: asn_debug.put_line('To Org = ' || locator_record.to_organization_id);
3607: asn_debug.put_line('Dest Type = ' || locator_record.destination_type_code);
3608: asn_debug.put_line('Item Id = ' || locator_record.item_id);
3609: END IF;
3610:
3611: locator_record.error_record.error_status := 'S';
3612: locator_record.error_record.error_message := NULL;
3610:
3611: locator_record.error_record.error_status := 'S';
3612: locator_record.error_record.error_message := NULL;
3613:
3614: IF (g_asn_debug = 'Y') THEN
3615: asn_debug.put_line('Validating Locator');
3616: END IF;
3617:
3618: rcv_transactions_interface_sv1.validate_locator(locator_record);
3611: locator_record.error_record.error_status := 'S';
3612: locator_record.error_record.error_message := NULL;
3613:
3614: IF (g_asn_debug = 'Y') THEN
3615: asn_debug.put_line('Validating Locator');
3616: END IF;
3617:
3618: rcv_transactions_interface_sv1.validate_locator(locator_record);
3619: x_cascaded_table(n).error_status := locator_record.error_record.error_status;
3618: rcv_transactions_interface_sv1.validate_locator(locator_record);
3619: x_cascaded_table(n).error_status := locator_record.error_record.error_status;
3620: rcv_error_pkg.set_error_message(locator_record.error_record.error_message, x_cascaded_table(n).error_message);
3621:
3622: IF (g_asn_debug = 'Y') THEN
3623: asn_debug.put_line('Loc Error Status = ' || locator_record.error_record.error_status);
3624: asn_debug.put_line('Loc Error Msg = ' || locator_record.error_record.error_message);
3625: END IF;
3626:
3619: x_cascaded_table(n).error_status := locator_record.error_record.error_status;
3620: rcv_error_pkg.set_error_message(locator_record.error_record.error_message, x_cascaded_table(n).error_message);
3621:
3622: IF (g_asn_debug = 'Y') THEN
3623: asn_debug.put_line('Loc Error Status = ' || locator_record.error_record.error_status);
3624: asn_debug.put_line('Loc Error Msg = ' || locator_record.error_record.error_message);
3625: END IF;
3626:
3627: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'LOCATOR');
3620: rcv_error_pkg.set_error_message(locator_record.error_record.error_message, x_cascaded_table(n).error_message);
3621:
3622: IF (g_asn_debug = 'Y') THEN
3623: asn_debug.put_line('Loc Error Status = ' || locator_record.error_record.error_status);
3624: asn_debug.put_line('Loc Error Msg = ' || locator_record.error_record.error_message);
3625: END IF;
3626:
3627: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'LOCATOR');
3628: ELSE
3636: tax_name_record.tax_name := x_cascaded_table(n).tax_name;
3637: tax_name_record.error_record.error_status := 'S';
3638: tax_name_record.error_record.error_message := NULL;
3639:
3640: IF (g_asn_debug = 'Y') THEN
3641: asn_debug.put_line('Validating Tax Code');
3642: END IF;
3643:
3644: rcv_transactions_interface_sv1.validate_tax_code(tax_name_record);
3637: tax_name_record.error_record.error_status := 'S';
3638: tax_name_record.error_record.error_message := NULL;
3639:
3640: IF (g_asn_debug = 'Y') THEN
3641: asn_debug.put_line('Validating Tax Code');
3642: END IF;
3643:
3644: rcv_transactions_interface_sv1.validate_tax_code(tax_name_record);
3645: x_cascaded_table(n).error_status := tax_name_record.error_record.error_status;
3653: country_of_origin_record.country_of_origin_code := x_cascaded_table(n).country_of_origin_code;
3654: country_of_origin_record.error_record.error_status := 'S';
3655: country_of_origin_record.error_record.error_message := NULL;
3656:
3657: IF (g_asn_debug = 'Y') THEN
3658: asn_debug.put_line('Validating Country of Origin Code');
3659: END IF;
3660:
3661: rcv_transactions_interface_sv1.validate_country_of_origin(country_of_origin_record);
3654: country_of_origin_record.error_record.error_status := 'S';
3655: country_of_origin_record.error_record.error_message := NULL;
3656:
3657: IF (g_asn_debug = 'Y') THEN
3658: asn_debug.put_line('Validating Country of Origin Code');
3659: END IF;
3660:
3661: rcv_transactions_interface_sv1.validate_country_of_origin(country_of_origin_record);
3662: x_cascaded_table(n).error_status := country_of_origin_record.error_record.error_status;
3671: asl_record.to_organization_id := x_cascaded_table(n).to_organization_id;
3672: asl_record.error_record.error_status := 'S';
3673: asl_record.error_record.error_message := NULL;
3674:
3675: IF (g_asn_debug = 'Y') THEN
3676: asn_debug.put_line('Validating ASL');
3677: END IF;
3678:
3679: rcv_transactions_interface_sv1.validate_asl(asl_record);
3672: asl_record.error_record.error_status := 'S';
3673: asl_record.error_record.error_message := NULL;
3674:
3675: IF (g_asn_debug = 'Y') THEN
3676: asn_debug.put_line('Validating ASL');
3677: END IF;
3678:
3679: rcv_transactions_interface_sv1.validate_asl(asl_record);
3680: x_cascaded_table(n).error_status := asl_record.error_record.error_status;
3694: cum_quantity_record.transaction_date := x_cascaded_table(n).transaction_date;
3695: cum_quantity_record.error_record.error_status := 'S';
3696: cum_quantity_record.error_record.error_message := NULL;
3697:
3698: IF (g_asn_debug = 'Y') THEN
3699: asn_debug.put_line('Validating Cum Qty Shipped');
3700: END IF;
3701:
3702: rcv_transactions_interface_sv1.validate_cum_quantity_shipped(cum_quantity_record);
3695: cum_quantity_record.error_record.error_status := 'S';
3696: cum_quantity_record.error_record.error_message := NULL;
3697:
3698: IF (g_asn_debug = 'Y') THEN
3699: asn_debug.put_line('Validating Cum Qty Shipped');
3700: END IF;
3701:
3702: rcv_transactions_interface_sv1.validate_cum_quantity_shipped(cum_quantity_record);
3703: x_cascaded_table(n).error_status := cum_quantity_record.error_record.error_status;
3710:
3711: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'VENDOR_CUM_SHIPPED_QTY');
3712: END IF; -- vendor_cum_shipped_qty <> 0
3713:
3714: IF (g_asn_debug = 'Y') THEN
3715: asn_debug.put_line('Validating ref integrity');
3716: END IF;
3717:
3718: ref_integrity_record.to_organization_id := x_cascaded_table(n).to_organization_id;
3711: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'VENDOR_CUM_SHIPPED_QTY');
3712: END IF; -- vendor_cum_shipped_qty <> 0
3713:
3714: IF (g_asn_debug = 'Y') THEN
3715: asn_debug.put_line('Validating ref integrity');
3716: END IF;
3717:
3718: ref_integrity_record.to_organization_id := x_cascaded_table(n).to_organization_id;
3719: ref_integrity_record.po_line_location_id := x_cascaded_table(n).po_line_location_id;
3725: ref_integrity_record.po_revision_num := x_cascaded_table(n).po_revision_num;
3726: ref_integrity_record.error_record.error_status := 'S';
3727: ref_integrity_record.error_record.error_message := NULL;
3728:
3729: IF (g_asn_debug = 'Y') THEN
3730: asn_debug.put_line('Validating Ref Integ');
3731: END IF;
3732:
3733: rcv_transactions_interface_sv1.validate_ref_integ(ref_integrity_record, x_header_record);
3726: ref_integrity_record.error_record.error_status := 'S';
3727: ref_integrity_record.error_record.error_message := NULL;
3728:
3729: IF (g_asn_debug = 'Y') THEN
3730: asn_debug.put_line('Validating Ref Integ');
3731: END IF;
3732:
3733: rcv_transactions_interface_sv1.validate_ref_integ(ref_integrity_record, x_header_record);
3734: x_cascaded_table(n).error_status := ref_integrity_record.error_record.error_status;
3745: exchange_sub_item(x_cascaded_table, n);
3746: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'SUBSTITUTE_ITEM_ID');
3747:
3748: IF x_cascaded_table(n).error_status NOT IN('S', 'W') THEN
3749: IF (g_asn_debug = 'Y') THEN
3750: asn_debug.put_line('Some problems in exchange');
3751: END IF;
3752: END IF;
3753: END IF;
3746: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'SUBSTITUTE_ITEM_ID');
3747:
3748: IF x_cascaded_table(n).error_status NOT IN('S', 'W') THEN
3749: IF (g_asn_debug = 'Y') THEN
3750: asn_debug.put_line('Some problems in exchange');
3751: END IF;
3752: END IF;
3753: END IF;
3754:
3760: l_consigned_po_rec.po_line_location_id := x_cascaded_table(n).po_line_location_id;
3761: l_consigned_po_rec.error_record.error_status := 'S';
3762: l_consigned_po_rec.error_record.error_message := NULL;
3763:
3764: IF (g_asn_debug = 'Y') THEN
3765: asn_debug.put_line('Validating ASBN for Consigned PO');
3766: END IF;
3767:
3768: rcv_transactions_interface_sv1.validate_consigned_po(l_consigned_po_rec);
3761: l_consigned_po_rec.error_record.error_status := 'S';
3762: l_consigned_po_rec.error_record.error_message := NULL;
3763:
3764: IF (g_asn_debug = 'Y') THEN
3765: asn_debug.put_line('Validating ASBN for Consigned PO');
3766: END IF;
3767:
3768: rcv_transactions_interface_sv1.validate_consigned_po(l_consigned_po_rec);
3769:
3766: END IF;
3767:
3768: rcv_transactions_interface_sv1.validate_consigned_po(l_consigned_po_rec);
3769:
3770: IF (g_asn_debug = 'Y') THEN
3771: asn_debug.put_line('After Validating ASBN for Consigned PO');
3772: END IF;
3773:
3774: x_cascaded_table(n).error_status := l_consigned_po_rec.error_record.error_status;
3767:
3768: rcv_transactions_interface_sv1.validate_consigned_po(l_consigned_po_rec);
3769:
3770: IF (g_asn_debug = 'Y') THEN
3771: asn_debug.put_line('After Validating ASBN for Consigned PO');
3772: END IF;
3773:
3774: x_cascaded_table(n).error_status := l_consigned_po_rec.error_record.error_status;
3775: rcv_error_pkg.set_error_message(l_consigned_po_rec.error_record.error_message, x_cascaded_table(n).error_message);
3773:
3774: x_cascaded_table(n).error_status := l_consigned_po_rec.error_record.error_status;
3775: rcv_error_pkg.set_error_message(l_consigned_po_rec.error_record.error_message, x_cascaded_table(n).error_message);
3776:
3777: IF (g_asn_debug = 'Y') THEN
3778: asn_debug.put_line('Error status ' || l_consigned_po_rec.error_record.error_status);
3779: asn_debug.put_line('Error name: ' || l_consigned_po_rec.error_record.error_message);
3780: END IF;
3781:
3774: x_cascaded_table(n).error_status := l_consigned_po_rec.error_record.error_status;
3775: rcv_error_pkg.set_error_message(l_consigned_po_rec.error_record.error_message, x_cascaded_table(n).error_message);
3776:
3777: IF (g_asn_debug = 'Y') THEN
3778: asn_debug.put_line('Error status ' || l_consigned_po_rec.error_record.error_status);
3779: asn_debug.put_line('Error name: ' || l_consigned_po_rec.error_record.error_message);
3780: END IF;
3781:
3782: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'PO_LINE_LOCATION_ID');
3775: rcv_error_pkg.set_error_message(l_consigned_po_rec.error_record.error_message, x_cascaded_table(n).error_message);
3776:
3777: IF (g_asn_debug = 'Y') THEN
3778: asn_debug.put_line('Error status ' || l_consigned_po_rec.error_record.error_status);
3779: asn_debug.put_line('Error name: ' || l_consigned_po_rec.error_record.error_message);
3780: END IF;
3781:
3782: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'PO_LINE_LOCATION_ID');
3783: END IF; -- IF (x_cascaded_table(n).error_status in ('S','W')) AND (X_asn_type = 'ASBN')
3790: l_consumption_po_rec.po_header_id := x_cascaded_table(n).po_header_id;
3791: l_consumption_po_rec.error_record.error_status := 'S';
3792: l_consumption_po_rec.error_record.error_message := NULL;
3793:
3794: IF (g_asn_debug = 'Y') THEN
3795: asn_debug.put_line('Validating Consumption PO');
3796: END IF;
3797:
3798: rcv_transactions_interface_sv1.validate_consumption_po(l_consumption_po_rec);
3791: l_consumption_po_rec.error_record.error_status := 'S';
3792: l_consumption_po_rec.error_record.error_message := NULL;
3793:
3794: IF (g_asn_debug = 'Y') THEN
3795: asn_debug.put_line('Validating Consumption PO');
3796: END IF;
3797:
3798: rcv_transactions_interface_sv1.validate_consumption_po(l_consumption_po_rec);
3799:
3796: END IF;
3797:
3798: rcv_transactions_interface_sv1.validate_consumption_po(l_consumption_po_rec);
3799:
3800: IF (g_asn_debug = 'Y') THEN
3801: asn_debug.put_line('After Validating Consumption PO');
3802: END IF;
3803:
3804: x_cascaded_table(n).error_status := l_consumption_po_rec.error_record.error_status;
3797:
3798: rcv_transactions_interface_sv1.validate_consumption_po(l_consumption_po_rec);
3799:
3800: IF (g_asn_debug = 'Y') THEN
3801: asn_debug.put_line('After Validating Consumption PO');
3802: END IF;
3803:
3804: x_cascaded_table(n).error_status := l_consumption_po_rec.error_record.error_status;
3805: rcv_error_pkg.set_error_message(l_consumption_po_rec.error_record.error_message, x_cascaded_table(n).error_message);
3803:
3804: x_cascaded_table(n).error_status := l_consumption_po_rec.error_record.error_status;
3805: rcv_error_pkg.set_error_message(l_consumption_po_rec.error_record.error_message, x_cascaded_table(n).error_message);
3806:
3807: IF (g_asn_debug = 'Y') THEN
3808: asn_debug.put_line('Error status ' || l_consumption_po_rec.error_record.error_status);
3809: asn_debug.put_line('Error name: ' || l_consumption_po_rec.error_record.error_message);
3810: END IF;
3811:
3804: x_cascaded_table(n).error_status := l_consumption_po_rec.error_record.error_status;
3805: rcv_error_pkg.set_error_message(l_consumption_po_rec.error_record.error_message, x_cascaded_table(n).error_message);
3806:
3807: IF (g_asn_debug = 'Y') THEN
3808: asn_debug.put_line('Error status ' || l_consumption_po_rec.error_record.error_status);
3809: asn_debug.put_line('Error name: ' || l_consumption_po_rec.error_record.error_message);
3810: END IF;
3811:
3812: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'PO_HEADER_ID');
3805: rcv_error_pkg.set_error_message(l_consumption_po_rec.error_record.error_message, x_cascaded_table(n).error_message);
3806:
3807: IF (g_asn_debug = 'Y') THEN
3808: asn_debug.put_line('Error status ' || l_consumption_po_rec.error_record.error_status);
3809: asn_debug.put_line('Error name: ' || l_consumption_po_rec.error_record.error_message);
3810: END IF;
3811:
3812: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'PO_HEADER_ID');
3813: END IF; -- IF (x_cascaded_table(n).error_status in ('S','W'))
3819: l_consumption_release_rec.po_release_id := x_cascaded_table(n).po_release_id;
3820: l_consumption_release_rec.error_record.error_status := 'S';
3821: l_consumption_release_rec.error_record.error_message := NULL;
3822:
3823: IF (g_asn_debug = 'Y') THEN
3824: asn_debug.put_line('Validating Consumption Release');
3825: END IF;
3826:
3827: rcv_transactions_interface_sv1.validate_consumption_release(l_consumption_release_rec);
3820: l_consumption_release_rec.error_record.error_status := 'S';
3821: l_consumption_release_rec.error_record.error_message := NULL;
3822:
3823: IF (g_asn_debug = 'Y') THEN
3824: asn_debug.put_line('Validating Consumption Release');
3825: END IF;
3826:
3827: rcv_transactions_interface_sv1.validate_consumption_release(l_consumption_release_rec);
3828:
3825: END IF;
3826:
3827: rcv_transactions_interface_sv1.validate_consumption_release(l_consumption_release_rec);
3828:
3829: IF (g_asn_debug = 'Y') THEN
3830: asn_debug.put_line('After Validating Consumption Release');
3831: END IF;
3832:
3833: x_cascaded_table(n).error_status := l_consumption_release_rec.error_record.error_status;
3826:
3827: rcv_transactions_interface_sv1.validate_consumption_release(l_consumption_release_rec);
3828:
3829: IF (g_asn_debug = 'Y') THEN
3830: asn_debug.put_line('After Validating Consumption Release');
3831: END IF;
3832:
3833: x_cascaded_table(n).error_status := l_consumption_release_rec.error_record.error_status;
3834: rcv_error_pkg.set_error_message(l_consumption_release_rec.error_record.error_message, x_cascaded_table(n).error_message);
3832:
3833: x_cascaded_table(n).error_status := l_consumption_release_rec.error_record.error_status;
3834: rcv_error_pkg.set_error_message(l_consumption_release_rec.error_record.error_message, x_cascaded_table(n).error_message);
3835:
3836: IF (g_asn_debug = 'Y') THEN
3837: asn_debug.put_line('Error status ' || l_consumption_release_rec.error_record.error_status);
3838: asn_debug.put_line('Error name: ' || l_consumption_release_rec.error_record.error_message);
3839: END IF;
3840:
3833: x_cascaded_table(n).error_status := l_consumption_release_rec.error_record.error_status;
3834: rcv_error_pkg.set_error_message(l_consumption_release_rec.error_record.error_message, x_cascaded_table(n).error_message);
3835:
3836: IF (g_asn_debug = 'Y') THEN
3837: asn_debug.put_line('Error status ' || l_consumption_release_rec.error_record.error_status);
3838: asn_debug.put_line('Error name: ' || l_consumption_release_rec.error_record.error_message);
3839: END IF;
3840:
3841: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'PO_RELEASE_ID');
3834: rcv_error_pkg.set_error_message(l_consumption_release_rec.error_record.error_message, x_cascaded_table(n).error_message);
3835:
3836: IF (g_asn_debug = 'Y') THEN
3837: asn_debug.put_line('Error status ' || l_consumption_release_rec.error_record.error_status);
3838: asn_debug.put_line('Error name: ' || l_consumption_release_rec.error_record.error_message);
3839: END IF;
3840:
3841: rcv_error_pkg.log_interface_message(x_cascaded_table(n).error_status, 'PO_RELEASE_ID');
3842: END IF; -- IF (x_cascaded_table(n).error_status in ('S','W'))
3844: EXCEPTION
3845: WHEN rcv_error_pkg.e_fatal_error THEN
3846: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
3847: WHEN OTHERS THEN
3848: IF (g_asn_debug = 'Y') THEN
3849: asn_debug.put_line('I have hit an exception');
3850: asn_debug.put_line(SQLERRM);
3851: asn_debug.put_line('Exit validate_shipment_line');
3852: END IF;
3845: WHEN rcv_error_pkg.e_fatal_error THEN
3846: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
3847: WHEN OTHERS THEN
3848: IF (g_asn_debug = 'Y') THEN
3849: asn_debug.put_line('I have hit an exception');
3850: asn_debug.put_line(SQLERRM);
3851: asn_debug.put_line('Exit validate_shipment_line');
3852: END IF;
3853:
3846: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
3847: WHEN OTHERS THEN
3848: IF (g_asn_debug = 'Y') THEN
3849: asn_debug.put_line('I have hit an exception');
3850: asn_debug.put_line(SQLERRM);
3851: asn_debug.put_line('Exit validate_shipment_line');
3852: END IF;
3853:
3854: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_unexp_error;
3847: WHEN OTHERS THEN
3848: IF (g_asn_debug = 'Y') THEN
3849: asn_debug.put_line('I have hit an exception');
3850: asn_debug.put_line(SQLERRM);
3851: asn_debug.put_line('Exit validate_shipment_line');
3852: END IF;
3853:
3854: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_unexp_error;
3855: rcv_error_pkg.set_sql_error_message('validate_shipment_line', x_progress);
3890: PROCEDURE get_locator_id(
3891: x_locator_id_record IN OUT NOCOPY rcv_shipment_line_sv.locator_id_record_type
3892: ) IS
3893: BEGIN
3894: IF (g_asn_debug = 'Y') THEN
3895: asn_debug.put_line('inside get_locator_id');
3896: END IF;
3897:
3898: /* Bug 3017707 - As locators with the same name can exist in two different organizations, added a filter on organization_id */
3891: x_locator_id_record IN OUT NOCOPY rcv_shipment_line_sv.locator_id_record_type
3892: ) IS
3893: BEGIN
3894: IF (g_asn_debug = 'Y') THEN
3895: asn_debug.put_line('inside get_locator_id');
3896: END IF;
3897:
3898: /* Bug 3017707 - As locators with the same name can exist in two different organizations, added a filter on organization_id */
3899: SELECT NVL(MAX(ml.inventory_location_id), -999)
4026: end if
4027: else
4028: item should not have any revisions which we will validate in the validation phase */
4029: IF x_revision_control_flag = 'Y' THEN
4030: IF (g_asn_debug = 'Y') THEN
4031: asn_debug.put_line('Item is under revision control');
4032: END IF;
4033:
4034: IF x_item_revision_record.item_revision IS NULL THEN -- pick up revision from source document
4027: else
4028: item should not have any revisions which we will validate in the validation phase */
4029: IF x_revision_control_flag = 'Y' THEN
4030: IF (g_asn_debug = 'Y') THEN
4031: asn_debug.put_line('Item is under revision control');
4032: END IF;
4033:
4034: IF x_item_revision_record.item_revision IS NULL THEN -- pick up revision from source document
4035: IF (g_asn_debug = 'Y') THEN
4031: asn_debug.put_line('Item is under revision control');
4032: END IF;
4033:
4034: IF x_item_revision_record.item_revision IS NULL THEN -- pick up revision from source document
4035: IF (g_asn_debug = 'Y') THEN
4036: asn_debug.put_line('Picking up from source document');
4037: END IF;
4038:
4039: SELECT item_revision
4032: END IF;
4033:
4034: IF x_item_revision_record.item_revision IS NULL THEN -- pick up revision from source document
4035: IF (g_asn_debug = 'Y') THEN
4036: asn_debug.put_line('Picking up from source document');
4037: END IF;
4038:
4039: SELECT item_revision
4040: INTO x_item_revision_record.item_revision
4052:
4053: IF x_item_revision_record.item_revision IS NULL
4054: AND x_number_of_inv_dest > 0 THEN -- still null and destination_type = INVENTORY
4055: -- default latest implementation
4056: IF (g_asn_debug = 'Y') THEN
4057: asn_debug.put_line('Picking up latest implementation since source doc is null');
4058: END IF;
4059:
4060: po_items_sv2.get_latest_item_rev(x_item_revision_record.item_id,
4053: IF x_item_revision_record.item_revision IS NULL
4054: AND x_number_of_inv_dest > 0 THEN -- still null and destination_type = INVENTORY
4055: -- default latest implementation
4056: IF (g_asn_debug = 'Y') THEN
4057: asn_debug.put_line('Picking up latest implementation since source doc is null');
4058: END IF;
4059:
4060: po_items_sv2.get_latest_item_rev(x_item_revision_record.item_id,
4061: x_item_revision_record.to_organization_id,
4065: END IF;
4066: END IF;
4067: EXCEPTION
4068: WHEN OTHERS THEN
4069: IF (g_asn_debug = 'Y') THEN
4070: asn_debug.put_line('In procedure default item_revision');
4071: END IF;
4072: END default_item_revision;
4073:
4066: END IF;
4067: EXCEPTION
4068: WHEN OTHERS THEN
4069: IF (g_asn_debug = 'Y') THEN
4070: asn_debug.put_line('In procedure default item_revision');
4071: END IF;
4072: END default_item_revision;
4073:
4074: /*===========================================================================
4086: x_sysdate DATE := SYSDATE;
4087: high_range_date DATE;
4088: low_range_date DATE;
4089: BEGIN
4090: IF (g_asn_debug = 'Y') THEN
4091: asn_debug.put_line('Check date tolerance');
4092: END IF;
4093:
4094: IF (expected_receipt_date IS NOT NULL) THEN
4087: high_range_date DATE;
4088: low_range_date DATE;
4089: BEGIN
4090: IF (g_asn_debug = 'Y') THEN
4091: asn_debug.put_line('Check date tolerance');
4092: END IF;
4093:
4094: IF (expected_receipt_date IS NOT NULL) THEN
4095: IF (promised_date IS NOT NULL) THEN
4114: receipt_days_exception_code := 'NONE';
4115: END IF;
4116:
4117: IF receipt_days_exception_code IS NULL THEN
4118: IF (g_asn_debug = 'Y') THEN
4119: asn_debug.put_line('In null days exception code');
4120: END IF;
4121:
4122: receipt_days_exception_code := 'NONE';
4115: END IF;
4116:
4117: IF receipt_days_exception_code IS NULL THEN
4118: IF (g_asn_debug = 'Y') THEN
4119: asn_debug.put_line('In null days exception code');
4120: END IF;
4121:
4122: receipt_days_exception_code := 'NONE';
4123: END IF;
4153:
4154: RETURN(correct_qty);
4155: EXCEPTION
4156: WHEN OTHERS THEN
4157: IF (g_asn_debug = 'Y') THEN
4158: asn_debug.put_line('Could not convert between UOMs');
4159: asn_debug.put_line('Will return 0');
4160: END IF;
4161:
4154: RETURN(correct_qty);
4155: EXCEPTION
4156: WHEN OTHERS THEN
4157: IF (g_asn_debug = 'Y') THEN
4158: asn_debug.put_line('Could not convert between UOMs');
4159: asn_debug.put_line('Will return 0');
4160: END IF;
4161:
4162: correct_qty := 0;
4155: EXCEPTION
4156: WHEN OTHERS THEN
4157: IF (g_asn_debug = 'Y') THEN
4158: asn_debug.put_line('Could not convert between UOMs');
4159: asn_debug.put_line('Will return 0');
4160: END IF;
4161:
4162: correct_qty := 0;
4163: RETURN(correct_qty);
4208: AND inventory_item_id(+) = v_cascaded_table(n).substitute_item_id
4209: AND unit_of_measure = v_cascaded_table(n).unit_of_measure;
4210:
4211: IF x_uom_count = 0 THEN
4212: IF (g_asn_debug = 'Y') THEN
4213: asn_debug.put_line('The substitute item cannot be received in ASN uom' || v_cascaded_table(n).unit_of_measure);
4214: END IF;
4215:
4216: rcv_error_pkg.set_error_message('RCV_ITEM_SUB_NOT_ALLOWED');
4209: AND unit_of_measure = v_cascaded_table(n).unit_of_measure;
4210:
4211: IF x_uom_count = 0 THEN
4212: IF (g_asn_debug = 'Y') THEN
4213: asn_debug.put_line('The substitute item cannot be received in ASN uom' || v_cascaded_table(n).unit_of_measure);
4214: END IF;
4215:
4216: rcv_error_pkg.set_error_message('RCV_ITEM_SUB_NOT_ALLOWED');
4217: RAISE e_validation_error;
4223: WHERE mtl_system_items.inventory_item_id = v_cascaded_table(n).item_id
4224: AND mtl_system_items.organization_id = v_cascaded_table(n).to_organization_id;
4225:
4226: IF x_primary_uom IS NULL THEN
4227: IF (g_asn_debug = 'Y') THEN
4228: asn_debug.put_line('No Primary UOM for substitute item');
4229: END IF;
4230:
4231: rcv_error_pkg.set_error_message('RCV_UOM_NO_CONV_PRIMARY');
4224: AND mtl_system_items.organization_id = v_cascaded_table(n).to_organization_id;
4225:
4226: IF x_primary_uom IS NULL THEN
4227: IF (g_asn_debug = 'Y') THEN
4228: asn_debug.put_line('No Primary UOM for substitute item');
4229: END IF;
4230:
4231: rcv_error_pkg.set_error_message('RCV_UOM_NO_CONV_PRIMARY');
4232: RAISE e_validation_error;
4231: rcv_error_pkg.set_error_message('RCV_UOM_NO_CONV_PRIMARY');
4232: RAISE e_validation_error;
4233: END IF;
4234:
4235: IF (g_asn_debug = 'Y') THEN
4236: asn_debug.put_line('Primary UOM for substitute item is ' || x_primary_uom);
4237: END IF;
4238:
4239: IF x_primary_uom <> v_cascaded_table(n).primary_unit_of_measure THEN
4232: RAISE e_validation_error;
4233: END IF;
4234:
4235: IF (g_asn_debug = 'Y') THEN
4236: asn_debug.put_line('Primary UOM for substitute item is ' || x_primary_uom);
4237: END IF;
4238:
4239: IF x_primary_uom <> v_cascaded_table(n).primary_unit_of_measure THEN
4240: prim_uom_qty := convert_into_correct_qty(v_cascaded_table(n).quantity,
4243: x_primary_uom
4244: );
4245:
4246: IF prim_uom_qty = 0 THEN
4247: IF (g_asn_debug = 'Y') THEN
4248: asn_debug.put_line('Not possible to convert between asn and primary UOM');
4249: END IF;
4250:
4251: rcv_error_pkg.set_error_message('RCV_UOM_NO_CONV_PRIMARY');
4244: );
4245:
4246: IF prim_uom_qty = 0 THEN
4247: IF (g_asn_debug = 'Y') THEN
4248: asn_debug.put_line('Not possible to convert between asn and primary UOM');
4249: END IF;
4250:
4251: rcv_error_pkg.set_error_message('RCV_UOM_NO_CONV_PRIMARY');
4252: RAISE e_validation_error;