1: PACKAGE BODY rcv_rma_headers
2: /* $Header: RCVRMAHB.pls 120.3 2006/04/20 16:27:30 pjiang noship $ */
3: AS
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:
7: /*===========================================================================+
8: | |
9: | PROCEDURE NAME: derive_rma_header() |
12: PROCEDURE derive_rma_header(
13: p_header_record IN OUT NOCOPY rcv_roi_preprocessor.header_rec_type
14: ) IS
15: BEGIN
16: IF (g_asn_debug = 'Y') THEN
17: asn_debug.put_line('In derive_rma_header');
18: END IF;
19:
20: rcv_roi_header_common.derive_ship_to_org_info(p_header_record);
13: p_header_record IN OUT NOCOPY rcv_roi_preprocessor.header_rec_type
14: ) IS
15: BEGIN
16: IF (g_asn_debug = 'Y') THEN
17: asn_debug.put_line('In derive_rma_header');
18: END IF;
19:
20: rcv_roi_header_common.derive_ship_to_org_info(p_header_record);
21: rcv_roi_header_common.derive_from_org_info(p_header_record);
24: rcv_roi_header_common.derive_receiver_info(p_header_record);
25: derive_customer_info(p_header_record);
26: derive_customer_site_info(p_header_record);
27:
28: IF (g_asn_debug = 'Y') THEN
29: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
30: asn_debug.put_line('Error in derive_rma_header');
31: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
32: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
26: derive_customer_site_info(p_header_record);
27:
28: IF (g_asn_debug = 'Y') THEN
29: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
30: asn_debug.put_line('Error in derive_rma_header');
31: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
32: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
33: END IF;
34:
27:
28: IF (g_asn_debug = 'Y') THEN
29: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
30: asn_debug.put_line('Error in derive_rma_header');
31: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
32: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
33: END IF;
34:
35: asn_debug.put_line('Done derive_rma_header');
28: IF (g_asn_debug = 'Y') THEN
29: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
30: asn_debug.put_line('Error in derive_rma_header');
31: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
32: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
33: END IF;
34:
35: asn_debug.put_line('Done derive_rma_header');
36: END IF;
31: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
32: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
33: END IF;
34:
35: asn_debug.put_line('Done derive_rma_header');
36: END IF;
37: END derive_rma_header;
38:
39: /*===========================================================================+
44: PROCEDURE default_rma_header(
45: p_header_record IN OUT NOCOPY rcv_roi_preprocessor.header_rec_type
46: ) IS
47: BEGIN
48: IF (g_asn_debug = 'Y') THEN
49: asn_debug.put_line('In default_rma_header');
50: END IF;
51:
52: default_customer_info(p_header_record);
45: p_header_record IN OUT NOCOPY rcv_roi_preprocessor.header_rec_type
46: ) IS
47: BEGIN
48: IF (g_asn_debug = 'Y') THEN
49: asn_debug.put_line('In default_rma_header');
50: END IF;
51:
52: default_customer_info(p_header_record);
53: default_customer_site_info(p_header_record);
59: rcv_roi_header_common.default_shipment_header_id(p_header_record);
60: rcv_roi_header_common.default_receipt_info(p_header_record);
61: rcv_roi_header_common.default_ship_to_location_info(p_header_record);
62:
63: IF (g_asn_debug = 'Y') THEN
64: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
65: asn_debug.put_line('Error in default_rma_header');
66: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
67: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
61: rcv_roi_header_common.default_ship_to_location_info(p_header_record);
62:
63: IF (g_asn_debug = 'Y') THEN
64: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
65: asn_debug.put_line('Error in default_rma_header');
66: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
67: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
68: END IF;
69:
62:
63: IF (g_asn_debug = 'Y') THEN
64: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
65: asn_debug.put_line('Error in default_rma_header');
66: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
67: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
68: END IF;
69:
70: asn_debug.put_line('Out of default_rma_header');
63: IF (g_asn_debug = 'Y') THEN
64: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
65: asn_debug.put_line('Error in default_rma_header');
66: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
67: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
68: END IF;
69:
70: asn_debug.put_line('Out of default_rma_header');
71: END IF;
66: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
67: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
68: END IF;
69:
70: asn_debug.put_line('Out of default_rma_header');
71: END IF;
72: END default_rma_header;
73:
74: /*===========================================================================+
79: PROCEDURE validate_rma_header(
80: p_header_record IN OUT NOCOPY rcv_roi_preprocessor.header_rec_type
81: ) IS
82: BEGIN
83: IF (g_asn_debug = 'Y') THEN
84: asn_debug.put_line('In validate_rma_header');
85: END IF;
86:
87: validate_receipt_source_code(p_header_record);
80: p_header_record IN OUT NOCOPY rcv_roi_preprocessor.header_rec_type
81: ) IS
82: BEGIN
83: IF (g_asn_debug = 'Y') THEN
84: asn_debug.put_line('In validate_rma_header');
85: END IF;
86:
87: validate_receipt_source_code(p_header_record);
88: validate_customer_info(p_header_record);
96: rcv_roi_header_common.validate_payment_terms_info(p_header_record);
97: rcv_roi_header_common.validate_receiver_info(p_header_record);
98: rcv_roi_header_common.validate_freight_carrier_info(p_header_record);
99:
100: IF (g_asn_debug = 'Y') THEN
101: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
102: asn_debug.put_line('Error in validate_rma_header');
103: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
104: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
98: rcv_roi_header_common.validate_freight_carrier_info(p_header_record);
99:
100: IF (g_asn_debug = 'Y') THEN
101: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
102: asn_debug.put_line('Error in validate_rma_header');
103: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
104: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
105: END IF;
106:
99:
100: IF (g_asn_debug = 'Y') THEN
101: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
102: asn_debug.put_line('Error in validate_rma_header');
103: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
104: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
105: END IF;
106:
107: asn_debug.put_line('Out of validate_rma_header');
100: IF (g_asn_debug = 'Y') THEN
101: IF (p_header_record.error_record.error_status NOT IN('S', 'W')) THEN
102: asn_debug.put_line('Error in validate_rma_header');
103: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
104: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
105: END IF;
106:
107: asn_debug.put_line('Out of validate_rma_header');
108: END IF;
103: asn_debug.put_line('status = ' || p_header_record.error_record.error_status);
104: asn_debug.put_line('message = ' || p_header_record.error_record.error_message);
105: END IF;
106:
107: asn_debug.put_line('Out of validate_rma_header');
108: END IF;
109: END validate_rma_header;
110:
111: PROCEDURE insert_rma_header(
397: IF ( p_header_record.header_record.customer_site_id IS NULL
398: AND p_header_record.header_record.from_organization_id IS NOT NULL) THEN
399: p_header_record.header_record.customer_site_id := p_header_record.header_record.from_organization_id;
400:
401: IF (g_asn_debug = 'Y') THEN
402: asn_debug.put_line('defaulted customer_site_id');
403: END IF;
404: END IF;
405: END default_customer_site_info;
398: AND p_header_record.header_record.from_organization_id IS NOT NULL) THEN
399: p_header_record.header_record.customer_site_id := p_header_record.header_record.from_organization_id;
400:
401: IF (g_asn_debug = 'Y') THEN
402: asn_debug.put_line('defaulted customer_site_id');
403: END IF;
404: END IF;
405: END default_customer_site_info;
406:
410: BEGIN
411: IF p_header_record.header_record.transaction_type IS NULL THEN
412: p_header_record.header_record.transaction_type := 'NEW';
413:
414: IF (g_asn_debug = 'Y') THEN
415: asn_debug.put_line('defaulted transaction_type');
416: END IF;
417: END IF;
418: END default_trx_info;
411: IF p_header_record.header_record.transaction_type IS NULL THEN
412: p_header_record.header_record.transaction_type := 'NEW';
413:
414: IF (g_asn_debug = 'Y') THEN
415: asn_debug.put_line('defaulted transaction_type');
416: END IF;
417: END IF;
418: END default_trx_info;
419:
425: /* First choice for ASN/ Second Choice for ASN */
426: IF p_header_record.header_record.shipment_num IS NULL THEN
427: p_header_record.header_record.shipment_num := p_header_record.header_record.packing_slip;
428:
429: IF (g_asn_debug = 'Y') THEN
430: asn_debug.put_line('defaulted shipment number');
431: END IF;
432: END IF;
433: END default_shipment_num;
426: IF p_header_record.header_record.shipment_num IS NULL THEN
427: p_header_record.header_record.shipment_num := p_header_record.header_record.packing_slip;
428:
429: IF (g_asn_debug = 'Y') THEN
430: asn_debug.put_line('defaulted shipment number');
431: END IF;
432: END IF;
433: END default_shipment_num;
434:
457: FROM hz_cust_accounts acct
458: WHERE acct.cust_account_id = p_header_record.header_record.customer_id;
459:
460: IF l_status <> 'A' THEN
461: IF (g_asn_debug = 'Y') THEN
462: asn_debug.put_line('Customer status is not ACTIVE');
463: END IF;
464: l_validation_failed := TRUE;
465: END IF;
458: WHERE acct.cust_account_id = p_header_record.header_record.customer_id;
459:
460: IF l_status <> 'A' THEN
461: IF (g_asn_debug = 'Y') THEN
462: asn_debug.put_line('Customer status is not ACTIVE');
463: END IF;
464: l_validation_failed := TRUE;
465: END IF;
466: ELSE
463: END IF;
464: l_validation_failed := TRUE;
465: END IF;
466: ELSE
467: IF (g_asn_debug = 'Y') THEN
468: asn_debug.put_line('Customer_id is null in header record');
469: END IF;
470:
471: -- Bug 4344351: The header record should be errored out if customer_id is null.
464: l_validation_failed := TRUE;
465: END IF;
466: ELSE
467: IF (g_asn_debug = 'Y') THEN
468: asn_debug.put_line('Customer_id is null in header record');
469: END IF;
470:
471: -- Bug 4344351: The header record should be errored out if customer_id is null.
472: l_validation_failed := TRUE;