1: PACKAGE BODY rcv_int_org_transfer AS
2: /* $Header: RCVIOTFB.pls 120.6.12000000.3 2007/08/15 19:42:41 vthevark ship $*/
3: g_asn_debug VARCHAR2(1) := NVL(fnd_profile.VALUE('RCV_DEBUG_MODE'), 'N');
4: x_progress VARCHAR2(3);
5: e_validation_error EXCEPTION;
6: PROCEDURE derive_int_org_rcv_line(
7: x_cascaded_table IN OUT NOCOPY rcv_roi_preprocessor.cascaded_trans_tab_type,
11: ) IS
12: BEGIN
13: x_progress := '000';
14:
15: IF (g_asn_debug = 'Y') THEN
16: asn_debug.put_line('enter int_org_rcv line');
17: END IF;
18:
19: -- 1) derive ship to org info
12: BEGIN
13: x_progress := '000';
14:
15: IF (g_asn_debug = 'Y') THEN
16: asn_debug.put_line('enter int_org_rcv line');
17: END IF;
18:
19: -- 1) derive ship to org info
20: rcv_roi_transaction.derive_ship_to_org_info(x_cascaded_table,
22: x_header_record
23: );
24: x_progress := '002';
25:
26: IF (g_asn_debug = 'Y') THEN
27: asn_debug.put_line('x_progress ' || x_progress);
28: END IF;
29:
30: x_progress := '010';
23: );
24: x_progress := '002';
25:
26: IF (g_asn_debug = 'Y') THEN
27: asn_debug.put_line('x_progress ' || x_progress);
28: END IF;
29:
30: x_progress := '010';
31: -- 5) derive item info
40: x_progress := '035';
41: -- 12) derive routing header info
42: rcv_roi_transaction.derive_routing_header_info(x_cascaded_table, n);
43: x_progress := '070';
44: asn_debug.put_line('progress in IOrcv : x_progress = ' || x_progress);
45: -- derive auto transact code
46: rcv_roi_transaction.derive_auto_transact_code(x_cascaded_table, n);
47: asn_debug.put_line('progress in IOrcv : before derive qty');
48: -- quantity > 0
43: x_progress := '070';
44: asn_debug.put_line('progress in IOrcv : x_progress = ' || x_progress);
45: -- derive auto transact code
46: rcv_roi_transaction.derive_auto_transact_code(x_cascaded_table, n);
47: asn_debug.put_line('progress in IOrcv : before derive qty');
48: -- quantity > 0
49: derive_int_org_rcv_line_qty(x_cascaded_table,
50: n,
51: temp_cascaded_table
156: BEGIN
157: --check line quanity > 0
158: x_progress := '097';
159:
160: IF (g_asn_debug = 'Y') THEN
161: asn_debug.put_line('inside line qty calculation of int org rcv');
162: asn_debug.put_line('x_progress ' || x_progress);
163: END IF;
164:
157: --check line quanity > 0
158: x_progress := '097';
159:
160: IF (g_asn_debug = 'Y') THEN
161: asn_debug.put_line('inside line qty calculation of int org rcv');
162: asn_debug.put_line('x_progress ' || x_progress);
163: END IF;
164:
165: IF x_cascaded_table(n).error_status NOT IN('S', 'W') THEN
158: x_progress := '097';
159:
160: IF (g_asn_debug = 'Y') THEN
161: asn_debug.put_line('inside line qty calculation of int org rcv');
162: asn_debug.put_line('x_progress ' || x_progress);
163: END IF;
164:
165: IF x_cascaded_table(n).error_status NOT IN('S', 'W') THEN
166: RETURN;
166: RETURN;
167: END IF;
168:
169: IF x_cascaded_table(n).quantity <= 0 THEN --{
170: IF (g_asn_debug = 'Y') THEN
171: asn_debug.put_line('quantity is <= zero. cascade will fail');
172: END IF;
173:
174: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
167: END IF;
168:
169: IF x_cascaded_table(n).quantity <= 0 THEN --{
170: IF (g_asn_debug = 'Y') THEN
171: asn_debug.put_line('quantity is <= zero. cascade will fail');
172: END IF;
173:
174: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
175: rcv_error_pkg.set_error_message('RCV_ITEM_NO_SHIP_QTY', x_cascaded_table(n).error_message);
178: END IF; --} end qty > 0 check
179:
180: x_progress := '098';
181:
182: IF (g_asn_debug = 'Y') THEN
183: asn_debug.put_line('x_progress ' || x_progress);
184: asn_debug.put_line('the shipment info is = ' || TO_CHAR(x_cascaded_table(n).shipment_header_id) || ' num = ' || x_cascaded_table(n).shipment_num);
185: END IF;
186:
179:
180: x_progress := '098';
181:
182: IF (g_asn_debug = 'Y') THEN
183: asn_debug.put_line('x_progress ' || x_progress);
184: asn_debug.put_line('the shipment info is = ' || TO_CHAR(x_cascaded_table(n).shipment_header_id) || ' num = ' || x_cascaded_table(n).shipment_num);
185: END IF;
186:
187: -- as long as shipment num or shipment header id is specified we can continue
180: x_progress := '098';
181:
182: IF (g_asn_debug = 'Y') THEN
183: asn_debug.put_line('x_progress ' || x_progress);
184: asn_debug.put_line('the shipment info is = ' || TO_CHAR(x_cascaded_table(n).shipment_header_id) || ' num = ' || x_cascaded_table(n).shipment_num);
185: END IF;
186:
187: -- as long as shipment num or shipment header id is specified we can continue
188: IF ( x_cascaded_table(n).shipment_header_id IS NULL
186:
187: -- as long as shipment num or shipment header id is specified we can continue
188: IF ( x_cascaded_table(n).shipment_header_id IS NULL
189: AND x_cascaded_table(n).shipment_num IS NULL) THEN --{
190: IF (g_asn_debug = 'Y') THEN
191: asn_debug.put_line('no shipment num/shipment header specified ');
192: END IF;
193:
194: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
187: -- as long as shipment num or shipment header id is specified we can continue
188: IF ( x_cascaded_table(n).shipment_header_id IS NULL
189: AND x_cascaded_table(n).shipment_num IS NULL) THEN --{
190: IF (g_asn_debug = 'Y') THEN
191: asn_debug.put_line('no shipment num/shipment header specified ');
192: END IF;
193:
194: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
195: rcv_error_pkg.set_error_message('RCV_IOT_NO_SHIP_INFO', x_cascaded_table(n).error_message);
199:
200:
201: -- copy record from main table to temp table
202:
203: IF (g_asn_debug = 'Y') THEN
204: asn_debug.put_line('copy record from main table to temp table');
205: END IF;
206:
207: current_n := 1;
200:
201: -- copy record from main table to temp table
202:
203: IF (g_asn_debug = 'Y') THEN
204: asn_debug.put_line('copy record from main table to temp table');
205: END IF;
206:
207: current_n := 1;
208: temp_cascaded_table(current_n) := x_cascaded_table(n);
209:
210: -- Bugfix 5201151
211: IF ( x_cascaded_table(n).shipment_header_id IS NULL
212: AND x_cascaded_table(n).shipment_num IS NOT NULL) THEN --{
213: IF (g_asn_debug = 'Y') THEN
214: asn_debug.put_line('Shipment header is not provided hence deriving shipment header id for shipment num ' || x_cascaded_table(n).shipment_num );
215: END IF;
216:
217: /* Bug:6313315
210: -- Bugfix 5201151
211: IF ( x_cascaded_table(n).shipment_header_id IS NULL
212: AND x_cascaded_table(n).shipment_num IS NOT NULL) THEN --{
213: IF (g_asn_debug = 'Y') THEN
214: asn_debug.put_line('Shipment header is not provided hence deriving shipment header id for shipment num ' || x_cascaded_table(n).shipment_num );
215: END IF;
216:
217: /* Bug:6313315
218: Added where clause condition rsh.receipt_source_code = 'INVENTORY'.
229: AND rsl.to_organization_id = NVL(temp_cascaded_table(current_n).to_organization_id, to_organization_id)
230: AND rsl.from_organization_id = NVL(temp_cascaded_table(current_n).from_organization_id, from_organization_id)
231: AND rsh.receipt_source_code = 'INVENTORY';--Bug: 6313315
232:
233: IF (g_asn_debug = 'Y') THEN
234: asn_debug.put_line('Shipment header = ' || l_shipment_header_id );
235: END IF;
236:
237: EXCEPTION
230: AND rsl.from_organization_id = NVL(temp_cascaded_table(current_n).from_organization_id, from_organization_id)
231: AND rsh.receipt_source_code = 'INVENTORY';--Bug: 6313315
232:
233: IF (g_asn_debug = 'Y') THEN
234: asn_debug.put_line('Shipment header = ' || l_shipment_header_id );
235: END IF;
236:
237: EXCEPTION
238: WHEN NO_DATA_FOUND
241: rcv_error_pkg.set_error_message('RCV_IOT_NO_SHIP_INFO', x_cascaded_table(n).error_message);
242: rcv_error_pkg.set_token('SHIPMENT_NUM', temp_cascaded_table(current_n).shipment_num);
243: rcv_error_pkg.log_interface_error('SHIPMENT_NUM');
244:
245: IF (g_asn_debug = 'Y') THEN
246: asn_debug.put_line(TO_CHAR(n));
247: asn_debug.put_line('No shipment_header_id found for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
248: asn_debug.put_line('error ' || x_progress);
249: END IF;
242: rcv_error_pkg.set_token('SHIPMENT_NUM', temp_cascaded_table(current_n).shipment_num);
243: rcv_error_pkg.log_interface_error('SHIPMENT_NUM');
244:
245: IF (g_asn_debug = 'Y') THEN
246: asn_debug.put_line(TO_CHAR(n));
247: asn_debug.put_line('No shipment_header_id found for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
248: asn_debug.put_line('error ' || x_progress);
249: END IF;
250: WHEN OTHERS
243: rcv_error_pkg.log_interface_error('SHIPMENT_NUM');
244:
245: IF (g_asn_debug = 'Y') THEN
246: asn_debug.put_line(TO_CHAR(n));
247: asn_debug.put_line('No shipment_header_id found for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
248: asn_debug.put_line('error ' || x_progress);
249: END IF;
250: WHEN OTHERS
251: THEN
244:
245: IF (g_asn_debug = 'Y') THEN
246: asn_debug.put_line(TO_CHAR(n));
247: asn_debug.put_line('No shipment_header_id found for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
248: asn_debug.put_line('error ' || x_progress);
249: END IF;
250: WHEN OTHERS
251: THEN
252: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_unexp_error;
253: rcv_error_pkg.set_sql_error_message('derive_int_org_rcv_line_qty', x_progress);
254: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
255: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
256:
257: IF (g_asn_debug = 'Y') THEN
258: asn_debug.put_line(TO_CHAR(n));
259: asn_debug.put_line('Error while selecting shipment_header_id for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
260: asn_debug.put_line(sqlerrm);
261: asn_debug.put_line('error ' || x_progress);
254: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
255: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
256:
257: IF (g_asn_debug = 'Y') THEN
258: asn_debug.put_line(TO_CHAR(n));
259: asn_debug.put_line('Error while selecting shipment_header_id for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
260: asn_debug.put_line(sqlerrm);
261: asn_debug.put_line('error ' || x_progress);
262: END IF;
255: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
256:
257: IF (g_asn_debug = 'Y') THEN
258: asn_debug.put_line(TO_CHAR(n));
259: asn_debug.put_line('Error while selecting shipment_header_id for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
260: asn_debug.put_line(sqlerrm);
261: asn_debug.put_line('error ' || x_progress);
262: END IF;
263: END;
256:
257: IF (g_asn_debug = 'Y') THEN
258: asn_debug.put_line(TO_CHAR(n));
259: asn_debug.put_line('Error while selecting shipment_header_id for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
260: asn_debug.put_line(sqlerrm);
261: asn_debug.put_line('error ' || x_progress);
262: END IF;
263: END;
264: ELSE
257: IF (g_asn_debug = 'Y') THEN
258: asn_debug.put_line(TO_CHAR(n));
259: asn_debug.put_line('Error while selecting shipment_header_id for shipment_num = ' || temp_cascaded_table(current_n).shipment_num );
260: asn_debug.put_line(sqlerrm);
261: asn_debug.put_line('error ' || x_progress);
262: END IF;
263: END;
264: ELSE
265: l_shipment_header_id := temp_cascaded_table(current_n).shipment_header_id;
266: END IF; -- } deriving shipment_header_id if it NULL from shipment_num
267: -- End of code for Bugfix 5201151
268:
269: -- get all rows which meet this condition
270: IF (g_asn_debug = 'Y') THEN
271: asn_debug.put_line('get all rows which meet this condition');
272: asn_debug.put_line('transaction type = ' || x_cascaded_table(n).transaction_type);
273: asn_debug.put_line('auto transact code = ' || x_cascaded_table(n).auto_transact_code);
274: END IF;
267: -- End of code for Bugfix 5201151
268:
269: -- get all rows which meet this condition
270: IF (g_asn_debug = 'Y') THEN
271: asn_debug.put_line('get all rows which meet this condition');
272: asn_debug.put_line('transaction type = ' || x_cascaded_table(n).transaction_type);
273: asn_debug.put_line('auto transact code = ' || x_cascaded_table(n).auto_transact_code);
274: END IF;
275:
268:
269: -- get all rows which meet this condition
270: IF (g_asn_debug = 'Y') THEN
271: asn_debug.put_line('get all rows which meet this condition');
272: asn_debug.put_line('transaction type = ' || x_cascaded_table(n).transaction_type);
273: asn_debug.put_line('auto transact code = ' || x_cascaded_table(n).auto_transact_code);
274: END IF;
275:
276: --{ open the cursors
269: -- get all rows which meet this condition
270: IF (g_asn_debug = 'Y') THEN
271: asn_debug.put_line('get all rows which meet this condition');
272: asn_debug.put_line('transaction type = ' || x_cascaded_table(n).transaction_type);
273: asn_debug.put_line('auto transact code = ' || x_cascaded_table(n).auto_transact_code);
274: END IF;
275:
276: --{ open the cursors
277: IF (g_asn_debug = 'Y') THEN
273: asn_debug.put_line('auto transact code = ' || x_cascaded_table(n).auto_transact_code);
274: END IF;
275:
276: --{ open the cursors
277: IF (g_asn_debug = 'Y') THEN
278: asn_debug.put_line('open shipment records');
279: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
280: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
281: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
274: END IF;
275:
276: --{ open the cursors
277: IF (g_asn_debug = 'Y') THEN
278: asn_debug.put_line('open shipment records');
279: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
280: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
281: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
282: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
275:
276: --{ open the cursors
277: IF (g_asn_debug = 'Y') THEN
278: asn_debug.put_line('open shipment records');
279: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
280: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
281: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
282: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
283: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
276: --{ open the cursors
277: IF (g_asn_debug = 'Y') THEN
278: asn_debug.put_line('open shipment records');
279: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
280: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
281: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
282: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
283: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
284: asn_debug.put_line('proceed to open cursor');
277: IF (g_asn_debug = 'Y') THEN
278: asn_debug.put_line('open shipment records');
279: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
280: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
281: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
282: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
283: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
284: asn_debug.put_line('proceed to open cursor');
285: END IF;
278: asn_debug.put_line('open shipment records');
279: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
280: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
281: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
282: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
283: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
284: asn_debug.put_line('proceed to open cursor');
285: END IF;
286:
279: asn_debug.put_line('shipment header id ' || TO_CHAR(temp_cascaded_table(current_n).shipment_header_id));
280: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
281: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
282: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
283: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
284: asn_debug.put_line('proceed to open cursor');
285: END IF;
286:
287: OPEN shipments(-- temp_cascaded_table(current_n).shipment_header_id, -- Bugfix 5201151
280: asn_debug.put_line('item id ' || TO_CHAR(temp_cascaded_table(current_n).item_id));
281: asn_debug.put_line('shipment line num ' || TO_CHAR(temp_cascaded_table(current_n).document_line_num));
282: asn_debug.put_line('ship to organization id ' || TO_CHAR(temp_cascaded_table(current_n).to_organization_id));
283: asn_debug.put_line('from org id ' || TO_CHAR(temp_cascaded_table(current_n).from_organization_id));
284: asn_debug.put_line('proceed to open cursor');
285: END IF;
286:
287: OPEN shipments(-- temp_cascaded_table(current_n).shipment_header_id, -- Bugfix 5201151
288: -- temp_cascaded_table(current_n).shipment_num, -- Bugfix 5201151
305:
306: -- }
307:
308: -- assign shipped quantity to remaining quantity
309: IF (g_asn_debug = 'Y') THEN
310: asn_debug.put_line('assign shipped quantity to remaining quantity');
311: asn_debug.put_line('pointer in temp_cascade ' || TO_CHAR(current_n));
312: END IF;
313:
306: -- }
307:
308: -- assign shipped quantity to remaining quantity
309: IF (g_asn_debug = 'Y') THEN
310: asn_debug.put_line('assign shipped quantity to remaining quantity');
311: asn_debug.put_line('pointer in temp_cascade ' || TO_CHAR(current_n));
312: END IF;
313:
314: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
307:
308: -- assign shipped quantity to remaining quantity
309: IF (g_asn_debug = 'Y') THEN
310: asn_debug.put_line('assign shipped quantity to remaining quantity');
311: asn_debug.put_line('pointer in temp_cascade ' || TO_CHAR(current_n));
312: END IF;
313:
314: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
315: x_remaining_qty_po_uom := 0;
313:
314: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
315: x_remaining_qty_po_uom := 0;
316:
317: IF (g_asn_debug = 'Y') THEN
318: asn_debug.put_line('have assigned the quantity');
319: END IF;
320:
321: -- calculate tax_amount_factor for calculating tax_amount for
314: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
315: x_remaining_qty_po_uom := 0;
316:
317: IF (g_asn_debug = 'Y') THEN
318: asn_debug.put_line('have assigned the quantity');
319: END IF;
320:
321: -- calculate tax_amount_factor for calculating tax_amount for
322: -- each cascaded line
326: ELSE
327: tax_amount_factor := 0;
328: END IF;
329:
330: IF (g_asn_debug = 'Y') THEN
331: asn_debug.put_line('tax factor ' || TO_CHAR(tax_amount_factor));
332: asn_debug.put_line('shipped quantity : ' || TO_CHAR(x_remaining_quantity));
333: END IF;
334:
327: tax_amount_factor := 0;
328: END IF;
329:
330: IF (g_asn_debug = 'Y') THEN
331: asn_debug.put_line('tax factor ' || TO_CHAR(tax_amount_factor));
332: asn_debug.put_line('shipped quantity : ' || TO_CHAR(x_remaining_quantity));
333: END IF;
334:
335: x_first_trans := TRUE;
328: END IF;
329:
330: IF (g_asn_debug = 'Y') THEN
331: asn_debug.put_line('tax factor ' || TO_CHAR(tax_amount_factor));
332: asn_debug.put_line('shipped quantity : ' || TO_CHAR(x_remaining_quantity));
333: END IF;
334:
335: x_first_trans := TRUE;
336: transaction_ok := FALSE;
339: */
340: FETCH count_shipments INTO x_countshipmentrec;
341: x_record_count := x_countshipmentrec.line_count;
342:
343: IF (g_asn_debug = 'Y') THEN
344: asn_debug.put_line('before starting cascade');
345: END IF;
346:
347: IF (g_asn_debug = 'Y') THEN
340: FETCH count_shipments INTO x_countshipmentrec;
341: x_record_count := x_countshipmentrec.line_count;
342:
343: IF (g_asn_debug = 'Y') THEN
344: asn_debug.put_line('before starting cascade');
345: END IF;
346:
347: IF (g_asn_debug = 'Y') THEN
348: asn_debug.put_line('record count = ' || x_record_count);
343: IF (g_asn_debug = 'Y') THEN
344: asn_debug.put_line('before starting cascade');
345: END IF;
346:
347: IF (g_asn_debug = 'Y') THEN
348: asn_debug.put_line('record count = ' || x_record_count);
349: END IF;
350:
351: LOOP --{ over the count of shipment records obtained
344: asn_debug.put_line('before starting cascade');
345: END IF;
346:
347: IF (g_asn_debug = 'Y') THEN
348: asn_debug.put_line('record count = ' || x_record_count);
349: END IF;
350:
351: LOOP --{ over the count of shipment records obtained
352: IF (g_asn_debug = 'Y') THEN
348: asn_debug.put_line('record count = ' || x_record_count);
349: END IF;
350:
351: LOOP --{ over the count of shipment records obtained
352: IF (g_asn_debug = 'Y') THEN
353: asn_debug.put_line('remaining quantity asn uom ' || TO_CHAR(x_remaining_quantity));
354: END IF;
355:
356: IF (g_asn_debug = 'Y') THEN
349: END IF;
350:
351: LOOP --{ over the count of shipment records obtained
352: IF (g_asn_debug = 'Y') THEN
353: asn_debug.put_line('remaining quantity asn uom ' || TO_CHAR(x_remaining_quantity));
354: END IF;
355:
356: IF (g_asn_debug = 'Y') THEN
357: asn_debug.put_line('open shipments and fetch');
352: IF (g_asn_debug = 'Y') THEN
353: asn_debug.put_line('remaining quantity asn uom ' || TO_CHAR(x_remaining_quantity));
354: END IF;
355:
356: IF (g_asn_debug = 'Y') THEN
357: asn_debug.put_line('open shipments and fetch');
358: END IF;
359:
360: /*
353: asn_debug.put_line('remaining quantity asn uom ' || TO_CHAR(x_remaining_quantity));
354: END IF;
355:
356: IF (g_asn_debug = 'Y') THEN
357: asn_debug.put_line('open shipments and fetch');
358: END IF;
359:
360: /*
361: ** fetch the cursor
360: /*
361: ** fetch the cursor
362: */
363: --{
364: IF (g_asn_debug = 'Y') THEN
365: asn_debug.put_line('fetching shipments cursor');
366: END IF;
367:
368: FETCH shipments INTO x_shipmentrec;
361: ** fetch the cursor
362: */
363: --{
364: IF (g_asn_debug = 'Y') THEN
365: asn_debug.put_line('fetching shipments cursor');
366: END IF;
367:
368: FETCH shipments INTO x_shipmentrec;
369:
375: END IF;
376:
377: rows_fetched := shipments%ROWCOUNT;
378:
379: IF (g_asn_debug = 'Y') THEN
380: asn_debug.put_line('shipment rows fetched ' || TO_CHAR(rows_fetched));
381: END IF;
382:
383: -- }
376:
377: rows_fetched := shipments%ROWCOUNT;
378:
379: IF (g_asn_debug = 'Y') THEN
380: asn_debug.put_line('shipment rows fetched ' || TO_CHAR(rows_fetched));
381: END IF;
382:
383: -- }
384:
384:
385:
386: IF ( lastrecord
387: OR x_remaining_quantity <= 0) THEN --{
388: IF (g_asn_debug = 'Y') THEN
389: asn_debug.put_line('hit exit condition');
390: END IF;
391:
392: IF NOT x_first_trans THEN
385:
386: IF ( lastrecord
387: OR x_remaining_quantity <= 0) THEN --{
388: IF (g_asn_debug = 'Y') THEN
389: asn_debug.put_line('hit exit condition');
390: END IF;
391:
392: IF NOT x_first_trans THEN
393: -- x_first_trans has been reset which means some cascade has
395: current_n := current_n - 1;
396: END IF;
397:
398: -- do the tolerance act here
399: IF (g_asn_debug = 'Y') THEN
400: asn_debug.put_line('temp table pointer ' || TO_CHAR(current_n));
401: asn_debug.put_line('check which condition has occured');
402: END IF;
403:
396: END IF;
397:
398: -- do the tolerance act here
399: IF (g_asn_debug = 'Y') THEN
400: asn_debug.put_line('temp table pointer ' || TO_CHAR(current_n));
401: asn_debug.put_line('check which condition has occured');
402: END IF;
403:
404: -- lastrecord...we have run out of rows and we still have quantity to allocate
397:
398: -- do the tolerance act here
399: IF (g_asn_debug = 'Y') THEN
400: asn_debug.put_line('temp table pointer ' || TO_CHAR(current_n));
401: asn_debug.put_line('check which condition has occured');
402: END IF;
403:
404: -- lastrecord...we have run out of rows and we still have quantity to allocate
405: IF x_remaining_quantity > 0 THEN --{
402: END IF;
403:
404: -- lastrecord...we have run out of rows and we still have quantity to allocate
405: IF x_remaining_quantity > 0 THEN --{
406: IF (g_asn_debug = 'Y') THEN
407: asn_debug.put_line('There is quantity remaining');
408: asn_debug.put_line('Need to check qty tolerances');
409: END IF;
410:
403:
404: -- lastrecord...we have run out of rows and we still have quantity to allocate
405: IF x_remaining_quantity > 0 THEN --{
406: IF (g_asn_debug = 'Y') THEN
407: asn_debug.put_line('There is quantity remaining');
408: asn_debug.put_line('Need to check qty tolerances');
409: END IF;
410:
411: IF rows_fetched > 0
404: -- lastrecord...we have run out of rows and we still have quantity to allocate
405: IF x_remaining_quantity > 0 THEN --{
406: IF (g_asn_debug = 'Y') THEN
407: asn_debug.put_line('There is quantity remaining');
408: asn_debug.put_line('Need to check qty tolerances');
409: END IF;
410:
411: IF rows_fetched > 0
412: AND NOT x_first_trans THEN --{
409: END IF;
410:
411: IF rows_fetched > 0
412: AND NOT x_first_trans THEN --{
413: IF (g_asn_debug = 'Y') THEN
414: asn_debug.put_line(' in inter org transfer rcv Extra Quantity ' || TO_CHAR(x_remaining_quantity));
415: END IF;
416:
417: IF (g_asn_debug = 'Y') THEN
410:
411: IF rows_fetched > 0
412: AND NOT x_first_trans THEN --{
413: IF (g_asn_debug = 'Y') THEN
414: asn_debug.put_line(' in inter org transfer rcv Extra Quantity ' || TO_CHAR(x_remaining_quantity));
415: END IF;
416:
417: IF (g_asn_debug = 'Y') THEN
418: asn_debug.put_line('delete the temp table ');
413: IF (g_asn_debug = 'Y') THEN
414: asn_debug.put_line(' in inter org transfer rcv Extra Quantity ' || TO_CHAR(x_remaining_quantity));
415: END IF;
416:
417: IF (g_asn_debug = 'Y') THEN
418: asn_debug.put_line('delete the temp table ');
419: END IF;
420:
421: IF temp_cascaded_table.COUNT > 0 THEN
414: asn_debug.put_line(' in inter org transfer rcv Extra Quantity ' || TO_CHAR(x_remaining_quantity));
415: END IF;
416:
417: IF (g_asn_debug = 'Y') THEN
418: asn_debug.put_line('delete the temp table ');
419: END IF;
420:
421: IF temp_cascaded_table.COUNT > 0 THEN
422: FOR i IN 1 .. temp_cascaded_table.COUNT LOOP
423: temp_cascaded_table.DELETE(i);
424: END LOOP;
425: END IF;
426:
427: IF (g_asn_debug = 'Y') THEN
428: asn_debug.put_line('mark the actual table with error status');
429: asn_debug.put_line('Error Status ' || x_cascaded_table(n).error_status);
430: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
431: END IF;
424: END LOOP;
425: END IF;
426:
427: IF (g_asn_debug = 'Y') THEN
428: asn_debug.put_line('mark the actual table with error status');
429: asn_debug.put_line('Error Status ' || x_cascaded_table(n).error_status);
430: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
431: END IF;
432:
425: END IF;
426:
427: IF (g_asn_debug = 'Y') THEN
428: asn_debug.put_line('mark the actual table with error status');
429: asn_debug.put_line('Error Status ' || x_cascaded_table(n).error_status);
430: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
431: END IF;
432:
433: IF (g_asn_debug = 'Y') THEN
426:
427: IF (g_asn_debug = 'Y') THEN
428: asn_debug.put_line('mark the actual table with error status');
429: asn_debug.put_line('Error Status ' || x_cascaded_table(n).error_status);
430: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
431: END IF;
432:
433: IF (g_asn_debug = 'Y') THEN
434: asn_debug.put_line('Need to insert a row into po_interface_errors for transfer');
429: asn_debug.put_line('Error Status ' || x_cascaded_table(n).error_status);
430: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
431: END IF;
432:
433: IF (g_asn_debug = 'Y') THEN
434: asn_debug.put_line('Need to insert a row into po_interface_errors for transfer');
435: END IF;
436:
437: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
430: asn_debug.put_line('Error message ' || x_cascaded_table(n).error_message);
431: END IF;
432:
433: IF (g_asn_debug = 'Y') THEN
434: asn_debug.put_line('Need to insert a row into po_interface_errors for transfer');
435: END IF;
436:
437: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
438: rcv_error_pkg.set_error_message('RCV_SHIP_QTY_OVER_TOLERANCE', x_cascaded_table(n).error_message);
440: rcv_error_pkg.set_token('QTY_B', x_cascaded_table(n).quantity - x_remaining_quantity);
441: rcv_error_pkg.log_interface_error('QUANTITY');
442: ELSE --}{ else for rows fetched = 0 OR x_first_trans = true
443: IF rows_fetched = 0 THEN
444: IF (g_asn_debug = 'Y') THEN
445: asn_debug.put_line('No rows were retrieved from cursor.');
446: END IF;
447: ELSIF x_first_trans THEN
448: IF (g_asn_debug = 'Y') THEN
441: rcv_error_pkg.log_interface_error('QUANTITY');
442: ELSE --}{ else for rows fetched = 0 OR x_first_trans = true
443: IF rows_fetched = 0 THEN
444: IF (g_asn_debug = 'Y') THEN
445: asn_debug.put_line('No rows were retrieved from cursor.');
446: END IF;
447: ELSIF x_first_trans THEN
448: IF (g_asn_debug = 'Y') THEN
449: asn_debug.put_line('No rows were cascaded');
444: IF (g_asn_debug = 'Y') THEN
445: asn_debug.put_line('No rows were retrieved from cursor.');
446: END IF;
447: ELSIF x_first_trans THEN
448: IF (g_asn_debug = 'Y') THEN
449: asn_debug.put_line('No rows were cascaded');
450: END IF;
451: END IF;
452:
445: asn_debug.put_line('No rows were retrieved from cursor.');
446: END IF;
447: ELSIF x_first_trans THEN
448: IF (g_asn_debug = 'Y') THEN
449: asn_debug.put_line('No rows were cascaded');
450: END IF;
451: END IF;
452:
453: -- 1) should we check to see why no rows were fetched ??
469: -- all the rows in the temp cascaded table
470: -- will be deleted
471: -- as we cannot over/under receive against a inter-org transfer receive
472: ELSE -- }{
473: IF (g_asn_debug = 'Y') THEN
474: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
475: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
476: END IF;
477: END IF; --} ends the check for whether last record has been reached
470: -- will be deleted
471: -- as we cannot over/under receive against a inter-org transfer receive
472: ELSE -- }{
473: IF (g_asn_debug = 'Y') THEN
474: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
475: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
476: END IF;
477: END IF; --} ends the check for whether last record has been reached
478:
471: -- as we cannot over/under receive against a inter-org transfer receive
472: ELSE -- }{
473: IF (g_asn_debug = 'Y') THEN
474: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
475: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
476: END IF;
477: END IF; --} ends the check for whether last record has been reached
478:
479: -- close cursors
477: END IF; --} ends the check for whether last record has been reached
478:
479: -- close cursors
480:
481: IF (g_asn_debug = 'Y') THEN
482: asn_debug.put_line('close cursors shipments, count_shipments');
483: END IF;
484:
485: IF shipments%ISOPEN THEN
478:
479: -- close cursors
480:
481: IF (g_asn_debug = 'Y') THEN
482: asn_debug.put_line('close cursors shipments, count_shipments');
483: END IF;
484:
485: IF shipments%ISOPEN THEN
486: CLOSE shipments;
494: END IF; --} matches lastrecord or x_remaining_quantity <= 0
495:
496: -- eliminate the row if it fails the date check
497:
498: IF (g_asn_debug = 'Y') THEN
499: asn_debug.put_line('count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
500: asn_debug.put_line('cursor record ' || TO_CHAR(rows_fetched));
501: asn_debug.put_line('int org rcv : calling get available qty');
502: END IF;
495:
496: -- eliminate the row if it fails the date check
497:
498: IF (g_asn_debug = 'Y') THEN
499: asn_debug.put_line('count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
500: asn_debug.put_line('cursor record ' || TO_CHAR(rows_fetched));
501: asn_debug.put_line('int org rcv : calling get available qty');
502: END IF;
503:
496: -- eliminate the row if it fails the date check
497:
498: IF (g_asn_debug = 'Y') THEN
499: asn_debug.put_line('count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
500: asn_debug.put_line('cursor record ' || TO_CHAR(rows_fetched));
501: asn_debug.put_line('int org rcv : calling get available qty');
502: END IF;
503:
504: -- removed rcv_transactions_interface_sv.check_date_tolerance;
497:
498: IF (g_asn_debug = 'Y') THEN
499: asn_debug.put_line('count in temp_cascade_table : ' || TO_CHAR(temp_cascaded_table.COUNT));
500: asn_debug.put_line('cursor record ' || TO_CHAR(rows_fetched));
501: asn_debug.put_line('int org rcv : calling get available qty');
502: END IF;
503:
504: -- removed rcv_transactions_interface_sv.check_date_tolerance;
505: -- removed check shipto_location enforcement
523: ** that is available for allocation by this interface transaction
524: ** the available qty can only be found from rsl
525: ** the else condition should never arise : confirm from priya ??
526: */
527: IF (g_asn_debug = 'Y') THEN
528: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
529: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
530: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
531: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
524: ** the available qty can only be found from rsl
525: ** the else condition should never arise : confirm from priya ??
526: */
527: IF (g_asn_debug = 'Y') THEN
528: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
529: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
530: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
531: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
532: asn_debug.put_line('receipt source code' || x_cascaded_table(n).receipt_source_code);
525: ** the else condition should never arise : confirm from priya ??
526: */
527: IF (g_asn_debug = 'Y') THEN
528: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
529: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
530: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
531: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
532: asn_debug.put_line('receipt source code' || x_cascaded_table(n).receipt_source_code);
533: END IF;
526: */
527: IF (g_asn_debug = 'Y') THEN
528: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
529: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
530: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
531: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
532: asn_debug.put_line('receipt source code' || x_cascaded_table(n).receipt_source_code);
533: END IF;
534:
527: IF (g_asn_debug = 'Y') THEN
528: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
529: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
530: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
531: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
532: asn_debug.put_line('receipt source code' || x_cascaded_table(n).receipt_source_code);
533: END IF;
534:
535: IF ( x_cascaded_table(n).transaction_type = 'RECEIVE'
528: asn_debug.put_line('shipment line id : ' || TO_CHAR(x_shipmentrec.shipment_line_id));
529: asn_debug.put_line('uom ' || x_shipmentrec.unit_of_measure);
530: asn_debug.put_line('converted trx qty : ' || TO_CHAR(x_converted_trx_qty));
531: asn_debug.put_line('tolerable qty : ' || TO_CHAR(x_tolerable_qty));
532: asn_debug.put_line('receipt source code' || x_cascaded_table(n).receipt_source_code);
533: END IF;
534:
535: IF ( x_cascaded_table(n).transaction_type = 'RECEIVE'
536: AND NVL(x_cascaded_table(n).auto_transact_code, 'RECEIVE') IN('RECEIVE', 'DELIVER')) THEN --{
566: END LOOP;
567: END IF;
568: END IF; --}
569:
570: IF (g_asn_debug = 'Y') THEN
571: asn_debug.put_line('after call to get_available quantity');
572: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
573: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
574: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
567: END IF;
568: END IF; --}
569:
570: IF (g_asn_debug = 'Y') THEN
571: asn_debug.put_line('after call to get_available quantity');
572: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
573: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
574: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
575: asn_debug.put_line(' Already allocated qty now in terms of shipment rec uom is ' || already_allocated_qty);
568: END IF; --}
569:
570: IF (g_asn_debug = 'Y') THEN
571: asn_debug.put_line('after call to get_available quantity');
572: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
573: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
574: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
575: asn_debug.put_line(' Already allocated qty now in terms of shipment rec uom is ' || already_allocated_qty);
576: END IF;
569:
570: IF (g_asn_debug = 'Y') THEN
571: asn_debug.put_line('after call to get_available quantity');
572: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
573: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
574: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
575: asn_debug.put_line(' Already allocated qty now in terms of shipment rec uom is ' || already_allocated_qty);
576: END IF;
577:
570: IF (g_asn_debug = 'Y') THEN
571: asn_debug.put_line('after call to get_available quantity');
572: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
573: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
574: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
575: asn_debug.put_line(' Already allocated qty now in terms of shipment rec uom is ' || already_allocated_qty);
576: END IF;
577:
578: -- if qty has already been allocated then reduce available and tolerable
571: asn_debug.put_line('after call to get_available quantity');
572: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
573: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
574: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
575: asn_debug.put_line(' Already allocated qty now in terms of shipment rec uom is ' || already_allocated_qty);
576: END IF;
577:
578: -- if qty has already been allocated then reduce available and tolerable
579: -- qty by the allocated amount
589: IF x_tolerable_qty < 0 THEN
590: x_tolerable_qty := 0;
591: END IF;
592:
593: IF (g_asn_debug = 'Y') THEN
594: asn_debug.put_line('have some allocated quantity. will reduce qty');
595: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
596: asn_debug.put_line('after reducing by allocated qty');
597: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
590: x_tolerable_qty := 0;
591: END IF;
592:
593: IF (g_asn_debug = 'Y') THEN
594: asn_debug.put_line('have some allocated quantity. will reduce qty');
595: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
596: asn_debug.put_line('after reducing by allocated qty');
597: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
598: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
591: END IF;
592:
593: IF (g_asn_debug = 'Y') THEN
594: asn_debug.put_line('have some allocated quantity. will reduce qty');
595: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
596: asn_debug.put_line('after reducing by allocated qty');
597: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
598: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
599: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
592:
593: IF (g_asn_debug = 'Y') THEN
594: asn_debug.put_line('have some allocated quantity. will reduce qty');
595: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
596: asn_debug.put_line('after reducing by allocated qty');
597: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
598: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
599: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
600: END IF;
593: IF (g_asn_debug = 'Y') THEN
594: asn_debug.put_line('have some allocated quantity. will reduce qty');
595: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
596: asn_debug.put_line('after reducing by allocated qty');
597: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
598: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
599: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
600: END IF;
601: END IF; --}
594: asn_debug.put_line('have some allocated quantity. will reduce qty');
595: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
596: asn_debug.put_line('after reducing by allocated qty');
597: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
598: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
599: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
600: END IF;
601: END IF; --}
602:
595: asn_debug.put_line('allocated qty ' || TO_CHAR(already_allocated_qty));
596: asn_debug.put_line('after reducing by allocated qty');
597: asn_debug.put_line('available quantity ' || TO_CHAR(x_converted_trx_qty));
598: asn_debug.put_line('tolerable quantity ' || TO_CHAR(x_tolerable_qty));
599: asn_debug.put_line('pointer to temp table ' || TO_CHAR(current_n));
600: END IF;
601: END IF; --}
602:
603: -- we can use the first record since the item_id and uom are not going to change
613: x_shipmentrec.unit_of_measure
614: );
615:
616: IF x_remaining_qty_rsl_uom = 0 THEN --{ -- no point continuing
617: IF (g_asn_debug = 'Y') THEN
618: asn_debug.put_line('need an error message in the interface tables');
619: asn_debug.put_line('cannot interconvert between diff uoms');
620: END IF;
621: ELSE -- we have converted the qty between uoms succesfully } {
614: );
615:
616: IF x_remaining_qty_rsl_uom = 0 THEN --{ -- no point continuing
617: IF (g_asn_debug = 'Y') THEN
618: asn_debug.put_line('need an error message in the interface tables');
619: asn_debug.put_line('cannot interconvert between diff uoms');
620: END IF;
621: ELSE -- we have converted the qty between uoms succesfully } {
622: IF (g_asn_debug = 'Y') THEN
615:
616: IF x_remaining_qty_rsl_uom = 0 THEN --{ -- no point continuing
617: IF (g_asn_debug = 'Y') THEN
618: asn_debug.put_line('need an error message in the interface tables');
619: asn_debug.put_line('cannot interconvert between diff uoms');
620: END IF;
621: ELSE -- we have converted the qty between uoms succesfully } {
622: IF (g_asn_debug = 'Y') THEN
623: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
618: asn_debug.put_line('need an error message in the interface tables');
619: asn_debug.put_line('cannot interconvert between diff uoms');
620: END IF;
621: ELSE -- we have converted the qty between uoms succesfully } {
622: IF (g_asn_debug = 'Y') THEN
623: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
624: asn_debug.put_line('current asn quantity ' || TO_CHAR(x_remaining_quantity));
625: asn_debug.put_line('current asn uom ' || temp_cascaded_table(1).unit_of_measure);
626: asn_debug.put_line('converted rsl uom quantity ' || TO_CHAR(x_remaining_qty_rsl_uom));
619: asn_debug.put_line('cannot interconvert between diff uoms');
620: END IF;
621: ELSE -- we have converted the qty between uoms succesfully } {
622: IF (g_asn_debug = 'Y') THEN
623: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
624: asn_debug.put_line('current asn quantity ' || TO_CHAR(x_remaining_quantity));
625: asn_debug.put_line('current asn uom ' || temp_cascaded_table(1).unit_of_measure);
626: asn_debug.put_line('converted rsl uom quantity ' || TO_CHAR(x_remaining_qty_rsl_uom));
627: END IF;
620: END IF;
621: ELSE -- we have converted the qty between uoms succesfully } {
622: IF (g_asn_debug = 'Y') THEN
623: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
624: asn_debug.put_line('current asn quantity ' || TO_CHAR(x_remaining_quantity));
625: asn_debug.put_line('current asn uom ' || temp_cascaded_table(1).unit_of_measure);
626: asn_debug.put_line('converted rsl uom quantity ' || TO_CHAR(x_remaining_qty_rsl_uom));
627: END IF;
628:
621: ELSE -- we have converted the qty between uoms succesfully } {
622: IF (g_asn_debug = 'Y') THEN
623: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
624: asn_debug.put_line('current asn quantity ' || TO_CHAR(x_remaining_quantity));
625: asn_debug.put_line('current asn uom ' || temp_cascaded_table(1).unit_of_measure);
626: asn_debug.put_line('converted rsl uom quantity ' || TO_CHAR(x_remaining_qty_rsl_uom));
627: END IF;
628:
629: IF x_converted_trx_qty > 0 THEN --{
622: IF (g_asn_debug = 'Y') THEN
623: asn_debug.put_line('current item id ' || TO_CHAR(temp_cascaded_table(1).item_id));
624: asn_debug.put_line('current asn quantity ' || TO_CHAR(x_remaining_quantity));
625: asn_debug.put_line('current asn uom ' || temp_cascaded_table(1).unit_of_measure);
626: asn_debug.put_line('converted rsl uom quantity ' || TO_CHAR(x_remaining_qty_rsl_uom));
627: END IF;
628:
629: IF x_converted_trx_qty > 0 THEN --{
630: IF (x_converted_trx_qty < x_remaining_qty_rsl_uom) THEN -- compare like uoms {
627: END IF;
628:
629: IF x_converted_trx_qty > 0 THEN --{
630: IF (x_converted_trx_qty < x_remaining_qty_rsl_uom) THEN -- compare like uoms {
631: IF (g_asn_debug = 'Y') THEN
632: asn_debug.put_line('total qty available to be received is less than remaining qty');
633: END IF;
634:
635: x_remaining_qty_rsl_uom := x_remaining_qty_rsl_uom - x_converted_trx_qty;
628:
629: IF x_converted_trx_qty > 0 THEN --{
630: IF (x_converted_trx_qty < x_remaining_qty_rsl_uom) THEN -- compare like uoms {
631: IF (g_asn_debug = 'Y') THEN
632: asn_debug.put_line('total qty available to be received is less than remaining qty');
633: END IF;
634:
635: x_remaining_qty_rsl_uom := x_remaining_qty_rsl_uom - x_converted_trx_qty;
636: -- change rsl uom qty to uom of first line in cascaded table so both qtys are in sync
640: temp_cascaded_table(1).unit_of_measure
641: );
642: insert_into_table := TRUE;
643: ELSE --} {
644: IF (g_asn_debug = 'Y') THEN
645: asn_debug.put_line('total qty available to be received is > remaining qty ');
646: END IF;
647:
648: x_converted_trx_qty := x_remaining_qty_rsl_uom;
641: );
642: insert_into_table := TRUE;
643: ELSE --} {
644: IF (g_asn_debug = 'Y') THEN
645: asn_debug.put_line('total qty available to be received is > remaining qty ');
646: END IF;
647:
648: x_converted_trx_qty := x_remaining_qty_rsl_uom;
649: insert_into_table := TRUE;
652: END IF; --}
653: ELSE -- no qty for this record but if last row we need it } {
654: IF rows_fetched = x_record_count THEN --{ last row needs to be inserted anyway
655: -- so that the row can be used based on qty tolerance checks
656: IF (g_asn_debug = 'Y') THEN
657: asn_debug.put_line('quantity is less then 0 but last record');
658: END IF;
659:
660: insert_into_table := TRUE;
653: ELSE -- no qty for this record but if last row we need it } {
654: IF rows_fetched = x_record_count THEN --{ last row needs to be inserted anyway
655: -- so that the row can be used based on qty tolerance checks
656: IF (g_asn_debug = 'Y') THEN
657: asn_debug.put_line('quantity is less then 0 but last record');
658: END IF;
659:
660: insert_into_table := TRUE;
661: x_converted_trx_qty := 0;
659:
660: insert_into_table := TRUE;
661: x_converted_trx_qty := 0;
662: ELSE --} {
663: IF (g_asn_debug = 'Y') THEN
664: asn_debug.put_line('<= 0 quantity but more records in cursor');
665: END IF;
666:
667: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
660: insert_into_table := TRUE;
661: x_converted_trx_qty := 0;
662: ELSE --} {
663: IF (g_asn_debug = 'Y') THEN
664: asn_debug.put_line('<= 0 quantity but more records in cursor');
665: END IF;
666:
667: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
668:
665: END IF;
666:
667: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
668:
669: IF (g_asn_debug = 'Y') THEN
670: asn_debug.put_line('we have to deal with remaining_qty > 0 and x_converted_trx_qty -ve');
671: END IF;
672:
673: insert_into_table := FALSE;
666:
667: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
668:
669: IF (g_asn_debug = 'Y') THEN
670: asn_debug.put_line('we have to deal with remaining_qty > 0 and x_converted_trx_qty -ve');
671: END IF;
672:
673: insert_into_table := FALSE;
674: END IF; --}
676: END IF; --} remaining_qty_po_uom <> 0
677:
678: IF insert_into_table THEN --{
679: IF (x_first_trans) THEN --{
680: IF (g_asn_debug = 'Y') THEN
681: asn_debug.put_line('first time ' || TO_CHAR(current_n));
682: END IF;
683:
684: x_first_trans := FALSE;
677:
678: IF insert_into_table THEN --{
679: IF (x_first_trans) THEN --{
680: IF (g_asn_debug = 'Y') THEN
681: asn_debug.put_line('first time ' || TO_CHAR(current_n));
682: END IF;
683:
684: x_first_trans := FALSE;
685: ELSE --} { not x_first_trans
682: END IF;
683:
684: x_first_trans := FALSE;
685: ELSE --} { not x_first_trans
686: IF (g_asn_debug = 'Y') THEN
687: asn_debug.put_line('next time ' || TO_CHAR(current_n));
688: END IF;
689:
690: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
683:
684: x_first_trans := FALSE;
685: ELSE --} { not x_first_trans
686: IF (g_asn_debug = 'Y') THEN
687: asn_debug.put_line('next time ' || TO_CHAR(current_n));
688: END IF;
689:
690: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
691: END IF; --} matches x_first_transfer
704: ELSE
705: temp_cascaded_table(current_n).quantity := x_converted_trx_qty;
706: END IF;
707:
708: IF (g_asn_debug = 'Y') THEN
709: asn_debug.put_line('Transaction qty in terms of the transaction uom is ' || temp_cascaded_table(current_n).quantity);
710: END IF;
711:
712: -- primary qty in primary uom
705: temp_cascaded_table(current_n).quantity := x_converted_trx_qty;
706: END IF;
707:
708: IF (g_asn_debug = 'Y') THEN
709: asn_debug.put_line('Transaction qty in terms of the transaction uom is ' || temp_cascaded_table(current_n).quantity);
710: END IF;
711:
712: -- primary qty in primary uom
713: IF (temp_cascaded_table(current_n).primary_unit_of_measure <> x_shipmentrec.unit_of_measure) THEN
718: );
719: ELSE
720: temp_cascaded_table(current_n).primary_quantity := x_converted_trx_qty;
721:
722: IF (g_asn_debug = 'Y') THEN
723: asn_debug.put_line('Transaction qty in terms of the primary uom is ' || temp_cascaded_table(current_n).primary_quantity);
724: END IF;
725:
726: temp_cascaded_table(current_n).inspection_status_code := 'NOT INSPECTED';
719: ELSE
720: temp_cascaded_table(current_n).primary_quantity := x_converted_trx_qty;
721:
722: IF (g_asn_debug = 'Y') THEN
723: asn_debug.put_line('Transaction qty in terms of the primary uom is ' || temp_cascaded_table(current_n).primary_quantity);
724: END IF;
725:
726: temp_cascaded_table(current_n).inspection_status_code := 'NOT INSPECTED';
727: temp_cascaded_table(current_n).interface_source_code := 'RCV';
727: temp_cascaded_table(current_n).interface_source_code := 'RCV';
728: -- temp_cascaded_table(current_n).currency_code := x_shipmentrec.currency_code;
729: temp_cascaded_table(current_n).tax_amount := ROUND(temp_cascaded_table(current_n).quantity * tax_amount_factor, 4);
730:
731: IF (g_asn_debug = 'Y') THEN
732: asn_debug.put_line('current tax amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
733: END IF;
734:
735: -- confirm the data in rsh and rsl for the provided info
728: -- temp_cascaded_table(current_n).currency_code := x_shipmentrec.currency_code;
729: temp_cascaded_table(current_n).tax_amount := ROUND(temp_cascaded_table(current_n).quantity * tax_amount_factor, 4);
730:
731: IF (g_asn_debug = 'Y') THEN
732: asn_debug.put_line('current tax amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
733: END IF;
734:
735: -- confirm the data in rsh and rsl for the provided info
736: IF (g_asn_debug = 'Y') THEN
732: asn_debug.put_line('current tax amount ' || TO_CHAR(temp_cascaded_table(current_n).tax_amount));
733: END IF;
734:
735: -- confirm the data in rsh and rsl for the provided info
736: IF (g_asn_debug = 'Y') THEN
737: asn_debug.put_line( 'rsl : cat '
738: || x_shipmentrec.category_id
739: || ' item desc '
740: || x_shipmentrec.item_description
733: END IF;
734:
735: -- confirm the data in rsh and rsl for the provided info
736: IF (g_asn_debug = 'Y') THEN
737: asn_debug.put_line( 'rsl : cat '
738: || x_shipmentrec.category_id
739: || ' item desc '
740: || x_shipmentrec.item_description
741: || ' header '
801: EXCEPTION
802: WHEN NO_DATA_FOUND THEN
803: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
804:
805: IF (g_asn_debug = 'Y') THEN
806: asn_debug.put_line('the deliver to person entered in po is currently inactive');
807: asn_debug.put_line(' so it is cleared off');
808: END IF;
809: WHEN OTHERS THEN
802: WHEN NO_DATA_FOUND THEN
803: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
804:
805: IF (g_asn_debug = 'Y') THEN
806: asn_debug.put_line('the deliver to person entered in po is currently inactive');
807: asn_debug.put_line(' so it is cleared off');
808: END IF;
809: WHEN OTHERS THEN
810: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
803: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
804:
805: IF (g_asn_debug = 'Y') THEN
806: asn_debug.put_line('the deliver to person entered in po is currently inactive');
807: asn_debug.put_line(' so it is cleared off');
808: END IF;
809: WHEN OTHERS THEN
810: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
811:
808: END IF;
809: WHEN OTHERS THEN
810: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
811:
812: IF (g_asn_debug = 'Y') THEN
813: asn_debug.put_line('some exception has occured');
814: asn_debug.put_line('this exception is due to the po deliver to person');
815: asn_debug.put_line('the deliver to person is optional');
816: asn_debug.put_line('so cleared off the deliver to person');
809: WHEN OTHERS THEN
810: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
811:
812: IF (g_asn_debug = 'Y') THEN
813: asn_debug.put_line('some exception has occured');
814: asn_debug.put_line('this exception is due to the po deliver to person');
815: asn_debug.put_line('the deliver to person is optional');
816: asn_debug.put_line('so cleared off the deliver to person');
817: END IF;
810: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
811:
812: IF (g_asn_debug = 'Y') THEN
813: asn_debug.put_line('some exception has occured');
814: asn_debug.put_line('this exception is due to the po deliver to person');
815: asn_debug.put_line('the deliver to person is optional');
816: asn_debug.put_line('so cleared off the deliver to person');
817: END IF;
818: END;
811:
812: IF (g_asn_debug = 'Y') THEN
813: asn_debug.put_line('some exception has occured');
814: asn_debug.put_line('this exception is due to the po deliver to person');
815: asn_debug.put_line('the deliver to person is optional');
816: asn_debug.put_line('so cleared off the deliver to person');
817: END IF;
818: END;
819: END IF; --}
812: IF (g_asn_debug = 'Y') THEN
813: asn_debug.put_line('some exception has occured');
814: asn_debug.put_line('this exception is due to the po deliver to person');
815: asn_debug.put_line('the deliver to person is optional');
816: asn_debug.put_line('so cleared off the deliver to person');
817: END IF;
818: END;
819: END IF; --}
820: END IF; --}
830: END IF; --} matches txn not deliver
831:
832: current_n := current_n + 1;
833:
834: IF (g_asn_debug = 'Y') THEN
835: asn_debug.put_line('increment pointer by 1 ' || TO_CHAR(current_n));
836: END IF;
837: END IF; --} matches if insert into table
838: END IF; --} matches shipmentdistributionrec.receipt_days_exception_code = none
831:
832: current_n := current_n + 1;
833:
834: IF (g_asn_debug = 'Y') THEN
835: asn_debug.put_line('increment pointer by 1 ' || TO_CHAR(current_n));
836: END IF;
837: END IF; --} matches if insert into table
838: END IF; --} matches shipmentdistributionrec.receipt_days_exception_code = none
839: END LOOP; --}
845: IF count_shipments%ISOPEN THEN
846: CLOSE count_shipments;
847: END IF;
848:
849: IF (g_asn_debug = 'Y') THEN
850: asn_debug.put_line('exit derive_int_org_rcv_line_qty');
851: END IF;
852: EXCEPTION
853: WHEN rcv_error_pkg.e_fatal_error THEN
846: CLOSE count_shipments;
847: END IF;
848:
849: IF (g_asn_debug = 'Y') THEN
850: asn_debug.put_line('exit derive_int_org_rcv_line_qty');
851: END IF;
852: EXCEPTION
853: WHEN rcv_error_pkg.e_fatal_error THEN
854: IF shipments%ISOPEN THEN
871: rcv_error_pkg.set_sql_error_message('derive_int_org_rcv_line_qty', x_progress);
872: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
873: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
874:
875: IF (g_asn_debug = 'Y') THEN
876: asn_debug.put_line(TO_CHAR(n));
877: asn_debug.put_line(SQLERRM);
878: asn_debug.put_line('error ' || x_progress);
879: END IF;
872: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
873: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
874:
875: IF (g_asn_debug = 'Y') THEN
876: asn_debug.put_line(TO_CHAR(n));
877: asn_debug.put_line(SQLERRM);
878: asn_debug.put_line('error ' || x_progress);
879: END IF;
880: END derive_int_org_rcv_line_qty;
873: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
874:
875: IF (g_asn_debug = 'Y') THEN
876: asn_debug.put_line(TO_CHAR(n));
877: asn_debug.put_line(SQLERRM);
878: asn_debug.put_line('error ' || x_progress);
879: END IF;
880: END derive_int_org_rcv_line_qty;
881:
874:
875: IF (g_asn_debug = 'Y') THEN
876: asn_debug.put_line(TO_CHAR(n));
877: asn_debug.put_line(SQLERRM);
878: asn_debug.put_line('error ' || x_progress);
879: END IF;
880: END derive_int_org_rcv_line_qty;
881:
882: PROCEDURE default_int_org_rcv_line(
935: x_cascaded_table(n).auto_transact_code := p_trx_record.auto_transact_code;
936: x_cascaded_table(n).destination_context := x_cascaded_table(n).destination_type_code;
937:
938: --open the cursor
939: IF (g_asn_debug = 'Y') THEN
940: asn_debug.put_line('default_int_org_rcv : defaulting called with shipment_header = ' || x_cascaded_table(n).shipment_header_id || ' and shipment_line = ' || x_cascaded_table(n).shipment_line_id);
941: END IF;
942:
943: OPEN shipments(x_cascaded_table(n).shipment_header_id, x_cascaded_table(n).shipment_line_id);
936: x_cascaded_table(n).destination_context := x_cascaded_table(n).destination_type_code;
937:
938: --open the cursor
939: IF (g_asn_debug = 'Y') THEN
940: asn_debug.put_line('default_int_org_rcv : defaulting called with shipment_header = ' || x_cascaded_table(n).shipment_header_id || ' and shipment_line = ' || x_cascaded_table(n).shipment_line_id);
941: END IF;
942:
943: OPEN shipments(x_cascaded_table(n).shipment_header_id, x_cascaded_table(n).shipment_line_id);
944:
982: -- if receive transaction
983: -- location has to be entered and the location_id is always = ship_to_location_id : cannot be defaulted
984: -- deliver to location id and deliver to person id do not have to be defaulted
985:
986: IF (g_asn_debug = 'Y') THEN
987: asn_debug.put_line('should have defaulted the location id to the ship to location id');
988: asn_debug.put_line('ship_to_loc ' || x_cascaded_table(n).ship_to_location_id || ' loc ' || NVL(x_cascaded_table(n).location_id, -1) || ' txn ' || x_cascaded_table(n).transaction_type || ' txn code ' || x_cascaded_table(n).auto_transact_code);
989: END IF;
990:
983: -- location has to be entered and the location_id is always = ship_to_location_id : cannot be defaulted
984: -- deliver to location id and deliver to person id do not have to be defaulted
985:
986: IF (g_asn_debug = 'Y') THEN
987: asn_debug.put_line('should have defaulted the location id to the ship to location id');
988: asn_debug.put_line('ship_to_loc ' || x_cascaded_table(n).ship_to_location_id || ' loc ' || NVL(x_cascaded_table(n).location_id, -1) || ' txn ' || x_cascaded_table(n).transaction_type || ' txn code ' || x_cascaded_table(n).auto_transact_code);
989: END IF;
990:
991: IF ( x_cascaded_table(n).transaction_type = 'RECEIVE'
984: -- deliver to location id and deliver to person id do not have to be defaulted
985:
986: IF (g_asn_debug = 'Y') THEN
987: asn_debug.put_line('should have defaulted the location id to the ship to location id');
988: asn_debug.put_line('ship_to_loc ' || x_cascaded_table(n).ship_to_location_id || ' loc ' || NVL(x_cascaded_table(n).location_id, -1) || ' txn ' || x_cascaded_table(n).transaction_type || ' txn code ' || x_cascaded_table(n).auto_transact_code);
989: END IF;
990:
991: IF ( x_cascaded_table(n).transaction_type = 'RECEIVE'
992: AND x_cascaded_table(n).auto_transact_code = 'RECEIVE') THEN --{
1030: IF (x_cascaded_table(n).source_document_code IS NULL) THEN
1031: x_cascaded_table(n).source_document_code := 'INVENTORY';
1032: END IF;
1033:
1034: IF (g_asn_debug = 'Y') THEN
1035: asn_debug.put_line('Exit default_int_org_rcv_line');
1036: END IF;
1037:
1038: IF shipments%ISOPEN THEN
1031: x_cascaded_table(n).source_document_code := 'INVENTORY';
1032: END IF;
1033:
1034: IF (g_asn_debug = 'Y') THEN
1035: asn_debug.put_line('Exit default_int_org_rcv_line');
1036: END IF;
1037:
1038: IF shipments%ISOPEN THEN
1039: CLOSE shipments;
1048: n IN BINARY_INTEGER,
1049: x_header_record IN rcv_roi_preprocessor.header_rec_type
1050: ) IS
1051: BEGIN
1052: IF (g_asn_debug = 'Y') THEN
1053: asn_debug.put_line('Enter validate_int_org_rcv_line');
1054: END IF;
1055:
1056: x_progress := '000';
1049: x_header_record IN rcv_roi_preprocessor.header_rec_type
1050: ) IS
1051: BEGIN
1052: IF (g_asn_debug = 'Y') THEN
1053: asn_debug.put_line('Enter validate_int_org_rcv_line');
1054: END IF;
1055:
1056: x_progress := '000';
1057: rcv_roi_transaction.validate_transaction_date(x_cascaded_table, n);
1113: temp_cascaded_table IN OUT NOCOPY rcv_roi_preprocessor.cascaded_trans_tab_type,
1114: x_header_record IN rcv_roi_preprocessor.header_rec_type
1115: ) IS
1116: BEGIN
1117: IF (g_asn_debug = 'Y') THEN
1118: asn_debug.put_line('enter derive_int_org_trans_del ');
1119: END IF;
1120:
1121: /* Derive the to_org_id */
1114: x_header_record IN rcv_roi_preprocessor.header_rec_type
1115: ) IS
1116: BEGIN
1117: IF (g_asn_debug = 'Y') THEN
1118: asn_debug.put_line('enter derive_int_org_trans_del ');
1119: END IF;
1120:
1121: /* Derive the to_org_id */
1122: rcv_roi_transaction.derive_ship_to_org_info(x_cascaded_table,
1124: x_header_record
1125: );
1126:
1127: IF (x_cascaded_table(n).unit_of_measure IS NOT NULL) THEN
1128: IF (g_asn_debug = 'Y') THEN
1129: asn_debug.put_line('X_progress ' || x_progress);
1130: END IF;
1131:
1132: SELECT muom.uom_code
1125: );
1126:
1127: IF (x_cascaded_table(n).unit_of_measure IS NOT NULL) THEN
1128: IF (g_asn_debug = 'Y') THEN
1129: asn_debug.put_line('X_progress ' || x_progress);
1130: END IF;
1131:
1132: SELECT muom.uom_code
1133: INTO x_cascaded_table(n).uom_code
1133: INTO x_cascaded_table(n).uom_code
1134: FROM mtl_units_of_measure muom
1135: WHERE muom.unit_of_measure = x_cascaded_table(n).unit_of_measure;
1136: ELSE
1137: IF (g_asn_debug = 'Y') THEN
1138: asn_debug.put_line('uom_code not dereived as unit_of_measure is null');
1139: END IF;
1140: END IF;
1141:
1134: FROM mtl_units_of_measure muom
1135: WHERE muom.unit_of_measure = x_cascaded_table(n).unit_of_measure;
1136: ELSE
1137: IF (g_asn_debug = 'Y') THEN
1138: asn_debug.put_line('uom_code not dereived as unit_of_measure is null');
1139: END IF;
1140: END IF;
1141:
1142: x_progress := '026';
1145: * project. Need to verify this with karun to see whether this is
1146: * needed for Transfer also.
1147: */
1148: IF (x_cascaded_table(n).transaction_type = 'TRANSFER') THEN
1149: asn_debug.put_line('doing ship to location /locator derivations ');
1150: rcv_roi_transaction.derive_location_info(x_cascaded_table, n);
1151: rcv_roi_transaction.derive_from_locator_id(x_cascaded_table, n); -- WMS Change
1152: rcv_roi_transaction.derive_to_locator_id(x_cascaded_table, n); -- WMS Change
1153: END IF;
1265: x_cascaded_table(n).processing_status_code := p_trx_record.processing_status_code;
1266: x_cascaded_table(n).transaction_status_code := p_trx_record.transaction_status_code;
1267: x_cascaded_table(n).auto_transact_code := p_trx_record.auto_transact_code;
1268:
1269: IF (g_asn_debug = 'Y') THEN
1270: asn_debug.put_line('Enter Default int org transfer');
1271: END IF;
1272:
1273: IF (x_cascaded_table(n).derive = 'Y') THEN --{
1266: x_cascaded_table(n).transaction_status_code := p_trx_record.transaction_status_code;
1267: x_cascaded_table(n).auto_transact_code := p_trx_record.auto_transact_code;
1268:
1269: IF (g_asn_debug = 'Y') THEN
1270: asn_debug.put_line('Enter Default int org transfer');
1271: END IF;
1272:
1273: IF (x_cascaded_table(n).derive = 'Y') THEN --{
1274: IF (x_cascaded_table(n).derive_index <> 0) THEN --{
1316: x_cascaded_table(n).subinventory := x_cascaded_table(temp_index).subinventory;
1317: END IF;
1318: END IF; --}
1319: ELSE --} {
1320: IF (g_asn_debug = 'Y') THEN
1321: asn_debug.put_line('open cursor Default');
1322: END IF;
1323:
1324: OPEN int_org_transfer_rti(x_cascaded_table(n).parent_interface_txn_id);
1317: END IF;
1318: END IF; --}
1319: ELSE --} {
1320: IF (g_asn_debug = 'Y') THEN
1321: asn_debug.put_line('open cursor Default');
1322: END IF;
1323:
1324: OPEN int_org_transfer_rti(x_cascaded_table(n).parent_interface_txn_id);
1325: END IF; --}
1327: OPEN int_org_transfer(x_cascaded_table(n).parent_transaction_id);
1328: END IF; --}
1329:
1330: IF (int_org_transfer%ISOPEN) THEN
1331: IF (g_asn_debug = 'Y') THEN
1332: asn_debug.put_line('fetch cursor Default');
1333: END IF;
1334:
1335: FETCH int_org_transfer INTO default_int_org_transfer_info;
1328: END IF; --}
1329:
1330: IF (int_org_transfer%ISOPEN) THEN
1331: IF (g_asn_debug = 'Y') THEN
1332: asn_debug.put_line('fetch cursor Default');
1333: END IF;
1334:
1335: FETCH int_org_transfer INTO default_int_org_transfer_info;
1336: ELSIF(int_org_transfer_rti%ISOPEN) THEN
1340: IF ( ( int_org_transfer%ISOPEN
1341: AND int_org_transfer%FOUND)
1342: OR ( int_org_transfer_rti%ISOPEN
1343: AND int_org_transfer_rti%FOUND)) THEN --{
1344: IF (g_asn_debug = 'Y') THEN --{
1345: asn_debug.put_line('Defaulting Transfer item_description' || default_int_org_transfer_info.item_description);
1346: asn_debug.put_line('Defaulting Transfer organization_id' || default_int_org_transfer_info.organization_id);
1347: asn_debug.put_line('Defaulting Transfer inspection_status_code' || default_int_org_transfer_info.inspection_status_code);
1348: asn_debug.put_line('Defaulting Transfer routing_header_id' || default_int_org_transfer_info.routing_header_id);
1341: AND int_org_transfer%FOUND)
1342: OR ( int_org_transfer_rti%ISOPEN
1343: AND int_org_transfer_rti%FOUND)) THEN --{
1344: IF (g_asn_debug = 'Y') THEN --{
1345: asn_debug.put_line('Defaulting Transfer item_description' || default_int_org_transfer_info.item_description);
1346: asn_debug.put_line('Defaulting Transfer organization_id' || default_int_org_transfer_info.organization_id);
1347: asn_debug.put_line('Defaulting Transfer inspection_status_code' || default_int_org_transfer_info.inspection_status_code);
1348: asn_debug.put_line('Defaulting Transfer routing_header_id' || default_int_org_transfer_info.routing_header_id);
1349: asn_debug.put_line('Defaulting Transfer currency_code' || default_int_org_transfer_info.currency_code);
1342: OR ( int_org_transfer_rti%ISOPEN
1343: AND int_org_transfer_rti%FOUND)) THEN --{
1344: IF (g_asn_debug = 'Y') THEN --{
1345: asn_debug.put_line('Defaulting Transfer item_description' || default_int_org_transfer_info.item_description);
1346: asn_debug.put_line('Defaulting Transfer organization_id' || default_int_org_transfer_info.organization_id);
1347: asn_debug.put_line('Defaulting Transfer inspection_status_code' || default_int_org_transfer_info.inspection_status_code);
1348: asn_debug.put_line('Defaulting Transfer routing_header_id' || default_int_org_transfer_info.routing_header_id);
1349: asn_debug.put_line('Defaulting Transfer currency_code' || default_int_org_transfer_info.currency_code);
1350: asn_debug.put_line('Defaulting Transfer currency_conversion_rate' || default_int_org_transfer_info.currency_conversion_rate);
1343: AND int_org_transfer_rti%FOUND)) THEN --{
1344: IF (g_asn_debug = 'Y') THEN --{
1345: asn_debug.put_line('Defaulting Transfer item_description' || default_int_org_transfer_info.item_description);
1346: asn_debug.put_line('Defaulting Transfer organization_id' || default_int_org_transfer_info.organization_id);
1347: asn_debug.put_line('Defaulting Transfer inspection_status_code' || default_int_org_transfer_info.inspection_status_code);
1348: asn_debug.put_line('Defaulting Transfer routing_header_id' || default_int_org_transfer_info.routing_header_id);
1349: asn_debug.put_line('Defaulting Transfer currency_code' || default_int_org_transfer_info.currency_code);
1350: asn_debug.put_line('Defaulting Transfer currency_conversion_rate' || default_int_org_transfer_info.currency_conversion_rate);
1351: asn_debug.put_line('Defaulting Transfer currency_conversion_type' || default_int_org_transfer_info.currency_conversion_type);
1344: IF (g_asn_debug = 'Y') THEN --{
1345: asn_debug.put_line('Defaulting Transfer item_description' || default_int_org_transfer_info.item_description);
1346: asn_debug.put_line('Defaulting Transfer organization_id' || default_int_org_transfer_info.organization_id);
1347: asn_debug.put_line('Defaulting Transfer inspection_status_code' || default_int_org_transfer_info.inspection_status_code);
1348: asn_debug.put_line('Defaulting Transfer routing_header_id' || default_int_org_transfer_info.routing_header_id);
1349: asn_debug.put_line('Defaulting Transfer currency_code' || default_int_org_transfer_info.currency_code);
1350: asn_debug.put_line('Defaulting Transfer currency_conversion_rate' || default_int_org_transfer_info.currency_conversion_rate);
1351: asn_debug.put_line('Defaulting Transfer currency_conversion_type' || default_int_org_transfer_info.currency_conversion_type);
1352: asn_debug.put_line('Defaulting Transfer currency_conversion_date' || default_int_org_transfer_info.currency_conversion_date);
1345: asn_debug.put_line('Defaulting Transfer item_description' || default_int_org_transfer_info.item_description);
1346: asn_debug.put_line('Defaulting Transfer organization_id' || default_int_org_transfer_info.organization_id);
1347: asn_debug.put_line('Defaulting Transfer inspection_status_code' || default_int_org_transfer_info.inspection_status_code);
1348: asn_debug.put_line('Defaulting Transfer routing_header_id' || default_int_org_transfer_info.routing_header_id);
1349: asn_debug.put_line('Defaulting Transfer currency_code' || default_int_org_transfer_info.currency_code);
1350: asn_debug.put_line('Defaulting Transfer currency_conversion_rate' || default_int_org_transfer_info.currency_conversion_rate);
1351: asn_debug.put_line('Defaulting Transfer currency_conversion_type' || default_int_org_transfer_info.currency_conversion_type);
1352: asn_debug.put_line('Defaulting Transfer currency_conversion_date' || default_int_org_transfer_info.currency_conversion_date);
1353: asn_debug.put_line('Defaulting Transfer shipment_header_id' || default_int_org_transfer_info.shipment_header_id);
1346: asn_debug.put_line('Defaulting Transfer organization_id' || default_int_org_transfer_info.organization_id);
1347: asn_debug.put_line('Defaulting Transfer inspection_status_code' || default_int_org_transfer_info.inspection_status_code);
1348: asn_debug.put_line('Defaulting Transfer routing_header_id' || default_int_org_transfer_info.routing_header_id);
1349: asn_debug.put_line('Defaulting Transfer currency_code' || default_int_org_transfer_info.currency_code);
1350: asn_debug.put_line('Defaulting Transfer currency_conversion_rate' || default_int_org_transfer_info.currency_conversion_rate);
1351: asn_debug.put_line('Defaulting Transfer currency_conversion_type' || default_int_org_transfer_info.currency_conversion_type);
1352: asn_debug.put_line('Defaulting Transfer currency_conversion_date' || default_int_org_transfer_info.currency_conversion_date);
1353: asn_debug.put_line('Defaulting Transfer shipment_header_id' || default_int_org_transfer_info.shipment_header_id);
1354: asn_debug.put_line('Defaulting Transfer shipment_line_id' || default_int_org_transfer_info.shipment_line_id);
1347: asn_debug.put_line('Defaulting Transfer inspection_status_code' || default_int_org_transfer_info.inspection_status_code);
1348: asn_debug.put_line('Defaulting Transfer routing_header_id' || default_int_org_transfer_info.routing_header_id);
1349: asn_debug.put_line('Defaulting Transfer currency_code' || default_int_org_transfer_info.currency_code);
1350: asn_debug.put_line('Defaulting Transfer currency_conversion_rate' || default_int_org_transfer_info.currency_conversion_rate);
1351: asn_debug.put_line('Defaulting Transfer currency_conversion_type' || default_int_org_transfer_info.currency_conversion_type);
1352: asn_debug.put_line('Defaulting Transfer currency_conversion_date' || default_int_org_transfer_info.currency_conversion_date);
1353: asn_debug.put_line('Defaulting Transfer shipment_header_id' || default_int_org_transfer_info.shipment_header_id);
1354: asn_debug.put_line('Defaulting Transfer shipment_line_id' || default_int_org_transfer_info.shipment_line_id);
1355: asn_debug.put_line('Defaulting Transfer category_id' || default_int_org_transfer_info.category_id);
1348: asn_debug.put_line('Defaulting Transfer routing_header_id' || default_int_org_transfer_info.routing_header_id);
1349: asn_debug.put_line('Defaulting Transfer currency_code' || default_int_org_transfer_info.currency_code);
1350: asn_debug.put_line('Defaulting Transfer currency_conversion_rate' || default_int_org_transfer_info.currency_conversion_rate);
1351: asn_debug.put_line('Defaulting Transfer currency_conversion_type' || default_int_org_transfer_info.currency_conversion_type);
1352: asn_debug.put_line('Defaulting Transfer currency_conversion_date' || default_int_org_transfer_info.currency_conversion_date);
1353: asn_debug.put_line('Defaulting Transfer shipment_header_id' || default_int_org_transfer_info.shipment_header_id);
1354: asn_debug.put_line('Defaulting Transfer shipment_line_id' || default_int_org_transfer_info.shipment_line_id);
1355: asn_debug.put_line('Defaulting Transfer category_id' || default_int_org_transfer_info.category_id);
1356: asn_debug.put_line('Defaulting Transfer DELIVER_TO_PERSON_ID' || default_int_org_transfer_info.deliver_to_person_id);
1349: asn_debug.put_line('Defaulting Transfer currency_code' || default_int_org_transfer_info.currency_code);
1350: asn_debug.put_line('Defaulting Transfer currency_conversion_rate' || default_int_org_transfer_info.currency_conversion_rate);
1351: asn_debug.put_line('Defaulting Transfer currency_conversion_type' || default_int_org_transfer_info.currency_conversion_type);
1352: asn_debug.put_line('Defaulting Transfer currency_conversion_date' || default_int_org_transfer_info.currency_conversion_date);
1353: asn_debug.put_line('Defaulting Transfer shipment_header_id' || default_int_org_transfer_info.shipment_header_id);
1354: asn_debug.put_line('Defaulting Transfer shipment_line_id' || default_int_org_transfer_info.shipment_line_id);
1355: asn_debug.put_line('Defaulting Transfer category_id' || default_int_org_transfer_info.category_id);
1356: asn_debug.put_line('Defaulting Transfer DELIVER_TO_PERSON_ID' || default_int_org_transfer_info.deliver_to_person_id);
1357: asn_debug.put_line('Defaulting Transfer DELIVER_TO_LOCATION_ID' || default_int_org_transfer_info.deliver_to_location_id);
1350: asn_debug.put_line('Defaulting Transfer currency_conversion_rate' || default_int_org_transfer_info.currency_conversion_rate);
1351: asn_debug.put_line('Defaulting Transfer currency_conversion_type' || default_int_org_transfer_info.currency_conversion_type);
1352: asn_debug.put_line('Defaulting Transfer currency_conversion_date' || default_int_org_transfer_info.currency_conversion_date);
1353: asn_debug.put_line('Defaulting Transfer shipment_header_id' || default_int_org_transfer_info.shipment_header_id);
1354: asn_debug.put_line('Defaulting Transfer shipment_line_id' || default_int_org_transfer_info.shipment_line_id);
1355: asn_debug.put_line('Defaulting Transfer category_id' || default_int_org_transfer_info.category_id);
1356: asn_debug.put_line('Defaulting Transfer DELIVER_TO_PERSON_ID' || default_int_org_transfer_info.deliver_to_person_id);
1357: asn_debug.put_line('Defaulting Transfer DELIVER_TO_LOCATION_ID' || default_int_org_transfer_info.deliver_to_location_id);
1358: asn_debug.put_line('Defaulting Transfer SUBINVENTORY' || default_int_org_transfer_info.subinventory);
1351: asn_debug.put_line('Defaulting Transfer currency_conversion_type' || default_int_org_transfer_info.currency_conversion_type);
1352: asn_debug.put_line('Defaulting Transfer currency_conversion_date' || default_int_org_transfer_info.currency_conversion_date);
1353: asn_debug.put_line('Defaulting Transfer shipment_header_id' || default_int_org_transfer_info.shipment_header_id);
1354: asn_debug.put_line('Defaulting Transfer shipment_line_id' || default_int_org_transfer_info.shipment_line_id);
1355: asn_debug.put_line('Defaulting Transfer category_id' || default_int_org_transfer_info.category_id);
1356: asn_debug.put_line('Defaulting Transfer DELIVER_TO_PERSON_ID' || default_int_org_transfer_info.deliver_to_person_id);
1357: asn_debug.put_line('Defaulting Transfer DELIVER_TO_LOCATION_ID' || default_int_org_transfer_info.deliver_to_location_id);
1358: asn_debug.put_line('Defaulting Transfer SUBINVENTORY' || default_int_org_transfer_info.subinventory);
1359: END IF; --}
1352: asn_debug.put_line('Defaulting Transfer currency_conversion_date' || default_int_org_transfer_info.currency_conversion_date);
1353: asn_debug.put_line('Defaulting Transfer shipment_header_id' || default_int_org_transfer_info.shipment_header_id);
1354: asn_debug.put_line('Defaulting Transfer shipment_line_id' || default_int_org_transfer_info.shipment_line_id);
1355: asn_debug.put_line('Defaulting Transfer category_id' || default_int_org_transfer_info.category_id);
1356: asn_debug.put_line('Defaulting Transfer DELIVER_TO_PERSON_ID' || default_int_org_transfer_info.deliver_to_person_id);
1357: asn_debug.put_line('Defaulting Transfer DELIVER_TO_LOCATION_ID' || default_int_org_transfer_info.deliver_to_location_id);
1358: asn_debug.put_line('Defaulting Transfer SUBINVENTORY' || default_int_org_transfer_info.subinventory);
1359: END IF; --}
1360:
1353: asn_debug.put_line('Defaulting Transfer shipment_header_id' || default_int_org_transfer_info.shipment_header_id);
1354: asn_debug.put_line('Defaulting Transfer shipment_line_id' || default_int_org_transfer_info.shipment_line_id);
1355: asn_debug.put_line('Defaulting Transfer category_id' || default_int_org_transfer_info.category_id);
1356: asn_debug.put_line('Defaulting Transfer DELIVER_TO_PERSON_ID' || default_int_org_transfer_info.deliver_to_person_id);
1357: asn_debug.put_line('Defaulting Transfer DELIVER_TO_LOCATION_ID' || default_int_org_transfer_info.deliver_to_location_id);
1358: asn_debug.put_line('Defaulting Transfer SUBINVENTORY' || default_int_org_transfer_info.subinventory);
1359: END IF; --}
1360:
1361: --x_cascaded_table(n).po_revision_num := default_int_org_transfer_info.po_revision_num;
1354: asn_debug.put_line('Defaulting Transfer shipment_line_id' || default_int_org_transfer_info.shipment_line_id);
1355: asn_debug.put_line('Defaulting Transfer category_id' || default_int_org_transfer_info.category_id);
1356: asn_debug.put_line('Defaulting Transfer DELIVER_TO_PERSON_ID' || default_int_org_transfer_info.deliver_to_person_id);
1357: asn_debug.put_line('Defaulting Transfer DELIVER_TO_LOCATION_ID' || default_int_org_transfer_info.deliver_to_location_id);
1358: asn_debug.put_line('Defaulting Transfer SUBINVENTORY' || default_int_org_transfer_info.subinventory);
1359: END IF; --}
1360:
1361: --x_cascaded_table(n).po_revision_num := default_int_org_transfer_info.po_revision_num;
1362:
1451: IF (x_cascaded_table(n).transaction_type = 'DELIVER') THEN
1452: x_cascaded_table(n).location_id := x_cascaded_table(n).deliver_to_location_id;
1453: END IF;
1454:
1455: IF (g_asn_debug = 'Y') THEN
1456: asn_debug.put_line('Set Location_id = ' || TO_CHAR(x_cascaded_table(n).location_id));
1457: END IF;
1458:
1459: IF (g_asn_debug = 'Y') THEN
1452: x_cascaded_table(n).location_id := x_cascaded_table(n).deliver_to_location_id;
1453: END IF;
1454:
1455: IF (g_asn_debug = 'Y') THEN
1456: asn_debug.put_line('Set Location_id = ' || TO_CHAR(x_cascaded_table(n).location_id));
1457: END IF;
1458:
1459: IF (g_asn_debug = 'Y') THEN
1460: asn_debug.put_line('Exit default_vendor_trans_del');
1455: IF (g_asn_debug = 'Y') THEN
1456: asn_debug.put_line('Set Location_id = ' || TO_CHAR(x_cascaded_table(n).location_id));
1457: END IF;
1458:
1459: IF (g_asn_debug = 'Y') THEN
1460: asn_debug.put_line('Exit default_vendor_trans_del');
1461: END IF;
1462:
1463: IF int_org_transfer%ISOPEN THEN
1456: asn_debug.put_line('Set Location_id = ' || TO_CHAR(x_cascaded_table(n).location_id));
1457: END IF;
1458:
1459: IF (g_asn_debug = 'Y') THEN
1460: asn_debug.put_line('Exit default_vendor_trans_del');
1461: END IF;
1462:
1463: IF int_org_transfer%ISOPEN THEN
1464: CLOSE int_org_transfer;
1578: temp_index NUMBER;
1579: l_supply_code rcv_supply.supply_type_code%TYPE;
1580: l_transaction_type rcv_transactions.transaction_type%TYPE;
1581: BEGIN
1582: IF (g_asn_debug = 'Y') THEN
1583: asn_debug.put_line('enter derive_quantity ' || x_cascaded_table(n).parent_transaction_id);
1584: END IF;
1585:
1586: IF (x_cascaded_table(n).parent_transaction_id IS NOT NULL) THEN --{
1579: l_supply_code rcv_supply.supply_type_code%TYPE;
1580: l_transaction_type rcv_transactions.transaction_type%TYPE;
1581: BEGIN
1582: IF (g_asn_debug = 'Y') THEN
1583: asn_debug.put_line('enter derive_quantity ' || x_cascaded_table(n).parent_transaction_id);
1584: END IF;
1585:
1586: IF (x_cascaded_table(n).parent_transaction_id IS NOT NULL) THEN --{
1587: IF (g_asn_debug = 'Y') THEN
1583: asn_debug.put_line('enter derive_quantity ' || x_cascaded_table(n).parent_transaction_id);
1584: END IF;
1585:
1586: IF (x_cascaded_table(n).parent_transaction_id IS NOT NULL) THEN --{
1587: IF (g_asn_debug = 'Y') THEN
1588: asn_debug.put_line('open int_org_transfer table ' || x_cascaded_table(n).parent_transaction_id);
1589: END IF;
1590:
1591: OPEN int_org_transfer(x_cascaded_table(n).parent_transaction_id, x_cascaded_table(n).to_organization_id);
1584: END IF;
1585:
1586: IF (x_cascaded_table(n).parent_transaction_id IS NOT NULL) THEN --{
1587: IF (g_asn_debug = 'Y') THEN
1588: asn_debug.put_line('open int_org_transfer table ' || x_cascaded_table(n).parent_transaction_id);
1589: END IF;
1590:
1591: OPEN int_org_transfer(x_cascaded_table(n).parent_transaction_id, x_cascaded_table(n).to_organization_id);
1592: already_derived := TRUE;
1604: /* if derive_values_from_table is true, then we derive the values from the pl/sql tables later
1605: * at the time when we try to see which cursor is open. We will have x_cascaded_table(n).
1606: * parent_interface_txn_id) populated with the correct value.
1607: */
1608: IF (g_asn_debug = 'Y') THEN
1609: asn_debug.put_line(' open pl/sql table');
1610: END IF;
1611:
1612: OPEN int_org_transfer_rti(x_cascaded_table(n).parent_interface_txn_id);
1605: * at the time when we try to see which cursor is open. We will have x_cascaded_table(n).
1606: * parent_interface_txn_id) populated with the correct value.
1607: */
1608: IF (g_asn_debug = 'Y') THEN
1609: asn_debug.put_line(' open pl/sql table');
1610: END IF;
1611:
1612: OPEN int_org_transfer_rti(x_cascaded_table(n).parent_interface_txn_id);
1613: END IF;
1616: /******************************************************************/
1617: --check line quantity > 0
1618: x_progress := '097';
1619:
1620: IF (g_asn_debug = 'Y') THEN
1621: asn_debug.put_line('X_progress ' || x_progress);
1622: END IF;
1623:
1624: IF (x_cascaded_table(n).error_status NOT IN('S', 'W')) THEN
1617: --check line quantity > 0
1618: x_progress := '097';
1619:
1620: IF (g_asn_debug = 'Y') THEN
1621: asn_debug.put_line('X_progress ' || x_progress);
1622: END IF;
1623:
1624: IF (x_cascaded_table(n).error_status NOT IN('S', 'W')) THEN
1625: RETURN;
1625: RETURN;
1626: END IF;
1627:
1628: IF x_cascaded_table(n).quantity <= 0 THEN --{
1629: IF (g_asn_debug = 'Y') THEN
1630: asn_debug.put_line('Quantity is <= zero. Cascade will fail');
1631: END IF;
1632:
1633: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
1626: END IF;
1627:
1628: IF x_cascaded_table(n).quantity <= 0 THEN --{
1629: IF (g_asn_debug = 'Y') THEN
1630: asn_debug.put_line('Quantity is <= zero. Cascade will fail');
1631: END IF;
1632:
1633: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
1634: rcv_error_pkg.set_error_message('RCV_ITEM_NO_SHIP_QTY', x_cascaded_table(n).error_message);
1641: -- the asn is consumed. (Cascade)
1642:
1643: x_progress := '098';
1644:
1645: IF (g_asn_debug = 'Y') THEN
1646: asn_debug.put_line('X_progress ' || x_progress);
1647: END IF;
1648:
1649: IF ( x_cascaded_table(n).parent_transaction_id IS NULL
1642:
1643: x_progress := '098';
1644:
1645: IF (g_asn_debug = 'Y') THEN
1646: asn_debug.put_line('X_progress ' || x_progress);
1647: END IF;
1648:
1649: IF ( x_cascaded_table(n).parent_transaction_id IS NULL
1650: AND x_cascaded_table(n).parent_interface_txn_id IS NULL) THEN
1647: END IF;
1648:
1649: IF ( x_cascaded_table(n).parent_transaction_id IS NULL
1650: AND x_cascaded_table(n).parent_interface_txn_id IS NULL) THEN
1651: IF (g_asn_debug = 'Y') THEN
1652: asn_debug.put_line('No parent transaction found ');
1653: END IF;
1654:
1655: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
1648:
1649: IF ( x_cascaded_table(n).parent_transaction_id IS NULL
1650: AND x_cascaded_table(n).parent_interface_txn_id IS NULL) THEN
1651: IF (g_asn_debug = 'Y') THEN
1652: asn_debug.put_line('No parent transaction found ');
1653: END IF;
1654:
1655: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
1656: rcv_error_pkg.set_error_message('RCV_NO_PARENT_TRANSACTION', x_cascaded_table(n).error_message);
1657: rcv_error_pkg.log_interface_error('PARENT_TRANSACTION_ID');
1658: END IF;
1659:
1660: -- Copy record from main table to temp table
1661: IF (g_asn_debug = 'Y') THEN
1662: asn_debug.put_line('Copy record from main table to temp table');
1663: END IF;
1664:
1665: current_n := 1;
1658: END IF;
1659:
1660: -- Copy record from main table to temp table
1661: IF (g_asn_debug = 'Y') THEN
1662: asn_debug.put_line('Copy record from main table to temp table');
1663: END IF;
1664:
1665: current_n := 1;
1666: temp_cascaded_table(current_n) := x_cascaded_table(n);
1665: current_n := 1;
1666: temp_cascaded_table(current_n) := x_cascaded_table(n);
1667:
1668: -- Get all rows which meet this condition
1669: IF (g_asn_debug = 'Y') THEN
1670: asn_debug.put_line('Get all rows which meet this condition');
1671: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
1672: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
1673: END IF;
1666: temp_cascaded_table(current_n) := x_cascaded_table(n);
1667:
1668: -- Get all rows which meet this condition
1669: IF (g_asn_debug = 'Y') THEN
1670: asn_debug.put_line('Get all rows which meet this condition');
1671: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
1672: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
1673: END IF;
1674:
1667:
1668: -- Get all rows which meet this condition
1669: IF (g_asn_debug = 'Y') THEN
1670: asn_debug.put_line('Get all rows which meet this condition');
1671: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
1672: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
1673: END IF;
1674:
1675: -- Assign shipped quantity to remaining quantity
1668: -- Get all rows which meet this condition
1669: IF (g_asn_debug = 'Y') THEN
1670: asn_debug.put_line('Get all rows which meet this condition');
1671: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
1672: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
1673: END IF;
1674:
1675: -- Assign shipped quantity to remaining quantity
1676: IF (g_asn_debug = 'Y') THEN
1672: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
1673: END IF;
1674:
1675: -- Assign shipped quantity to remaining quantity
1676: IF (g_asn_debug = 'Y') THEN
1677: asn_debug.put_line('Assign populated quantity to remaining quantity');
1678: asn_debug.put_line('Pointer in temp_cascade ' || TO_CHAR(current_n));
1679: END IF;
1680:
1673: END IF;
1674:
1675: -- Assign shipped quantity to remaining quantity
1676: IF (g_asn_debug = 'Y') THEN
1677: asn_debug.put_line('Assign populated quantity to remaining quantity');
1678: asn_debug.put_line('Pointer in temp_cascade ' || TO_CHAR(current_n));
1679: END IF;
1680:
1681: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1674:
1675: -- Assign shipped quantity to remaining quantity
1676: IF (g_asn_debug = 'Y') THEN
1677: asn_debug.put_line('Assign populated quantity to remaining quantity');
1678: asn_debug.put_line('Pointer in temp_cascade ' || TO_CHAR(current_n));
1679: END IF;
1680:
1681: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1682: x_remaining_qty_po_uom := 0;
1680:
1681: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1682: x_remaining_qty_po_uom := 0;
1683:
1684: IF (g_asn_debug = 'Y') THEN
1685: asn_debug.put_line('Have assigned the quantity');
1686: END IF;
1687:
1688: -- Calculate tax_amount_factor for calculating tax_amount for
1681: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
1682: x_remaining_qty_po_uom := 0;
1683:
1684: IF (g_asn_debug = 'Y') THEN
1685: asn_debug.put_line('Have assigned the quantity');
1686: END IF;
1687:
1688: -- Calculate tax_amount_factor for calculating tax_amount for
1689: -- each cascaded line
1693: ELSE
1694: tax_amount_factor := 0;
1695: END IF;
1696:
1697: IF (g_asn_debug = 'Y') THEN
1698: asn_debug.put_line('Tax Factor ' || TO_CHAR(tax_amount_factor));
1699: asn_debug.put_line('Shipped Quantity : ' || TO_CHAR(x_remaining_quantity));
1700: END IF;
1701:
1694: tax_amount_factor := 0;
1695: END IF;
1696:
1697: IF (g_asn_debug = 'Y') THEN
1698: asn_debug.put_line('Tax Factor ' || TO_CHAR(tax_amount_factor));
1699: asn_debug.put_line('Shipped Quantity : ' || TO_CHAR(x_remaining_quantity));
1700: END IF;
1701:
1702: x_first_trans := TRUE;
1695: END IF;
1696:
1697: IF (g_asn_debug = 'Y') THEN
1698: asn_debug.put_line('Tax Factor ' || TO_CHAR(tax_amount_factor));
1699: asn_debug.put_line('Shipped Quantity : ' || TO_CHAR(x_remaining_quantity));
1700: END IF;
1701:
1702: x_first_trans := TRUE;
1703: transaction_ok := FALSE;
1701:
1702: x_first_trans := TRUE;
1703: transaction_ok := FALSE;
1704:
1705: IF (g_asn_debug = 'Y') THEN
1706: asn_debug.put_line('Before starting Cascade');
1707: END IF;
1708:
1709: IF (g_asn_debug = 'Y') THEN
1702: x_first_trans := TRUE;
1703: transaction_ok := FALSE;
1704:
1705: IF (g_asn_debug = 'Y') THEN
1706: asn_debug.put_line('Before starting Cascade');
1707: END IF;
1708:
1709: IF (g_asn_debug = 'Y') THEN
1710: asn_debug.put_line('Record Count = ' || x_record_count);
1705: IF (g_asn_debug = 'Y') THEN
1706: asn_debug.put_line('Before starting Cascade');
1707: END IF;
1708:
1709: IF (g_asn_debug = 'Y') THEN
1710: asn_debug.put_line('Record Count = ' || x_record_count);
1711: END IF;
1712:
1713: LOOP --{
1706: asn_debug.put_line('Before starting Cascade');
1707: END IF;
1708:
1709: IF (g_asn_debug = 'Y') THEN
1710: asn_debug.put_line('Record Count = ' || x_record_count);
1711: END IF;
1712:
1713: LOOP --{
1714: IF (g_asn_debug = 'Y') THEN
1710: asn_debug.put_line('Record Count = ' || x_record_count);
1711: END IF;
1712:
1713: LOOP --{
1714: IF (g_asn_debug = 'Y') THEN
1715: asn_debug.put_line('Remaining Quantity ASN UOM ' || TO_CHAR(x_remaining_quantity));
1716: END IF;
1717:
1718: /*
1711: END IF;
1712:
1713: LOOP --{
1714: IF (g_asn_debug = 'Y') THEN
1715: asn_debug.put_line('Remaining Quantity ASN UOM ' || TO_CHAR(x_remaining_quantity));
1716: END IF;
1717:
1718: /*
1719: ** Fetch the appropriate record
1717:
1718: /*
1719: ** Fetch the appropriate record
1720: */
1721: IF (g_asn_debug = 'Y') THEN
1722: asn_debug.put_line('DEBUG: transaction_type = ' || x_cascaded_table(n).transaction_type);
1723: END IF;
1724:
1725: IF (int_org_transfer%ISOPEN) THEN --{
1718: /*
1719: ** Fetch the appropriate record
1720: */
1721: IF (g_asn_debug = 'Y') THEN
1722: asn_debug.put_line('DEBUG: transaction_type = ' || x_cascaded_table(n).transaction_type);
1723: END IF;
1724:
1725: IF (int_org_transfer%ISOPEN) THEN --{
1726: IF (g_asn_debug = 'Y') THEN
1722: asn_debug.put_line('DEBUG: transaction_type = ' || x_cascaded_table(n).transaction_type);
1723: END IF;
1724:
1725: IF (int_org_transfer%ISOPEN) THEN --{
1726: IF (g_asn_debug = 'Y') THEN
1727: asn_debug.put_line(' fetch int_org_transfer');
1728: END IF;
1729:
1730: FETCH int_org_transfer INTO x_int_org_transferrec;
1723: END IF;
1724:
1725: IF (int_org_transfer%ISOPEN) THEN --{
1726: IF (g_asn_debug = 'Y') THEN
1727: asn_debug.put_line(' fetch int_org_transfer');
1728: END IF;
1729:
1730: FETCH int_org_transfer INTO x_int_org_transferrec;
1731:
1734: END IF;
1735:
1736: rows_fetched := int_org_transfer%ROWCOUNT;
1737: ELSIF(int_org_transfer_rti%ISOPEN) THEN --}{
1738: IF (g_asn_debug = 'Y') THEN
1739: asn_debug.put_line(' fetch int_org_transfer_rti');
1740: END IF;
1741:
1742: FETCH int_org_transfer_rti INTO x_int_org_transferrec;
1735:
1736: rows_fetched := int_org_transfer%ROWCOUNT;
1737: ELSIF(int_org_transfer_rti%ISOPEN) THEN --}{
1738: IF (g_asn_debug = 'Y') THEN
1739: asn_debug.put_line(' fetch int_org_transfer_rti');
1740: END IF;
1741:
1742: FETCH int_org_transfer_rti INTO x_int_org_transferrec;
1743:
1741:
1742: FETCH int_org_transfer_rti INTO x_int_org_transferrec;
1743:
1744: IF (int_org_transfer_rti%NOTFOUND) THEN
1745: IF (g_asn_debug = 'Y') THEN
1746: asn_debug.put_line('transfer last row');
1747: END IF;
1748:
1749: lastrecord := TRUE;
1742: FETCH int_org_transfer_rti INTO x_int_org_transferrec;
1743:
1744: IF (int_org_transfer_rti%NOTFOUND) THEN
1745: IF (g_asn_debug = 'Y') THEN
1746: asn_debug.put_line('transfer last row');
1747: END IF;
1748:
1749: lastrecord := TRUE;
1750: END IF;
1758: * parent_interface_txn_id) populated with
1759: * with the correct value. Also we have cascaded_table_index
1760: * with the correct pl/sql table index number;
1761: */
1762: IF (g_asn_debug = 'Y') THEN
1763: asn_debug.put_line(' fetch pl/sql table');
1764: END IF;
1765:
1766: temp_index := temp_cascaded_table(current_n).derive_index;
1759: * with the correct value. Also we have cascaded_table_index
1760: * with the correct pl/sql table index number;
1761: */
1762: IF (g_asn_debug = 'Y') THEN
1763: asn_debug.put_line(' fetch pl/sql table');
1764: END IF;
1765:
1766: temp_index := temp_cascaded_table(current_n).derive_index;
1767: x_int_org_transferrec.unit_of_meas := x_cascaded_table(temp_index).unit_of_measure;
1784: END IF; --}
1785:
1786: --x_remaining_quantity:= temp_cascaded_table(current_n).quantity;
1787:
1788: IF (g_asn_debug = 'Y') THEN
1789: asn_debug.put_line('Transfer Rows fetched ' || TO_CHAR(rows_fetched));
1790: --asn_debug.put_line('po_line_id ' || to_char(x_int_org_transferrec.po_line_id));
1791: --asn_debug.put_line('po_dist ' || to_char(x_int_org_transferrec.po_distribution_id));
1792: asn_debug.put_line('Transfer remainaing qty ' || x_remaining_quantity);
1785:
1786: --x_remaining_quantity:= temp_cascaded_table(current_n).quantity;
1787:
1788: IF (g_asn_debug = 'Y') THEN
1789: asn_debug.put_line('Transfer Rows fetched ' || TO_CHAR(rows_fetched));
1790: --asn_debug.put_line('po_line_id ' || to_char(x_int_org_transferrec.po_line_id));
1791: --asn_debug.put_line('po_dist ' || to_char(x_int_org_transferrec.po_distribution_id));
1792: asn_debug.put_line('Transfer remainaing qty ' || x_remaining_quantity);
1793: END IF;
1786: --x_remaining_quantity:= temp_cascaded_table(current_n).quantity;
1787:
1788: IF (g_asn_debug = 'Y') THEN
1789: asn_debug.put_line('Transfer Rows fetched ' || TO_CHAR(rows_fetched));
1790: --asn_debug.put_line('po_line_id ' || to_char(x_int_org_transferrec.po_line_id));
1791: --asn_debug.put_line('po_dist ' || to_char(x_int_org_transferrec.po_distribution_id));
1792: asn_debug.put_line('Transfer remainaing qty ' || x_remaining_quantity);
1793: END IF;
1794:
1787:
1788: IF (g_asn_debug = 'Y') THEN
1789: asn_debug.put_line('Transfer Rows fetched ' || TO_CHAR(rows_fetched));
1790: --asn_debug.put_line('po_line_id ' || to_char(x_int_org_transferrec.po_line_id));
1791: --asn_debug.put_line('po_dist ' || to_char(x_int_org_transferrec.po_distribution_id));
1792: asn_debug.put_line('Transfer remainaing qty ' || x_remaining_quantity);
1793: END IF;
1794:
1795: IF ( lastrecord
1788: IF (g_asn_debug = 'Y') THEN
1789: asn_debug.put_line('Transfer Rows fetched ' || TO_CHAR(rows_fetched));
1790: --asn_debug.put_line('po_line_id ' || to_char(x_int_org_transferrec.po_line_id));
1791: --asn_debug.put_line('po_dist ' || to_char(x_int_org_transferrec.po_distribution_id));
1792: asn_debug.put_line('Transfer remainaing qty ' || x_remaining_quantity);
1793: END IF;
1794:
1795: IF ( lastrecord
1796: OR x_remaining_quantity <= 0) THEN --{
1793: END IF;
1794:
1795: IF ( lastrecord
1796: OR x_remaining_quantity <= 0) THEN --{
1797: IF (g_asn_debug = 'Y') THEN
1798: asn_debug.put_line('Hit exit condition');
1799: END IF;
1800:
1801: IF NOT x_first_trans THEN
1794:
1795: IF ( lastrecord
1796: OR x_remaining_quantity <= 0) THEN --{
1797: IF (g_asn_debug = 'Y') THEN
1798: asn_debug.put_line('Hit exit condition');
1799: END IF;
1800:
1801: IF NOT x_first_trans THEN
1802: -- x_first_trans has been reset which means some cascade has
1800:
1801: IF NOT x_first_trans THEN
1802: -- x_first_trans has been reset which means some cascade has
1803: -- happened. Otherwise current_n = 1
1804: asn_debug.put_line('current_n before is ' || current_n);
1805: current_n := current_n - 1;
1806: END IF;
1807:
1808: -- do the tolerance act here
1805: current_n := current_n - 1;
1806: END IF;
1807:
1808: -- do the tolerance act here
1809: IF (g_asn_debug = 'Y') THEN
1810: asn_debug.put_line('Temp table pointer ' || TO_CHAR(current_n));
1811: asn_debug.put_line('Check which condition has occured');
1812: END IF;
1813:
1806: END IF;
1807:
1808: -- do the tolerance act here
1809: IF (g_asn_debug = 'Y') THEN
1810: asn_debug.put_line('Temp table pointer ' || TO_CHAR(current_n));
1811: asn_debug.put_line('Check which condition has occured');
1812: END IF;
1813:
1814: -- lastrecord...we have run out of rows and we still have quantity to allocate
1807:
1808: -- do the tolerance act here
1809: IF (g_asn_debug = 'Y') THEN
1810: asn_debug.put_line('Temp table pointer ' || TO_CHAR(current_n));
1811: asn_debug.put_line('Check which condition has occured');
1812: END IF;
1813:
1814: -- lastrecord...we have run out of rows and we still have quantity to allocate
1815: IF x_remaining_quantity > 0 THEN --{
1812: END IF;
1813:
1814: -- lastrecord...we have run out of rows and we still have quantity to allocate
1815: IF x_remaining_quantity > 0 THEN --{
1816: IF (g_asn_debug = 'Y') THEN
1817: asn_debug.put_line('There is quantity remaining');
1818: asn_debug.put_line('Need to check qty tolerances');
1819: END IF;
1820:
1813:
1814: -- lastrecord...we have run out of rows and we still have quantity to allocate
1815: IF x_remaining_quantity > 0 THEN --{
1816: IF (g_asn_debug = 'Y') THEN
1817: asn_debug.put_line('There is quantity remaining');
1818: asn_debug.put_line('Need to check qty tolerances');
1819: END IF;
1820:
1821: IF rows_fetched > 0
1814: -- lastrecord...we have run out of rows and we still have quantity to allocate
1815: IF x_remaining_quantity > 0 THEN --{
1816: IF (g_asn_debug = 'Y') THEN
1817: asn_debug.put_line('There is quantity remaining');
1818: asn_debug.put_line('Need to check qty tolerances');
1819: END IF;
1820:
1821: IF rows_fetched > 0
1822: AND NOT x_first_trans THEN --{
1825: /* for transfer,accept an reject type we dont have the
1826: * tolerance check. Hence error out.
1827: * We cannot transfer quantities more than that was received.
1828: */
1829: IF (g_asn_debug = 'Y') THEN
1830: asn_debug.put_line(' in transfer Extra ASN UOM Quantity ' || TO_CHAR(x_remaining_quantity));
1831: asn_debug.put_line('Extra PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
1832: END IF;
1833:
1826: * tolerance check. Hence error out.
1827: * We cannot transfer quantities more than that was received.
1828: */
1829: IF (g_asn_debug = 'Y') THEN
1830: asn_debug.put_line(' in transfer Extra ASN UOM Quantity ' || TO_CHAR(x_remaining_quantity));
1831: asn_debug.put_line('Extra PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
1832: END IF;
1833:
1834: IF (g_asn_debug = 'Y') THEN
1827: * We cannot transfer quantities more than that was received.
1828: */
1829: IF (g_asn_debug = 'Y') THEN
1830: asn_debug.put_line(' in transfer Extra ASN UOM Quantity ' || TO_CHAR(x_remaining_quantity));
1831: asn_debug.put_line('Extra PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
1832: END IF;
1833:
1834: IF (g_asn_debug = 'Y') THEN
1835: asn_debug.put_line('delete the temp table ');
1830: asn_debug.put_line(' in transfer Extra ASN UOM Quantity ' || TO_CHAR(x_remaining_quantity));
1831: asn_debug.put_line('Extra PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
1832: END IF;
1833:
1834: IF (g_asn_debug = 'Y') THEN
1835: asn_debug.put_line('delete the temp table ');
1836: END IF;
1837:
1838: IF temp_cascaded_table.COUNT > 0 THEN
1831: asn_debug.put_line('Extra PO UOM Quantity ' || TO_CHAR(x_remaining_qty_po_uom));
1832: END IF;
1833:
1834: IF (g_asn_debug = 'Y') THEN
1835: asn_debug.put_line('delete the temp table ');
1836: END IF;
1837:
1838: IF temp_cascaded_table.COUNT > 0 THEN
1839: FOR i IN 1 .. temp_cascaded_table.COUNT LOOP
1847: rcv_error_pkg.set_token('QTY_B', x_cascaded_table(n).quantity - x_remaining_quantity);
1848: rcv_error_pkg.log_interface_error('QUANTITY');
1849: ELSE --}{ else for rows fetched = 0 OR x_first_trans = true
1850: IF rows_fetched = 0 THEN
1851: IF (g_asn_debug = 'Y') THEN
1852: asn_debug.put_line('No rows were retrieved from cursor.');
1853: END IF;
1854: ELSIF x_first_trans THEN
1855: IF (g_asn_debug = 'Y') THEN
1848: rcv_error_pkg.log_interface_error('QUANTITY');
1849: ELSE --}{ else for rows fetched = 0 OR x_first_trans = true
1850: IF rows_fetched = 0 THEN
1851: IF (g_asn_debug = 'Y') THEN
1852: asn_debug.put_line('No rows were retrieved from cursor.');
1853: END IF;
1854: ELSIF x_first_trans THEN
1855: IF (g_asn_debug = 'Y') THEN
1856: asn_debug.put_line('No rows were cascaded');
1851: IF (g_asn_debug = 'Y') THEN
1852: asn_debug.put_line('No rows were retrieved from cursor.');
1853: END IF;
1854: ELSIF x_first_trans THEN
1855: IF (g_asn_debug = 'Y') THEN
1856: asn_debug.put_line('No rows were cascaded');
1857: END IF;
1858: END IF;
1859:
1852: asn_debug.put_line('No rows were retrieved from cursor.');
1853: END IF;
1854: ELSIF x_first_trans THEN
1855: IF (g_asn_debug = 'Y') THEN
1856: asn_debug.put_line('No rows were cascaded');
1857: END IF;
1858: END IF;
1859:
1860: x_temp_count := 1;
1891: rcv_error_pkg.log_interface_error('PARENT_TRANSACTION_ID');
1892: END IF; --} end else for rows fetched = 0 OR x_first_trans = true
1893: -- end x_remaining_qty > 0 => this is the last record
1894: ELSE -- }{
1895: IF (g_asn_debug = 'Y') THEN
1896: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
1897: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
1898: END IF;
1899: END IF; --} ends the check for whether last record has been reached
1892: END IF; --} end else for rows fetched = 0 OR x_first_trans = true
1893: -- end x_remaining_qty > 0 => this is the last record
1894: ELSE -- }{
1895: IF (g_asn_debug = 'Y') THEN
1896: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
1897: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
1898: END IF;
1899: END IF; --} ends the check for whether last record has been reached
1900:
1893: -- end x_remaining_qty > 0 => this is the last record
1894: ELSE -- }{
1895: IF (g_asn_debug = 'Y') THEN
1896: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
1897: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
1898: END IF;
1899: END IF; --} ends the check for whether last record has been reached
1900:
1901: -- close cursors
1899: END IF; --} ends the check for whether last record has been reached
1900:
1901: -- close cursors
1902:
1903: IF (g_asn_debug = 'Y') THEN
1904: asn_debug.put_line('Close cursors shipments, count_shipments, distributions, count_disributions ' || current_n);
1905: END IF;
1906:
1907: IF int_org_transfer%ISOPEN THEN
1900:
1901: -- close cursors
1902:
1903: IF (g_asn_debug = 'Y') THEN
1904: asn_debug.put_line('Close cursors shipments, count_shipments, distributions, count_disributions ' || current_n);
1905: END IF;
1906:
1907: IF int_org_transfer%ISOPEN THEN
1908: CLOSE int_org_transfer;
1911: IF int_org_transfer_rti%ISOPEN THEN
1912: CLOSE int_org_transfer_rti;
1913: END IF;
1914:
1915: IF (g_asn_debug = 'Y') THEN
1916: asn_debug.put_line('before exit current_n is ' || current_n);
1917: END IF;
1918:
1919: EXIT;
1912: CLOSE int_org_transfer_rti;
1913: END IF;
1914:
1915: IF (g_asn_debug = 'Y') THEN
1916: asn_debug.put_line('before exit current_n is ' || current_n);
1917: END IF;
1918:
1919: EXIT;
1920: END IF; --} matches lastrecord or x_remaining_quantity <= 0
1920: END IF; --} matches lastrecord or x_remaining_quantity <= 0
1921:
1922: -- eliminate the row if it fails the date check
1923:
1924: IF (g_asn_debug = 'Y') THEN
1925: asn_debug.put_line(' Entering qty calculateion for transfer');
1926: END IF;
1927:
1928: IF (x_first_trans)
1921:
1922: -- eliminate the row if it fails the date check
1923:
1924: IF (g_asn_debug = 'Y') THEN
1925: asn_debug.put_line(' Entering qty calculateion for transfer');
1926: END IF;
1927:
1928: IF (x_first_trans)
1929: AND temp_cascaded_table(current_n).item_id IS NULL THEN
1939: x_converted_parent_trx_qty
1940: );
1941:
1942: IF (x_converted_parent_trx_qty = 0) THEN --{
1943: IF (g_asn_debug = 'Y') THEN
1944: asn_debug.put_line('calling transfer get_available_qty ');
1945: END IF;
1946:
1947: -- the call for transfer/deliver should be the same
1940: );
1941:
1942: IF (x_converted_parent_trx_qty = 0) THEN --{
1943: IF (g_asn_debug = 'Y') THEN
1944: asn_debug.put_line('calling transfer get_available_qty ');
1945: END IF;
1946:
1947: -- the call for transfer/deliver should be the same
1948: rcv_quantities_s.get_available_quantity('TRANSFER',
1958: x_secondary_available_qty
1959: );
1960: END IF; --}
1961:
1962: IF (g_asn_debug = 'Y') THEN
1963: asn_debug.put_line('qty from GET_AVAILABLE_QUANTITY for transfer is ' || x_converted_parent_trx_qty);
1964: END IF;
1965:
1966: x_remaining_qty_parent_uom := rcv_roi_transaction.convert_into_correct_qty(x_remaining_quantity,
1959: );
1960: END IF; --}
1961:
1962: IF (g_asn_debug = 'Y') THEN
1963: asn_debug.put_line('qty from GET_AVAILABLE_QUANTITY for transfer is ' || x_converted_parent_trx_qty);
1964: END IF;
1965:
1966: x_remaining_qty_parent_uom := rcv_roi_transaction.convert_into_correct_qty(x_remaining_quantity,
1967: temp_cascaded_table(1).unit_of_measure,
1969: x_int_org_transferrec.unit_of_meas
1970: );
1971:
1972: IF (x_remaining_qty_parent_uom = 0) THEN --{
1973: IF (g_asn_debug = 'Y') THEN
1974: asn_debug.put_line(' Transfer Need an error message in the interface tables');
1975: END IF;
1976: ELSE /* Converted qty successfully and we have some quantity on which we can act */
1977: IF (g_asn_debug = 'Y') THEN
1970: );
1971:
1972: IF (x_remaining_qty_parent_uom = 0) THEN --{
1973: IF (g_asn_debug = 'Y') THEN
1974: asn_debug.put_line(' Transfer Need an error message in the interface tables');
1975: END IF;
1976: ELSE /* Converted qty successfully and we have some quantity on which we can act */
1977: IF (g_asn_debug = 'Y') THEN
1978: asn_debug.put_line('Converted trx qty that is available ' || x_converted_parent_trx_qty);
1973: IF (g_asn_debug = 'Y') THEN
1974: asn_debug.put_line(' Transfer Need an error message in the interface tables');
1975: END IF;
1976: ELSE /* Converted qty successfully and we have some quantity on which we can act */
1977: IF (g_asn_debug = 'Y') THEN
1978: asn_debug.put_line('Converted trx qty that is available ' || x_converted_parent_trx_qty);
1979: asn_debug.put_line('Remaining qty in parents uom that is available ' || x_remaining_qty_parent_uom);
1980: END IF;
1981:
1974: asn_debug.put_line(' Transfer Need an error message in the interface tables');
1975: END IF;
1976: ELSE /* Converted qty successfully and we have some quantity on which we can act */
1977: IF (g_asn_debug = 'Y') THEN
1978: asn_debug.put_line('Converted trx qty that is available ' || x_converted_parent_trx_qty);
1979: asn_debug.put_line('Remaining qty in parents uom that is available ' || x_remaining_qty_parent_uom);
1980: END IF;
1981:
1982: IF (x_converted_parent_trx_qty > 0) THEN --{
1975: END IF;
1976: ELSE /* Converted qty successfully and we have some quantity on which we can act */
1977: IF (g_asn_debug = 'Y') THEN
1978: asn_debug.put_line('Converted trx qty that is available ' || x_converted_parent_trx_qty);
1979: asn_debug.put_line('Remaining qty in parents uom that is available ' || x_remaining_qty_parent_uom);
1980: END IF;
1981:
1982: IF (x_converted_parent_trx_qty > 0) THEN --{
1983: IF (x_converted_parent_trx_qty < x_remaining_qty_parent_uom) THEN --{
1999: END IF;
2000:
2001: insert_into_table := TRUE;
2002: ELSE --}{
2003: IF (g_asn_debug = 'Y') THEN
2004: asn_debug.put_line('We are in >= Qty branch ');
2005: END IF;
2006:
2007: x_converted_parent_trx_qty := x_remaining_qty_parent_uom;
2000:
2001: insert_into_table := TRUE;
2002: ELSE --}{
2003: IF (g_asn_debug = 'Y') THEN
2004: asn_debug.put_line('We are in >= Qty branch ');
2005: END IF;
2006:
2007: x_converted_parent_trx_qty := x_remaining_qty_parent_uom;
2008: insert_into_table := TRUE;
2011: END IF; --} /* if (x_converted_parent_trx_qty < x_remaining_qty_parent_uom) then */
2012: ELSE /* x_converted_parent_trx_qty >0 */ --}{
2013: IF rows_fetched = x_record_count THEN -- { last row needs to be inserted anyway
2014: -- so that the row can be used based on qty tolerance checks
2015: IF (g_asn_debug = 'Y') THEN
2016: asn_debug.put_line('Quantity is less then 0 but last record');
2017: END IF;
2018:
2019: insert_into_table := TRUE;
2012: ELSE /* x_converted_parent_trx_qty >0 */ --}{
2013: IF rows_fetched = x_record_count THEN -- { last row needs to be inserted anyway
2014: -- so that the row can be used based on qty tolerance checks
2015: IF (g_asn_debug = 'Y') THEN
2016: asn_debug.put_line('Quantity is less then 0 but last record');
2017: END IF;
2018:
2019: insert_into_table := TRUE;
2020: x_converted_trx_qty := 0;
2018:
2019: insert_into_table := TRUE;
2020: x_converted_trx_qty := 0;
2021: ELSE --}{
2022: IF (g_asn_debug = 'Y') THEN
2023: asn_debug.put_line('<= 0 Quantity but more records in cursor');
2024: END IF;
2025:
2026: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
2019: insert_into_table := TRUE;
2020: x_converted_trx_qty := 0;
2021: ELSE --}{
2022: IF (g_asn_debug = 'Y') THEN
2023: asn_debug.put_line('<= 0 Quantity but more records in cursor');
2024: END IF;
2025:
2026: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
2027:
2024: END IF;
2025:
2026: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
2027:
2028: IF (g_asn_debug = 'Y') THEN
2029: asn_debug.put_line('We have to deal with remaining_qty > 0 and x_converted_trx_qty -ve');
2030: END IF;
2031:
2032: insert_into_table := FALSE;
2025:
2026: x_remaining_qty_po_uom := 0; -- we may have a diff uom on the next iteration
2027:
2028: IF (g_asn_debug = 'Y') THEN
2029: asn_debug.put_line('We have to deal with remaining_qty > 0 and x_converted_trx_qty -ve');
2030: END IF;
2031:
2032: insert_into_table := FALSE;
2033: END IF; --}
2033: END IF; --}
2034: END IF; /*x_converted_parent_trx_qty >0 */ --}
2035: END IF; -- } Converted qty successfully and we have some quantity on which we can act
2036:
2037: IF (g_asn_debug = 'Y') THEN
2038: asn_debug.put_line('Transaction qty in terms of the parents uom is ' || x_converted_parent_trx_qty);
2039: END IF;
2040:
2041: IF insert_into_table THEN --{ --start
2034: END IF; /*x_converted_parent_trx_qty >0 */ --}
2035: END IF; -- } Converted qty successfully and we have some quantity on which we can act
2036:
2037: IF (g_asn_debug = 'Y') THEN
2038: asn_debug.put_line('Transaction qty in terms of the parents uom is ' || x_converted_parent_trx_qty);
2039: END IF;
2040:
2041: IF insert_into_table THEN --{ --start
2042: IF (x_first_trans) THEN --{
2039: END IF;
2040:
2041: IF insert_into_table THEN --{ --start
2042: IF (x_first_trans) THEN --{
2043: IF (g_asn_debug = 'Y') THEN
2044: asn_debug.put_line('First Time ' || TO_CHAR(current_n));
2045: END IF;
2046:
2047: x_first_trans := FALSE;
2040:
2041: IF insert_into_table THEN --{ --start
2042: IF (x_first_trans) THEN --{
2043: IF (g_asn_debug = 'Y') THEN
2044: asn_debug.put_line('First Time ' || TO_CHAR(current_n));
2045: END IF;
2046:
2047: x_first_trans := FALSE;
2048: ELSE --}{
2045: END IF;
2046:
2047: x_first_trans := FALSE;
2048: ELSE --}{
2049: IF (g_asn_debug = 'Y') THEN
2050: asn_debug.put_line('Next Time ' || TO_CHAR(current_n));
2051: END IF;
2052:
2053: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
2046:
2047: x_first_trans := FALSE;
2048: ELSE --}{
2049: IF (g_asn_debug = 'Y') THEN
2050: asn_debug.put_line('Next Time ' || TO_CHAR(current_n));
2051: END IF;
2052:
2053: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
2054: END IF; --}
2061: temp_cascaded_table(current_n).item_id,
2062: temp_cascaded_table(current_n).unit_of_measure
2063: ); -- in asn uom
2064:
2065: IF (g_asn_debug = 'Y') THEN
2066: asn_debug.put_line('Transaction qty in terms of the transaction uom is ' || temp_cascaded_table(current_n).quantity);
2067: END IF;
2068: ELSE
2069: temp_cascaded_table(current_n).quantity := x_converted_parent_trx_qty;
2062: temp_cascaded_table(current_n).unit_of_measure
2063: ); -- in asn uom
2064:
2065: IF (g_asn_debug = 'Y') THEN
2066: asn_debug.put_line('Transaction qty in terms of the transaction uom is ' || temp_cascaded_table(current_n).quantity);
2067: END IF;
2068: ELSE
2069: temp_cascaded_table(current_n).quantity := x_converted_parent_trx_qty;
2070: END IF;
2078: ELSE
2079: temp_cascaded_table(current_n).primary_quantity := x_converted_parent_trx_qty;
2080: END IF;
2081:
2082: IF (g_asn_debug = 'Y') THEN
2083: asn_debug.put_line('Transaction qty in terms of the primary uom is ' || temp_cascaded_table(current_n).primary_quantity);
2084: END IF;
2085:
2086: --sugatas put here
2079: temp_cascaded_table(current_n).primary_quantity := x_converted_parent_trx_qty;
2080: END IF;
2081:
2082: IF (g_asn_debug = 'Y') THEN
2083: asn_debug.put_line('Transaction qty in terms of the primary uom is ' || temp_cascaded_table(current_n).primary_quantity);
2084: END IF;
2085:
2086: --sugatas put here
2087: --temp_cascaded_table(current_n).inspection_status_code := x_int_org_transferrec.inspection_status_code;
2122: EXCEPTION
2123: WHEN NO_DATA_FOUND THEN
2124: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2125:
2126: IF (g_asn_debug = 'Y') THEN
2127: asn_debug.put_line('The deliver to person entered in IOT is currently inactive');
2128: asn_debug.put_line(' So it is cleared off');
2129: END IF;
2130: WHEN OTHERS THEN
2123: WHEN NO_DATA_FOUND THEN
2124: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2125:
2126: IF (g_asn_debug = 'Y') THEN
2127: asn_debug.put_line('The deliver to person entered in IOT is currently inactive');
2128: asn_debug.put_line(' So it is cleared off');
2129: END IF;
2130: WHEN OTHERS THEN
2131: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2124: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2125:
2126: IF (g_asn_debug = 'Y') THEN
2127: asn_debug.put_line('The deliver to person entered in IOT is currently inactive');
2128: asn_debug.put_line(' So it is cleared off');
2129: END IF;
2130: WHEN OTHERS THEN
2131: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2132:
2129: END IF;
2130: WHEN OTHERS THEN
2131: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2132:
2133: IF (g_asn_debug = 'Y') THEN
2134: asn_debug.put_line('Some exception has occured');
2135: asn_debug.put_line('This exception is due to the IOT deliver to person');
2136: asn_debug.put_line('The deliver to person is optional');
2137: asn_debug.put_line('So cleared off the deliver to person');
2130: WHEN OTHERS THEN
2131: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2132:
2133: IF (g_asn_debug = 'Y') THEN
2134: asn_debug.put_line('Some exception has occured');
2135: asn_debug.put_line('This exception is due to the IOT deliver to person');
2136: asn_debug.put_line('The deliver to person is optional');
2137: asn_debug.put_line('So cleared off the deliver to person');
2138: END IF;
2131: temp_cascaded_table(current_n).deliver_to_person_id := NULL;
2132:
2133: IF (g_asn_debug = 'Y') THEN
2134: asn_debug.put_line('Some exception has occured');
2135: asn_debug.put_line('This exception is due to the IOT deliver to person');
2136: asn_debug.put_line('The deliver to person is optional');
2137: asn_debug.put_line('So cleared off the deliver to person');
2138: END IF;
2139: END;
2132:
2133: IF (g_asn_debug = 'Y') THEN
2134: asn_debug.put_line('Some exception has occured');
2135: asn_debug.put_line('This exception is due to the IOT deliver to person');
2136: asn_debug.put_line('The deliver to person is optional');
2137: asn_debug.put_line('So cleared off the deliver to person');
2138: END IF;
2139: END;
2140: END IF; --}
2133: IF (g_asn_debug = 'Y') THEN
2134: asn_debug.put_line('Some exception has occured');
2135: asn_debug.put_line('This exception is due to the IOT deliver to person');
2136: asn_debug.put_line('The deliver to person is optional');
2137: asn_debug.put_line('So cleared off the deliver to person');
2138: END IF;
2139: END;
2140: END IF; --}
2141: END IF; --}
2146: END IF; --}
2147:
2148: current_n := current_n + 1;
2149:
2150: IF (g_asn_debug = 'Y') THEN
2151: asn_debug.put_line('Increment pointer by 1 ' || TO_CHAR(current_n));
2152: END IF;
2153: END IF; --}
2154:
2147:
2148: current_n := current_n + 1;
2149:
2150: IF (g_asn_debug = 'Y') THEN
2151: asn_debug.put_line('Increment pointer by 1 ' || TO_CHAR(current_n));
2152: END IF;
2153: END IF; --}
2154:
2155: asn_debug.put_line('finished processing one row in derive_qty for IOT transfers/delivers/accept/reject ');
2151: asn_debug.put_line('Increment pointer by 1 ' || TO_CHAR(current_n));
2152: END IF;
2153: END IF; --}
2154:
2155: asn_debug.put_line('finished processing one row in derive_qty for IOT transfers/delivers/accept/reject ');
2156: END LOOP; --}
2157:
2158: IF (g_asn_debug = 'Y') THEN
2159: asn_debug.put_line('before closing cursors current_n is ' || temp_cascaded_table.COUNT);
2154:
2155: asn_debug.put_line('finished processing one row in derive_qty for IOT transfers/delivers/accept/reject ');
2156: END LOOP; --}
2157:
2158: IF (g_asn_debug = 'Y') THEN
2159: asn_debug.put_line('before closing cursors current_n is ' || temp_cascaded_table.COUNT);
2160: END IF;
2161:
2162: IF int_org_transfer%ISOPEN THEN
2155: asn_debug.put_line('finished processing one row in derive_qty for IOT transfers/delivers/accept/reject ');
2156: END LOOP; --}
2157:
2158: IF (g_asn_debug = 'Y') THEN
2159: asn_debug.put_line('before closing cursors current_n is ' || temp_cascaded_table.COUNT);
2160: END IF;
2161:
2162: IF int_org_transfer%ISOPEN THEN
2163: CLOSE int_org_transfer;
2166: IF int_org_transfer_rti%ISOPEN THEN
2167: CLOSE int_org_transfer_rti;
2168: END IF;
2169:
2170: IF (g_asn_debug = 'Y') THEN
2171: asn_debug.put_line('Exit derive_trans_del_line_quantity');
2172: END IF;
2173: EXCEPTION
2174: WHEN rcv_error_pkg.e_fatal_error THEN
2167: CLOSE int_org_transfer_rti;
2168: END IF;
2169:
2170: IF (g_asn_debug = 'Y') THEN
2171: asn_debug.put_line('Exit derive_trans_del_line_quantity');
2172: END IF;
2173: EXCEPTION
2174: WHEN rcv_error_pkg.e_fatal_error THEN
2175: IF int_org_transfer%ISOPEN THEN
2192: rcv_error_pkg.set_sql_error_message('derive_trans_del_line_quantity', x_progress);
2193: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
2194: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
2195:
2196: IF (g_asn_debug = 'Y') THEN
2197: asn_debug.put_line(TO_CHAR(n));
2198: asn_debug.put_line(SQLERRM);
2199: asn_debug.put_line('error ' || x_progress);
2200: END IF;
2193: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
2194: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
2195:
2196: IF (g_asn_debug = 'Y') THEN
2197: asn_debug.put_line(TO_CHAR(n));
2198: asn_debug.put_line(SQLERRM);
2199: asn_debug.put_line('error ' || x_progress);
2200: END IF;
2201: END derive_trans_del_line_quantity;
2194: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
2195:
2196: IF (g_asn_debug = 'Y') THEN
2197: asn_debug.put_line(TO_CHAR(n));
2198: asn_debug.put_line(SQLERRM);
2199: asn_debug.put_line('error ' || x_progress);
2200: END IF;
2201: END derive_trans_del_line_quantity;
2202:
2195:
2196: IF (g_asn_debug = 'Y') THEN
2197: asn_debug.put_line(TO_CHAR(n));
2198: asn_debug.put_line(SQLERRM);
2199: asn_debug.put_line('error ' || x_progress);
2200: END IF;
2201: END derive_trans_del_line_quantity;
2202:
2203: /*-------- corrections --------------------------*/
2207: temp_cascaded_table IN OUT NOCOPY rcv_roi_preprocessor.cascaded_trans_tab_type,
2208: x_header_record IN rcv_roi_preprocessor.header_rec_type
2209: ) IS
2210: BEGIN
2211: IF (g_asn_debug = 'Y') THEN
2212: asn_debug.put_line('enter derive_correction_line ');
2213: END IF;
2214:
2215: /* Derive the to_org_id */
2208: x_header_record IN rcv_roi_preprocessor.header_rec_type
2209: ) IS
2210: BEGIN
2211: IF (g_asn_debug = 'Y') THEN
2212: asn_debug.put_line('enter derive_correction_line ');
2213: END IF;
2214:
2215: /* Derive the to_org_id */
2216: rcv_roi_transaction.derive_ship_to_org_info(x_cascaded_table,
2218: x_header_record
2219: );
2220:
2221: IF (x_cascaded_table(n).unit_of_measure IS NOT NULL) THEN
2222: IF (g_asn_debug = 'Y') THEN
2223: asn_debug.put_line('X_progress ' || x_progress);
2224: END IF;
2225:
2226: SELECT muom.uom_code
2219: );
2220:
2221: IF (x_cascaded_table(n).unit_of_measure IS NOT NULL) THEN
2222: IF (g_asn_debug = 'Y') THEN
2223: asn_debug.put_line('X_progress ' || x_progress);
2224: END IF;
2225:
2226: SELECT muom.uom_code
2227: INTO x_cascaded_table(n).uom_code
2227: INTO x_cascaded_table(n).uom_code
2228: FROM mtl_units_of_measure muom
2229: WHERE muom.unit_of_measure = x_cascaded_table(n).unit_of_measure;
2230: ELSE
2231: IF (g_asn_debug = 'Y') THEN
2232: asn_debug.put_line('uom_code not dereived as unit_of_measure is null');
2233: END IF;
2234: END IF;
2235:
2228: FROM mtl_units_of_measure muom
2229: WHERE muom.unit_of_measure = x_cascaded_table(n).unit_of_measure;
2230: ELSE
2231: IF (g_asn_debug = 'Y') THEN
2232: asn_debug.put_line('uom_code not dereived as unit_of_measure is null');
2233: END IF;
2234: END IF;
2235:
2236: x_progress := '091';
2348: l_item_id NUMBER;
2349: /* Bug#5369121 */
2350:
2351: BEGIN
2352: IF (g_asn_debug = 'Y') THEN
2353: asn_debug.put_line('enter derive_quantity ' || x_cascaded_table(n).parent_transaction_id);
2354: END IF;
2355:
2356: IF (x_cascaded_table(n).parent_transaction_id IS NOT NULL) THEN --{
2349: /* Bug#5369121 */
2350:
2351: BEGIN
2352: IF (g_asn_debug = 'Y') THEN
2353: asn_debug.put_line('enter derive_quantity ' || x_cascaded_table(n).parent_transaction_id);
2354: END IF;
2355:
2356: IF (x_cascaded_table(n).parent_transaction_id IS NOT NULL) THEN --{
2357: already_derived := TRUE;
2377: END;
2378: END IF; --}
2379:
2380: IF already_derived THEN --{
2381: IF (g_asn_debug = 'Y') THEN
2382: asn_debug.put_line(' open int_org_cor_rt table ' || x_cascaded_table(n).parent_transaction_id);
2383: END IF;
2384:
2385: OPEN int_org_cor_rt(x_cascaded_table(n).parent_transaction_id, x_cascaded_table(n).to_organization_id);
2378: END IF; --}
2379:
2380: IF already_derived THEN --{
2381: IF (g_asn_debug = 'Y') THEN
2382: asn_debug.put_line(' open int_org_cor_rt table ' || x_cascaded_table(n).parent_transaction_id);
2383: END IF;
2384:
2385: OPEN int_org_cor_rt(x_cascaded_table(n).parent_transaction_id, x_cascaded_table(n).to_organization_id);
2386: END IF; ---}
2402: * We will have x_cascaded_table(n).
2403: * parent_interface_txn_id) populated with teh
2404: * correct value.
2405: */
2406: IF (g_asn_debug = 'Y') THEN
2407: asn_debug.put_line(' open pl/sql table');
2408: END IF;
2409:
2410: OPEN int_org_cor_rti(x_cascaded_table(n).parent_interface_txn_id);
2403: * parent_interface_txn_id) populated with teh
2404: * correct value.
2405: */
2406: IF (g_asn_debug = 'Y') THEN
2407: asn_debug.put_line(' open pl/sql table');
2408: END IF;
2409:
2410: OPEN int_org_cor_rti(x_cascaded_table(n).parent_interface_txn_id);
2411: END IF;
2414: /******************************************************************/
2415: --check line quanity > 0
2416: x_progress := '097';
2417:
2418: IF (g_asn_debug = 'Y') THEN
2419: asn_debug.put_line('X_progress ' || x_progress);
2420: END IF;
2421:
2422: IF (x_cascaded_table(n).error_status NOT IN('S', 'W')) THEN
2415: --check line quanity > 0
2416: x_progress := '097';
2417:
2418: IF (g_asn_debug = 'Y') THEN
2419: asn_debug.put_line('X_progress ' || x_progress);
2420: END IF;
2421:
2422: IF (x_cascaded_table(n).error_status NOT IN('S', 'W')) THEN
2423: RETURN;
2423: RETURN;
2424: END IF;
2425:
2426: IF (x_cascaded_table(n).quantity = 0) THEN --{
2427: IF (g_asn_debug = 'Y') THEN
2428: asn_debug.put_line('Quantity is <= zero. Cascade will fail');
2429: END IF;
2430:
2431: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
2424: END IF;
2425:
2426: IF (x_cascaded_table(n).quantity = 0) THEN --{
2427: IF (g_asn_debug = 'Y') THEN
2428: asn_debug.put_line('Quantity is <= zero. Cascade will fail');
2429: END IF;
2430:
2431: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
2432: rcv_error_pkg.set_error_message('RCV_ITEM_NO_SHIP_QTY', x_cascaded_table(n).error_message);
2435: END IF; --} end qty > 0 check
2436:
2437: x_progress := '098';
2438:
2439: IF (g_asn_debug = 'Y') THEN
2440: asn_debug.put_line('X_progress ' || x_progress);
2441: END IF;
2442:
2443: IF ( x_cascaded_table(n).parent_transaction_id IS NULL
2436:
2437: x_progress := '098';
2438:
2439: IF (g_asn_debug = 'Y') THEN
2440: asn_debug.put_line('X_progress ' || x_progress);
2441: END IF;
2442:
2443: IF ( x_cascaded_table(n).parent_transaction_id IS NULL
2444: AND x_cascaded_table(n).parent_interface_txn_id IS NULL) THEN
2441: END IF;
2442:
2443: IF ( x_cascaded_table(n).parent_transaction_id IS NULL
2444: AND x_cascaded_table(n).parent_interface_txn_id IS NULL) THEN
2445: IF (g_asn_debug = 'Y') THEN
2446: asn_debug.put_line('No parent transaction found ');
2447: END IF;
2448:
2449: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
2442:
2443: IF ( x_cascaded_table(n).parent_transaction_id IS NULL
2444: AND x_cascaded_table(n).parent_interface_txn_id IS NULL) THEN
2445: IF (g_asn_debug = 'Y') THEN
2446: asn_debug.put_line('No parent transaction found ');
2447: END IF;
2448:
2449: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
2450: rcv_error_pkg.set_error_message('RCV_NO_PARENT_TRANSACTION', x_cascaded_table(n).error_message);
2451: rcv_error_pkg.log_interface_error('PARENT_TRANSACTION_ID');
2452: END IF;
2453:
2454: -- Copy record from main table to temp table
2455: IF (g_asn_debug = 'Y') THEN
2456: asn_debug.put_line('Copy record from main table to temp table');
2457: END IF;
2458:
2459: current_n := 1;
2452: END IF;
2453:
2454: -- Copy record from main table to temp table
2455: IF (g_asn_debug = 'Y') THEN
2456: asn_debug.put_line('Copy record from main table to temp table');
2457: END IF;
2458:
2459: current_n := 1;
2460: temp_cascaded_table(current_n) := x_cascaded_table(n);
2459: current_n := 1;
2460: temp_cascaded_table(current_n) := x_cascaded_table(n);
2461:
2462: -- Get all rows which meet this condition
2463: IF (g_asn_debug = 'Y') THEN
2464: asn_debug.put_line('Get all rows which meet this condition');
2465: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
2466: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
2467: END IF;
2460: temp_cascaded_table(current_n) := x_cascaded_table(n);
2461:
2462: -- Get all rows which meet this condition
2463: IF (g_asn_debug = 'Y') THEN
2464: asn_debug.put_line('Get all rows which meet this condition');
2465: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
2466: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
2467: END IF;
2468:
2461:
2462: -- Get all rows which meet this condition
2463: IF (g_asn_debug = 'Y') THEN
2464: asn_debug.put_line('Get all rows which meet this condition');
2465: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
2466: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
2467: END IF;
2468:
2469: -- Assign shipped quantity to remaining quantity
2462: -- Get all rows which meet this condition
2463: IF (g_asn_debug = 'Y') THEN
2464: asn_debug.put_line('Get all rows which meet this condition');
2465: asn_debug.put_line('Transaction Type = ' || x_cascaded_table(n).transaction_type);
2466: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
2467: END IF;
2468:
2469: -- Assign shipped quantity to remaining quantity
2470: IF (g_asn_debug = 'Y') THEN
2466: asn_debug.put_line('Auto Transact Code = ' || x_cascaded_table(n).auto_transact_code);
2467: END IF;
2468:
2469: -- Assign shipped quantity to remaining quantity
2470: IF (g_asn_debug = 'Y') THEN
2471: asn_debug.put_line('Assign populated quantity to remaining quantity');
2472: asn_debug.put_line('Pointer in temp_cascade ' || TO_CHAR(current_n));
2473: END IF;
2474:
2467: END IF;
2468:
2469: -- Assign shipped quantity to remaining quantity
2470: IF (g_asn_debug = 'Y') THEN
2471: asn_debug.put_line('Assign populated quantity to remaining quantity');
2472: asn_debug.put_line('Pointer in temp_cascade ' || TO_CHAR(current_n));
2473: END IF;
2474:
2475: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
2468:
2469: -- Assign shipped quantity to remaining quantity
2470: IF (g_asn_debug = 'Y') THEN
2471: asn_debug.put_line('Assign populated quantity to remaining quantity');
2472: asn_debug.put_line('Pointer in temp_cascade ' || TO_CHAR(current_n));
2473: END IF;
2474:
2475: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
2476:
2473: END IF;
2474:
2475: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
2476:
2477: IF (g_asn_debug = 'Y') THEN
2478: asn_debug.put_line('Have assigned the quantity');
2479: END IF;
2480:
2481: -- Calculate tax_amount_factor for calculating tax_amount for
2474:
2475: x_remaining_quantity := temp_cascaded_table(current_n).quantity;
2476:
2477: IF (g_asn_debug = 'Y') THEN
2478: asn_debug.put_line('Have assigned the quantity');
2479: END IF;
2480:
2481: -- Calculate tax_amount_factor for calculating tax_amount for
2482: -- each cascaded line
2486: ELSE
2487: tax_amount_factor := 0;
2488: END IF;
2489:
2490: IF (g_asn_debug = 'Y') THEN
2491: asn_debug.put_line('Tax Factor ' || TO_CHAR(tax_amount_factor));
2492: asn_debug.put_line('transaction Quantity : ' || TO_CHAR(x_remaining_quantity));
2493: END IF;
2494:
2487: tax_amount_factor := 0;
2488: END IF;
2489:
2490: IF (g_asn_debug = 'Y') THEN
2491: asn_debug.put_line('Tax Factor ' || TO_CHAR(tax_amount_factor));
2492: asn_debug.put_line('transaction Quantity : ' || TO_CHAR(x_remaining_quantity));
2493: END IF;
2494:
2495: x_first_trans := TRUE;
2488: END IF;
2489:
2490: IF (g_asn_debug = 'Y') THEN
2491: asn_debug.put_line('Tax Factor ' || TO_CHAR(tax_amount_factor));
2492: asn_debug.put_line('transaction Quantity : ' || TO_CHAR(x_remaining_quantity));
2493: END IF;
2494:
2495: x_first_trans := TRUE;
2496:
2493: END IF;
2494:
2495: x_first_trans := TRUE;
2496:
2497: IF (g_asn_debug = 'Y') THEN
2498: asn_debug.put_line('Before starting Cascade');
2499: END IF;
2500:
2501: IF (g_asn_debug = 'Y') THEN
2494:
2495: x_first_trans := TRUE;
2496:
2497: IF (g_asn_debug = 'Y') THEN
2498: asn_debug.put_line('Before starting Cascade');
2499: END IF;
2500:
2501: IF (g_asn_debug = 'Y') THEN
2502: asn_debug.put_line('Record Count = ' || x_record_count);
2497: IF (g_asn_debug = 'Y') THEN
2498: asn_debug.put_line('Before starting Cascade');
2499: END IF;
2500:
2501: IF (g_asn_debug = 'Y') THEN
2502: asn_debug.put_line('Record Count = ' || x_record_count);
2503: END IF;
2504:
2505: LOOP --{
2498: asn_debug.put_line('Before starting Cascade');
2499: END IF;
2500:
2501: IF (g_asn_debug = 'Y') THEN
2502: asn_debug.put_line('Record Count = ' || x_record_count);
2503: END IF;
2504:
2505: LOOP --{
2506: IF (g_asn_debug = 'Y') THEN
2502: asn_debug.put_line('Record Count = ' || x_record_count);
2503: END IF;
2504:
2505: LOOP --{
2506: IF (g_asn_debug = 'Y') THEN
2507: asn_debug.put_line('Remaining Quantity ' || TO_CHAR(x_remaining_quantity));
2508: END IF;
2509:
2510: /*
2503: END IF;
2504:
2505: LOOP --{
2506: IF (g_asn_debug = 'Y') THEN
2507: asn_debug.put_line('Remaining Quantity ' || TO_CHAR(x_remaining_quantity));
2508: END IF;
2509:
2510: /*
2511: ** Fetch the appropriate record
2510: /*
2511: ** Fetch the appropriate record
2512: */
2513: IF (int_org_cor_rt%ISOPEN) THEN --{
2514: IF (g_asn_debug = 'Y') THEN
2515: asn_debug.put_line(' fetch int_org_cor_rt');
2516: END IF;
2517:
2518: FETCH int_org_cor_rt INTO int_org_cor_rec;
2511: ** Fetch the appropriate record
2512: */
2513: IF (int_org_cor_rt%ISOPEN) THEN --{
2514: IF (g_asn_debug = 'Y') THEN
2515: asn_debug.put_line(' fetch int_org_cor_rt');
2516: END IF;
2517:
2518: FETCH int_org_cor_rt INTO int_org_cor_rec;
2519:
2522: END IF;
2523:
2524: rows_fetched := int_org_cor_rt%ROWCOUNT;
2525: ELSIF(int_org_cor_rti%ISOPEN) THEN --}{
2526: IF (g_asn_debug = 'Y') THEN
2527: asn_debug.put_line(' fetch int_org_cor_rti');
2528: END IF;
2529:
2530: FETCH int_org_cor_rti INTO int_org_cor_rec;
2523:
2524: rows_fetched := int_org_cor_rt%ROWCOUNT;
2525: ELSIF(int_org_cor_rti%ISOPEN) THEN --}{
2526: IF (g_asn_debug = 'Y') THEN
2527: asn_debug.put_line(' fetch int_org_cor_rti');
2528: END IF;
2529:
2530: FETCH int_org_cor_rti INTO int_org_cor_rec;
2531:
2529:
2530: FETCH int_org_cor_rti INTO int_org_cor_rec;
2531:
2532: IF (int_org_cor_rti%NOTFOUND) THEN
2533: IF (g_asn_debug = 'Y') THEN
2534: asn_debug.put_line('correct last row');
2535: END IF;
2536:
2537: lastrecord := TRUE;
2530: FETCH int_org_cor_rti INTO int_org_cor_rec;
2531:
2532: IF (int_org_cor_rti%NOTFOUND) THEN
2533: IF (g_asn_debug = 'Y') THEN
2534: asn_debug.put_line('correct last row');
2535: END IF;
2536:
2537: lastrecord := TRUE;
2538: END IF;
2539:
2540: rows_fetched := int_org_cor_rti%ROWCOUNT;
2541: ELSIF(temp_cascaded_table(current_n).derive = 'Y') THEN --}{
2542: /* GET VALUES FROM THE PLSQL TABLE */
2543: IF (g_asn_debug = 'Y') THEN
2544: asn_debug.put_line(' fetch pl/sql table');
2545: END IF;
2546:
2547: temp_index := temp_cascaded_table(current_n).derive_index;
2540: rows_fetched := int_org_cor_rti%ROWCOUNT;
2541: ELSIF(temp_cascaded_table(current_n).derive = 'Y') THEN --}{
2542: /* GET VALUES FROM THE PLSQL TABLE */
2543: IF (g_asn_debug = 'Y') THEN
2544: asn_debug.put_line(' fetch pl/sql table');
2545: END IF;
2546:
2547: temp_index := temp_cascaded_table(current_n).derive_index;
2548: int_org_cor_rec.unit_of_meas := x_cascaded_table(temp_index).unit_of_measure;
2570: lastrecord := TRUE;
2571: END IF; --}
2572: --x_remaining_quantity:= temp_cascaded_table(current_n).quantity;
2573:
2574: IF (g_asn_debug = 'Y') THEN
2575: asn_debug.put_line('Correct Rows fetched ' || TO_CHAR(rows_fetched));
2576: asn_debug.put_line('correct remainaing qty ' || x_remaining_quantity);
2577: END IF;
2578:
2571: END IF; --}
2572: --x_remaining_quantity:= temp_cascaded_table(current_n).quantity;
2573:
2574: IF (g_asn_debug = 'Y') THEN
2575: asn_debug.put_line('Correct Rows fetched ' || TO_CHAR(rows_fetched));
2576: asn_debug.put_line('correct remainaing qty ' || x_remaining_quantity);
2577: END IF;
2578:
2579: IF (lastrecord) THEN --{
2572: --x_remaining_quantity:= temp_cascaded_table(current_n).quantity;
2573:
2574: IF (g_asn_debug = 'Y') THEN
2575: asn_debug.put_line('Correct Rows fetched ' || TO_CHAR(rows_fetched));
2576: asn_debug.put_line('correct remainaing qty ' || x_remaining_quantity);
2577: END IF;
2578:
2579: IF (lastrecord) THEN --{
2580: IF (g_asn_debug = 'Y') THEN
2576: asn_debug.put_line('correct remainaing qty ' || x_remaining_quantity);
2577: END IF;
2578:
2579: IF (lastrecord) THEN --{
2580: IF (g_asn_debug = 'Y') THEN
2581: asn_debug.put_line('Hit exit condition');
2582: END IF;
2583:
2584: IF NOT x_first_trans THEN
2577: END IF;
2578:
2579: IF (lastrecord) THEN --{
2580: IF (g_asn_debug = 'Y') THEN
2581: asn_debug.put_line('Hit exit condition');
2582: END IF;
2583:
2584: IF NOT x_first_trans THEN
2585: -- x_first_trans has been reset which means some cascade has
2583:
2584: IF NOT x_first_trans THEN
2585: -- x_first_trans has been reset which means some cascade has
2586: -- happened. Otherwise current_n = 1
2587: IF (g_asn_debug = 'Y') THEN
2588: asn_debug.put_line('current_n before is ' || current_n);
2589: END IF;
2590:
2591: current_n := current_n - 1;
2584: IF NOT x_first_trans THEN
2585: -- x_first_trans has been reset which means some cascade has
2586: -- happened. Otherwise current_n = 1
2587: IF (g_asn_debug = 'Y') THEN
2588: asn_debug.put_line('current_n before is ' || current_n);
2589: END IF;
2590:
2591: current_n := current_n - 1;
2592: END IF;
2591: current_n := current_n - 1;
2592: END IF;
2593:
2594: -- do the tolerance act here
2595: IF (g_asn_debug = 'Y') THEN
2596: asn_debug.put_line('Temp table pointer ' || TO_CHAR(current_n));
2597: asn_debug.put_line('Check which condition has occured');
2598: END IF;
2599:
2592: END IF;
2593:
2594: -- do the tolerance act here
2595: IF (g_asn_debug = 'Y') THEN
2596: asn_debug.put_line('Temp table pointer ' || TO_CHAR(current_n));
2597: asn_debug.put_line('Check which condition has occured');
2598: END IF;
2599:
2600: -- lastrecord...we have run out of rows and we still have quantity to allocate
2593:
2594: -- do the tolerance act here
2595: IF (g_asn_debug = 'Y') THEN
2596: asn_debug.put_line('Temp table pointer ' || TO_CHAR(current_n));
2597: asn_debug.put_line('Check which condition has occured');
2598: END IF;
2599:
2600: -- lastrecord...we have run out of rows and we still have quantity to allocate
2601: /* Do abs(x_remaining_quantity) since it can be a negative
2601: /* Do abs(x_remaining_quantity) since it can be a negative
2602: * or positive correction.
2603: */
2604: IF ABS(x_remaining_quantity) > 0 THEN --{
2605: IF (g_asn_debug = 'Y') THEN
2606: asn_debug.put_line('There is quantity remaining ');
2607: asn_debug.put_line('tolerable quantity now in plsql table ' || temp_cascaded_table(current_n).quantity);
2608: asn_debug.put_line('rows_fetched ' || rows_fetched);
2609: END IF;
2602: * or positive correction.
2603: */
2604: IF ABS(x_remaining_quantity) > 0 THEN --{
2605: IF (g_asn_debug = 'Y') THEN
2606: asn_debug.put_line('There is quantity remaining ');
2607: asn_debug.put_line('tolerable quantity now in plsql table ' || temp_cascaded_table(current_n).quantity);
2608: asn_debug.put_line('rows_fetched ' || rows_fetched);
2609: END IF;
2610:
2603: */
2604: IF ABS(x_remaining_quantity) > 0 THEN --{
2605: IF (g_asn_debug = 'Y') THEN
2606: asn_debug.put_line('There is quantity remaining ');
2607: asn_debug.put_line('tolerable quantity now in plsql table ' || temp_cascaded_table(current_n).quantity);
2608: asn_debug.put_line('rows_fetched ' || rows_fetched);
2609: END IF;
2610:
2611: IF NOT x_first_trans THEN
2604: IF ABS(x_remaining_quantity) > 0 THEN --{
2605: IF (g_asn_debug = 'Y') THEN
2606: asn_debug.put_line('There is quantity remaining ');
2607: asn_debug.put_line('tolerable quantity now in plsql table ' || temp_cascaded_table(current_n).quantity);
2608: asn_debug.put_line('rows_fetched ' || rows_fetched);
2609: END IF;
2610:
2611: IF NOT x_first_trans THEN
2612: asn_debug.put_line('not first txn');
2608: asn_debug.put_line('rows_fetched ' || rows_fetched);
2609: END IF;
2610:
2611: IF NOT x_first_trans THEN
2612: asn_debug.put_line('not first txn');
2613: END IF;
2614:
2615: IF rows_fetched > 0
2616: AND NOT x_first_trans THEN --{
2613: END IF;
2614:
2615: IF rows_fetched > 0
2616: AND NOT x_first_trans THEN --{
2617: IF (g_asn_debug = 'Y') THEN
2618: asn_debug.put_line(' inside transaction_type ' || int_org_cor_rec.parent_transaction_type);
2619: END IF;
2620:
2621: IF (SIGN(temp_cascaded_table(current_n).quantity) IN(-1, -1)) THEN --{
2614:
2615: IF rows_fetched > 0
2616: AND NOT x_first_trans THEN --{
2617: IF (g_asn_debug = 'Y') THEN
2618: asn_debug.put_line(' inside transaction_type ' || int_org_cor_rec.parent_transaction_type);
2619: END IF;
2620:
2621: IF (SIGN(temp_cascaded_table(current_n).quantity) IN(-1, -1)) THEN --{
2622: /* for correct,accept an reject type we dont have the
2622: /* for correct,accept an reject type we dont have the
2623: * tolerance check. Hence error out.
2624: * We cannot correct quantities more than that was received.
2625: */
2626: IF (g_asn_debug = 'Y') THEN
2627: asn_debug.put_line(' in correct extra Quantity ' || TO_CHAR(x_remaining_quantity));
2628: END IF;
2629:
2630: IF (g_asn_debug = 'Y') THEN
2623: * tolerance check. Hence error out.
2624: * We cannot correct quantities more than that was received.
2625: */
2626: IF (g_asn_debug = 'Y') THEN
2627: asn_debug.put_line(' in correct extra Quantity ' || TO_CHAR(x_remaining_quantity));
2628: END IF;
2629:
2630: IF (g_asn_debug = 'Y') THEN
2631: asn_debug.put_line('delete the temp table ');
2626: IF (g_asn_debug = 'Y') THEN
2627: asn_debug.put_line(' in correct extra Quantity ' || TO_CHAR(x_remaining_quantity));
2628: END IF;
2629:
2630: IF (g_asn_debug = 'Y') THEN
2631: asn_debug.put_line('delete the temp table ');
2632: END IF;
2633:
2634: IF temp_cascaded_table.COUNT > 0 THEN
2627: asn_debug.put_line(' in correct extra Quantity ' || TO_CHAR(x_remaining_quantity));
2628: END IF;
2629:
2630: IF (g_asn_debug = 'Y') THEN
2631: asn_debug.put_line('delete the temp table ');
2632: END IF;
2633:
2634: IF temp_cascaded_table.COUNT > 0 THEN
2635: FOR i IN 1 .. temp_cascaded_table.COUNT LOOP
2644: rcv_error_pkg.log_interface_error('QUANTITY');
2645: END IF; --}ends check for a -ve correction
2646: ELSE --}{ else for rows fetched = 0 OR x_first_trans = true
2647: IF rows_fetched = 0 THEN
2648: IF (g_asn_debug = 'Y') THEN
2649: asn_debug.put_line('No rows were retrieved from cursor.');
2650: END IF;
2651: ELSIF x_first_trans THEN
2652: IF (g_asn_debug = 'Y') THEN
2645: END IF; --}ends check for a -ve correction
2646: ELSE --}{ else for rows fetched = 0 OR x_first_trans = true
2647: IF rows_fetched = 0 THEN
2648: IF (g_asn_debug = 'Y') THEN
2649: asn_debug.put_line('No rows were retrieved from cursor.');
2650: END IF;
2651: ELSIF x_first_trans THEN
2652: IF (g_asn_debug = 'Y') THEN
2653: asn_debug.put_line('No rows were cascaded');
2648: IF (g_asn_debug = 'Y') THEN
2649: asn_debug.put_line('No rows were retrieved from cursor.');
2650: END IF;
2651: ELSIF x_first_trans THEN
2652: IF (g_asn_debug = 'Y') THEN
2653: asn_debug.put_line('No rows were cascaded');
2654: END IF;
2655: END IF;
2656:
2649: asn_debug.put_line('No rows were retrieved from cursor.');
2650: END IF;
2651: ELSIF x_first_trans THEN
2652: IF (g_asn_debug = 'Y') THEN
2653: asn_debug.put_line('No rows were cascaded');
2654: END IF;
2655: END IF;
2656:
2657: IF (x_cascaded_table(n).parent_transaction_id IS NOT NULL) THEN --{
2687: x_cascaded_table(n).error_status := rcv_error_pkg.g_ret_sts_error;
2688: rcv_error_pkg.log_interface_error('PARENT_TRANSACTION_ID');
2689: END IF; --} end else for rows fetched = 0 OR x_first_trans = true
2690: ELSE -- }{ this is the else for whether remaining qty is not 0
2691: IF (g_asn_debug = 'Y') THEN
2692: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
2693: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
2694: END IF;
2695: END IF; --} ends the check for whether last record has been reached
2688: rcv_error_pkg.log_interface_error('PARENT_TRANSACTION_ID');
2689: END IF; --} end else for rows fetched = 0 OR x_first_trans = true
2690: ELSE -- }{ this is the else for whether remaining qty is not 0
2691: IF (g_asn_debug = 'Y') THEN
2692: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
2693: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
2694: END IF;
2695: END IF; --} ends the check for whether last record has been reached
2696:
2689: END IF; --} end else for rows fetched = 0 OR x_first_trans = true
2690: ELSE -- }{ this is the else for whether remaining qty is not 0
2691: IF (g_asn_debug = 'Y') THEN
2692: asn_debug.put_line('Remaining UOM quantity is zero ' || TO_CHAR(x_remaining_quantity));
2693: asn_debug.put_line('Return the cascaded rows back to the calling procedure');
2694: END IF;
2695: END IF; --} ends the check for whether last record has been reached
2696:
2697: -- close cursors
2695: END IF; --} ends the check for whether last record has been reached
2696:
2697: -- close cursors
2698:
2699: IF (g_asn_debug = 'Y') THEN
2700: asn_debug.put_line('Close cursors ' || current_n);
2701: END IF;
2702:
2703: IF int_org_cor_rt%ISOPEN THEN
2696:
2697: -- close cursors
2698:
2699: IF (g_asn_debug = 'Y') THEN
2700: asn_debug.put_line('Close cursors ' || current_n);
2701: END IF;
2702:
2703: IF int_org_cor_rt%ISOPEN THEN
2704: CLOSE int_org_cor_rt;
2707: IF int_org_cor_rti%ISOPEN THEN
2708: CLOSE int_org_cor_rti;
2709: END IF;
2710:
2711: IF (g_asn_debug = 'Y') THEN
2712: asn_debug.put_line('before exit current_n is ' || current_n);
2713: END IF;
2714:
2715: EXIT;
2708: CLOSE int_org_cor_rti;
2709: END IF;
2710:
2711: IF (g_asn_debug = 'Y') THEN
2712: asn_debug.put_line('before exit current_n is ' || current_n);
2713: END IF;
2714:
2715: EXIT;
2716: END IF; --} matches the condition of lastrecord has been reached
2714:
2715: EXIT;
2716: END IF; --} matches the condition of lastrecord has been reached
2717:
2718: IF (g_asn_debug = 'Y') THEN
2719: asn_debug.put_line(' the iot rec uom is ' || int_org_cor_rec.unit_of_meas);
2720: asn_debug.put_line(' the iot rec primary uom is ' || int_org_cor_rec.primary_unit_of_measure);
2721: asn_debug.put_line(' Entering qty calculateion for correct');
2722: END IF;
2715: EXIT;
2716: END IF; --} matches the condition of lastrecord has been reached
2717:
2718: IF (g_asn_debug = 'Y') THEN
2719: asn_debug.put_line(' the iot rec uom is ' || int_org_cor_rec.unit_of_meas);
2720: asn_debug.put_line(' the iot rec primary uom is ' || int_org_cor_rec.primary_unit_of_measure);
2721: asn_debug.put_line(' Entering qty calculateion for correct');
2722: END IF;
2723:
2716: END IF; --} matches the condition of lastrecord has been reached
2717:
2718: IF (g_asn_debug = 'Y') THEN
2719: asn_debug.put_line(' the iot rec uom is ' || int_org_cor_rec.unit_of_meas);
2720: asn_debug.put_line(' the iot rec primary uom is ' || int_org_cor_rec.primary_unit_of_measure);
2721: asn_debug.put_line(' Entering qty calculateion for correct');
2722: END IF;
2723:
2724: -- bug fix 5269121 :it is wrong to
2717:
2718: IF (g_asn_debug = 'Y') THEN
2719: asn_debug.put_line(' the iot rec uom is ' || int_org_cor_rec.unit_of_meas);
2720: asn_debug.put_line(' the iot rec primary uom is ' || int_org_cor_rec.primary_unit_of_measure);
2721: asn_debug.put_line(' Entering qty calculateion for correct');
2722: END IF;
2723:
2724: -- bug fix 5269121 :it is wrong to
2725: --copy the parents unit of measure into the childs unit of measure, as this will be the one
2740: x_converted_parent_trx_qty
2741: );
2742:
2743: IF (x_converted_parent_trx_qty = 0) THEN --{
2744: IF (g_asn_debug = 'Y') THEN
2745: asn_debug.put_line('calling Correct get_available_qty ' || int_org_cor_rec.parent_transaction_type);
2746: END IF;
2747:
2748: -- this is a negative correction
2741: );
2742:
2743: IF (x_converted_parent_trx_qty = 0) THEN --{
2744: IF (g_asn_debug = 'Y') THEN
2745: asn_debug.put_line('calling Correct get_available_qty ' || int_org_cor_rec.parent_transaction_type);
2746: END IF;
2747:
2748: -- this is a negative correction
2749: IF (SIGN(temp_cascaded_table(current_n).quantity) = -1) THEN --{
2759: x_secondary_available_qty
2760: );
2761:
2762: /* Bug#5369121 - START */
2763: IF (g_asn_debug = 'Y') THEN
2764: asn_debug.put_line('x_converted_parent_trx_qty:' || x_converted_parent_trx_qty);
2765: asn_debug.put_line('transaction_quantity:' || temp_cascaded_table(current_n).quantity);
2766: END IF;
2767:
2760: );
2761:
2762: /* Bug#5369121 - START */
2763: IF (g_asn_debug = 'Y') THEN
2764: asn_debug.put_line('x_converted_parent_trx_qty:' || x_converted_parent_trx_qty);
2765: asn_debug.put_line('transaction_quantity:' || temp_cascaded_table(current_n).quantity);
2766: END IF;
2767:
2768: IF (x_converted_parent_trx_qty < ABS(temp_cascaded_table(current_n).quantity)) THEN
2761:
2762: /* Bug#5369121 - START */
2763: IF (g_asn_debug = 'Y') THEN
2764: asn_debug.put_line('x_converted_parent_trx_qty:' || x_converted_parent_trx_qty);
2765: asn_debug.put_line('transaction_quantity:' || temp_cascaded_table(current_n).quantity);
2766: END IF;
2767:
2768: IF (x_converted_parent_trx_qty < ABS(temp_cascaded_table(current_n).quantity)) THEN
2769:
2805: ** There is unprocessed quantity. Convert it to the transaction uom
2806: ** so that the available quantity can be calculated in the trx uom
2807: */
2808:
2809: IF (g_asn_debug = 'Y') THEN
2810: asn_debug.put_line('Before uom_convert:');
2811: asn_debug.put_line('l_interface_quantity' || l_interface_quantity);
2812: asn_debug.put_line('l_primary_uom' || l_primary_uom);
2813: asn_debug.put_line('l_transaction_uom' || l_transaction_uom);
2806: ** so that the available quantity can be calculated in the trx uom
2807: */
2808:
2809: IF (g_asn_debug = 'Y') THEN
2810: asn_debug.put_line('Before uom_convert:');
2811: asn_debug.put_line('l_interface_quantity' || l_interface_quantity);
2812: asn_debug.put_line('l_primary_uom' || l_primary_uom);
2813: asn_debug.put_line('l_transaction_uom' || l_transaction_uom);
2814: asn_debug.put_line('l_item_id' || l_item_id);
2807: */
2808:
2809: IF (g_asn_debug = 'Y') THEN
2810: asn_debug.put_line('Before uom_convert:');
2811: asn_debug.put_line('l_interface_quantity' || l_interface_quantity);
2812: asn_debug.put_line('l_primary_uom' || l_primary_uom);
2813: asn_debug.put_line('l_transaction_uom' || l_transaction_uom);
2814: asn_debug.put_line('l_item_id' || l_item_id);
2815: END IF;
2808:
2809: IF (g_asn_debug = 'Y') THEN
2810: asn_debug.put_line('Before uom_convert:');
2811: asn_debug.put_line('l_interface_quantity' || l_interface_quantity);
2812: asn_debug.put_line('l_primary_uom' || l_primary_uom);
2813: asn_debug.put_line('l_transaction_uom' || l_transaction_uom);
2814: asn_debug.put_line('l_item_id' || l_item_id);
2815: END IF;
2816:
2809: IF (g_asn_debug = 'Y') THEN
2810: asn_debug.put_line('Before uom_convert:');
2811: asn_debug.put_line('l_interface_quantity' || l_interface_quantity);
2812: asn_debug.put_line('l_primary_uom' || l_primary_uom);
2813: asn_debug.put_line('l_transaction_uom' || l_transaction_uom);
2814: asn_debug.put_line('l_item_id' || l_item_id);
2815: END IF;
2816:
2817: po_uom_s.uom_convert(l_interface_quantity, l_primary_uom, l_item_id,
2810: asn_debug.put_line('Before uom_convert:');
2811: asn_debug.put_line('l_interface_quantity' || l_interface_quantity);
2812: asn_debug.put_line('l_primary_uom' || l_primary_uom);
2813: asn_debug.put_line('l_transaction_uom' || l_transaction_uom);
2814: asn_debug.put_line('l_item_id' || l_item_id);
2815: END IF;
2816:
2817: po_uom_s.uom_convert(l_interface_quantity, l_primary_uom, l_item_id,
2818: l_transaction_uom, l_interface_qty_in_trx_uom);
2820: END IF;
2821:
2822: x_converted_parent_trx_qty := x_converted_parent_trx_qty - l_interface_qty_in_trx_uom;
2823:
2824: IF (g_asn_debug = 'Y') THEN
2825: asn_debug.put_line('x_converted_parent_trx_qty:' || x_converted_parent_trx_qty);
2826: END IF;
2827:
2828: END IF;
2821:
2822: x_converted_parent_trx_qty := x_converted_parent_trx_qty - l_interface_qty_in_trx_uom;
2823:
2824: IF (g_asn_debug = 'Y') THEN
2825: asn_debug.put_line('x_converted_parent_trx_qty:' || x_converted_parent_trx_qty);
2826: END IF;
2827:
2828: END IF;
2829: /* Bug#5369121 - END */
2842: l_grand_parent_trx_id := int_org_cor_rec.shipment_line_id;
2843: END IF;
2844: END IF;
2845:
2846: IF (g_asn_debug = 'Y') THEN
2847: asn_debug.put_line('grand parent trx id' || l_grand_parent_trx_id);
2848: asn_debug.put_line('rcv_transaction id' || int_org_cor_rec.rcv_transaction_id);
2849: asn_debug.put_line('parent txn type' || int_org_cor_rec.parent_transaction_type);
2850: END IF;
2843: END IF;
2844: END IF;
2845:
2846: IF (g_asn_debug = 'Y') THEN
2847: asn_debug.put_line('grand parent trx id' || l_grand_parent_trx_id);
2848: asn_debug.put_line('rcv_transaction id' || int_org_cor_rec.rcv_transaction_id);
2849: asn_debug.put_line('parent txn type' || int_org_cor_rec.parent_transaction_type);
2850: END IF;
2851:
2844: END IF;
2845:
2846: IF (g_asn_debug = 'Y') THEN
2847: asn_debug.put_line('grand parent trx id' || l_grand_parent_trx_id);
2848: asn_debug.put_line('rcv_transaction id' || int_org_cor_rec.rcv_transaction_id);
2849: asn_debug.put_line('parent txn type' || int_org_cor_rec.parent_transaction_type);
2850: END IF;
2851:
2852: IF (l_grand_parent_trx_id IS NOT NULL) THEN
2845:
2846: IF (g_asn_debug = 'Y') THEN
2847: asn_debug.put_line('grand parent trx id' || l_grand_parent_trx_id);
2848: asn_debug.put_line('rcv_transaction id' || int_org_cor_rec.rcv_transaction_id);
2849: asn_debug.put_line('parent txn type' || int_org_cor_rec.parent_transaction_type);
2850: END IF;
2851:
2852: IF (l_grand_parent_trx_id IS NOT NULL) THEN
2853: rcv_quantities_s.get_available_quantity('CORRECT',
2863: );
2864: END IF;
2865: END IF; --}
2866:
2867: IF (g_asn_debug = 'Y') THEN
2868: asn_debug.put_line('qty from GET_AVAILABLE_QUANTITY for corrections is ' || x_converted_parent_trx_qty);
2869: END IF;
2870: END IF; --} matches the parent trx qty = 0
2871:
2864: END IF;
2865: END IF; --}
2866:
2867: IF (g_asn_debug = 'Y') THEN
2868: asn_debug.put_line('qty from GET_AVAILABLE_QUANTITY for corrections is ' || x_converted_parent_trx_qty);
2869: END IF;
2870: END IF; --} matches the parent trx qty = 0
2871:
2872: IF (x_remaining_quantity = 0) THEN
2869: END IF;
2870: END IF; --} matches the parent trx qty = 0
2871:
2872: IF (x_remaining_quantity = 0) THEN
2873: IF (g_asn_debug = 'Y') THEN
2874: asn_debug.put_line(' correct Need an error message in the interface tables');
2875: END IF;
2876: ELSE
2877: /* Converted successfully and have some quantity on which we can act */
2870: END IF; --} matches the parent trx qty = 0
2871:
2872: IF (x_remaining_quantity = 0) THEN
2873: IF (g_asn_debug = 'Y') THEN
2874: asn_debug.put_line(' correct Need an error message in the interface tables');
2875: END IF;
2876: ELSE
2877: /* Converted successfully and have some quantity on which we can act */
2878: IF (g_asn_debug = 'Y') THEN
2874: asn_debug.put_line(' correct Need an error message in the interface tables');
2875: END IF;
2876: ELSE
2877: /* Converted successfully and have some quantity on which we can act */
2878: IF (g_asn_debug = 'Y') THEN
2879: asn_debug.put_line('Converted trx qty that is available ' || x_converted_parent_trx_qty);
2880: asn_debug.put_line('Remaining qty in parents uom that is available ' || x_remaining_quantity);
2881: END IF;
2882:
2875: END IF;
2876: ELSE
2877: /* Converted successfully and have some quantity on which we can act */
2878: IF (g_asn_debug = 'Y') THEN
2879: asn_debug.put_line('Converted trx qty that is available ' || x_converted_parent_trx_qty);
2880: asn_debug.put_line('Remaining qty in parents uom that is available ' || x_remaining_quantity);
2881: END IF;
2882:
2883: IF ( (rows_fetched = x_record_count)
2876: ELSE
2877: /* Converted successfully and have some quantity on which we can act */
2878: IF (g_asn_debug = 'Y') THEN
2879: asn_debug.put_line('Converted trx qty that is available ' || x_converted_parent_trx_qty);
2880: asn_debug.put_line('Remaining qty in parents uom that is available ' || x_remaining_quantity);
2881: END IF;
2882:
2883: IF ( (rows_fetched = x_record_count)
2884: AND (SIGN(temp_cascaded_table(current_n).quantity) = 1)) THEN --{
2883: IF ( (rows_fetched = x_record_count)
2884: AND (SIGN(temp_cascaded_table(current_n).quantity) = 1)) THEN --{
2885: x_converted_trx_qty := x_tolerable_qty;
2886:
2887: IF (g_asn_debug = 'Y') THEN
2888: asn_debug.put_line('Last Row : ' || TO_CHAR(x_converted_trx_qty));
2889: END IF;
2890: END IF; --}
2891:
2884: AND (SIGN(temp_cascaded_table(current_n).quantity) = 1)) THEN --{
2885: x_converted_trx_qty := x_tolerable_qty;
2886:
2887: IF (g_asn_debug = 'Y') THEN
2888: asn_debug.put_line('Last Row : ' || TO_CHAR(x_converted_trx_qty));
2889: END IF;
2890: END IF; --}
2891:
2892: IF (x_converted_parent_trx_qty > 0) THEN --{
2903: */
2904: x_remaining_quantity := x_remaining_quantity - SIGN(temp_cascaded_table(current_n).quantity) * x_converted_parent_trx_qty;
2905: x_converted_parent_trx_qty := SIGN(temp_cascaded_table(current_n).quantity) * x_converted_parent_trx_qty;
2906:
2907: IF (g_asn_debug = 'Y') THEN
2908: asn_debug.put_line('remaning qty after allocation is : ' || TO_CHAR(x_remaining_quantity));
2909: END IF;
2910:
2911: insert_into_table := TRUE;
2904: x_remaining_quantity := x_remaining_quantity - SIGN(temp_cascaded_table(current_n).quantity) * x_converted_parent_trx_qty;
2905: x_converted_parent_trx_qty := SIGN(temp_cascaded_table(current_n).quantity) * x_converted_parent_trx_qty;
2906:
2907: IF (g_asn_debug = 'Y') THEN
2908: asn_debug.put_line('remaning qty after allocation is : ' || TO_CHAR(x_remaining_quantity));
2909: END IF;
2910:
2911: insert_into_table := TRUE;
2912: ELSE --}{
2909: END IF;
2910:
2911: insert_into_table := TRUE;
2912: ELSE --}{
2913: IF (g_asn_debug = 'Y') THEN
2914: asn_debug.put_line('We are in >= Qty branch ');
2915: END IF;
2916:
2917: x_converted_parent_trx_qty := x_remaining_quantity;
2910:
2911: insert_into_table := TRUE;
2912: ELSE --}{
2913: IF (g_asn_debug = 'Y') THEN
2914: asn_debug.put_line('We are in >= Qty branch ');
2915: END IF;
2916:
2917: x_converted_parent_trx_qty := x_remaining_quantity;
2918: insert_into_table := TRUE;
2919: x_remaining_quantity := 0;
2920: END IF; --} /* if (x_converted_parent_trx_qty < x_remaining_quantity) then */
2921: ELSE /* x_converted_parent_trx_qty >0 */ --}{
2922: -- so that the row can be used based on qty tolerance checks
2923: IF (g_asn_debug = 'Y') THEN
2924: asn_debug.put_line('Quantity is less then 0 but last record');
2925: END IF;
2926:
2927: insert_into_table := TRUE;
2920: END IF; --} /* if (x_converted_parent_trx_qty < x_remaining_quantity) then */
2921: ELSE /* x_converted_parent_trx_qty >0 */ --}{
2922: -- so that the row can be used based on qty tolerance checks
2923: IF (g_asn_debug = 'Y') THEN
2924: asn_debug.put_line('Quantity is less then 0 but last record');
2925: END IF;
2926:
2927: insert_into_table := TRUE;
2928: x_converted_trx_qty := 0;
2929: END IF; /*x_converted_parent_trx_qty >0 */ --}
2930: END IF;
2931:
2932: /* Converted qty successfully and we have some quantity on which we can act */
2933: IF (g_asn_debug = 'Y') THEN
2934: asn_debug.put_line('Txn qty in terms of the parents uom is ' || x_converted_parent_trx_qty);
2935: END IF;
2936:
2937: IF insert_into_table THEN --{ --start
2930: END IF;
2931:
2932: /* Converted qty successfully and we have some quantity on which we can act */
2933: IF (g_asn_debug = 'Y') THEN
2934: asn_debug.put_line('Txn qty in terms of the parents uom is ' || x_converted_parent_trx_qty);
2935: END IF;
2936:
2937: IF insert_into_table THEN --{ --start
2938: IF (x_first_trans) THEN --{
2935: END IF;
2936:
2937: IF insert_into_table THEN --{ --start
2938: IF (x_first_trans) THEN --{
2939: IF (g_asn_debug = 'Y') THEN
2940: asn_debug.put_line('First Time ' || TO_CHAR(current_n));
2941: END IF;
2942:
2943: x_first_trans := FALSE;
2936:
2937: IF insert_into_table THEN --{ --start
2938: IF (x_first_trans) THEN --{
2939: IF (g_asn_debug = 'Y') THEN
2940: asn_debug.put_line('First Time ' || TO_CHAR(current_n));
2941: END IF;
2942:
2943: x_first_trans := FALSE;
2944: ELSE --}{
2941: END IF;
2942:
2943: x_first_trans := FALSE;
2944: ELSE --}{
2945: IF (g_asn_debug = 'Y') THEN
2946: asn_debug.put_line('Next Time ' || TO_CHAR(current_n));
2947: END IF;
2948:
2949: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
2942:
2943: x_first_trans := FALSE;
2944: ELSE --}{
2945: IF (g_asn_debug = 'Y') THEN
2946: asn_debug.put_line('Next Time ' || TO_CHAR(current_n));
2947: END IF;
2948:
2949: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
2950: END IF; --}
2948:
2949: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
2950: END IF; --}
2951:
2952: IF (g_asn_debug = 'Y') THEN
2953: asn_debug.put_line('primary uom before ' || temp_cascaded_table(current_n).primary_unit_of_measure);
2954: asn_debug.put_line('normal uom is ' || int_org_cor_rec.unit_of_meas);
2955: END IF;
2956:
2949: temp_cascaded_table(current_n) := temp_cascaded_table(current_n - 1);
2950: END IF; --}
2951:
2952: IF (g_asn_debug = 'Y') THEN
2953: asn_debug.put_line('primary uom before ' || temp_cascaded_table(current_n).primary_unit_of_measure);
2954: asn_debug.put_line('normal uom is ' || int_org_cor_rec.unit_of_meas);
2955: END IF;
2956:
2957: temp_cascaded_table(current_n).primary_unit_of_measure := int_org_cor_rec.primary_unit_of_measure;
2950: END IF; --}
2951:
2952: IF (g_asn_debug = 'Y') THEN
2953: asn_debug.put_line('primary uom before ' || temp_cascaded_table(current_n).primary_unit_of_measure);
2954: asn_debug.put_line('normal uom is ' || int_org_cor_rec.unit_of_meas);
2955: END IF;
2956:
2957: temp_cascaded_table(current_n).primary_unit_of_measure := int_org_cor_rec.primary_unit_of_measure;
2958: temp_cascaded_table(current_n).quantity := x_converted_parent_trx_qty;
2958: temp_cascaded_table(current_n).quantity := x_converted_parent_trx_qty;
2959: temp_cascaded_table(current_n).shipment_line_id := int_org_cor_rec.shipment_line_id;
2960:
2961: IF (temp_cascaded_table(current_n).primary_unit_of_measure <> int_org_cor_rec.unit_of_meas) THEN
2962: IF (g_asn_debug = 'Y') THEN
2963: asn_debug.put_line('primary uoms not the same and need to convert quantity');
2964: END IF;
2965:
2966: temp_cascaded_table(current_n).primary_quantity := rcv_roi_transaction.convert_into_correct_qty(x_converted_parent_trx_qty,
2959: temp_cascaded_table(current_n).shipment_line_id := int_org_cor_rec.shipment_line_id;
2960:
2961: IF (temp_cascaded_table(current_n).primary_unit_of_measure <> int_org_cor_rec.unit_of_meas) THEN
2962: IF (g_asn_debug = 'Y') THEN
2963: asn_debug.put_line('primary uoms not the same and need to convert quantity');
2964: END IF;
2965:
2966: temp_cascaded_table(current_n).primary_quantity := rcv_roi_transaction.convert_into_correct_qty(x_converted_parent_trx_qty,
2967: int_org_cor_rec.unit_of_meas,
2971: ELSE
2972: temp_cascaded_table(current_n).primary_quantity := x_converted_parent_trx_qty;
2973: END IF;
2974:
2975: IF (g_asn_debug = 'Y') THEN
2976: asn_debug.put_line('txn qty in primary uom is ' || temp_cascaded_table(current_n).primary_quantity);
2977: END IF;
2978:
2979: current_n := current_n + 1;
2972: temp_cascaded_table(current_n).primary_quantity := x_converted_parent_trx_qty;
2973: END IF;
2974:
2975: IF (g_asn_debug = 'Y') THEN
2976: asn_debug.put_line('txn qty in primary uom is ' || temp_cascaded_table(current_n).primary_quantity);
2977: END IF;
2978:
2979: current_n := current_n + 1;
2980:
2977: END IF;
2978:
2979: current_n := current_n + 1;
2980:
2981: IF (g_asn_debug = 'Y') THEN
2982: asn_debug.put_line('Increment pointer by 1 ' || TO_CHAR(current_n));
2983: END IF;
2984: END IF; --}
2985:
2978:
2979: current_n := current_n + 1;
2980:
2981: IF (g_asn_debug = 'Y') THEN
2982: asn_debug.put_line('Increment pointer by 1 ' || TO_CHAR(current_n));
2983: END IF;
2984: END IF; --}
2985:
2986: IF (g_asn_debug = 'Y') THEN
2982: asn_debug.put_line('Increment pointer by 1 ' || TO_CHAR(current_n));
2983: END IF;
2984: END IF; --}
2985:
2986: IF (g_asn_debug = 'Y') THEN
2987: asn_debug.put_line('finished assigning line qty for one row in cursor for IOT corrections ');
2988: END IF;
2989: END LOOP; --}
2990:
2983: END IF;
2984: END IF; --}
2985:
2986: IF (g_asn_debug = 'Y') THEN
2987: asn_debug.put_line('finished assigning line qty for one row in cursor for IOT corrections ');
2988: END IF;
2989: END LOOP; --}
2990:
2991: IF (g_asn_debug = 'Y') THEN
2987: asn_debug.put_line('finished assigning line qty for one row in cursor for IOT corrections ');
2988: END IF;
2989: END LOOP; --}
2990:
2991: IF (g_asn_debug = 'Y') THEN
2992: asn_debug.put_line('before closing cursors current_n is ' || temp_cascaded_table.COUNT);
2993: END IF;
2994:
2995: IF int_org_cor_rt%ISOPEN THEN
2988: END IF;
2989: END LOOP; --}
2990:
2991: IF (g_asn_debug = 'Y') THEN
2992: asn_debug.put_line('before closing cursors current_n is ' || temp_cascaded_table.COUNT);
2993: END IF;
2994:
2995: IF int_org_cor_rt%ISOPEN THEN
2996: CLOSE int_org_cor_rt;
2999: IF int_org_cor_rti%ISOPEN THEN
3000: CLOSE int_org_cor_rti;
3001: END IF;
3002:
3003: IF (g_asn_debug = 'Y') THEN
3004: asn_debug.put_line('Exit explode_line_quantity');
3005: END IF;
3006: EXCEPTION
3007: WHEN rcv_error_pkg.e_fatal_error THEN
3000: CLOSE int_org_cor_rti;
3001: END IF;
3002:
3003: IF (g_asn_debug = 'Y') THEN
3004: asn_debug.put_line('Exit explode_line_quantity');
3005: END IF;
3006: EXCEPTION
3007: WHEN rcv_error_pkg.e_fatal_error THEN
3008: IF int_org_cor_rt%ISOPEN THEN
3025: rcv_error_pkg.set_sql_error_message('derive_int_org_cor_line_qty', x_progress);
3026: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
3027: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
3028:
3029: IF (g_asn_debug = 'Y') THEN
3030: asn_debug.put_line(TO_CHAR(n));
3031: asn_debug.put_line(SQLERRM);
3032: asn_debug.put_line('error ' || x_progress);
3033: END IF;
3026: x_cascaded_table(n).error_message := rcv_error_pkg.get_last_message;
3027: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
3028:
3029: IF (g_asn_debug = 'Y') THEN
3030: asn_debug.put_line(TO_CHAR(n));
3031: asn_debug.put_line(SQLERRM);
3032: asn_debug.put_line('error ' || x_progress);
3033: END IF;
3034: END derive_int_org_cor_line_qty;
3027: rcv_error_pkg.log_interface_error('INTERFACE_TRANSACTION_ID');
3028:
3029: IF (g_asn_debug = 'Y') THEN
3030: asn_debug.put_line(TO_CHAR(n));
3031: asn_debug.put_line(SQLERRM);
3032: asn_debug.put_line('error ' || x_progress);
3033: END IF;
3034: END derive_int_org_cor_line_qty;
3035:
3028:
3029: IF (g_asn_debug = 'Y') THEN
3030: asn_debug.put_line(TO_CHAR(n));
3031: asn_debug.put_line(SQLERRM);
3032: asn_debug.put_line('error ' || x_progress);
3033: END IF;
3034: END derive_int_org_cor_line_qty;
3035:
3036: PROCEDURE default_int_org_cor_line(
3126: x_cascaded_table(n).processing_status_code := p_trx_record.processing_status_code;
3127: x_cascaded_table(n).transaction_status_code := p_trx_record.transaction_status_code;
3128: x_cascaded_table(n).auto_transact_code := p_trx_record.auto_transact_code;
3129:
3130: IF (g_asn_debug = 'Y') THEN
3131: asn_debug.put_line('Enter Default for IOT Corrections');
3132: END IF;
3133:
3134: IF (x_cascaded_table(n).derive = 'Y') THEN --{
3127: x_cascaded_table(n).transaction_status_code := p_trx_record.transaction_status_code;
3128: x_cascaded_table(n).auto_transact_code := p_trx_record.auto_transact_code;
3129:
3130: IF (g_asn_debug = 'Y') THEN
3131: asn_debug.put_line('Enter Default for IOT Corrections');
3132: END IF;
3133:
3134: IF (x_cascaded_table(n).derive = 'Y') THEN --{
3135: IF (x_cascaded_table(n).derive_index <> 0) THEN --{
3214: x_cascaded_table(n).deliver_to_person_id := x_cascaded_table(temp_index).deliver_to_person_id;
3215: x_cascaded_table(n).deliver_to_location_id := x_cascaded_table(temp_index).deliver_to_location_id;
3216: x_cascaded_table(n).subinventory := x_cascaded_table(temp_index).subinventory;
3217: ELSE --} {
3218: IF (g_asn_debug = 'Y') THEN
3219: asn_debug.put_line('open cursor Default');
3220: END IF;
3221:
3222: OPEN int_org_cor_rti(x_cascaded_table(n).parent_interface_txn_id);
3215: x_cascaded_table(n).deliver_to_location_id := x_cascaded_table(temp_index).deliver_to_location_id;
3216: x_cascaded_table(n).subinventory := x_cascaded_table(temp_index).subinventory;
3217: ELSE --} {
3218: IF (g_asn_debug = 'Y') THEN
3219: asn_debug.put_line('open cursor Default');
3220: END IF;
3221:
3222: OPEN int_org_cor_rti(x_cascaded_table(n).parent_interface_txn_id);
3223: END IF; --}
3225: OPEN int_org_cor_rt(x_cascaded_table(n).parent_transaction_id);
3226: END IF; --}
3227:
3228: IF (int_org_cor_rt%ISOPEN) THEN
3229: IF (g_asn_debug = 'Y') THEN
3230: asn_debug.put_line('fetch cursor Default ' || x_cascaded_table(n).parent_transaction_id);
3231: END IF;
3232:
3233: FETCH int_org_cor_rt INTO default_int_org_cor_rt_info;
3226: END IF; --}
3227:
3228: IF (int_org_cor_rt%ISOPEN) THEN
3229: IF (g_asn_debug = 'Y') THEN
3230: asn_debug.put_line('fetch cursor Default ' || x_cascaded_table(n).parent_transaction_id);
3231: END IF;
3232:
3233: FETCH int_org_cor_rt INTO default_int_org_cor_rt_info;
3234: ELSIF(int_org_cor_rti%ISOPEN) THEN
3247: x_from_organization_id;
3248: CLOSE int_org_cor_rsl;
3249: END IF;
3250:
3251: IF (g_asn_debug = 'Y') THEN --{
3252: asn_debug.put_line('Defaulting Cor item_description' || default_int_org_cor_rt_info.item_description);
3253: asn_debug.put_line('Defaulting Cor location_id' || default_int_org_cor_rt_info.loc_id);
3254: asn_debug.put_line('Defaulting Cor to organization_id' || NVL(x_to_organization_id, default_int_org_cor_rt_info.organization_id));
3255: asn_debug.put_line('Defaulting Cor from organization_id' || NVL(x_from_organization_id, default_int_org_cor_rt_info.organization_id));
3248: CLOSE int_org_cor_rsl;
3249: END IF;
3250:
3251: IF (g_asn_debug = 'Y') THEN --{
3252: asn_debug.put_line('Defaulting Cor item_description' || default_int_org_cor_rt_info.item_description);
3253: asn_debug.put_line('Defaulting Cor location_id' || default_int_org_cor_rt_info.loc_id);
3254: asn_debug.put_line('Defaulting Cor to organization_id' || NVL(x_to_organization_id, default_int_org_cor_rt_info.organization_id));
3255: asn_debug.put_line('Defaulting Cor from organization_id' || NVL(x_from_organization_id, default_int_org_cor_rt_info.organization_id));
3256: asn_debug.put_line('Defaulting Cor routing_header_id' || default_int_org_cor_rt_info.routing_header_id);
3249: END IF;
3250:
3251: IF (g_asn_debug = 'Y') THEN --{
3252: asn_debug.put_line('Defaulting Cor item_description' || default_int_org_cor_rt_info.item_description);
3253: asn_debug.put_line('Defaulting Cor location_id' || default_int_org_cor_rt_info.loc_id);
3254: asn_debug.put_line('Defaulting Cor to organization_id' || NVL(x_to_organization_id, default_int_org_cor_rt_info.organization_id));
3255: asn_debug.put_line('Defaulting Cor from organization_id' || NVL(x_from_organization_id, default_int_org_cor_rt_info.organization_id));
3256: asn_debug.put_line('Defaulting Cor routing_header_id' || default_int_org_cor_rt_info.routing_header_id);
3257: asn_debug.put_line('Defaulting Cor currency_code' || default_int_org_cor_rt_info.currency_code);
3250:
3251: IF (g_asn_debug = 'Y') THEN --{
3252: asn_debug.put_line('Defaulting Cor item_description' || default_int_org_cor_rt_info.item_description);
3253: asn_debug.put_line('Defaulting Cor location_id' || default_int_org_cor_rt_info.loc_id);
3254: asn_debug.put_line('Defaulting Cor to organization_id' || NVL(x_to_organization_id, default_int_org_cor_rt_info.organization_id));
3255: asn_debug.put_line('Defaulting Cor from organization_id' || NVL(x_from_organization_id, default_int_org_cor_rt_info.organization_id));
3256: asn_debug.put_line('Defaulting Cor routing_header_id' || default_int_org_cor_rt_info.routing_header_id);
3257: asn_debug.put_line('Defaulting Cor currency_code' || default_int_org_cor_rt_info.currency_code);
3258: asn_debug.put_line('Defaulting Cor currency_conversion_rate' || default_int_org_cor_rt_info.currency_conversion_rate);
3251: IF (g_asn_debug = 'Y') THEN --{
3252: asn_debug.put_line('Defaulting Cor item_description' || default_int_org_cor_rt_info.item_description);
3253: asn_debug.put_line('Defaulting Cor location_id' || default_int_org_cor_rt_info.loc_id);
3254: asn_debug.put_line('Defaulting Cor to organization_id' || NVL(x_to_organization_id, default_int_org_cor_rt_info.organization_id));
3255: asn_debug.put_line('Defaulting Cor from organization_id' || NVL(x_from_organization_id, default_int_org_cor_rt_info.organization_id));
3256: asn_debug.put_line('Defaulting Cor routing_header_id' || default_int_org_cor_rt_info.routing_header_id);
3257: asn_debug.put_line('Defaulting Cor currency_code' || default_int_org_cor_rt_info.currency_code);
3258: asn_debug.put_line('Defaulting Cor currency_conversion_rate' || default_int_org_cor_rt_info.currency_conversion_rate);
3259: asn_debug.put_line('Defaulting Cor currency_conversion_type' || default_int_org_cor_rt_info.currency_conversion_type);
3252: asn_debug.put_line('Defaulting Cor item_description' || default_int_org_cor_rt_info.item_description);
3253: asn_debug.put_line('Defaulting Cor location_id' || default_int_org_cor_rt_info.loc_id);
3254: asn_debug.put_line('Defaulting Cor to organization_id' || NVL(x_to_organization_id, default_int_org_cor_rt_info.organization_id));
3255: asn_debug.put_line('Defaulting Cor from organization_id' || NVL(x_from_organization_id, default_int_org_cor_rt_info.organization_id));
3256: asn_debug.put_line('Defaulting Cor routing_header_id' || default_int_org_cor_rt_info.routing_header_id);
3257: asn_debug.put_line('Defaulting Cor currency_code' || default_int_org_cor_rt_info.currency_code);
3258: asn_debug.put_line('Defaulting Cor currency_conversion_rate' || default_int_org_cor_rt_info.currency_conversion_rate);
3259: asn_debug.put_line('Defaulting Cor currency_conversion_type' || default_int_org_cor_rt_info.currency_conversion_type);
3260: asn_debug.put_line('Defaulting cor currency_conversion_date' || default_int_org_cor_rt_info.currency_conversion_date);
3253: asn_debug.put_line('Defaulting Cor location_id' || default_int_org_cor_rt_info.loc_id);
3254: asn_debug.put_line('Defaulting Cor to organization_id' || NVL(x_to_organization_id, default_int_org_cor_rt_info.organization_id));
3255: asn_debug.put_line('Defaulting Cor from organization_id' || NVL(x_from_organization_id, default_int_org_cor_rt_info.organization_id));
3256: asn_debug.put_line('Defaulting Cor routing_header_id' || default_int_org_cor_rt_info.routing_header_id);
3257: asn_debug.put_line('Defaulting Cor currency_code' || default_int_org_cor_rt_info.currency_code);
3258: asn_debug.put_line('Defaulting Cor currency_conversion_rate' || default_int_org_cor_rt_info.currency_conversion_rate);
3259: asn_debug.put_line('Defaulting Cor currency_conversion_type' || default_int_org_cor_rt_info.currency_conversion_type);
3260: asn_debug.put_line('Defaulting cor currency_conversion_date' || default_int_org_cor_rt_info.currency_conversion_date);
3261: asn_debug.put_line('Defaulting cor shipment_header_id' || default_int_org_cor_rt_info.shipment_header_id);
3254: asn_debug.put_line('Defaulting Cor to organization_id' || NVL(x_to_organization_id, default_int_org_cor_rt_info.organization_id));
3255: asn_debug.put_line('Defaulting Cor from organization_id' || NVL(x_from_organization_id, default_int_org_cor_rt_info.organization_id));
3256: asn_debug.put_line('Defaulting Cor routing_header_id' || default_int_org_cor_rt_info.routing_header_id);
3257: asn_debug.put_line('Defaulting Cor currency_code' || default_int_org_cor_rt_info.currency_code);
3258: asn_debug.put_line('Defaulting Cor currency_conversion_rate' || default_int_org_cor_rt_info.currency_conversion_rate);
3259: asn_debug.put_line('Defaulting Cor currency_conversion_type' || default_int_org_cor_rt_info.currency_conversion_type);
3260: asn_debug.put_line('Defaulting cor currency_conversion_date' || default_int_org_cor_rt_info.currency_conversion_date);
3261: asn_debug.put_line('Defaulting cor shipment_header_id' || default_int_org_cor_rt_info.shipment_header_id);
3262: asn_debug.put_line('Defaulting cor shipment_line_id' || default_int_org_cor_rt_info.shipment_line_id);
3255: asn_debug.put_line('Defaulting Cor from organization_id' || NVL(x_from_organization_id, default_int_org_cor_rt_info.organization_id));
3256: asn_debug.put_line('Defaulting Cor routing_header_id' || default_int_org_cor_rt_info.routing_header_id);
3257: asn_debug.put_line('Defaulting Cor currency_code' || default_int_org_cor_rt_info.currency_code);
3258: asn_debug.put_line('Defaulting Cor currency_conversion_rate' || default_int_org_cor_rt_info.currency_conversion_rate);
3259: asn_debug.put_line('Defaulting Cor currency_conversion_type' || default_int_org_cor_rt_info.currency_conversion_type);
3260: asn_debug.put_line('Defaulting cor currency_conversion_date' || default_int_org_cor_rt_info.currency_conversion_date);
3261: asn_debug.put_line('Defaulting cor shipment_header_id' || default_int_org_cor_rt_info.shipment_header_id);
3262: asn_debug.put_line('Defaulting cor shipment_line_id' || default_int_org_cor_rt_info.shipment_line_id);
3263: asn_debug.put_line('Defaulting cor category_id' || default_int_org_cor_rt_info.category_id);
3256: asn_debug.put_line('Defaulting Cor routing_header_id' || default_int_org_cor_rt_info.routing_header_id);
3257: asn_debug.put_line('Defaulting Cor currency_code' || default_int_org_cor_rt_info.currency_code);
3258: asn_debug.put_line('Defaulting Cor currency_conversion_rate' || default_int_org_cor_rt_info.currency_conversion_rate);
3259: asn_debug.put_line('Defaulting Cor currency_conversion_type' || default_int_org_cor_rt_info.currency_conversion_type);
3260: asn_debug.put_line('Defaulting cor currency_conversion_date' || default_int_org_cor_rt_info.currency_conversion_date);
3261: asn_debug.put_line('Defaulting cor shipment_header_id' || default_int_org_cor_rt_info.shipment_header_id);
3262: asn_debug.put_line('Defaulting cor shipment_line_id' || default_int_org_cor_rt_info.shipment_line_id);
3263: asn_debug.put_line('Defaulting cor category_id' || default_int_org_cor_rt_info.category_id);
3264: asn_debug.put_line('Defaulting cor DELIVER_TO_PERSON_ID' || default_int_org_cor_rt_info.deliver_to_person_id);
3257: asn_debug.put_line('Defaulting Cor currency_code' || default_int_org_cor_rt_info.currency_code);
3258: asn_debug.put_line('Defaulting Cor currency_conversion_rate' || default_int_org_cor_rt_info.currency_conversion_rate);
3259: asn_debug.put_line('Defaulting Cor currency_conversion_type' || default_int_org_cor_rt_info.currency_conversion_type);
3260: asn_debug.put_line('Defaulting cor currency_conversion_date' || default_int_org_cor_rt_info.currency_conversion_date);
3261: asn_debug.put_line('Defaulting cor shipment_header_id' || default_int_org_cor_rt_info.shipment_header_id);
3262: asn_debug.put_line('Defaulting cor shipment_line_id' || default_int_org_cor_rt_info.shipment_line_id);
3263: asn_debug.put_line('Defaulting cor category_id' || default_int_org_cor_rt_info.category_id);
3264: asn_debug.put_line('Defaulting cor DELIVER_TO_PERSON_ID' || default_int_org_cor_rt_info.deliver_to_person_id);
3265: asn_debug.put_line('Defaulting Corr DELIVER_TO_LOCATION_ID' || default_int_org_cor_rt_info.deliver_to_location_id);
3258: asn_debug.put_line('Defaulting Cor currency_conversion_rate' || default_int_org_cor_rt_info.currency_conversion_rate);
3259: asn_debug.put_line('Defaulting Cor currency_conversion_type' || default_int_org_cor_rt_info.currency_conversion_type);
3260: asn_debug.put_line('Defaulting cor currency_conversion_date' || default_int_org_cor_rt_info.currency_conversion_date);
3261: asn_debug.put_line('Defaulting cor shipment_header_id' || default_int_org_cor_rt_info.shipment_header_id);
3262: asn_debug.put_line('Defaulting cor shipment_line_id' || default_int_org_cor_rt_info.shipment_line_id);
3263: asn_debug.put_line('Defaulting cor category_id' || default_int_org_cor_rt_info.category_id);
3264: asn_debug.put_line('Defaulting cor DELIVER_TO_PERSON_ID' || default_int_org_cor_rt_info.deliver_to_person_id);
3265: asn_debug.put_line('Defaulting Corr DELIVER_TO_LOCATION_ID' || default_int_org_cor_rt_info.deliver_to_location_id);
3266: asn_debug.put_line('Defaulting Cor subinv' || default_int_org_cor_rt_info.subinventory);
3259: asn_debug.put_line('Defaulting Cor currency_conversion_type' || default_int_org_cor_rt_info.currency_conversion_type);
3260: asn_debug.put_line('Defaulting cor currency_conversion_date' || default_int_org_cor_rt_info.currency_conversion_date);
3261: asn_debug.put_line('Defaulting cor shipment_header_id' || default_int_org_cor_rt_info.shipment_header_id);
3262: asn_debug.put_line('Defaulting cor shipment_line_id' || default_int_org_cor_rt_info.shipment_line_id);
3263: asn_debug.put_line('Defaulting cor category_id' || default_int_org_cor_rt_info.category_id);
3264: asn_debug.put_line('Defaulting cor DELIVER_TO_PERSON_ID' || default_int_org_cor_rt_info.deliver_to_person_id);
3265: asn_debug.put_line('Defaulting Corr DELIVER_TO_LOCATION_ID' || default_int_org_cor_rt_info.deliver_to_location_id);
3266: asn_debug.put_line('Defaulting Cor subinv' || default_int_org_cor_rt_info.subinventory);
3267: END IF; --}
3260: asn_debug.put_line('Defaulting cor currency_conversion_date' || default_int_org_cor_rt_info.currency_conversion_date);
3261: asn_debug.put_line('Defaulting cor shipment_header_id' || default_int_org_cor_rt_info.shipment_header_id);
3262: asn_debug.put_line('Defaulting cor shipment_line_id' || default_int_org_cor_rt_info.shipment_line_id);
3263: asn_debug.put_line('Defaulting cor category_id' || default_int_org_cor_rt_info.category_id);
3264: asn_debug.put_line('Defaulting cor DELIVER_TO_PERSON_ID' || default_int_org_cor_rt_info.deliver_to_person_id);
3265: asn_debug.put_line('Defaulting Corr DELIVER_TO_LOCATION_ID' || default_int_org_cor_rt_info.deliver_to_location_id);
3266: asn_debug.put_line('Defaulting Cor subinv' || default_int_org_cor_rt_info.subinventory);
3267: END IF; --}
3268:
3261: asn_debug.put_line('Defaulting cor shipment_header_id' || default_int_org_cor_rt_info.shipment_header_id);
3262: asn_debug.put_line('Defaulting cor shipment_line_id' || default_int_org_cor_rt_info.shipment_line_id);
3263: asn_debug.put_line('Defaulting cor category_id' || default_int_org_cor_rt_info.category_id);
3264: asn_debug.put_line('Defaulting cor DELIVER_TO_PERSON_ID' || default_int_org_cor_rt_info.deliver_to_person_id);
3265: asn_debug.put_line('Defaulting Corr DELIVER_TO_LOCATION_ID' || default_int_org_cor_rt_info.deliver_to_location_id);
3266: asn_debug.put_line('Defaulting Cor subinv' || default_int_org_cor_rt_info.subinventory);
3267: END IF; --}
3268:
3269: x_cascaded_table(n).item_description := default_int_org_cor_rt_info.item_description;
3262: asn_debug.put_line('Defaulting cor shipment_line_id' || default_int_org_cor_rt_info.shipment_line_id);
3263: asn_debug.put_line('Defaulting cor category_id' || default_int_org_cor_rt_info.category_id);
3264: asn_debug.put_line('Defaulting cor DELIVER_TO_PERSON_ID' || default_int_org_cor_rt_info.deliver_to_person_id);
3265: asn_debug.put_line('Defaulting Corr DELIVER_TO_LOCATION_ID' || default_int_org_cor_rt_info.deliver_to_location_id);
3266: asn_debug.put_line('Defaulting Cor subinv' || default_int_org_cor_rt_info.subinventory);
3267: END IF; --}
3268:
3269: x_cascaded_table(n).item_description := default_int_org_cor_rt_info.item_description;
3270: x_cascaded_table(n).destination_type_code := default_int_org_cor_rt_info.destination_type_code;
3285: x_cascaded_table(n).deliver_to_location_id := default_int_org_cor_rt_info.deliver_to_location_id;
3286: x_cascaded_table(n).subinventory := default_int_org_cor_rt_info.subinventory;
3287:
3288: -- LPN defaulting
3289: IF (g_asn_debug = 'Y') THEN
3290: asn_debug.put_line(' defaulting lpn_id and transfer_lpn_id for int org cor');
3291: END IF;
3292:
3293: IF (x_cascaded_table(n).quantity > 0) THEN --{
3286: x_cascaded_table(n).subinventory := default_int_org_cor_rt_info.subinventory;
3287:
3288: -- LPN defaulting
3289: IF (g_asn_debug = 'Y') THEN
3290: asn_debug.put_line(' defaulting lpn_id and transfer_lpn_id for int org cor');
3291: END IF;
3292:
3293: IF (x_cascaded_table(n).quantity > 0) THEN --{
3294: -- for +ve corrections :
3366: AND mtl_system_items.organization_id = x_cascaded_table(n).to_organization_id;
3367:
3368: END Comment: Bug: 4735484
3369: */
3370: IF (g_asn_debug = 'Y') THEN
3371: asn_debug.put_line('Set Location_id = ' || TO_CHAR(x_cascaded_table(n).location_id));
3372: END IF;
3373:
3374: IF (g_asn_debug = 'Y') THEN
3367:
3368: END Comment: Bug: 4735484
3369: */
3370: IF (g_asn_debug = 'Y') THEN
3371: asn_debug.put_line('Set Location_id = ' || TO_CHAR(x_cascaded_table(n).location_id));
3372: END IF;
3373:
3374: IF (g_asn_debug = 'Y') THEN
3375: asn_debug.put_line('Exit default_int_org_cor_line');
3370: IF (g_asn_debug = 'Y') THEN
3371: asn_debug.put_line('Set Location_id = ' || TO_CHAR(x_cascaded_table(n).location_id));
3372: END IF;
3373:
3374: IF (g_asn_debug = 'Y') THEN
3375: asn_debug.put_line('Exit default_int_org_cor_line');
3376: END IF;
3377:
3378: IF int_org_cor_rt%ISOPEN THEN
3371: asn_debug.put_line('Set Location_id = ' || TO_CHAR(x_cascaded_table(n).location_id));
3372: END IF;
3373:
3374: IF (g_asn_debug = 'Y') THEN
3375: asn_debug.put_line('Exit default_int_org_cor_line');
3376: END IF;
3377:
3378: IF int_org_cor_rt%ISOPEN THEN
3379: CLOSE int_org_cor_rt;
3413: END IF;
3414:
3415: x_error_status := rcv_error_pkg.g_ret_sts_error;
3416:
3417: IF (g_asn_debug = 'Y') THEN
3418: asn_debug.put_line('Validating ref integrity');
3419: END IF;
3420:
3421: IF (g_asn_debug = 'Y') THEN
3414:
3415: x_error_status := rcv_error_pkg.g_ret_sts_error;
3416:
3417: IF (g_asn_debug = 'Y') THEN
3418: asn_debug.put_line('Validating ref integrity');
3419: END IF;
3420:
3421: IF (g_asn_debug = 'Y') THEN
3422: asn_debug.put_line('transaction_type '||(x_cascaded_table(n).transaction_type ));
3417: IF (g_asn_debug = 'Y') THEN
3418: asn_debug.put_line('Validating ref integrity');
3419: END IF;
3420:
3421: IF (g_asn_debug = 'Y') THEN
3422: asn_debug.put_line('transaction_type '||(x_cascaded_table(n).transaction_type ));
3423: asn_debug.put_line('shipment_header_id '||(x_header_record.header_record.receipt_header_id ));
3424: asn_debug.put_line('shipment_line_id '||(x_cascaded_table(n).shipment_line_id ));
3425: end if;
3418: asn_debug.put_line('Validating ref integrity');
3419: END IF;
3420:
3421: IF (g_asn_debug = 'Y') THEN
3422: asn_debug.put_line('transaction_type '||(x_cascaded_table(n).transaction_type ));
3423: asn_debug.put_line('shipment_header_id '||(x_header_record.header_record.receipt_header_id ));
3424: asn_debug.put_line('shipment_line_id '||(x_cascaded_table(n).shipment_line_id ));
3425: end if;
3426: /* Get the shipment_header_id for that shipment_line_id and the
3419: END IF;
3420:
3421: IF (g_asn_debug = 'Y') THEN
3422: asn_debug.put_line('transaction_type '||(x_cascaded_table(n).transaction_type ));
3423: asn_debug.put_line('shipment_header_id '||(x_header_record.header_record.receipt_header_id ));
3424: asn_debug.put_line('shipment_line_id '||(x_cascaded_table(n).shipment_line_id ));
3425: end if;
3426: /* Get the shipment_header_id for that shipment_line_id and the
3427: * shipment_header_id in the header record. If you dont get it then
3420:
3421: IF (g_asn_debug = 'Y') THEN
3422: asn_debug.put_line('transaction_type '||(x_cascaded_table(n).transaction_type ));
3423: asn_debug.put_line('shipment_header_id '||(x_header_record.header_record.receipt_header_id ));
3424: asn_debug.put_line('shipment_line_id '||(x_cascaded_table(n).shipment_line_id ));
3425: end if;
3426: /* Get the shipment_header_id for that shipment_line_id and the
3427: * shipment_header_id in the header record. If you dont get it then
3428: * this means that you are trying to receive a shipment line that
3436: where shipment_header_id =
3437: x_header_record.header_record.receipt_header_id
3438: and shipment_line_id = x_cascaded_table(n).shipment_line_id;
3439:
3440: IF (g_asn_debug = 'Y') THEN
3441: asn_debug.put_line('max shipment_header_id '||x_header_id );
3442: end if;
3443:
3444: IF (x_header_id = 0) THEN
3437: x_header_record.header_record.receipt_header_id
3438: and shipment_line_id = x_cascaded_table(n).shipment_line_id;
3439:
3440: IF (g_asn_debug = 'Y') THEN
3441: asn_debug.put_line('max shipment_header_id '||x_header_id );
3442: end if;
3443:
3444: IF (x_header_id = 0) THEN
3445: IF (g_asn_debug = 'Y') THEN
3441: asn_debug.put_line('max shipment_header_id '||x_header_id );
3442: end if;
3443:
3444: IF (x_header_id = 0) THEN
3445: IF (g_asn_debug = 'Y') THEN
3446: asn_debug.put_line('No header id found. This shipment line does not belong to the same shipment as that of the header' );
3447: end if;
3448: rcv_error_pkg.set_error_message('RCV_INTORD_MISMATCH_SHIPMENTS');
3449: RAISE e_validation_error;
3442: end if;
3443:
3444: IF (x_header_id = 0) THEN
3445: IF (g_asn_debug = 'Y') THEN
3446: asn_debug.put_line('No header id found. This shipment line does not belong to the same shipment as that of the header' );
3447: end if;
3448: rcv_error_pkg.set_error_message('RCV_INTORD_MISMATCH_SHIPMENTS');
3449: RAISE e_validation_error;
3450:
3448: rcv_error_pkg.set_error_message('RCV_INTORD_MISMATCH_SHIPMENTS');
3449: RAISE e_validation_error;
3450:
3451: else
3452: IF (g_asn_debug = 'Y') THEN
3453: asn_debug.put_line('Header id found' );
3454: end if;
3455: END IF;
3456:
3449: RAISE e_validation_error;
3450:
3451: else
3452: IF (g_asn_debug = 'Y') THEN
3453: asn_debug.put_line('Header id found' );
3454: end if;
3455: END IF;
3456:
3457: end if;