1: PACKAGE BODY rcv_transactions_history_pkg as
2: /* $Header: RCVTXHSB.pls 120.0.12010000.11 2010/04/13 11:23:19 smididud noship $ */
3:
4: g_asn_debug VARCHAR2(1) := asn_debug.is_debug_on; -- Bug 9152790
5:
6: --
7: G_PKG_NAME CONSTANT VARCHAR2(50) := 'RCV_TRANSACTIONS_HISTORY_PKG';
8: --
53:
54: BEGIN
55:
56:
57: IF (g_asn_debug = 'Y') THEN
58: asn_debug.put_line('Entering Create_Update_Txns_History');
59: asn_debug.put_line('Entity Type is '||p_txns_history_Rec.entity_type);
60: asn_debug.put_line('Entity number is '||p_txns_history_Rec.entity_number);
61: asn_debug.put_line('Transaction status is '||p_txns_history_Rec.transaction_status);
54: BEGIN
55:
56:
57: IF (g_asn_debug = 'Y') THEN
58: asn_debug.put_line('Entering Create_Update_Txns_History');
59: asn_debug.put_line('Entity Type is '||p_txns_history_Rec.entity_type);
60: asn_debug.put_line('Entity number is '||p_txns_history_Rec.entity_number);
61: asn_debug.put_line('Transaction status is '||p_txns_history_Rec.transaction_status);
62: END IF;
55:
56:
57: IF (g_asn_debug = 'Y') THEN
58: asn_debug.put_line('Entering Create_Update_Txns_History');
59: asn_debug.put_line('Entity Type is '||p_txns_history_Rec.entity_type);
60: asn_debug.put_line('Entity number is '||p_txns_history_Rec.entity_number);
61: asn_debug.put_line('Transaction status is '||p_txns_history_Rec.transaction_status);
62: END IF;
63:
56:
57: IF (g_asn_debug = 'Y') THEN
58: asn_debug.put_line('Entering Create_Update_Txns_History');
59: asn_debug.put_line('Entity Type is '||p_txns_history_Rec.entity_type);
60: asn_debug.put_line('Entity number is '||p_txns_history_Rec.entity_number);
61: asn_debug.put_line('Transaction status is '||p_txns_history_Rec.transaction_status);
62: END IF;
63:
64: x_return_status := rcv_error_pkg.g_ret_sts_success;
57: IF (g_asn_debug = 'Y') THEN
58: asn_debug.put_line('Entering Create_Update_Txns_History');
59: asn_debug.put_line('Entity Type is '||p_txns_history_Rec.entity_type);
60: asn_debug.put_line('Entity number is '||p_txns_history_Rec.entity_number);
61: asn_debug.put_line('Transaction status is '||p_txns_history_Rec.transaction_status);
62: END IF;
63:
64: x_return_status := rcv_error_pkg.g_ret_sts_success;
65: l_xml_document_id := P_xml_document_id;
63:
64: x_return_status := rcv_error_pkg.g_ret_sts_success;
65: l_xml_document_id := P_xml_document_id;
66:
67: IF (g_asn_debug = 'Y') THEN
68: asn_debug.put_line('l_xml_document_id is '|| to_char(l_xml_document_id));
69: END IF;
70:
71:
64: x_return_status := rcv_error_pkg.g_ret_sts_success;
65: l_xml_document_id := P_xml_document_id;
66:
67: IF (g_asn_debug = 'Y') THEN
68: asn_debug.put_line('l_xml_document_id is '|| to_char(l_xml_document_id));
69: END IF;
70:
71:
72: -- First check for null values
105:
106: -- Check if a record already exists
107:
108:
109: IF (g_asn_debug = 'Y') THEN
110: asn_debug.put_line('Opening txn_cur');
111: END IF;
112:
113: OPEN txn_cur;
106: -- Check if a record already exists
107:
108:
109: IF (g_asn_debug = 'Y') THEN
110: asn_debug.put_line('Opening txn_cur');
111: END IF;
112:
113: OPEN txn_cur;
114:
112:
113: OPEN txn_cur;
114:
115:
116: IF (g_asn_debug = 'Y') THEN
117: asn_debug.put_line('Fetching txn_cur');
118: END IF;
119:
120:
113: OPEN txn_cur;
114:
115:
116: IF (g_asn_debug = 'Y') THEN
117: asn_debug.put_line('Fetching txn_cur');
118: END IF;
119:
120:
121:
135: SELECT MTL_TXNS_HISTORY_S.nextval
136: INTO x_transaction_id
137: FROM dual;
138:
139: IF (g_asn_debug = 'Y') THEN
140: asn_debug.put_line('Transaction ID is '|| x_transaction_id);
141: asn_debug.put_line('Inserting into MTL_TXNS_HISTORY');
142: END IF;
143:
136: INTO x_transaction_id
137: FROM dual;
138:
139: IF (g_asn_debug = 'Y') THEN
140: asn_debug.put_line('Transaction ID is '|| x_transaction_id);
141: asn_debug.put_line('Inserting into MTL_TXNS_HISTORY');
142: END IF;
143:
144:
137: FROM dual;
138:
139: IF (g_asn_debug = 'Y') THEN
140: asn_debug.put_line('Transaction ID is '|| x_transaction_id);
141: asn_debug.put_line('Inserting into MTL_TXNS_HISTORY');
142: END IF;
143:
144:
145: INSERT INTO MTL_TXNS_HISTORY(
225:
226:
227: x_txns_id := x_transaction_id;
228:
229: IF (g_asn_debug = 'Y') THEN
230: asn_debug.put_line('Record inserted into MTL_TXNS_HISTORY');
231: asn_debug.put_line('x_transaction_id is '||x_transaction_id);
232: END IF;
233:
226:
227: x_txns_id := x_transaction_id;
228:
229: IF (g_asn_debug = 'Y') THEN
230: asn_debug.put_line('Record inserted into MTL_TXNS_HISTORY');
231: asn_debug.put_line('x_transaction_id is '||x_transaction_id);
232: END IF;
233:
234: ELSE
227: x_txns_id := x_transaction_id;
228:
229: IF (g_asn_debug = 'Y') THEN
230: asn_debug.put_line('Record inserted into MTL_TXNS_HISTORY');
231: asn_debug.put_line('x_transaction_id is '||x_transaction_id);
232: END IF;
233:
234: ELSE
235:
232: END IF;
233:
234: ELSE
235:
236: IF (g_asn_debug = 'Y') THEN
237: asn_debug.put_line('transaction_id is ' || l_transaction_id);
238: asn_debug.put_line('l_transaction_status is ' || l_transaction_status);
239: asn_debug.put_line('p_txns_history_rec.transaction_status is ' || p_txns_history_rec.transaction_status);
240: asn_debug.put_line('Record already exists. So need to update in MTL_TXNS_HISTORY');
233:
234: ELSE
235:
236: IF (g_asn_debug = 'Y') THEN
237: asn_debug.put_line('transaction_id is ' || l_transaction_id);
238: asn_debug.put_line('l_transaction_status is ' || l_transaction_status);
239: asn_debug.put_line('p_txns_history_rec.transaction_status is ' || p_txns_history_rec.transaction_status);
240: asn_debug.put_line('Record already exists. So need to update in MTL_TXNS_HISTORY');
241: END IF;
234: ELSE
235:
236: IF (g_asn_debug = 'Y') THEN
237: asn_debug.put_line('transaction_id is ' || l_transaction_id);
238: asn_debug.put_line('l_transaction_status is ' || l_transaction_status);
239: asn_debug.put_line('p_txns_history_rec.transaction_status is ' || p_txns_history_rec.transaction_status);
240: asn_debug.put_line('Record already exists. So need to update in MTL_TXNS_HISTORY');
241: END IF;
242:
235:
236: IF (g_asn_debug = 'Y') THEN
237: asn_debug.put_line('transaction_id is ' || l_transaction_id);
238: asn_debug.put_line('l_transaction_status is ' || l_transaction_status);
239: asn_debug.put_line('p_txns_history_rec.transaction_status is ' || p_txns_history_rec.transaction_status);
240: asn_debug.put_line('Record already exists. So need to update in MTL_TXNS_HISTORY');
241: END IF;
242:
243: -- Record already exists. So Need to Update
236: IF (g_asn_debug = 'Y') THEN
237: asn_debug.put_line('transaction_id is ' || l_transaction_id);
238: asn_debug.put_line('l_transaction_status is ' || l_transaction_status);
239: asn_debug.put_line('p_txns_history_rec.transaction_status is ' || p_txns_history_rec.transaction_status);
240: asn_debug.put_line('Record already exists. So need to update in MTL_TXNS_HISTORY');
241: END IF;
242:
243: -- Record already exists. So Need to Update
244: -- Before Update Check for validity of status
250: raise invalid_status;
251:
252: END IF; -- if l_transaction_status checks
253:
254: IF (g_asn_debug = 'Y') THEN
255: asn_debug.put_line('Updating MTL_TXNS_HISTORY');
256: END IF;
257:
258:
251:
252: END IF; -- if l_transaction_status checks
253:
254: IF (g_asn_debug = 'Y') THEN
255: asn_debug.put_line('Updating MTL_TXNS_HISTORY');
256: END IF;
257:
258:
259: UPDATE MTL_TXNS_HISTORY
286: attribute14 = p_txns_history_rec.ATTRIBUTE14,
287: attribute15 = p_txns_history_rec.ATTRIBUTE15
288: WHERE transaction_id = l_transaction_id;
289:
290: IF (g_asn_debug = 'Y') THEN
291: asn_debug.put_line('MTL_TXNS_HISTORY record updated');
292: END IF;
293:
294:
287: attribute15 = p_txns_history_rec.ATTRIBUTE15
288: WHERE transaction_id = l_transaction_id;
289:
290: IF (g_asn_debug = 'Y') THEN
291: asn_debug.put_line('MTL_TXNS_HISTORY record updated');
292: END IF;
293:
294:
295: IF (l_xml_document_id is null) THEN
295: IF (l_xml_document_id is null) THEN
296:
297: IF (p_txns_history_rec.client_code is not null) THEN
298:
299: IF (g_asn_debug = 'Y') THEN
300: asn_debug.put_line('LSP : Updating RT.receipt_confirmation_extracted to Y');
301: END IF;
302:
303: UPDATE rcv_transactions rt
296:
297: IF (p_txns_history_rec.client_code is not null) THEN
298:
299: IF (g_asn_debug = 'Y') THEN
300: asn_debug.put_line('LSP : Updating RT.receipt_confirmation_extracted to Y');
301: END IF;
302:
303: UPDATE rcv_transactions rt
304: SET rt.receipt_confirmation_extracted = 'Y',
323: AND wms_deploy.get_client_code(rsl.item_id) = p_txns_history_rec.client_code);
324:
325: ELSE
326:
327: IF (g_asn_debug = 'Y') THEN
328: asn_debug.put_line('Distributed : Updating RT.receipt_confirmation_extracted to Y');
329: END IF;
330:
331:
324:
325: ELSE
326:
327: IF (g_asn_debug = 'Y') THEN
328: asn_debug.put_line('Distributed : Updating RT.receipt_confirmation_extracted to Y');
329: END IF;
330:
331:
332: UPDATE rcv_transactions rt
359:
360: IF(txn_cur%ISOPEN) THEN
361: CLOSE txn_cur;
362:
363: IF (g_asn_debug = 'Y') THEN
364: asn_debug.put_line('Closing txn_cur');
365: END IF;
366:
367: END IF;
360: IF(txn_cur%ISOPEN) THEN
361: CLOSE txn_cur;
362:
363: IF (g_asn_debug = 'Y') THEN
364: asn_debug.put_line('Closing txn_cur');
365: END IF;
366:
367: END IF;
368: ELSE
371: x_return_status := rcv_error_pkg.g_ret_sts_error;
372:
373: END IF; -- if p_txns_history_rec columns are not null
374:
375: IF (g_asn_debug = 'Y') THEN
376: asn_debug.put_line('Exiting Create_Update_Txns_History call');
377: END IF;
378:
379: EXCEPTION
372:
373: END IF; -- if p_txns_history_rec columns are not null
374:
375: IF (g_asn_debug = 'Y') THEN
376: asn_debug.put_line('Exiting Create_Update_Txns_History call');
377: END IF;
378:
379: EXCEPTION
380: WHEN invalid_status THEN
378:
379: EXCEPTION
380: WHEN invalid_status THEN
381: x_return_status := rcv_error_pkg.g_ret_sts_error;
382: IF (g_asn_debug = 'Y') THEN
383: asn_debug.put_line('invalid_status exception has occured.');
384: END IF;
385: WHEN invalid_action THEN
386: x_return_status := rcv_error_pkg.g_ret_sts_error;
379: EXCEPTION
380: WHEN invalid_status THEN
381: x_return_status := rcv_error_pkg.g_ret_sts_error;
382: IF (g_asn_debug = 'Y') THEN
383: asn_debug.put_line('invalid_status exception has occured.');
384: END IF;
385: WHEN invalid_action THEN
386: x_return_status := rcv_error_pkg.g_ret_sts_error;
387: IF (g_asn_debug = 'Y') THEN
383: asn_debug.put_line('invalid_status exception has occured.');
384: END IF;
385: WHEN invalid_action THEN
386: x_return_status := rcv_error_pkg.g_ret_sts_error;
387: IF (g_asn_debug = 'Y') THEN
388: asn_debug.put_line('invalid_action exception has occured.');
389: END IF;
390: WHEN invalid_entity_type THEN
391: x_return_status := rcv_error_pkg.g_ret_sts_error;
384: END IF;
385: WHEN invalid_action THEN
386: x_return_status := rcv_error_pkg.g_ret_sts_error;
387: IF (g_asn_debug = 'Y') THEN
388: asn_debug.put_line('invalid_action exception has occured.');
389: END IF;
390: WHEN invalid_entity_type THEN
391: x_return_status := rcv_error_pkg.g_ret_sts_error;
392: IF (g_asn_debug = 'Y') THEN
388: asn_debug.put_line('invalid_action exception has occured.');
389: END IF;
390: WHEN invalid_entity_type THEN
391: x_return_status := rcv_error_pkg.g_ret_sts_error;
392: IF (g_asn_debug = 'Y') THEN
393: asn_debug.put_line('invalid_entity_type exception has occured.');
394: END IF;
395: WHEN invalid_direction THEN
396: x_return_status := rcv_error_pkg.g_ret_sts_error;
389: END IF;
390: WHEN invalid_entity_type THEN
391: x_return_status := rcv_error_pkg.g_ret_sts_error;
392: IF (g_asn_debug = 'Y') THEN
393: asn_debug.put_line('invalid_entity_type exception has occured.');
394: END IF;
395: WHEN invalid_direction THEN
396: x_return_status := rcv_error_pkg.g_ret_sts_error;
397: IF (g_asn_debug = 'Y') THEN
393: asn_debug.put_line('invalid_entity_type exception has occured.');
394: END IF;
395: WHEN invalid_direction THEN
396: x_return_status := rcv_error_pkg.g_ret_sts_error;
397: IF (g_asn_debug = 'Y') THEN
398: asn_debug.put_line('invalid_direction exception has occured.');
399: END IF;
400: WHEN invalid_document_type THEN
401: x_return_status := rcv_error_pkg.g_ret_sts_error;
394: END IF;
395: WHEN invalid_direction THEN
396: x_return_status := rcv_error_pkg.g_ret_sts_error;
397: IF (g_asn_debug = 'Y') THEN
398: asn_debug.put_line('invalid_direction exception has occured.');
399: END IF;
400: WHEN invalid_document_type THEN
401: x_return_status := rcv_error_pkg.g_ret_sts_error;
402: IF (g_asn_debug = 'Y') THEN
398: asn_debug.put_line('invalid_direction exception has occured.');
399: END IF;
400: WHEN invalid_document_type THEN
401: x_return_status := rcv_error_pkg.g_ret_sts_error;
402: IF (g_asn_debug = 'Y') THEN
403: asn_debug.put_line('invalid_document_type exception has occured.');
404: END IF;
405: WHEN Others THEN
406: x_return_status := rcv_error_pkg.g_ret_sts_error;
399: END IF;
400: WHEN invalid_document_type THEN
401: x_return_status := rcv_error_pkg.g_ret_sts_error;
402: IF (g_asn_debug = 'Y') THEN
403: asn_debug.put_line('invalid_document_type exception has occured.');
404: END IF;
405: WHEN Others THEN
406: x_return_status := rcv_error_pkg.g_ret_sts_error;
407: IF (g_asn_debug = 'Y') THEN
403: asn_debug.put_line('invalid_document_type exception has occured.');
404: END IF;
405: WHEN Others THEN
406: x_return_status := rcv_error_pkg.g_ret_sts_error;
407: IF (g_asn_debug = 'Y') THEN
408: asn_debug.put_line('Unexpected error has occured. Oracle error message is '|| SQLERRM);
409: END IF;
410:
411: END Create_Update_Txns_History;
404: END IF;
405: WHEN Others THEN
406: x_return_status := rcv_error_pkg.g_ret_sts_error;
407: IF (g_asn_debug = 'Y') THEN
408: asn_debug.put_line('Unexpected error has occured. Oracle error message is '|| SQLERRM);
409: END IF;
410:
411: END Create_Update_Txns_History;
412:
462: no_record_found exception;
463:
464: BEGIN
465:
466: IF (g_asn_debug = 'Y') THEN
467: asn_debug.put_line('Entering Get_Txns_History');
468: END IF;
469:
470: x_return_status := rcv_error_pkg.g_ret_sts_success;
463:
464: BEGIN
465:
466: IF (g_asn_debug = 'Y') THEN
467: asn_debug.put_line('Entering Get_Txns_History');
468: END IF;
469:
470: x_return_status := rcv_error_pkg.g_ret_sts_success;
471:
477: END IF;
478:
479: CLOSE txns_history_cur;
480:
481: IF (g_asn_debug = 'Y') THEN
482: asn_debug.put_line('Exiting Get_Txns_History');
483: END IF;
484:
485: EXCEPTION
478:
479: CLOSE txns_history_cur;
480:
481: IF (g_asn_debug = 'Y') THEN
482: asn_debug.put_line('Exiting Get_Txns_History');
483: END IF;
484:
485: EXCEPTION
486: WHEN no_record_found THEN
489: CLOSE txns_history_cur;
490: END IF;
491:
492: x_return_status := rcv_error_pkg.g_ret_sts_error;
493: IF (g_asn_debug = 'Y') THEN
494: asn_debug.put_line('no_record_found exception has occured.');
495: END IF;
496:
497: WHEN Others THEN
490: END IF;
491:
492: x_return_status := rcv_error_pkg.g_ret_sts_error;
493: IF (g_asn_debug = 'Y') THEN
494: asn_debug.put_line('no_record_found exception has occured.');
495: END IF;
496:
497: WHEN Others THEN
498: x_return_status := rcv_error_pkg.g_ret_sts_unexp_error;
495: END IF;
496:
497: WHEN Others THEN
498: x_return_status := rcv_error_pkg.g_ret_sts_unexp_error;
499: IF (g_asn_debug = 'Y') THEN
500: asn_debug.put_line('Unexpected error has occured. Oracle error message is '|| SQLERRM);
501: END IF;
502: END Get_Txns_History;
503:
496:
497: WHEN Others THEN
498: x_return_status := rcv_error_pkg.g_ret_sts_unexp_error;
499: IF (g_asn_debug = 'Y') THEN
500: asn_debug.put_line('Unexpected error has occured. Oracle error message is '|| SQLERRM);
501: END IF;
502: END Get_Txns_History;
503:
504: END RCV_TRANSACTIONS_HISTORY_PKG;