1: PACKAGE BODY RCV_SHIPMENT_LINE_SV AS
2: /* $Header: RCVTHCB.pls 120.0.12010000.2 2010/01/25 23:33:00 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: /*===========================================================================+
8: | |
9: | PROCEDURE NAME: create_shipment_line() |
26:
27:
28: BEGIN
29:
30: IF (g_asn_debug = 'Y') THEN
31: ASN_DEBUG.PUT_LINE('Enter create shipment line');
32: END IF;
33:
34: IF (g_asn_debug = 'Y') THEN
27:
28: BEGIN
29:
30: IF (g_asn_debug = 'Y') THEN
31: ASN_DEBUG.PUT_LINE('Enter create shipment line');
32: END IF;
33:
34: IF (g_asn_debug = 'Y') THEN
35: ASN_DEBUG.PUT_LINE('Initialize the table structure used for storing the cascaded rows');
30: IF (g_asn_debug = 'Y') THEN
31: ASN_DEBUG.PUT_LINE('Enter create shipment line');
32: END IF;
33:
34: IF (g_asn_debug = 'Y') THEN
35: ASN_DEBUG.PUT_LINE('Initialize the table structure used for storing the cascaded rows');
36: END IF;
37:
38: -- delete all records from used_for_cascaded_rows
31: ASN_DEBUG.PUT_LINE('Enter create shipment line');
32: END IF;
33:
34: IF (g_asn_debug = 'Y') THEN
35: ASN_DEBUG.PUT_LINE('Initialize the table structure used for storing the cascaded rows');
36: END IF;
37:
38: -- delete all records from used_for_cascaded_rows
39:
49: -- derive IDs and also explode rows
50:
51: rcv_transactions_interface_sv.derive_shipment_line (X_cascaded_table, n, used_for_cascaded_rows, V_header_record);
52:
53: IF (g_asn_debug = 'Y') THEN
54: ASN_DEBUG.PUT_LINE('Back from derive routine with ' || to_char(used_for_cascaded_rows.count) || ' rows');
55: ASN_DEBUG.PUT_LINE('Error Status ' || x_cascaded_table(n).error_status);
56: ASN_DEBUG.PUT_LINE('Error Message ' || x_cascaded_table(n).error_message);
57: END IF;
50:
51: rcv_transactions_interface_sv.derive_shipment_line (X_cascaded_table, n, used_for_cascaded_rows, V_header_record);
52:
53: IF (g_asn_debug = 'Y') THEN
54: ASN_DEBUG.PUT_LINE('Back from derive routine with ' || to_char(used_for_cascaded_rows.count) || ' rows');
55: ASN_DEBUG.PUT_LINE('Error Status ' || x_cascaded_table(n).error_status);
56: ASN_DEBUG.PUT_LINE('Error Message ' || x_cascaded_table(n).error_message);
57: END IF;
58:
51: rcv_transactions_interface_sv.derive_shipment_line (X_cascaded_table, n, used_for_cascaded_rows, V_header_record);
52:
53: IF (g_asn_debug = 'Y') THEN
54: ASN_DEBUG.PUT_LINE('Back from derive routine with ' || to_char(used_for_cascaded_rows.count) || ' rows');
55: ASN_DEBUG.PUT_LINE('Error Status ' || x_cascaded_table(n).error_status);
56: ASN_DEBUG.PUT_LINE('Error Message ' || x_cascaded_table(n).error_message);
57: END IF;
58:
59: X_progress := '010';
52:
53: IF (g_asn_debug = 'Y') THEN
54: ASN_DEBUG.PUT_LINE('Back from derive routine with ' || to_char(used_for_cascaded_rows.count) || ' rows');
55: ASN_DEBUG.PUT_LINE('Error Status ' || x_cascaded_table(n).error_status);
56: ASN_DEBUG.PUT_LINE('Error Message ' || x_cascaded_table(n).error_message);
57: END IF;
58:
59: X_progress := '010';
60:
62: used_for_cascaded_rows.count > 0 then -- we have returned with a cascaded table
63:
64: for i in 1..used_for_cascaded_rows.count loop
65:
66: IF (g_asn_debug = 'Y') THEN
67: ASN_DEBUG.PUT_LINE('Defaulting for cascaded row ' || to_char(i));
68: END IF;
69: rcv_transactions_interface_sv.default_shipment_line (used_for_cascaded_rows, i, X_header_id, V_header_record);
70:
63:
64: for i in 1..used_for_cascaded_rows.count loop
65:
66: IF (g_asn_debug = 'Y') THEN
67: ASN_DEBUG.PUT_LINE('Defaulting for cascaded row ' || to_char(i));
68: END IF;
69: rcv_transactions_interface_sv.default_shipment_line (used_for_cascaded_rows, i, X_header_id, V_header_record);
70:
71: X_progress := '020';
82: X_cascaded_table(n).processing_status_code := 'ERROR';
83: X_cascaded_table(n).error_status := used_for_cascaded_rows(i).error_status;
84: X_cascaded_table(n).error_message := used_for_cascaded_rows(i).error_message;
85:
86: IF (g_asn_debug = 'Y') THEN
87: ASN_DEBUG.PUT_LINE('Have hit error condition in validation');
88: ASN_DEBUG.PUT_LINE('Mark needed flags and error message');
89: ASN_DEBUG.PUT_LINE('Delete the cascaded rows');
90: END IF;
83: X_cascaded_table(n).error_status := used_for_cascaded_rows(i).error_status;
84: X_cascaded_table(n).error_message := used_for_cascaded_rows(i).error_message;
85:
86: IF (g_asn_debug = 'Y') THEN
87: ASN_DEBUG.PUT_LINE('Have hit error condition in validation');
88: ASN_DEBUG.PUT_LINE('Mark needed flags and error message');
89: ASN_DEBUG.PUT_LINE('Delete the cascaded rows');
90: END IF;
91:
84: X_cascaded_table(n).error_message := used_for_cascaded_rows(i).error_message;
85:
86: IF (g_asn_debug = 'Y') THEN
87: ASN_DEBUG.PUT_LINE('Have hit error condition in validation');
88: ASN_DEBUG.PUT_LINE('Mark needed flags and error message');
89: ASN_DEBUG.PUT_LINE('Delete the cascaded rows');
90: END IF;
91:
92: for j in 1..used_for_cascaded_rows.count loop
85:
86: IF (g_asn_debug = 'Y') THEN
87: ASN_DEBUG.PUT_LINE('Have hit error condition in validation');
88: ASN_DEBUG.PUT_LINE('Mark needed flags and error message');
89: ASN_DEBUG.PUT_LINE('Delete the cascaded rows');
90: END IF;
91:
92: for j in 1..used_for_cascaded_rows.count loop
93:
101: end loop;
102:
103: IF X_cascaded_table(n).processing_status_code = 'ERROR' THEN
104:
105: IF (g_asn_debug = 'Y') THEN
106: ASN_DEBUG.PUT_LINE('Have hit error condition in validation');
107: ASN_DEBUG.PUT_LINE('Mark needed flags and error message');
108: ASN_DEBUG.PUT_LINE('Delete the cascaded rows');
109: END IF;
102:
103: IF X_cascaded_table(n).processing_status_code = 'ERROR' THEN
104:
105: IF (g_asn_debug = 'Y') THEN
106: ASN_DEBUG.PUT_LINE('Have hit error condition in validation');
107: ASN_DEBUG.PUT_LINE('Mark needed flags and error message');
108: ASN_DEBUG.PUT_LINE('Delete the cascaded rows');
109: END IF;
110:
103: IF X_cascaded_table(n).processing_status_code = 'ERROR' THEN
104:
105: IF (g_asn_debug = 'Y') THEN
106: ASN_DEBUG.PUT_LINE('Have hit error condition in validation');
107: ASN_DEBUG.PUT_LINE('Mark needed flags and error message');
108: ASN_DEBUG.PUT_LINE('Delete the cascaded rows');
109: END IF;
110:
111: for j in 1..used_for_cascaded_rows.count loop
104:
105: IF (g_asn_debug = 'Y') THEN
106: ASN_DEBUG.PUT_LINE('Have hit error condition in validation');
107: ASN_DEBUG.PUT_LINE('Mark needed flags and error message');
108: ASN_DEBUG.PUT_LINE('Delete the cascaded rows');
109: END IF;
110:
111: for j in 1..used_for_cascaded_rows.count loop
112:
115: end loop;
116:
117: ELSE
118:
119: IF (g_asn_debug = 'Y') THEN
120: ASN_DEBUG.PUT_LINE('Have finished default and validation');
121: ASN_DEBUG.PUT_LINE('Process has encountered no fatal errors');
122: ASN_DEBUG.PUT_LINE('Will write the cascaded rows into actual table');
123: ASN_DEBUG.PUT_LINE('Count of cascaded rows ' || to_char(used_for_cascaded_rows.count));
116:
117: ELSE
118:
119: IF (g_asn_debug = 'Y') THEN
120: ASN_DEBUG.PUT_LINE('Have finished default and validation');
121: ASN_DEBUG.PUT_LINE('Process has encountered no fatal errors');
122: ASN_DEBUG.PUT_LINE('Will write the cascaded rows into actual table');
123: ASN_DEBUG.PUT_LINE('Count of cascaded rows ' || to_char(used_for_cascaded_rows.count));
124: END IF;
117: ELSE
118:
119: IF (g_asn_debug = 'Y') THEN
120: ASN_DEBUG.PUT_LINE('Have finished default and validation');
121: ASN_DEBUG.PUT_LINE('Process has encountered no fatal errors');
122: ASN_DEBUG.PUT_LINE('Will write the cascaded rows into actual table');
123: ASN_DEBUG.PUT_LINE('Count of cascaded rows ' || to_char(used_for_cascaded_rows.count));
124: END IF;
125:
118:
119: IF (g_asn_debug = 'Y') THEN
120: ASN_DEBUG.PUT_LINE('Have finished default and validation');
121: ASN_DEBUG.PUT_LINE('Process has encountered no fatal errors');
122: ASN_DEBUG.PUT_LINE('Will write the cascaded rows into actual table');
123: ASN_DEBUG.PUT_LINE('Count of cascaded rows ' || to_char(used_for_cascaded_rows.count));
124: END IF;
125:
126: for j in 1..used_for_cascaded_rows.count loop
119: IF (g_asn_debug = 'Y') THEN
120: ASN_DEBUG.PUT_LINE('Have finished default and validation');
121: ASN_DEBUG.PUT_LINE('Process has encountered no fatal errors');
122: ASN_DEBUG.PUT_LINE('Will write the cascaded rows into actual table');
123: ASN_DEBUG.PUT_LINE('Count of cascaded rows ' || to_char(used_for_cascaded_rows.count));
124: END IF;
125:
126: for j in 1..used_for_cascaded_rows.count loop
127:
124: END IF;
125:
126: for j in 1..used_for_cascaded_rows.count loop
127:
128: IF (g_asn_debug = 'Y') THEN
129: ASN_DEBUG.PUT_LINE('Current counter in actual table is at ' || to_char(n));
130: END IF;
131: X_cascaded_table(n) := used_for_cascaded_rows(j);
132: used_for_cascaded_rows.delete(j);
125:
126: for j in 1..used_for_cascaded_rows.count loop
127:
128: IF (g_asn_debug = 'Y') THEN
129: ASN_DEBUG.PUT_LINE('Current counter in actual table is at ' || to_char(n));
130: END IF;
131: X_cascaded_table(n) := used_for_cascaded_rows(j);
132: used_for_cascaded_rows.delete(j);
133: n := n + 1;
133: n := n + 1;
134:
135: end loop;
136:
137: IF (g_asn_debug = 'Y') THEN
138: ASN_DEBUG.PUT_LINE('Current counter before decrementing in actual table is at ' || to_char(n));
139: END IF;
140: n := n -1; -- Get the counter in sync
141: IF (g_asn_debug = 'Y') THEN
134:
135: end loop;
136:
137: IF (g_asn_debug = 'Y') THEN
138: ASN_DEBUG.PUT_LINE('Current counter before decrementing in actual table is at ' || to_char(n));
139: END IF;
140: n := n -1; -- Get the counter in sync
141: IF (g_asn_debug = 'Y') THEN
142: ASN_DEBUG.PUT_LINE('Current counter in actual table is at ' || to_char(n));
137: IF (g_asn_debug = 'Y') THEN
138: ASN_DEBUG.PUT_LINE('Current counter before decrementing in actual table is at ' || to_char(n));
139: END IF;
140: n := n -1; -- Get the counter in sync
141: IF (g_asn_debug = 'Y') THEN
142: ASN_DEBUG.PUT_LINE('Current counter in actual table is at ' || to_char(n));
143: END IF;
144:
145: END IF;
138: ASN_DEBUG.PUT_LINE('Current counter before decrementing in actual table is at ' || to_char(n));
139: END IF;
140: n := n -1; -- Get the counter in sync
141: IF (g_asn_debug = 'Y') THEN
142: ASN_DEBUG.PUT_LINE('Current counter in actual table is at ' || to_char(n));
143: END IF;
144:
145: END IF;
146:
149: X_cascaded_table(n).processing_status_code := 'ERROR'; -- changed (i) -> (n)
150: return;
151: end if;
152:
153: IF (g_asn_debug = 'Y') THEN
154: ASN_DEBUG.PUT_LINE('Exit create shipment line');
155: END IF;
156:
157: END create_shipment_line;
150: return;
151: end if;
152:
153: IF (g_asn_debug = 'Y') THEN
154: ASN_DEBUG.PUT_LINE('Exit create shipment line');
155: END IF;
156:
157: END create_shipment_line;
158: