DBA Data[Home] [Help]

PACKAGE BODY: APPS.RCV_SHIPMENT_HEADER_SV

Source


1 PACKAGE BODY rcv_shipment_header_sv AS
2 /* $Header: RCVSHCB.pls 120.0.12010000.2 2010/01/25 23:29:26 vthevark ship $ */
3 
4 -- Read the profile option that enables/disables the debug log
5    g_asn_debug VARCHAR2(1) := asn_debug.is_debug_on; -- Bug 9152790
6 
7    PROCEDURE create_shipment_header(
8       x_header_record IN OUT NOCOPY rcv_shipment_header_sv.headerrectype
9    ) IS
10    BEGIN
11       rcv_headers_interface_sv.derive_shipment_header(x_header_record);
12 
13       IF x_header_record.error_record.error_status IN('S', 'W') THEN
14          rcv_headers_interface_sv.default_shipment_header(x_header_record);
15       END IF;
16 
17       IF x_header_record.error_record.error_status IN('S', 'W') THEN
18          rcv_headers_interface_sv.validate_shipment_header(x_header_record);
19       END IF;
20 
21       IF x_header_record.error_record.error_status IN('S', 'W') THEN
22          IF NVL(x_header_record.header_record.test_flag, 'N') <> 'Y' THEN
23             rcv_headers_interface_sv.insert_shipment_header(x_header_record);
24          END IF;
25       END IF;
26     /* Check for test flag and make sure the records are not inserted for
27        the test flag = 'Y' case */
28     /* If no fatal errors were detected at the header_level and at least
29        one line did not have fatal errors and TEST_FLAG = 'P', populate
30        the RCV_SHIPMENT_HEADERS with the header info. */
31    /* If type != ASBN set processing_status_code =
32          "Not processable for invoice creation" */
33 
34    /* If type = ASBN and any lines fail validation then
35         set processing_status_code =
36           "Not processable for invoice creation" */
37    EXCEPTION
38       WHEN OTHERS THEN
39          rcv_error_pkg.set_sql_error_message('create_shipment_header', '000');
40          x_header_record.error_record.error_status   := rcv_error_pkg.g_ret_sts_unexp_error;
41          x_header_record.error_record.error_message  := rcv_error_pkg.get_last_message;
42 
43          IF (g_asn_debug = 'Y') THEN
44             asn_debug.put_line('Fatal Error');
45          END IF;
46    END create_shipment_header;
47 
48 /* --------------------------------------------
49       Cancel Shipment Procedure
50 
51    --------------------------------------------*/
52    PROCEDURE cancel_shipment(
53       x_header_record IN OUT NOCOPY rcv_shipment_header_sv.headerrectype
54    ) IS
55    BEGIN
56       rcv_headers_interface_sv.derive_shipment_header(x_header_record);
57 
58       IF x_header_record.error_record.error_status IN('S', 'W') THEN
59          rcv_headers_interface_sv.default_shipment_header(x_header_record);
60       END IF;
61 
62       IF x_header_record.error_record.error_status IN('S', 'W') THEN
63          rcv_headers_interface_sv.validate_shipment_header(x_header_record);
64       END IF;
65 
66       IF x_header_record.error_record.error_status IN('S', 'W') THEN
67          IF NVL(x_header_record.header_record.test_flag, 'N') <> 'Y' THEN
68             IF (g_asn_debug = 'Y') THEN
69                asn_debug.put_line('Start the process of cancellation');
70             END IF;
71 
72             rcv_asn_trx_insert.insert_cancelled_asn_lines(x_header_record);
73          END IF;
74       END IF;
75    /* Check for test flag and make sure the actions are not carried for
76       the test flag = 'Y' case */
77    EXCEPTION
78       WHEN OTHERS THEN
79          rcv_error_pkg.set_sql_error_message('create_shipment_header', '000');
80          x_header_record.error_record.error_status   := rcv_error_pkg.g_ret_sts_unexp_error;
81          x_header_record.error_record.error_message  := rcv_error_pkg.get_last_message;
82 
83          IF (g_asn_debug = 'Y') THEN
84             asn_debug.put_line('Fatal Error');
85          END IF;
86    END cancel_shipment;
87 END rcv_shipment_header_sv;