16: IF pg_debug = 'Y'
17: THEN
18: ar_invoice_utils.debug ('generate_default_salescredit (+)');
19: END IF;
20: x_return_status := FND_API.G_RET_STS_SUCCESS;
21: -- check whether user has passed any sales credit for this line
22: BEGIN
23: SELECT COUNT(*)
24: INTO l_cnt
39: l_status1 );
40: IF l_status1 <> 'OK'
41: THEN
42: x_errmsg := l_status1;
43: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
44: return;
45: END IF;
46: END IF;
47: END;
48:
49: EXCEPTION
50: WHEN OTHERS THEN
51: x_errmsg := 'Error in AR_INVOICE_TABLE_HANDLER.generate_default_salescredit '||sqlerrm;
52: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
53: return;
54:
55:
56: END;
71: THEN
72: ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_TRX_HEADER(+)' );
73: END IF;
74:
75: x_return_status := FND_API.G_RET_STS_SUCCESS;
76: /* 5921925 - removed trx_number sequence from here. Moved it to
77: ar_invoice_utils.populate_doc_sequence */
78:
79: -- call table handler to insert into ra_customer_trx
86: p_trx_header_id => ar_trx_header_rec.trx_header_id,
87: x_errmsg => x_errmsg,
88: x_return_status => x_return_status);
89:
90: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR
91: THEN
92: return;
93: END IF;
94:
101: END IF;
102: EXCEPTION
103: WHEN OTHERS THEN
104: x_errmsg := 'Error in AR_INVOICE_TABLE_HANDLER.INSERT_TRX_HEADER '||sqlerrm;
105: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
106: return;
107: END;
108:
109: PROCEDURE INSERT_TRX_LINES (
118: THEN
119: ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_TRX_LINES(+)' );
120: END IF;
121:
122: x_return_status := FND_API.G_RET_STS_SUCCESS;
123:
124: -- call table handler to insert into ra_customer_trx
125: AR_TRX_BULK_PROCESS_LINES.insert_row(
126: p_trx_header_id => ar_trx_lines_rec.trx_header_id,
126: p_trx_header_id => ar_trx_lines_rec.trx_header_id,
127: p_trx_line_id => ar_trx_lines_rec.trx_line_id,
128: x_errmsg => x_errmsg,
129: x_return_status => x_return_status );
130: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR
131: THEN
132: return;
133: END IF;
134: IF pg_debug = 'Y'
137: END IF;
138: EXCEPTION
139: WHEN OTHERS THEN
140: x_errmsg := 'Error in AR_INVOICE_TABLE_HANDLER.INSERT_TRX_LINES '||sqlerrm;
141: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
142: return;
143: END;
144:
145:
153: IF pg_debug = 'Y'
154: THEN
155: ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_TRX_DIST(+)' );
156: END IF;
157: x_return_status := FND_API.G_RET_STS_SUCCESS;
158:
159: AR_TRX_BULK_PROCESS_DIST.INSERT_ROW (
160: p_trx_dist_id => p_trx_dist_id,
161: x_errmsg => x_errmsg,
160: p_trx_dist_id => p_trx_dist_id,
161: x_errmsg => x_errmsg,
162: x_return_status => x_return_status );
163:
164: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR
165: THEN
166: return;
167: END IF;
168: IF pg_debug = 'Y'
172:
173: EXCEPTION
174: WHEN OTHERS THEN
175: x_errmsg := 'Error in AR_INVOICE_TABLE_HANDLER.INSERT_TRX_DIST '||sqlerrm;
176: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
177: return;
178:
179: END INSERT_TRX_DIST;
180:
189: THEN
190: ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_SALESCR(+)' );
191: END IF;
192:
193: x_return_status := FND_API.G_RET_STS_SUCCESS;
194:
195: UPDATE ar_trx_salescredits_gt
196: SET request_id = -(p_batch_id)
197: WHERE customer_trx_id = AR_INVOICE_API_PUB.g_customer_trx_id; -- 16203156
200: p_trx_salescredit_id => p_trx_salescredit_id,
201: x_errmsg => x_errmsg,
202: x_return_status => x_return_status );
203:
204: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR
205: THEN
206: return;
207: END IF;
208: IF pg_debug = 'Y'
212:
213: EXCEPTION
214: WHEN OTHERS THEN
215: x_errmsg := 'Error in AR_INVOICE_TABLE_HANDLER.INSERT_TRX_SALESCR '||sqlerrm;
216: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
217: return;
218: END INSERT_TRX_SALESCR;
219:
220:
232: THEN
233: ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.create_batch(+)' );
234: END IF;
235:
236: x_return_status := FND_API.G_RET_STS_SUCCESS;
237:
238: INSERT INTO RA_BATCHES
239: (
240: CREATED_BY,
285: END IF;
286: EXCEPTION
287: WHEN OTHERS THEN
288: x_errmsg := 'Error in AR_INVOICE_TABLE_HANDLER.CREATE_BATCH '||sqlerrm;
289: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
290: return;
291:
292: END;
293:
310: THEN
311: ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.GET_DEFAULT_TAX_CODE(+)' );
312: END IF;
313:
314: x_return_status := FND_API.G_RET_STS_SUCCESS;
315: IF pg_debug = 'Y'
316: THEN
317: ar_invoice_utils.debug ('Ship to site use Id :' || ar_trx_header_rec.ship_to_site_use_id);
318: ar_invoice_utils.debug ('Bill to site use Id :' || ar_trx_header_rec.bill_to_site_use_id);
333: END IF;
334: EXCEPTION
335: WHEN OTHERS THEN
336: x_errmsg := 'Error during default Tax Code';
337: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
338: return;
339: END GET_DEFAULT_TAX_CODE;
340:
341: PROCEDURE populate_error_stack (
537: THEN
538: ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.insert_row(+)' );
539: END IF;
540:
541: x_return_status := FND_API.G_RET_STS_SUCCESS;
542:
543: l_batch_id := g_batch_id;
544:
545: IF pg_debug = 'Y'
576: p_batch_id => l_batch_id,
577: x_errmsg => x_errmsg,
578: x_return_status => x_return_status);
579:
580: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR
581: THEN
582: return;
583: END IF;
584:
630: p_batch_id => l_batch_id,
631: x_errmsg => x_errmsg,
632: x_return_status => x_return_status);
633:
634: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR
635: THEN
636: return;
637: END IF;
638: IF pg_debug = 'Y'
680: x_errmsg => x_errmsg,
681: x_return_status => x_return_status);
682: END IF;
683:
684: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR
685: THEN
686: return;
687: END IF;
688: IF pg_debug = 'Y'
744: l_status);
745:
746: EXCEPTION
747: WHEN OTHERS THEN
748: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
749: x_errmsg :=
750: 'arp_process_header.update_header_freight_cover '
751: || 'raised unexpected error!';
752: RETURN;
789: INSERT_TRX_DIST( p_trx_dist_id => null,
790: p_batch_id => l_batch_id,
791: x_errmsg => x_errmsg,
792: x_return_status => x_return_status );
793: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR
794: THEN
795: cleanup(p_customer_trx_id => l_cust_trx_id);
796: return;
797: END IF;
803: p_batch_id => l_batch_id,
804: x_errmsg => x_errmsg,
805: x_return_status => x_return_status );
806:
807: IF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR
808: THEN
809: cleanup(p_customer_trx_id => l_cust_trx_id);
810: return;
811: END IF;
1100: WHEN OTHERS
1101: THEN
1102: cleanup(p_customer_trx_id => l_cust_trx_id);
1103: x_errmsg := sqlerrm;
1104: x_return_status := fnd_api.g_ret_sts_unexp_error;
1105: INSERT INTO ar_trx_errors_gt (
1106: trx_header_id,
1107: error_message)
1108: VALUES
1120: EXCEPTION
1121: WHEN OTHERS THEN
1122: cleanup(p_customer_trx_id => l_cust_trx_id);
1123: x_errmsg := 'Fatal Error' || sqlerrm;
1124: x_return_status := fnd_api.g_ret_sts_unexp_error;
1125: return;
1126:
1127: END INSERT_ROW;
1128: