17: BEGIN
18:
19: x_return_status := FND_API.G_RET_STS_SUCCESS;
20: IF pg_debug = 'Y' THEN
21: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_header(+)' );
22: ar_invoice_utils.debug ('All Default Values ' );
23: ar_invoice_utils.debug ('Set of Books Id '||
24: p_trx_system_param_rec.set_of_books_id);
25: ar_invoice_utils.debug ('Trx Currency '||
18:
19: x_return_status := FND_API.G_RET_STS_SUCCESS;
20: IF pg_debug = 'Y' THEN
21: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_header(+)' );
22: ar_invoice_utils.debug ('All Default Values ' );
23: ar_invoice_utils.debug ('Set of Books Id '||
24: p_trx_system_param_rec.set_of_books_id);
25: ar_invoice_utils.debug ('Trx Currency '||
26: p_trx_system_param_rec.base_currency_code);
19: x_return_status := FND_API.G_RET_STS_SUCCESS;
20: IF pg_debug = 'Y' THEN
21: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_header(+)' );
22: ar_invoice_utils.debug ('All Default Values ' );
23: ar_invoice_utils.debug ('Set of Books Id '||
24: p_trx_system_param_rec.set_of_books_id);
25: ar_invoice_utils.debug ('Trx Currency '||
26: p_trx_system_param_rec.base_currency_code);
27: ar_invoice_utils.debug ('Batch Source '||
21: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_header(+)' );
22: ar_invoice_utils.debug ('All Default Values ' );
23: ar_invoice_utils.debug ('Set of Books Id '||
24: p_trx_system_param_rec.set_of_books_id);
25: ar_invoice_utils.debug ('Trx Currency '||
26: p_trx_system_param_rec.base_currency_code);
27: ar_invoice_utils.debug ('Batch Source '||
28: p_trx_profile_rec.ar_ra_batch_source);
29: ar_invoice_utils.debug ('GL Date '|| p_batch_source_rec.default_date);
23: ar_invoice_utils.debug ('Set of Books Id '||
24: p_trx_system_param_rec.set_of_books_id);
25: ar_invoice_utils.debug ('Trx Currency '||
26: p_trx_system_param_rec.base_currency_code);
27: ar_invoice_utils.debug ('Batch Source '||
28: p_trx_profile_rec.ar_ra_batch_source);
29: ar_invoice_utils.debug ('GL Date '|| p_batch_source_rec.default_date);
30: ar_invoice_utils.debug ('Exchange Rate Type '
31: || p_trx_profile_rec.default_exchange_rate_type);
25: ar_invoice_utils.debug ('Trx Currency '||
26: p_trx_system_param_rec.base_currency_code);
27: ar_invoice_utils.debug ('Batch Source '||
28: p_trx_profile_rec.ar_ra_batch_source);
29: ar_invoice_utils.debug ('GL Date '|| p_batch_source_rec.default_date);
30: ar_invoice_utils.debug ('Exchange Rate Type '
31: || p_trx_profile_rec.default_exchange_rate_type);
32: END IF;
33:
26: p_trx_system_param_rec.base_currency_code);
27: ar_invoice_utils.debug ('Batch Source '||
28: p_trx_profile_rec.ar_ra_batch_source);
29: ar_invoice_utils.debug ('GL Date '|| p_batch_source_rec.default_date);
30: ar_invoice_utils.debug ('Exchange Rate Type '
31: || p_trx_profile_rec.default_exchange_rate_type);
32: END IF;
33:
34: -- First populate the global header table with the user parameter.
45: /* 5921925 - Removed defaulting UPDATE statement and integrated it
46: into ar_trx_global_process_header.insert_row */
47:
48: IF pg_debug = 'Y' THEN
49: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_header(-)' );
50: END IF;
51:
52: EXCEPTION
53: WHEN OTHERS THEN
79:
80: BEGIN
81:
82: IF pg_debug = 'Y' THEN
83: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_lines(+)' );
84: END IF;
85:
86: x_return_status := FND_API.G_RET_STS_SUCCESS;
87:
109: FETCH line INTO l_customer_trx_line_id;
110: CLOSE line;
111:
112: IF pg_debug = 'Y' THEN
113: ar_invoice_utils.debug ('Cust Trx Line Id in Link Loop ' ||
114: l_customer_trx_line_id);
115: ar_invoice_utils.debug ('Link to Line Id in Link Loop ' ||
116: clinkRec.link_to_trx_line_id );
117: ar_invoice_utils.debug ('Trx Line Id in Link Loop ' ||
111:
112: IF pg_debug = 'Y' THEN
113: ar_invoice_utils.debug ('Cust Trx Line Id in Link Loop ' ||
114: l_customer_trx_line_id);
115: ar_invoice_utils.debug ('Link to Line Id in Link Loop ' ||
116: clinkRec.link_to_trx_line_id );
117: ar_invoice_utils.debug ('Trx Line Id in Link Loop ' ||
118: clinkRec.trx_line_id );
119: END IF;
113: ar_invoice_utils.debug ('Cust Trx Line Id in Link Loop ' ||
114: l_customer_trx_line_id);
115: ar_invoice_utils.debug ('Link to Line Id in Link Loop ' ||
116: clinkRec.link_to_trx_line_id );
117: ar_invoice_utils.debug ('Trx Line Id in Link Loop ' ||
118: clinkRec.trx_line_id );
119: END IF;
120:
121: UPDATE ar_trx_lines_gt gt
133: request_id = AR_INVOICE_TABLE_HANDLER.g_request_id;
134:
135: IF pg_debug = 'Y'
136: THEN
137: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_lines(-)' );
138: END IF;
139:
140: EXCEPTION
141: WHEN OTHERS THEN
161:
162: BEGIN
163:
164: IF pg_debug = 'Y' THEN
165: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_distributions(+)' );
166: END IF;
167:
168: x_return_status := FND_API.G_RET_STS_SUCCESS;
169:
203: AND dist.account_class = 'REC');
204:
205:
206: IF pg_debug = 'Y' THEN
207: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_distributions(-)' );
208: END IF;
209:
210: EXCEPTION
211: WHEN OTHERS THEN
225:
226: BEGIN
227: IF pg_debug = 'Y'
228: THEN
229: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_salescredits(+)' );
230: END IF;
231: x_return_status := FND_API.G_RET_STS_SUCCESS;
232: --populate global dist. table
233: AR_TRX_GLOBAL_PROCESS_SALESCR.INSERT_ROW(
255:
256:
257: IF pg_debug = 'Y'
258: THEN
259: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_salescredits(-)' );
260: END IF;
261: EXCEPTION
262: WHEN OTHERS THEN
263: x_errmsg := 'Error in AR_INVOICE_API_PUB.populate sales credits '||sqlerrm;
277:
278: BEGIN
279:
280: IF pg_debug = 'Y' THEN
281: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_contingencies(+)' );
282: END IF;
283:
284: x_return_status := FND_API.G_RET_STS_SUCCESS;
285: -- populate global contingencies table
305: WHERE tlg.trx_line_id = tcg.trx_line_id
306: AND rownum = 1);
307:
308: IF pg_debug = 'Y' THEN
309: ar_invoice_utils.debug ('ar_invoice_api_pub.populate_contingencies(-)' );
310: END IF;
311:
312: EXCEPTION
313: WHEN OTHERS THEN
378: BEGIN
379:
380: IF pg_debug = 'Y'
381: THEN
382: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.CREATE_INVOICE(2)(+)' );
383: END IF;
384:
385: SAVEPOINT Create_Invoice;
386: /*--------------------------------------------------+
418:
419:
420: IF pg_debug = 'Y'
421: THEN
422: ar_invoice_utils.debug ('Before looping thru invoice headers....' );
423: ar_invoice_utils.debug ('x_return_status = '|| x_return_status);
424: ar_invoice_utils.debug ('x_errmsg = '|| x_errmsg);
425: END IF;
426:
419:
420: IF pg_debug = 'Y'
421: THEN
422: ar_invoice_utils.debug ('Before looping thru invoice headers....' );
423: ar_invoice_utils.debug ('x_return_status = '|| x_return_status);
424: ar_invoice_utils.debug ('x_errmsg = '|| x_errmsg);
425: END IF;
426:
427: FOR org_rec in org_cur LOOP
420: IF pg_debug = 'Y'
421: THEN
422: ar_invoice_utils.debug ('Before looping thru invoice headers....' );
423: ar_invoice_utils.debug ('x_return_status = '|| x_return_status);
424: ar_invoice_utils.debug ('x_errmsg = '|| x_errmsg);
425: END IF;
426:
427: FOR org_rec in org_cur LOOP
428: AR_TRX_GLOBAL_PROCESS_TMP.GET_ROWS (
433: p_trx_salescredits_tbl => l_trx_salescredits_tbl,
434: x_errmsg => x_errmsg,
435: x_return_status => x_return_status);
436:
437: ar_invoice_utils.debug ('Looping thru invoice headers....' );
438: ar_invoice_utils.debug ('x_return_status = '|| x_return_status);
439: ar_invoice_utils.debug ('x_errmsg = '|| x_errmsg);
440:
441: l_org_id := org_rec.org_id;
434: x_errmsg => x_errmsg,
435: x_return_status => x_return_status);
436:
437: ar_invoice_utils.debug ('Looping thru invoice headers....' );
438: ar_invoice_utils.debug ('x_return_status = '|| x_return_status);
439: ar_invoice_utils.debug ('x_errmsg = '|| x_errmsg);
440:
441: l_org_id := org_rec.org_id;
442: l_org_return_status := FND_API.G_RET_STS_SUCCESS;
435: x_return_status => x_return_status);
436:
437: ar_invoice_utils.debug ('Looping thru invoice headers....' );
438: ar_invoice_utils.debug ('x_return_status = '|| x_return_status);
439: ar_invoice_utils.debug ('x_errmsg = '|| x_errmsg);
440:
441: l_org_id := org_rec.org_id;
442: l_org_return_status := FND_API.G_RET_STS_SUCCESS;
443: ar_mo_cache_utils.set_org_context_in_api(p_org_id =>l_org_id,
441: l_org_id := org_rec.org_id;
442: l_org_return_status := FND_API.G_RET_STS_SUCCESS;
443: ar_mo_cache_utils.set_org_context_in_api(p_org_id =>l_org_id,
444: p_return_status =>l_org_return_status);
445: ar_invoice_utils.debug ('l_org_id = '|| l_org_id);
446: ar_invoice_utils.debug ('l_org_return_status = '|| l_org_return_status);
447:
448: /* 6006015 - this logic differs from 11.5 because
449: the transactions are processed by org. So we
442: l_org_return_status := FND_API.G_RET_STS_SUCCESS;
443: ar_mo_cache_utils.set_org_context_in_api(p_org_id =>l_org_id,
444: p_return_status =>l_org_return_status);
445: ar_invoice_utils.debug ('l_org_id = '|| l_org_id);
446: ar_invoice_utils.debug ('l_org_return_status = '|| l_org_return_status);
447:
448: /* 6006015 - this logic differs from 11.5 because
449: the transactions are processed by org. So we
450: have to init each time the org changes */
491: END IF;
492:
493: IF pg_debug = 'Y'
494: THEN
495: ar_invoice_utils.debug ('Calling Default Rtn from ar_invoice_pub(-)' );
496: ar_invoice_utils.debug ('Create Batch(+)' );
497: END IF;
498:
499: /* 5921925 - only create a batch if they are not calling in single invoice
492:
493: IF pg_debug = 'Y'
494: THEN
495: ar_invoice_utils.debug ('Calling Default Rtn from ar_invoice_pub(-)' );
496: ar_invoice_utils.debug ('Create Batch(+)' );
497: END IF;
498:
499: /* 5921925 - only create a batch if they are not calling in single invoice
500: mode */
526: --first popolate the global temp. table based on user passed variables and
527: -- default system parameters and profile values.
528: IF pg_debug = 'Y'
529: THEN
530: ar_invoice_utils.debug ('Create Batch(-)' );
531: ar_invoice_utils.debug ('populate header(+)' );
532: END IF;
533: populate_header( p_trx_header_tbl => l_trx_header_tbl,
534: p_trx_system_param_rec => l_trx_system_parameters_rec,
527: -- default system parameters and profile values.
528: IF pg_debug = 'Y'
529: THEN
530: ar_invoice_utils.debug ('Create Batch(-)' );
531: ar_invoice_utils.debug ('populate header(+)' );
532: END IF;
533: populate_header( p_trx_header_tbl => l_trx_header_tbl,
534: p_trx_system_param_rec => l_trx_system_parameters_rec,
535: p_trx_profile_rec => l_trx_profile_rec,
543: return;
544: END IF;
545: IF pg_debug = 'Y'
546: THEN
547: ar_invoice_utils.debug ('populate header (-)' );
548: ar_invoice_utils.debug ('populate lines (+)' );
549: END IF;
550:
551: populate_lines ( p_trx_lines_tbl => l_trx_lines_tbl,
544: END IF;
545: IF pg_debug = 'Y'
546: THEN
547: ar_invoice_utils.debug ('populate header (-)' );
548: ar_invoice_utils.debug ('populate lines (+)' );
549: END IF;
550:
551: populate_lines ( p_trx_lines_tbl => l_trx_lines_tbl,
552: p_trx_system_param_rec => l_trx_system_parameters_rec,
561:
562: -- Check for validations that spans across header and lines.
563:
564: IF pg_debug = 'Y' THEN
565: ar_invoice_utils.debug ('validate_master_detail' );
566: END IF;
567:
568: ar_invoice_utils.validate_master_detail
569: ( x_errmsg => x_errmsg,
564: IF pg_debug = 'Y' THEN
565: ar_invoice_utils.debug ('validate_master_detail' );
566: END IF;
567:
568: ar_invoice_utils.validate_master_detail
569: ( x_errmsg => x_errmsg,
570: x_return_status => x_return_status);
571:
572: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
576: END IF;
577:
578: IF pg_debug = 'Y'
579: THEN
580: ar_invoice_utils.debug ('populate lines (-)' );
581: ar_invoice_utils.debug ('populate distributions (+)' );
582: END IF;
583:
584: /* 5921925 - only execute if there are rows */
577:
578: IF pg_debug = 'Y'
579: THEN
580: ar_invoice_utils.debug ('populate lines (-)' );
581: ar_invoice_utils.debug ('populate distributions (+)' );
582: END IF;
583:
584: /* 5921925 - only execute if there are rows */
585: IF p_trx_dist_tbl.count > 0
602: END IF;
603:
604: IF pg_debug = 'Y'
605: THEN
606: ar_invoice_utils.debug ('populate distributions (-)' );
607: ar_invoice_utils.debug ('populate sales credits (+)' );
608: END IF;
609:
610: /* 5921925 - only execute if rows exist */
603:
604: IF pg_debug = 'Y'
605: THEN
606: ar_invoice_utils.debug ('populate distributions (-)' );
607: ar_invoice_utils.debug ('populate sales credits (+)' );
608: END IF;
609:
610: /* 5921925 - only execute if rows exist */
611: IF p_trx_salescredits_tbl.count > 0
626: g_sc_exist := FALSE;
627: END IF;
628:
629: IF pg_debug = 'Y' THEN
630: ar_invoice_utils.debug('populate sales credits(-)' );
631: ar_invoice_utils.debug('populate contingencies(+)' );
632: END IF;
633:
634: /* 5921925 - only populate if rows exist */
627: END IF;
628:
629: IF pg_debug = 'Y' THEN
630: ar_invoice_utils.debug('populate sales credits(-)' );
631: ar_invoice_utils.debug('populate contingencies(+)' );
632: END IF;
633:
634: /* 5921925 - only populate if rows exist */
635: IF p_trx_contingencies_tbl.count > 0
660: -- ORASHID 20-Sep-2004
661: -- END
662:
663: IF pg_debug = 'Y' THEN
664: ar_invoice_utils.debug ('populate contingencies(-)' );
665: END IF;
666:
667: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
668: ROLLBACK to Create_Invoice;
672:
673: -- Validate all inter-dependent parameters
674: IF pg_debug = 'Y'
675: THEN
676: ar_invoice_utils.debug ('validate_dependend_parameter' );
677: END IF;
678: ar_invoice_utils.validate_dependent_parameters
679: ( p_trx_system_param_rec => l_trx_system_parameters_rec,
680: x_errmsg => x_errmsg,
674: IF pg_debug = 'Y'
675: THEN
676: ar_invoice_utils.debug ('validate_dependend_parameter' );
677: END IF;
678: ar_invoice_utils.validate_dependent_parameters
679: ( p_trx_system_param_rec => l_trx_system_parameters_rec,
680: x_errmsg => x_errmsg,
681: x_return_status => x_return_status);
682:
690: -- Now validate all the values which user has passed and populate
691: -- any dependent fields.
692: IF pg_debug = 'Y'
693: THEN
694: ar_invoice_utils.debug ('validate_header from ar_invoice_pub (+)' );
695: END IF;
696:
697: ar_invoice_utils.validate_header
698: ( p_trx_system_param_rec => l_trx_system_parameters_rec,
693: THEN
694: ar_invoice_utils.debug ('validate_header from ar_invoice_pub (+)' );
695: END IF;
696:
697: ar_invoice_utils.validate_header
698: ( p_trx_system_param_rec => l_trx_system_parameters_rec,
699: p_trx_profile_rec => l_trx_profile_rec,
700: x_errmsg => x_errmsg,
701: x_return_status => x_return_status);
709:
710:
711: IF pg_debug = 'Y'
712: THEN
713: ar_invoice_utils.debug ('validate_header from ar_invoice_pub (-)' );
714: ar_invoice_utils.debug ('validate_lines from ar_invoice_pub (+)' );
715: END IF;
716:
717: ar_invoice_utils.validate_lines
710:
711: IF pg_debug = 'Y'
712: THEN
713: ar_invoice_utils.debug ('validate_header from ar_invoice_pub (-)' );
714: ar_invoice_utils.debug ('validate_lines from ar_invoice_pub (+)' );
715: END IF;
716:
717: ar_invoice_utils.validate_lines
718: ( x_errmsg => x_errmsg,
713: ar_invoice_utils.debug ('validate_header from ar_invoice_pub (-)' );
714: ar_invoice_utils.debug ('validate_lines from ar_invoice_pub (+)' );
715: END IF;
716:
717: ar_invoice_utils.validate_lines
718: ( x_errmsg => x_errmsg,
719: x_return_status => x_return_status);
720:
721: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR
725: return;
726: END IF;
727: IF pg_debug = 'Y'
728: THEN
729: ar_invoice_utils.debug ('validate_lines from ar_invoice_pub (-)' );
730: ar_invoice_utils.debug ('validate_distributions from ar_invoice_pub (+)' );
731: END IF;
732:
733: /* 5921925 - prevent this call if no distributions passed */
726: END IF;
727: IF pg_debug = 'Y'
728: THEN
729: ar_invoice_utils.debug ('validate_lines from ar_invoice_pub (-)' );
730: ar_invoice_utils.debug ('validate_distributions from ar_invoice_pub (+)' );
731: END IF;
732:
733: /* 5921925 - prevent this call if no distributions passed */
734: IF g_dist_exist
732:
733: /* 5921925 - prevent this call if no distributions passed */
734: IF g_dist_exist
735: THEN
736: ar_invoice_utils.validate_distributions
737: ( p_trx_system_parameters_rec => l_trx_system_parameters_rec,
738: x_errmsg => x_errmsg,
739: x_return_status => x_return_status);
740:
747: END IF;
748:
749: IF pg_debug = 'Y'
750: THEN
751: ar_invoice_utils.debug ('validate_distributions from ar_invoice_pub (-)' );
752: ar_invoice_utils.debug ('validate_salescredits from ar_invoice_pub (+)' );
753: END IF;
754:
755: IF g_sc_exist
748:
749: IF pg_debug = 'Y'
750: THEN
751: ar_invoice_utils.debug ('validate_distributions from ar_invoice_pub (-)' );
752: ar_invoice_utils.debug ('validate_salescredits from ar_invoice_pub (+)' );
753: END IF;
754:
755: IF g_sc_exist
756: THEN
753: END IF;
754:
755: IF g_sc_exist
756: THEN
757: ar_invoice_utils.validate_salescredits(
758: p_trx_system_param_rec => l_trx_system_parameters_rec,
759: x_errmsg => x_errmsg,
760: x_return_status => x_return_status);
761:
768: END IF;
769:
770: IF pg_debug = 'Y'
771: THEN
772: ar_invoice_utils.debug ('validate_salescredits from ar_invoice_pub (-)' );
773: ar_invoice_utils.debug ('vaidate_gdf (+) ');
774: END IF;
775:
776: ar_invoice_utils.validate_gdf(
769:
770: IF pg_debug = 'Y'
771: THEN
772: ar_invoice_utils.debug ('validate_salescredits from ar_invoice_pub (-)' );
773: ar_invoice_utils.debug ('vaidate_gdf (+) ');
774: END IF;
775:
776: ar_invoice_utils.validate_gdf(
777: p_request_id => AR_INVOICE_TABLE_HANDLER.g_request_id,
772: ar_invoice_utils.debug ('validate_salescredits from ar_invoice_pub (-)' );
773: ar_invoice_utils.debug ('vaidate_gdf (+) ');
774: END IF;
775:
776: ar_invoice_utils.validate_gdf(
777: p_request_id => AR_INVOICE_TABLE_HANDLER.g_request_id,
778: x_errmsg => x_errmsg,
779: x_return_status => x_return_status);
780:
785: return;
786: END IF;
787: IF pg_debug = 'Y'
788: THEN
789: ar_invoice_utils.debug ('validate_gdf (-)' );
790: ar_invoice_utils.debug ('Calling Table Handler ar_invoice_table_handler.insert_row (+) ');
791: END IF;
792:
793: AR_INVOICE_TABLE_HANDLER.insert_row(
786: END IF;
787: IF pg_debug = 'Y'
788: THEN
789: ar_invoice_utils.debug ('validate_gdf (-)' );
790: ar_invoice_utils.debug ('Calling Table Handler ar_invoice_table_handler.insert_row (+) ');
791: END IF;
792:
793: AR_INVOICE_TABLE_HANDLER.insert_row(
794: p_trx_system_parameters_rec => l_trx_system_parameters_rec,
815:
816:
817: --{Call creation of the events should outside the loop as not org striped
818: --
819: ar_invoice_utils.debug ('Call creation of XLA events in bulk mode +' );
820: ar_invoice_utils.debug (' Using the request_id :'||AR_INVOICE_TABLE_HANDLER.g_request_id);
821:
822: arp_xla_events.Create_Events_Req(p_request_id => AR_INVOICE_TABLE_HANDLER.g_request_id,
823: p_doc_table => 'CT',
816:
817: --{Call creation of the events should outside the loop as not org striped
818: --
819: ar_invoice_utils.debug ('Call creation of XLA events in bulk mode +' );
820: ar_invoice_utils.debug (' Using the request_id :'||AR_INVOICE_TABLE_HANDLER.g_request_id);
821:
822: arp_xla_events.Create_Events_Req(p_request_id => AR_INVOICE_TABLE_HANDLER.g_request_id,
823: p_doc_table => 'CT',
824: p_mode => 'B',
822: arp_xla_events.Create_Events_Req(p_request_id => AR_INVOICE_TABLE_HANDLER.g_request_id,
823: p_doc_table => 'CT',
824: p_mode => 'B',
825: p_call => 'B');
826: ar_invoice_utils.debug ('Call creation of XLA events in bulk mode -' );
827: --}
828:
829:
830: IF pg_debug = 'Y'
828:
829:
830: IF pg_debug = 'Y'
831: THEN
832: ar_invoice_utils.debug ('Calling Table Handler ar_invoice_table_handler.insert_row (-) ');
833: ar_invoice_utils.debug ('ar_invoice_api_pub.create_invoice(-)' );
834: END IF;
835:
836:
829:
830: IF pg_debug = 'Y'
831: THEN
832: ar_invoice_utils.debug ('Calling Table Handler ar_invoice_table_handler.insert_row (-) ');
833: ar_invoice_utils.debug ('ar_invoice_api_pub.create_invoice(-)' );
834: END IF;
835:
836:
837: END CREATE_INVOICE;
858:
859: BEGIN
860: IF pg_debug = 'Y'
861: THEN
862: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.CREATE_SINGLE_INVOICE(2)(+)' );
863: END IF;
864:
865: x_return_status := FND_API.G_RET_STS_SUCCESS;
866:
899: END IF;
900:
901: IF pg_debug = 'Y'
902: THEN
903: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.CREATE_SINGLE_INVOICE(-)' );
904: END IF;
905:
906: END CREATE_SINGLE_INVOICE;
907:
927:
928: BEGIN
929:
930: IF pg_debug = 'Y' THEN
931: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.CREATE_SINGLE_INVOICE(+)' );
932: END IF;
933:
934: -- call the api with a null trx_contingencies_tbl
935:
947: x_msg_count => x_msg_count,
948: x_msg_data => x_msg_data);
949:
950: IF pg_debug = 'Y' THEN
951: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.CREATE_SINGLE_INVOICE(-)' );
952: END IF;
953:
954: END create_invoice;
955:
972:
973: BEGIN
974:
975: IF pg_debug = 'Y' THEN
976: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.CREATE_SINGLE_INVOICE(+)' );
977: END IF;
978:
979: -- call the api with a null trx_contingencies_tbl
980:
993: x_msg_count => x_msg_count,
994: x_msg_data => x_msg_data);
995:
996: IF pg_debug = 'Y' THEN
997: ar_invoice_utils.debug ('AR_INVOICE_API_PUB.CREATE_SINGLE_INVOICE(-)' );
998: END IF;
999:
1000: END create_single_invoice;
1001:
1043: l_dummy_type ra_cust_trx_types%rowtype;
1044:
1045: BEGIN
1046:
1047: ar_invoice_utils.debug('Cache_Transaction_Type()+');
1048:
1049: IF ( p_cust_trx_type_id IS NOT NULL )
1050: THEN
1051:
1062: INTO Type_Cache_Tbl( p_cust_trx_type_id )
1063: FROM ra_cust_trx_types
1064: WHERE cust_trx_type_id = p_cust_trx_type_id;
1065:
1066: ar_invoice_utils.debug('Transaction Type: ' ||
1067: Type_Cache_Tbl( p_cust_trx_type_id ).name ||
1068: ' found.');
1069:
1070: EXCEPTION
1080: +---------------------------------------------*/
1081:
1082: Type_Cache_Tbl( p_cust_trx_type_id ) :=
1083: l_dummy_type;
1084: ar_invoice_utils.debug('Transaction Type not found');
1085:
1086: WHEN OTHERS THEN
1087: RAISE;
1088: END;
1090: END IF;
1091:
1092: END IF;
1093:
1094: ar_invoice_utils.debug('Cache_Transaction_type()-');
1095:
1096: EXCEPTION
1097: WHEN NO_DATA_FOUND THEN NULL;
1098:
1096: EXCEPTION
1097: WHEN NO_DATA_FOUND THEN NULL;
1098:
1099: WHEN OTHERS THEN
1100: ar_invoice_utils.debug('EXCEPTION: Cache_Transaction_Type() ');
1101: ar_invoice_utils.debug('p_cust_trx_type_id = ' ||
1102: TO_CHAR(p_cust_trx_type_id));
1103: RAISE;
1104:
1097: WHEN NO_DATA_FOUND THEN NULL;
1098:
1099: WHEN OTHERS THEN
1100: ar_invoice_utils.debug('EXCEPTION: Cache_Transaction_Type() ');
1101: ar_invoice_utils.debug('p_cust_trx_type_id = ' ||
1102: TO_CHAR(p_cust_trx_type_id));
1103: RAISE;
1104:
1105: END Cache_Transaction_Type;
1152: l_index BINARY_INTEGER;
1153:
1154: BEGIN
1155:
1156: ar_invoice_utils.debug('Get_Flags()+');
1157:
1158: p_posted_flag := 'N';
1159: p_activity_flag := 'N';
1160: p_dm_reversal := 'N';
1191: END IF;
1192:
1193: END LOOP;
1194:
1195: ar_invoice_utils.debug('. posted_flag = ' ||
1196: p_posted_flag);
1197:
1198: ar_invoice_utils.debug('. activity_flag = ' ||
1199: p_activity_flag);
1194:
1195: ar_invoice_utils.debug('. posted_flag = ' ||
1196: p_posted_flag);
1197:
1198: ar_invoice_utils.debug('. activity_flag = ' ||
1199: p_activity_flag);
1200:
1201: ar_invoice_utils.debug('. printed_flag = ' ||
1202: p_printed_flag);
1197:
1198: ar_invoice_utils.debug('. activity_flag = ' ||
1199: p_activity_flag);
1200:
1201: ar_invoice_utils.debug('. printed_flag = ' ||
1202: p_printed_flag);
1203:
1204: ar_invoice_utils.debug('. p_rev_recog_run_flag = ' ||
1205: p_rev_recog_run_flag);
1200:
1201: ar_invoice_utils.debug('. printed_flag = ' ||
1202: p_printed_flag);
1203:
1204: ar_invoice_utils.debug('. p_rev_recog_run_flag = ' ||
1205: p_rev_recog_run_flag);
1206:
1207: ar_invoice_utils.debug('. Class = ' ||
1208: p_type_rec.type);
1203:
1204: ar_invoice_utils.debug('. p_rev_recog_run_flag = ' ||
1205: p_rev_recog_run_flag);
1206:
1207: ar_invoice_utils.debug('. Class = ' ||
1208: p_type_rec.type);
1209:
1210: ar_invoice_utils.debug('. created_from = ' ||
1211: p_trx_rec.created_from);
1206:
1207: ar_invoice_utils.debug('. Class = ' ||
1208: p_type_rec.type);
1209:
1210: ar_invoice_utils.debug('. created_from = ' ||
1211: p_trx_rec.created_from);
1212:
1213: IF ( p_trx_rec.created_from IN ('ARXREV', 'REL9_ARXREV') )
1214: THEN
1219: THEN
1220: p_cb := 'Y';
1221: END IF;
1222:
1223: ar_invoice_utils.debug('Get_Flags()-');
1224:
1225: EXCEPTION
1226: WHEN OTHERS THEN
1227:
1224:
1225: EXCEPTION
1226: WHEN OTHERS THEN
1227:
1228: ar_invoice_utils.debug('EXCEPTION: Get_Flags()');
1229: RAISE;
1230:
1231: END Get_Flags;
1232:
1275: l_cb_flag VARCHAR2(1);
1276:
1277: BEGIN
1278:
1279: ar_invoice_utils.debug('Validate_Delete_Transaction()+');
1280:
1281: p_return_status := FND_API.G_RET_STS_SUCCESS;
1282:
1283: /*------------------------------------------------------------+
1313: /*--------------------------------------------------------------------+
1314: | The invoice_deletion_flag must be Y for transactions to be deleted |
1315: +--------------------------------------------------------------------*/
1316:
1317: ar_invoice_utils.debug('. invoice_deletion_flag = ' ||
1318: arp_global.sysparam.invoice_deletion_flag);
1319:
1320: IF ( arp_global.sysparam.invoice_deletion_flag <> 'Y' )
1321: THEN
1352: | o It has not been posted to GL and |
1353: | o There is no activity against it. |
1354: +--------------------------------------------------------------*/
1355:
1356: ar_invoice_utils.debug('. complete_flag = ' ||
1357: p_trx_rec.complete_flag);
1358:
1359: IF ( p_trx_rec.complete_flag = 'Y' )
1360: THEN
1438: END IF; -- complete case
1439:
1440: END IF;
1441:
1442: ar_invoice_utils.debug('Validate_Delete_Transaction()-');
1443:
1444: EXCEPTION
1445: WHEN OTHERS THEN
1446: ar_invoice_utils.debug('EXCEPTION: Validate_Delete_Transaction()');
1442: ar_invoice_utils.debug('Validate_Delete_Transaction()-');
1443:
1444: EXCEPTION
1445: WHEN OTHERS THEN
1446: ar_invoice_utils.debug('EXCEPTION: Validate_Delete_Transaction()');
1447: ar_invoice_utils.debug('p_customer_trx_id = ' ||
1448: p_customer_trx_id);
1449:
1450: RAISE;
1443:
1444: EXCEPTION
1445: WHEN OTHERS THEN
1446: ar_invoice_utils.debug('EXCEPTION: Validate_Delete_Transaction()');
1447: ar_invoice_utils.debug('p_customer_trx_id = ' ||
1448: p_customer_trx_id);
1449:
1450: RAISE;
1451:
1490: x_return_status VARCHAR2(240);
1491: l_payment_trxn_extn_id ra_customer_trx.PAYMENT_TRXN_EXTENSION_ID%TYPE;
1492: l_fnd_api_constants_rec ar_bills_main.fnd_api_constants_type := ar_bills_main.get_fnd_api_constants_rec;
1493: Begin
1494: ar_invoice_utils.debug('AR_INVOICE_API_PUB.Delete_Trxn_Extn_Details()+ ');
1495:
1496: p_return_status := FND_API.G_RET_STS_SUCCESS;
1497:
1498:
1509:
1510: /*-------------------------+
1511: | Call the IBY API |
1512: +-------------------------*/
1513: ar_invoice_utils.debug('Call TO IBY API ()+ ');
1514:
1515:
1516: IBY_FNDCPT_TRXN_PUB.delete_transaction_extension(
1517: p_api_version => 1.0,
1528:
1529:
1530: IF x_return_status = FND_API.G_RET_STS_SUCCESS
1531: THEN
1532: ar_invoice_utils.debug('Payment_Trxn_Extension_Id : ' || l_payment_trxn_extn_id);
1533: Else
1534: ar_invoice_utils.debug('Errors Reported by IBY API:Delete Transaction Extension ');
1535: p_return_status := FND_API.G_RET_STS_ERROR;
1536: END IF;
1530: IF x_return_status = FND_API.G_RET_STS_SUCCESS
1531: THEN
1532: ar_invoice_utils.debug('Payment_Trxn_Extension_Id : ' || l_payment_trxn_extn_id);
1533: Else
1534: ar_invoice_utils.debug('Errors Reported by IBY API:Delete Transaction Extension ');
1535: p_return_status := FND_API.G_RET_STS_ERROR;
1536: END IF;
1537: EXCEPTION
1538: WHEN OTHERS THEN
1535: p_return_status := FND_API.G_RET_STS_ERROR;
1536: END IF;
1537: EXCEPTION
1538: WHEN OTHERS THEN
1539: ar_invoice_utils.debug('exception in AR_INVOICE_API_PUB.Delete_Trxn_Extn_Detail ');
1540: p_return_status := FND_API.G_RET_STS_ERROR;
1541: END Delete_Trxn_Extn_Details;
1542:
1543:
1621: l_delete_pmt_ext_status VARCHAR2(10);
1622:
1623: PROCEDURE Display_Parameters IS
1624: BEGIN
1625: ar_invoice_utils.debug('p_api_name = ' || p_api_name);
1626: ar_invoice_utils.debug('p_api_version = ' || p_api_version);
1627: ar_invoice_utils.debug('p_init_msg_list = ' || p_init_msg_list);
1628: ar_invoice_utils.debug('p_commit = ' || p_commit);
1629: ar_invoice_utils.debug('p_validation_level = ' || p_validation_level);
1622:
1623: PROCEDURE Display_Parameters IS
1624: BEGIN
1625: ar_invoice_utils.debug('p_api_name = ' || p_api_name);
1626: ar_invoice_utils.debug('p_api_version = ' || p_api_version);
1627: ar_invoice_utils.debug('p_init_msg_list = ' || p_init_msg_list);
1628: ar_invoice_utils.debug('p_commit = ' || p_commit);
1629: ar_invoice_utils.debug('p_validation_level = ' || p_validation_level);
1630: ar_invoice_utils.debug('p_customer_trx_id = ' || p_customer_trx_id);
1623: PROCEDURE Display_Parameters IS
1624: BEGIN
1625: ar_invoice_utils.debug('p_api_name = ' || p_api_name);
1626: ar_invoice_utils.debug('p_api_version = ' || p_api_version);
1627: ar_invoice_utils.debug('p_init_msg_list = ' || p_init_msg_list);
1628: ar_invoice_utils.debug('p_commit = ' || p_commit);
1629: ar_invoice_utils.debug('p_validation_level = ' || p_validation_level);
1630: ar_invoice_utils.debug('p_customer_trx_id = ' || p_customer_trx_id);
1631: END;
1624: BEGIN
1625: ar_invoice_utils.debug('p_api_name = ' || p_api_name);
1626: ar_invoice_utils.debug('p_api_version = ' || p_api_version);
1627: ar_invoice_utils.debug('p_init_msg_list = ' || p_init_msg_list);
1628: ar_invoice_utils.debug('p_commit = ' || p_commit);
1629: ar_invoice_utils.debug('p_validation_level = ' || p_validation_level);
1630: ar_invoice_utils.debug('p_customer_trx_id = ' || p_customer_trx_id);
1631: END;
1632:
1625: ar_invoice_utils.debug('p_api_name = ' || p_api_name);
1626: ar_invoice_utils.debug('p_api_version = ' || p_api_version);
1627: ar_invoice_utils.debug('p_init_msg_list = ' || p_init_msg_list);
1628: ar_invoice_utils.debug('p_commit = ' || p_commit);
1629: ar_invoice_utils.debug('p_validation_level = ' || p_validation_level);
1630: ar_invoice_utils.debug('p_customer_trx_id = ' || p_customer_trx_id);
1631: END;
1632:
1633: BEGIN
1626: ar_invoice_utils.debug('p_api_version = ' || p_api_version);
1627: ar_invoice_utils.debug('p_init_msg_list = ' || p_init_msg_list);
1628: ar_invoice_utils.debug('p_commit = ' || p_commit);
1629: ar_invoice_utils.debug('p_validation_level = ' || p_validation_level);
1630: ar_invoice_utils.debug('p_customer_trx_id = ' || p_customer_trx_id);
1631: END;
1632:
1633: BEGIN
1634:
1672: /*---------------------------------------------+
1673: | ========== Start of API Body ========== |
1674: +---------------------------------------------*/
1675:
1676: ar_invoice_utils.debug('AR_INVOICE_API_PUB.Delete_Transaction(+)' );
1677:
1678:
1679: Validate_Delete_Transaction(
1680: p_customer_trx_id,
1689: THEN
1690:
1691: IF pg_debug = 'Y'
1692: THEN
1693: ar_invoice_utils.debug('Making the transaction incomplete ' );
1694: END IF;
1695:
1696: /*-------------------------------------------+
1697: | Try to make the transaction incomplete. |
1707: AND latest_rec_flag = 'Y';
1708:
1709: IF pg_debug = 'Y'
1710: THEN
1711: ar_invoice_utils.debug ('. gl_date = ' || TO_CHAR(l_gl_date, 'DD-MON-YYYY'));
1712: END IF;
1713:
1714: IF pg_debug = 'Y'
1715: THEN
1712: END IF;
1713:
1714: IF pg_debug = 'Y'
1715: THEN
1716: ar_invoice_utils.debug ('. amount = ' ||TO_CHAR(l_amount));
1717: END IF;
1718:
1719: l_trx_rec.complete_flag := 'N';
1720:
1742: +-----------------------*/
1743:
1744: IF pg_debug = 'Y'
1745: THEN
1746: ar_invoice_utils.debug('post_commit()+ ');
1747: END IF;
1748:
1749: arp_process_header_post_commit.post_commit(
1750: 'ARTPTRXB',
1763:
1764:
1765: IF pg_debug = 'Y'
1766: THEN
1767: ar_invoice_utils.debug('post_commit()- ');
1768: END IF;
1769:
1770: END IF; -- end complete_flag = 'Y' case
1771:
1775: +-----------------------------------------------------*/
1776:
1777: IF pg_debug = 'Y'
1778: THEN
1779: ar_invoice_utils.debug ('. update_status = ' || l_update_status);
1780: END IF;
1781:
1782: IF (
1783: l_return_status = FND_API.G_RET_STS_SUCCESS
1785: )
1786: THEN
1787: IF pg_debug = 'Y'
1788: THEN
1789: ar_invoice_utils.debug('Deleting the transaction');
1790: END IF;
1791:
1792:
1793: IF l_trx_rec.payment_trxn_extension_id IS NOT NULL THEN
1873: p_return_status := FND_API.G_RET_STS_ERROR ;
1874:
1875: IF pg_debug = 'Y'
1876: THEN
1877: ar_invoice_utils.debug ('Error(s) occurred. Rolling back and setting status to ERROR');
1878: ar_invoice_utils.debug ('Number Of Messages: ' || TO_CHAR( arp_trx_validate.pg_message_tbl.COUNT) );
1879: END IF;
1880:
1881:
1874:
1875: IF pg_debug = 'Y'
1876: THEN
1877: ar_invoice_utils.debug ('Error(s) occurred. Rolling back and setting status to ERROR');
1878: ar_invoice_utils.debug ('Number Of Messages: ' || TO_CHAR( arp_trx_validate.pg_message_tbl.COUNT) );
1879: END IF;
1880:
1881:
1882:
1886: | Standard check of p_commit |
1887: +--------------------------------*/
1888:
1889: IF FND_API.To_Boolean( p_commit )
1890: THEN ar_invoice_utils.debug('committing');
1891: Commit;
1892: END IF;
1893:
1894: ar_invoice_utils.debug('AR_INVOICE_API_PUB.Delete_Transaction(-)' );
1890: THEN ar_invoice_utils.debug('committing');
1891: Commit;
1892: END IF;
1893:
1894: ar_invoice_utils.debug('AR_INVOICE_API_PUB.Delete_Transaction(-)' );
1895:
1896:
1897: EXCEPTION
1898: WHEN NO_DATA_FOUND THEN
1905: p_data => p_msg_data
1906: );
1907:
1908: WHEN FND_API.G_EXC_ERROR THEN
1909: ar_invoice_utils.debug(SQLCODE);
1910: ar_invoice_utils.debug(SQLERRM);
1911:
1912:
1913: ROLLBACK TO Delete_Transaction_PUB;
1906: );
1907:
1908: WHEN FND_API.G_EXC_ERROR THEN
1909: ar_invoice_utils.debug(SQLCODE);
1910: ar_invoice_utils.debug(SQLERRM);
1911:
1912:
1913: ROLLBACK TO Delete_Transaction_PUB;
1914: p_return_status := FND_API.G_RET_STS_ERROR ;
1919: );
1920:
1921: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1922:
1923: ar_invoice_utils.debug(SQLCODE);
1924: ar_invoice_utils.debug(SQLERRM);
1925: ROLLBACK TO Delete_Transaction_PUB;
1926: p_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1927: Display_Parameters;
1920:
1921: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1922:
1923: ar_invoice_utils.debug(SQLCODE);
1924: ar_invoice_utils.debug(SQLERRM);
1925: ROLLBACK TO Delete_Transaction_PUB;
1926: p_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1927: Display_Parameters;
1928:
1930: p_data => p_msg_data
1931: );
1932:
1933: WHEN OTHERS THEN
1934: ar_invoice_utils.debug(SQLCODE);
1935: ar_invoice_utils.debug(SQLERRM);
1936: /*-------------------------------------------------------+
1937: | Handle application errors that result from trapable |
1938: | error conditions. The error messages have already |
1931: );
1932:
1933: WHEN OTHERS THEN
1934: ar_invoice_utils.debug(SQLCODE);
1935: ar_invoice_utils.debug(SQLERRM);
1936: /*-------------------------------------------------------+
1937: | Handle application errors that result from trapable |
1938: | error conditions. The error messages have already |
1939: | been put on the error stack. |
1946: ROLLBACK TO Delete_Transaction_PUB;
1947:
1948: p_return_status := FND_API.G_RET_STS_ERROR ;
1949:
1950: ar_invoice_utils.debug('Completion validation error(s) occurred. ' ||
1951: 'Rolling back and setting status to ERROR');
1952:
1953: RETURN;
1954: