83:
84: retcode := 'F';
85:
86: -- ========================= FND LOG ===========================
87: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
88: psa_utils.debug_other_string(g_state_level,l_full_path,' Create_distributions ');
89: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
90: psa_utils.debug_other_string(g_state_level,l_full_path,' PARAMETERS : ');
91: psa_utils.debug_other_string(g_state_level,l_full_path,' ============ ');
84: retcode := 'F';
85:
86: -- ========================= FND LOG ===========================
87: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
88: psa_utils.debug_other_string(g_state_level,l_full_path,' Create_distributions ');
89: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
90: psa_utils.debug_other_string(g_state_level,l_full_path,' PARAMETERS : ');
91: psa_utils.debug_other_string(g_state_level,l_full_path,' ============ ');
92: psa_utils.debug_other_string(g_state_level,l_full_path,' p_cust_trx_id -->' || p_cust_trx_id);
85:
86: -- ========================= FND LOG ===========================
87: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
88: psa_utils.debug_other_string(g_state_level,l_full_path,' Create_distributions ');
89: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
90: psa_utils.debug_other_string(g_state_level,l_full_path,' PARAMETERS : ');
91: psa_utils.debug_other_string(g_state_level,l_full_path,' ============ ');
92: psa_utils.debug_other_string(g_state_level,l_full_path,' p_cust_trx_id -->' || p_cust_trx_id);
93: psa_utils.debug_other_string(g_state_level,l_full_path,' p_set_of_books_id -->' || p_set_of_books_id);
86: -- ========================= FND LOG ===========================
87: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
88: psa_utils.debug_other_string(g_state_level,l_full_path,' Create_distributions ');
89: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
90: psa_utils.debug_other_string(g_state_level,l_full_path,' PARAMETERS : ');
91: psa_utils.debug_other_string(g_state_level,l_full_path,' ============ ');
92: psa_utils.debug_other_string(g_state_level,l_full_path,' p_cust_trx_id -->' || p_cust_trx_id);
93: psa_utils.debug_other_string(g_state_level,l_full_path,' p_set_of_books_id -->' || p_set_of_books_id);
94: psa_utils.debug_other_string(g_state_level,l_full_path,' p_run_id -->' || p_run_id);
87: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
88: psa_utils.debug_other_string(g_state_level,l_full_path,' Create_distributions ');
89: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
90: psa_utils.debug_other_string(g_state_level,l_full_path,' PARAMETERS : ');
91: psa_utils.debug_other_string(g_state_level,l_full_path,' ============ ');
92: psa_utils.debug_other_string(g_state_level,l_full_path,' p_cust_trx_id -->' || p_cust_trx_id);
93: psa_utils.debug_other_string(g_state_level,l_full_path,' p_set_of_books_id -->' || p_set_of_books_id);
94: psa_utils.debug_other_string(g_state_level,l_full_path,' p_run_id -->' || p_run_id);
95: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
88: psa_utils.debug_other_string(g_state_level,l_full_path,' Create_distributions ');
89: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
90: psa_utils.debug_other_string(g_state_level,l_full_path,' PARAMETERS : ');
91: psa_utils.debug_other_string(g_state_level,l_full_path,' ============ ');
92: psa_utils.debug_other_string(g_state_level,l_full_path,' p_cust_trx_id -->' || p_cust_trx_id);
93: psa_utils.debug_other_string(g_state_level,l_full_path,' p_set_of_books_id -->' || p_set_of_books_id);
94: psa_utils.debug_other_string(g_state_level,l_full_path,' p_run_id -->' || p_run_id);
95: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
96: -- ========================= FND LOG ===========================
89: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
90: psa_utils.debug_other_string(g_state_level,l_full_path,' PARAMETERS : ');
91: psa_utils.debug_other_string(g_state_level,l_full_path,' ============ ');
92: psa_utils.debug_other_string(g_state_level,l_full_path,' p_cust_trx_id -->' || p_cust_trx_id);
93: psa_utils.debug_other_string(g_state_level,l_full_path,' p_set_of_books_id -->' || p_set_of_books_id);
94: psa_utils.debug_other_string(g_state_level,l_full_path,' p_run_id -->' || p_run_id);
95: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
96: -- ========================= FND LOG ===========================
97:
90: psa_utils.debug_other_string(g_state_level,l_full_path,' PARAMETERS : ');
91: psa_utils.debug_other_string(g_state_level,l_full_path,' ============ ');
92: psa_utils.debug_other_string(g_state_level,l_full_path,' p_cust_trx_id -->' || p_cust_trx_id);
93: psa_utils.debug_other_string(g_state_level,l_full_path,' p_set_of_books_id -->' || p_set_of_books_id);
94: psa_utils.debug_other_string(g_state_level,l_full_path,' p_run_id -->' || p_run_id);
95: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
96: -- ========================= FND LOG ===========================
97:
98: -- IF arp_global.sysparam.accounting_method = 'CASH' THEN
91: psa_utils.debug_other_string(g_state_level,l_full_path,' ============ ');
92: psa_utils.debug_other_string(g_state_level,l_full_path,' p_cust_trx_id -->' || p_cust_trx_id);
93: psa_utils.debug_other_string(g_state_level,l_full_path,' p_set_of_books_id -->' || p_set_of_books_id);
94: psa_utils.debug_other_string(g_state_level,l_full_path,' p_run_id -->' || p_run_id);
95: psa_utils.debug_other_string(g_state_level,l_full_path,' ');
96: -- ========================= FND LOG ===========================
97:
98: -- IF arp_global.sysparam.accounting_method = 'CASH' THEN
99:
110: g_set_of_books_id := p_set_of_books_id;
111: g_run_id := p_run_id;
112:
113: -- ========================= FND LOG ===========================
114: psa_utils.debug_other_string(g_state_level,l_full_path,
115: ' Create_distribution --> Is transaction compelete ? ');
116: -- ========================= FND LOG ===========================
117:
118: IF (transaction_is_complete) THEN
116: -- ========================= FND LOG ===========================
117:
118: IF (transaction_is_complete) THEN
119: -- ========================= FND LOG ===========================
120: psa_utils.debug_other_string(g_state_level,l_full_path,
121: ' Create_distribution --> Transaction is complete ');
122: -- ========================= FND LOG ===========================
123:
124: SELECT code_combination_id
128: AND account_class = 'REC'
129: AND account_set_flag = 'N';
130:
131: -- ========================= FND LOG ===========================
132: psa_utils.debug_other_string(g_state_level,l_full_path,
133: ' Create_distribution --> g_receivables_ccid --> ' || g_receivables_ccid);
134: -- ========================= FND LOG ===========================
135:
136: --
141: FETCH c_trx_dist INTO l_trx_dist_rec;
142: CLOSE c_trx_dist;
143:
144: -- ========================= FND LOG ===========================
145: psa_utils.debug_other_string(g_state_level,l_full_path,
146: ' #cust_trx_line_gl_dist_id --> ' || l_trx_dist_rec.gl_dist_id
147: || ' #code_combination_id --> ' || l_trx_dist_rec.rev_ccid
148: || ' #mf_receivables_ccid --> ' || l_trx_dist_rec.mf_ccid
149: || ' #prev_mf_receivables_ccid --> ' || l_trx_dist_rec.prev_mf_ccid);
153: IF (transaction_modified) THEN
154:
155: IF NOT (GENERATE_TRX_DIST (l_errbuf, l_retcode, l_exception_error)) THEN
156: -- ========================= FND LOG ===========================
157: psa_utils.debug_other_string(g_state_level,l_full_path,
158: ' Create_distribution --> GENERATE_TRX_DIST -> FALSE');
159: -- ========================= FND LOG ===========================
160: RAISE generate_trx_dist_excep;
161: ELSE
159: -- ========================= FND LOG ===========================
160: RAISE generate_trx_dist_excep;
161: ELSE
162: -- ========================= FND LOG ===========================
163: psa_utils.debug_other_string(g_state_level,l_full_path,
164: ' Create_distribution --> GENERATE_TRX_DIST -> TRUE');
165: -- ========================= FND LOG ===========================
166: END IF;
167:
172: FETCH c_trx_dist INTO l_trx_dist_rec;
173: EXIT WHEN c_trx_dist%NOTFOUND;
174:
175: -- ========================= FND LOG ===========================
176: psa_utils.debug_other_string(g_state_level,l_full_path,
177: ' Create_distribution --> calling PSA_MFAR_UTILS.OVERRIDE_SEGMENTS');
178: -- ========================= FND LOG ===========================
179:
180: IF NOT (PSA_MFAR_UTILS.OVERRIDE_SEGMENTS (
184: p_trx_type => 'TRX',
185: p_ccid => l_temp_rec_ccid)) THEN
186:
187: -- ========================= FND LOG ===========================
188: psa_utils.debug_other_string(g_state_level,l_full_path,
189: ' Create_distribution --> Raising FLEX_COMPARE_ERROR ');
190: -- ========================= FND LOG ===========================
191: RAISE FLEX_COMPARE_ERROR;
192: END IF;
194: IF NOT (l_temp_rec_ccid = l_trx_dist_rec.prev_mf_ccid) THEN
195:
196: IF NOT (GENERATE_TRX_DIST (l_errbuf, l_retcode, l_exception_error)) THEN
197: -- ========================= FND LOG ===========================
198: psa_utils.debug_other_string(g_state_level,l_full_path,
199: ' Create_distribution --> GENERATE_TRX_DIST -> FALSE');
200: -- ========================= FND LOG ===========================
201: RAISE generate_trx_dist_excep;
202: ELSE
200: -- ========================= FND LOG ===========================
201: RAISE generate_trx_dist_excep;
202: ELSE
203: -- ========================= FND LOG ===========================
204: psa_utils.debug_other_string(g_state_level,l_full_path,
205: ' Create_distribution --> GENERATE_TRX_DIST -> TRUE');
206: -- ========================= FND LOG ===========================
207: END IF;
208:
219: FETCH c_trx_type INTO l_trx_type;
220: CLOSE c_trx_type;
221:
222: -- ========================= FND LOG ===========================
223: psa_utils.debug_other_string(g_state_level,l_full_path,
224: ' Create_distribution --> Else part --> Type - Invoice OR DM');
225: -- ========================= FND LOG ===========================
226:
227: IF l_trx_type.row_id Is Not Null THEN -- Transaction is an invoice or a debit memo
226:
227: IF l_trx_type.row_id Is Not Null THEN -- Transaction is an invoice or a debit memo
228: IF NOT (GENERATE_TRX_DIST (l_errbuf, l_retcode, l_exception_error)) THEN
229: -- ========================= FND LOG ===========================
230: psa_utils.debug_other_string(g_state_level,l_full_path,
231: ' Create_distribution --> GENERATE_TRX_DIST -> FALSE');
232: -- ========================= FND LOG ===========================
233: RAISE generate_trx_dist_excep;
234: ELSE
232: -- ========================= FND LOG ===========================
233: RAISE generate_trx_dist_excep;
234: ELSE
235: -- ========================= FND LOG ===========================
236: psa_utils.debug_other_string(g_state_level,l_full_path,
237: ' Create_distribution --> GENERATE_TRX_DIST -> TRUE');
238: -- ========================= FND LOG ===========================
239: END IF;
240: END IF;
251: g_cust_trx_id, Null, l_exception_error);
252: p_error_message := l_exception_error;
253: retcode := 'F';
254: -- ========================= FND LOG ===========================
255: psa_utils.debug_other_string(g_excep_level,l_full_path,p_error_message);
256: -- ========================= FND LOG ===========================
257: RETURN FALSE;
258:
259: WHEN FLEX_COMPARE_ERROR THEN
263:
264: p_error_message := l_exception_error;
265: retcode := 'F';
266: -- ========================= FND LOG ===========================
267: psa_utils.debug_other_string(g_excep_level,l_full_path,p_error_message);
268: -- ========================= FND LOG ===========================
269: RETURN FALSE;
270:
271: WHEN OTHERS THEN
276:
277: retcode := 'F';
278: p_error_message := l_exception_error;
279: -- ========================= FND LOG ===========================
280: psa_utils.debug_other_string(g_excep_level,l_full_path,p_error_message);
281: psa_utils.debug_unexpected_msg(l_full_path);
282: -- ========================= FND LOG ===========================
283: RETURN FALSE;
284:
277: retcode := 'F';
278: p_error_message := l_exception_error;
279: -- ========================= FND LOG ===========================
280: psa_utils.debug_other_string(g_excep_level,l_full_path,p_error_message);
281: psa_utils.debug_unexpected_msg(l_full_path);
282: -- ========================= FND LOG ===========================
283: RETURN FALSE;
284:
285: END create_distributions;
336: WHERE customer_trx_id = g_cust_trx_id)
337: AND posting_control_id IS NULL;
338:
339: -- ========================= FND LOG ===========================
340: psa_utils.debug_other_string(g_state_level,l_full_path,
341: ' Generate_trx_dist --> delete from psa_mf_trx_dist_all -->'
342: || SQL%ROWCOUNT);
343: -- ========================= FND LOG ===========================
344:
359: -- Retrieve/Generate receivable ccid
360: --
361:
362: -- ========================= FND LOG ===========================
363: psa_utils.debug_other_string(g_state_level,l_full_path,
364: ' Generate_trx_dist --> psa_mfar_utils.override_segments : ');
365: psa_utils.debug_other_string(g_state_level,l_full_path,
366: ' Generate_trx_dist --> g_receivables_ccid --> '
367: || g_receivables_ccid);
361:
362: -- ========================= FND LOG ===========================
363: psa_utils.debug_other_string(g_state_level,l_full_path,
364: ' Generate_trx_dist --> psa_mfar_utils.override_segments : ');
365: psa_utils.debug_other_string(g_state_level,l_full_path,
366: ' Generate_trx_dist --> g_receivables_ccid --> '
367: || g_receivables_ccid);
368: psa_utils.debug_other_string(g_state_level,l_full_path,
369: ' Generate_trx_dist --> l_revenue_ccid --> ' || l_revenue_ccid);
364: ' Generate_trx_dist --> psa_mfar_utils.override_segments : ');
365: psa_utils.debug_other_string(g_state_level,l_full_path,
366: ' Generate_trx_dist --> g_receivables_ccid --> '
367: || g_receivables_ccid);
368: psa_utils.debug_other_string(g_state_level,l_full_path,
369: ' Generate_trx_dist --> l_revenue_ccid --> ' || l_revenue_ccid);
370: psa_utils.debug_other_string(g_state_level,l_full_path,
371: ' Generate_trx_dist --> g_set_of_books_id --> '
372: || g_set_of_books_id);
366: ' Generate_trx_dist --> g_receivables_ccid --> '
367: || g_receivables_ccid);
368: psa_utils.debug_other_string(g_state_level,l_full_path,
369: ' Generate_trx_dist --> l_revenue_ccid --> ' || l_revenue_ccid);
370: psa_utils.debug_other_string(g_state_level,l_full_path,
371: ' Generate_trx_dist --> g_set_of_books_id --> '
372: || g_set_of_books_id);
373: psa_utils.debug_other_string(g_state_level,l_full_path,
374: ' Generate_trx_dist --> transaction type --> ' || 'TRX');
369: ' Generate_trx_dist --> l_revenue_ccid --> ' || l_revenue_ccid);
370: psa_utils.debug_other_string(g_state_level,l_full_path,
371: ' Generate_trx_dist --> g_set_of_books_id --> '
372: || g_set_of_books_id);
373: psa_utils.debug_other_string(g_state_level,l_full_path,
374: ' Generate_trx_dist --> transaction type --> ' || 'TRX');
375: psa_utils.debug_other_string(g_state_level,l_full_path,
376: ' Generate_trx_dist --> l_ccid --> ' || l_ccid);
377: -- ========================= FND LOG ===========================
371: ' Generate_trx_dist --> g_set_of_books_id --> '
372: || g_set_of_books_id);
373: psa_utils.debug_other_string(g_state_level,l_full_path,
374: ' Generate_trx_dist --> transaction type --> ' || 'TRX');
375: psa_utils.debug_other_string(g_state_level,l_full_path,
376: ' Generate_trx_dist --> l_ccid --> ' || l_ccid);
377: -- ========================= FND LOG ===========================
378:
379:
383: 'TRX',
384: l_ccid)) THEN
385:
386: -- ========================= FND LOG ===========================
387: psa_utils.debug_other_string(g_state_level,l_full_path,
388: ' Generate_trx_dist --> PSA_MFAR_UTILS.OVERRIDE_SEGMENTS --> FALSE');
389: -- ========================= FND LOG ===========================
390: RAISE FLEX_BUILD_ERROR;
391: END IF;
401: X_PREV_MF_RECEIVABLES_CCID => l_ccid,
402: X_MODE => 'R');
403:
404: -- ========================= FND LOG ===========================
405: psa_utils.debug_other_string(g_state_level,l_full_path,
406: ' Generate_trx_dist --> PSA_MFAR_TRANSACTION_COVER_PKG.INSERT_ROW ');
407: -- ========================= FND LOG ===========================
408:
409: END LOOP;
417: PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'TRANSACTION',
418: g_cust_trx_id, Null, p_error_message);
419: retcode := 'F';
420: -- ========================= FND LOG ===========================
421: psa_utils.debug_other_string(g_excep_level,l_full_path,p_error_message);
422: -- ========================= FND LOG ===========================
423: RETURN FALSE;
424:
425: WHEN OTHERS THEN
427: PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'TRANSACTION',
428: g_cust_trx_id, Null, p_error_message);
429: retcode := 'F';
430: -- ========================= FND LOG ===========================
431: psa_utils.debug_other_string(g_excep_level,l_full_path,p_error_message);
432: psa_utils.debug_unexpected_msg(l_full_path);
433: -- ========================= FND LOG ===========================
434: RETURN FALSE;
435:
428: g_cust_trx_id, Null, p_error_message);
429: retcode := 'F';
430: -- ========================= FND LOG ===========================
431: psa_utils.debug_other_string(g_excep_level,l_full_path,p_error_message);
432: psa_utils.debug_unexpected_msg(l_full_path);
433: -- ========================= FND LOG ===========================
434: RETURN FALSE;
435:
436: END generate_trx_dist;
457: CLOSE c_trx_complete;
458:
459: IF l_trx_complete_rec.complete_flag = 'Y' THEN
460: -- ========================= FND LOG ===========================
461: psa_utils.debug_other_string(g_state_level,l_full_path,' Transaction_is_complete --> return TRUE');
462: -- ========================= FND LOG ===========================
463: RETURN TRUE;
464: ELSE
465: -- ========================= FND LOG ===========================
462: -- ========================= FND LOG ===========================
463: RETURN TRUE;
464: ELSE
465: -- ========================= FND LOG ===========================
466: psa_utils.debug_other_string(g_state_level,l_full_path,' Transaction_is_complete --> return FALSE');
467: -- ========================= FND LOG ===========================
468: RETURN FALSE;
469: END IF;
470:
474: || SQLERRM;
475: PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'TRANSACTION', g_cust_trx_id, Null,
476: l_exception_error);
477: -- ========================= FND LOG ===========================
478: psa_utils.debug_other_string(g_excep_level,l_full_path,l_exception_error);
479: psa_utils.debug_unexpected_msg(l_full_path);
480: -- ========================= FND LOG ===========================
481: RETURN FALSE;
482:
475: PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'TRANSACTION', g_cust_trx_id, Null,
476: l_exception_error);
477: -- ========================= FND LOG ===========================
478: psa_utils.debug_other_string(g_excep_level,l_full_path,l_exception_error);
479: psa_utils.debug_unexpected_msg(l_full_path);
480: -- ========================= FND LOG ===========================
481: RETURN FALSE;
482:
483: END transaction_is_complete;
509: FETCH c_core_trx_count INTO l_core_count;
510: CLOSE c_core_trx_count;
511:
512: -- ========================= FND LOG ===========================
513: psa_utils.debug_other_string(g_state_level,l_full_path,
514: ' Transaction_modified --> l_core_count --> ' || l_core_count);
515: -- ========================= FND LOG ===========================
516:
517: OPEN c_mf_trx_count;
518: FETCH c_mf_trx_count INTO l_mf_dist_count;
519: CLOSE c_mf_trx_count;
520:
521: -- ========================= FND LOG ===========================
522: psa_utils.debug_other_string(g_state_level,l_full_path,
523: ' Transaction_modified --> l_mf_dist_count --> ' || l_mf_dist_count);
524: -- ========================= FND LOG ===========================
525:
526: -- Bug 3671841, Delete statement commented and now placed in PSAMFG2B.pls
530: ( SELECT cust_trx_line_gl_dist_id FROM ra_cust_trx_line_gl_dist_all );
531: */
532:
533: -- ========================= FND LOG ===========================
534: psa_utils.debug_other_string(g_state_level,l_full_path,
535: ' Transaction_modified --> delete psa_mf_trx_dist_all --> '
536: || SQL%ROWCOUNT);
537: -- ========================= FND LOG ===========================
538:
548: || SQLERRM;
549: PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'TRANSACTION',
550: g_cust_trx_id, Null,l_exception_error);
551: -- ========================= FND LOG ===========================
552: psa_utils.debug_other_string(g_excep_level,l_full_path,l_exception_error);
553: psa_utils.debug_unexpected_msg(l_full_path);
554: -- ========================= FND LOG ===========================
555: RETURN FALSE;
556:
549: PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'TRANSACTION',
550: g_cust_trx_id, Null,l_exception_error);
551: -- ========================= FND LOG ===========================
552: psa_utils.debug_other_string(g_excep_level,l_full_path,l_exception_error);
553: psa_utils.debug_unexpected_msg(l_full_path);
554: -- ========================= FND LOG ===========================
555: RETURN FALSE;
556:
557: END transaction_modified;