[Home] [Help]
PACKAGE BODY: APPS.ARP_ACCT_MAIN
Source
1 PACKAGE BODY ARP_ACCT_MAIN AS
2 /* $Header: ARTACCMB.pls 120.19.12010000.2 2008/11/13 09:31:39 dgaurab ship $ */
3
4 /*========================================================================
5 | Prototype Declarations
6 *=======================================================================*/
7 PG_DEBUG varchar2(1) := NVL(FND_PROFILE.value('AFLOG_ENABLED'), 'N');
8
9 PROCEDURE Insert_Ae_Lines(p_ae_line_tbl IN ae_line_tbl_type);
10
11 PROCEDURE Init_Curr_Details(p_accounting_method IN OUT NOCOPY ar_system_parameters.accounting_method%TYPE);
12
13 PROCEDURE Dump_Dist_Amts(p_ae_line_rec ar_distributions%ROWTYPE);
14
15 /*========================================================================
16 | Public Functions/Procedures
17 *=======================================================================*/
18
19 /*========================================================================
20 | PUBLIC PROCEDURE Create_Acct_Entry
21 |
22 | DESCRIPTION
23 | Create accounting entries for a document
24 | ----------------------------------------
25 | This procedure calls the document main packages to create accounting
26 | for Receipts, Credit Memos and Adjustments.
27 |
28 | PARAMETERS
29 | p_mode IN Document or Accounting Event mode
30 | p_ae_doc_rec IN Document Record
31 | p_ae_event_rec IN Event Record
32 | p_client_server IN A value indicates that a call is made
33 | from C code hence raise exception.
34 | KNOWN ISSUES
35 | 6-24-02 We are consciously not doing any modification to the
36 | arp_acct_hook for the mrc trigger replacment.
37 *=======================================================================*/
38 PROCEDURE Create_Acct_Entry(
39 p_mode IN VARCHAR2, -- DOCUMENT or ACCT_EVENT
40 p_ae_doc_rec IN ae_doc_rec_type,
41 p_ae_event_rec IN ae_event_rec_type,
42 p_client_server IN VARCHAR2 DEFAULT NULL,
43 --{HYUDETUPT
44 p_from_llca_call IN VARCHAR2 DEFAULT 'N',
45 p_gt_id IN NUMBER DEFAULT NULL
46 --}
47 ) IS
48
49 l_replace_default_processing BOOLEAN := FALSE;
50 l_ae_created BOOLEAN := FALSE;
51 l_ae_line_tbl ae_line_tbl_type;
52 l_summarize BOOLEAN := FALSE;
53 l_sob_id NUMBER;
54 l_accounting_method ar_system_parameters.accounting_method%TYPE;
55 l_create_acct VARCHAR2(1) := 'Y';
56
57 --Bug#2750340
58 l_xla_ev_rec arp_xla_events.xla_events_type;
59 l_xla_doc_table VARCHAR2(20);
60
61 BEGIN
62
63 IF PG_DEBUG in ('Y', 'C') THEN
64 arp_standard.debug( 'ARP_ACCT_MAIN.Create_Acct_Entry()+');
65 END IF;
66
67 /*-----------------------------------------------------------------------+
68 |Dump the document record details usefull for debugging purposes. |
69 +-----------------------------------------------------------------------*/
70 IF PG_DEBUG in ('Y', 'C') THEN
71 arp_standard.debug( ' Document Type :' || p_ae_doc_rec.document_type);
72 arp_standard.debug( ' Document Id :' || p_ae_doc_rec.document_id);
73 arp_standard.debug( ' Accounting Entity Level :' || p_ae_doc_rec.accounting_entity_level);
74 arp_standard.debug( ' Source Table :' || p_ae_doc_rec.source_table);
75 arp_standard.debug( ' Source Id :' || p_ae_doc_rec.source_id);
76 arp_standard.debug( ' Source Id Old :' || p_ae_doc_rec.source_id_old);
77 arp_standard.debug( ' Other Flag :' || p_ae_doc_rec.other_flag);
78 arp_standard.debug( ' Miscel1 :' || p_ae_doc_rec.miscel1);
79 arp_standard.debug( ' Miscel2 :' || p_ae_doc_rec.miscel2);
80 arp_standard.debug( ' Miscel3 :' || p_ae_doc_rec.miscel3);
81 arp_standard.debug( ' Miscel4 :' || p_ae_doc_rec.miscel4);
82 arp_standard.debug( ' Miscel5 :' || p_ae_doc_rec.miscel5);
83 arp_standard.debug( ' Miscel6 :' || p_ae_doc_rec.miscel6);
84 arp_standard.debug( ' Miscel7 :' || p_ae_doc_rec.miscel7);
85 arp_standard.debug( ' Miscel8 :' || p_ae_doc_rec.miscel8);
86 arp_standard.debug( ' Event :' || p_ae_doc_rec.event);
87 arp_standard.debug( ' Deferred Tax :' || p_ae_doc_rec.deferred_tax);
88 arp_standard.debug( ' Called_from :' || p_ae_doc_rec.called_from);
89 arp_standard.debug( ' Tax account id :' || p_ae_doc_rec.gl_tax_acct);
90 --{HYUDETUPT
91 arp_standard.debug( ' p_from_llca_call :' || p_from_llca_call);
92 arp_standard.debug( ' p_gt_id :' || p_gt_id);
93 --}
94 END IF;
95 /* Bug fix 2300268 : Added debug message*/
96
97 Init_Curr_Details(p_accounting_method => l_accounting_method);
98
99
100 IF PG_DEBUG in ('Y', 'C') THEN
101 arp_standard.debug( 'ARP_ACCT_MAIN - Accounting Method ' || l_accounting_method);
102 END IF;
103
104 -- bug5655154, commented accounting_method = 'ACCRUAL' check
105 -- IF l_accounting_method = 'ACCRUAL' THEN
106
107 IF PG_DEBUG in ('Y', 'C') THEN
108 arp_standard.debug( 'Create_Acct_Entry - Processing Accounting Method ' || l_accounting_method);
109 END IF;
110
111 /*---------------------------------------------------------------------------+
112 |Determine whether we really need to create accounting, in the case of MCD |
113 |as the drive is using the document id against source id we dont need to |
114 |check whether its accounting exists.The check below is a security mechanism|
115 +---------------------------------------------------------------------------*/
116
117 IF ((p_ae_doc_rec.accounting_entity_level = 'ONE')
118 AND (p_ae_doc_rec.source_table <> 'MCD')) THEN
119 BEGIN
120
121 IF PG_DEBUG in ('Y', 'C') THEN
122 arp_standard.debug( 'ARP_ACCT_MAIN.Create_Acct_Entry - check whether accounting required ');
123 END IF;
124
125 select 'N'
126 into l_create_acct
127 from dual
128 where exists (select 'X'
129 from ar_distributions dist
130 where dist.source_id = p_ae_doc_rec.source_id
131 and dist.source_table = p_ae_doc_rec.source_table);
132
133 IF PG_DEBUG in ('Y', 'C') THEN
134 arp_standard.debug( 'ARP_ACCT_MAIN.Create_Acct_Entry - accounting already exists');
135 END IF;
136
137 EXCEPTION
138 WHEN NO_DATA_FOUND THEN
139 IF PG_DEBUG in ('Y', 'C') THEN
140 arp_standard.debug( 'ARP_ACCT_MAIN.Create_Acct_Entry - creating accounting ');
141 END IF;
142 l_create_acct := 'Y';
143 END;
144
145 END IF; --end if check accounting required
146
147 IF PG_DEBUG in ('Y', 'C') THEN
148 arp_standard.debug( 'l_create_acct = ' || l_create_acct);
149 END IF;
150
151 IF (l_create_acct = 'N') THEN
152 IF PG_DEBUG in ('Y', 'C') THEN
153 arp_standard.debug( 'Ending Processing for l_create_acct = ' || l_create_acct);
154 END IF;
155 GOTO end_process_lbl;
156 END IF;
157
158 /*------------------------------------------------------+
159 | Get Summarization Rules |
160 +------------------------------------------------------*/
161 l_summarize := FALSE;
162
163 /*------------------------------------------------------+
164 | Call Hook to Override Accounting Entry |
165 +------------------------------------------------------*/
166
167 ARP_ACCT_HOOK.Override_Ae_Lines(
168 p_mode => p_mode
169 ,p_ae_doc_rec => p_ae_doc_rec
170 ,p_ae_event_rec => p_ae_event_rec
171 ,p_ae_line_tbl => l_ae_line_tbl
172 ,p_ae_created => l_ae_created
173 ,p_replace_default_processing => l_replace_default_processing
174 );
175
176 IF ( NOT l_replace_default_processing ) THEN
177
178 /*------------------------------------------------------+
179 | Accounting Entry Derivation |
180 +------------------------------------------------------*/
181 IF (( p_ae_doc_rec.document_type = 'RECEIPT') OR
182 ((p_ae_doc_rec.document_type = 'CREDIT_MEMO') AND
183 (p_ae_doc_rec.source_table = 'RA'))) THEN
184
185 ARP_RECEIPTS_MAIN.Execute(
186 p_mode => p_mode,
187 p_ae_doc_rec => p_ae_doc_rec,
188 p_ae_event_rec => p_ae_event_rec,
189 p_ae_line_tbl => l_ae_line_tbl,
190 p_ae_created => l_ae_created,
191 --{HYUDETUPT
192 p_from_llca_call => p_from_llca_call,
193 p_gt_id => p_gt_id
194 --}
195 );
196
197 ELSIF p_ae_doc_rec.document_type = 'ADJUSTMENT' OR
198 p_ae_doc_rec.document_type = 'FINANCE_CHARGES' THEN
199
200 -- Added parameter for Line level adjustment
201 ARP_ADJUSTMENTS_MAIN.Execute(
202 p_mode,
203 p_ae_doc_rec,
204 p_ae_event_rec,
205 l_ae_line_tbl,
206 l_ae_created,
207 p_from_llca_call => p_from_llca_call,
208 p_gt_id => p_gt_id
209 );
210
211 ELSIF p_ae_doc_rec.document_type = 'BILLS_RECEIVABLE' THEN
212
213 ARP_BILLS_RECEIVABLE_MAIN.Execute(
214 p_mode,
215 p_ae_doc_rec,
216 p_ae_event_rec,
217 l_ae_line_tbl,
218 l_ae_created
219 );
220
221 END IF; -- Document type
222
223 END IF; -- Replace Default Processing?
224
225 /*------------------------------------------------------+
226 | Optionally Summarize Accounting Entry Lines created |
227 +------------------------------------------------------*/
228 IF l_ae_created AND l_summarize THEN
229
230 NULL;
231
232 END IF;
233
234
235 /*------------------------------------------------------+
236 | Insert Accounting Entry Lines into AEL table |
237 +------------------------------------------------------*/
238 IF l_ae_created THEN
239
240 Insert_Ae_Lines(l_ae_line_tbl);
241
242 END IF;
243
244 --{ Bug#2750340 : Call ARP_XLA_EVENT
245 IF arp_global.request_id IS NULL THEN
246
247 l_xla_ev_rec.xla_from_doc_id := p_ae_doc_rec.document_id;
248 l_xla_ev_rec.xla_to_doc_id := p_ae_doc_rec.document_id;
249 l_xla_ev_rec.xla_mode := 'O';
250 l_xla_ev_rec.xla_call := 'B';
251
252 IF p_ae_doc_rec.source_table = 'MCD' AND p_ae_doc_rec.document_type = 'RECEIPT' THEN
253 l_xla_ev_rec.xla_doc_table := 'MCD';
254 l_xla_ev_rec.xla_call := 'D';
255 ARP_XLA_EVENTS.create_events(p_xla_ev_rec => l_xla_ev_rec);
256 ELSIF p_ae_doc_rec.source_table = 'RA' AND p_ae_doc_rec.document_type = 'RECEIPT' THEN
257 l_xla_ev_rec.xla_doc_table := 'APP';
258 l_xla_ev_rec.xla_from_doc_id := p_ae_doc_rec.source_id;
259 l_xla_ev_rec.xla_to_doc_id := p_ae_doc_rec.source_id;
260 ARP_XLA_EVENTS.create_events(p_xla_ev_rec => l_xla_ev_rec);
261 ELSIF p_ae_doc_rec.source_table = 'RA' AND p_ae_doc_rec.document_type = 'CREDIT_MEMO' THEN
262 l_xla_ev_rec.xla_doc_table := 'CMAPP';
263 l_xla_ev_rec.xla_from_doc_id := p_ae_doc_rec.source_id;
264 l_xla_ev_rec.xla_to_doc_id := p_ae_doc_rec.source_id;
265 ARP_XLA_EVENTS.create_events(p_xla_ev_rec => l_xla_ev_rec);
266 ELSIF p_ae_doc_rec.source_table = 'ADJ' AND p_ae_doc_rec.document_type = 'ADJUSTMENT' THEN
267 l_xla_ev_rec.xla_doc_table := 'ADJ';
268 ARP_XLA_EVENTS.create_events(p_xla_ev_rec => l_xla_ev_rec);
269 ELSIF p_ae_doc_rec.source_table = 'ADJ' AND p_ae_doc_rec.document_type = 'FINANCE_CHARGES' THEN
270 l_xla_ev_rec.xla_doc_table := 'ADJ';
271 ARP_XLA_EVENTS.create_events(p_xla_ev_rec => l_xla_ev_rec);
272 ELSIF p_ae_doc_rec.source_table = 'TH' AND p_ae_doc_rec.document_type = 'BILLS_RECEIVABLE' THEN
273 l_xla_ev_rec.xla_doc_table := 'TRH';
274 ARP_XLA_EVENTS.create_events(p_xla_ev_rec => l_xla_ev_rec);
275 END IF;
276
277 END IF;
278 --}
279
280 -- bug5655154, commented the end if condition
281 -- END IF; --end if ACCRUAL method of accounting
282
283 <<end_process_lbl>>
284 IF PG_DEBUG in ('Y', 'C') THEN
285 arp_standard.debug( 'ARP_ACCT_MAIN.Create_Acct_Entry()-');
286 END IF;
287
288 EXCEPTION
289 WHEN OTHERS THEN
290 IF PG_DEBUG in ('Y', 'C') THEN
291 arp_standard.debug( 'EXCEPTION: ARP_ACCT_MAIN.Create_Acct_Entry');
292 END IF;
293 IF p_client_server IS NULL THEN
294 app_exception.raise_exception;
295 ELSE
296 RAISE;
297 END IF;
298
299 END Create_Acct_Entry;
300
301 /*========================================================================
302 | PUBLIC PROCEDURE Create_Acct_Entry
303 |
304 | DESCRIPTION
305 | Create accounting entries for a document
306 | ----------------------------------------
307 | This is an overloaded procedure to which is passed the document
308 | information, to create accounting entries for Receipts, Credit Memos
309 | or Adjustments.
310 |
311 | PARAMETERS
312 | p_mode IN Document or Accounting Event mode
313 | p_ae_doc_rec IN Document Record
314 | p_ae_event_rec IN Event Record
315 *=======================================================================*/
316 PROCEDURE Create_Acct_Entry(
317 p_ae_doc_rec IN ae_doc_rec_type,
318 p_client_server IN VARCHAR2 DEFAULT NULL,
319 --{HYUDETUPT
320 p_from_llca_call IN VARCHAR2 DEFAULT 'N',
321 p_gt_id IN NUMBER DEFAULT NULL
322 --}
323 ) IS
324
325 l_mode VARCHAR2(1);
326 l_ae_event_rec ae_event_rec_type ;
327
328 BEGIN
329 IF PG_DEBUG in ('Y', 'C') THEN
330 arp_standard.debug( 'Overloaded ARP_ACCT_MAIN.Create_Acct_Entry()+');
331 END IF;
332
333 Create_Acct_Entry(p_mode => l_mode,
334 p_ae_doc_rec => p_ae_doc_rec,
335 p_ae_event_rec => l_ae_event_rec,
336 p_client_server => p_client_server,
337 p_from_llca_call => p_from_llca_call,
338 p_gt_id => p_gt_id);
339
340 IF PG_DEBUG in ('Y', 'C') THEN
341 arp_standard.debug( 'Overloaded ARP_ACCT_MAIN.Create_Acct_Entry()-');
342 END IF;
343
344 EXCEPTION
345 WHEN OTHERS THEN
346 IF PG_DEBUG in ('Y', 'C') THEN
347 arp_standard.debug( 'EXCEPTION: Overloaded ARP_ACCT_MAIN.Create_Acct_Entry');
348 END IF;
349 RAISE;
350 END Create_Acct_Entry;
351
352 /*========================================================================
353 | PUBLIC PROCEDURE Create_Acct_Entry
354 |
355 | DESCRIPTION
356 | Create accounting entries for a document
357 | ----------------------------------------
358 | This is an overloaded procedure to which is passed the document
359 | information, to create accounting entries for Receipts, Credit Memos
360 | or Adjustments.
361 |
362 | PARAMETERS
363 | document_type IN Document Type
364 | document_id IN Document Id
365 | accounting_entity_level IN Entitity Level accounting
366 | source_table IN Source table
367 | source_id IN Source Id
368 | source_id_old IN Source Id Old
369 | other_flag IN Other Flag
370 *=======================================================================*/
371 PROCEDURE Create_Acct_Entry(
372 p_document_type IN VARCHAR2,
373 p_document_id IN NUMBER ,
374 p_accounting_entity_level IN VARCHAR2,
375 p_source_table IN VARCHAR2,
376 p_source_id IN NUMBER ,
377 p_source_id_old IN NUMBER ,
378 p_other_flag IN VARCHAR2,
379 p_client_server IN VARCHAR2 DEFAULT NULL,
380 --{HYUDETUPT
381 p_from_llca_call IN VARCHAR2 DEFAULT 'N',
382 p_gt_id IN NUMBER DEFAULT NULL
383 --}
384 ) IS
385
386 l_mode VARCHAR2(1);
387 l_ae_event_rec ae_event_rec_type ;
388 l_ae_doc_rec ae_doc_rec_type;
389
390 BEGIN
391
392 IF PG_DEBUG in ('Y', 'C') THEN
393 arp_standard.debug( 'Overloaded1 ARP_ACCT_MAIN.Create_Acct_Entry()+');
394 END IF;
395
396 l_ae_doc_rec.document_type := p_document_type ;
397 l_ae_doc_rec.document_id := p_document_id ;
398 l_ae_doc_rec.accounting_entity_level := p_accounting_entity_level ;
399 l_ae_doc_rec.source_table := p_source_table ;
400 l_ae_doc_rec.source_id := p_source_id ;
401 l_ae_doc_rec.source_id_old := p_source_id_old ;
402 l_ae_doc_rec.other_flag := p_other_flag ;
403
404 Create_Acct_Entry(p_mode => l_mode,
405 p_ae_doc_rec => l_ae_doc_rec,
406 p_ae_event_rec => l_ae_event_rec,
407 p_client_server => p_client_server,
408 p_from_llca_call=> p_from_llca_call,
409 p_gt_id => p_gt_id);
410
411 IF PG_DEBUG in ('Y', 'C') THEN
412 arp_standard.debug( 'Overloaded1 ARP_ACCT_MAIN.Create_Acct_Entry()-');
413 END IF;
414
415 EXCEPTION
416 WHEN OTHERS THEN
417 IF PG_DEBUG in ('Y', 'C') THEN
418 arp_standard.debug( 'EXCEPTION: Overloaded1 ARP_ACCT_MAIN.Create_Acct_Entry');
419 END IF;
420 RAISE;
421
422 END Create_Acct_Entry;
423
424 /*========================================================================
425 | PUBLIC PROCEDURE Create_Acct_Entry
426 |
427 | DESCRIPTION
428 | Create accounting entries for a document
429 | ----------------------------------------
430 | This is an overloaded procedure to which is passed the document
431 | information, to create accounting entries for Receipts, Credit Memos
432 | or Adjustments. This is used by C code and it was necessary to overload
433 | this to pass the pay_sched_upd_yn, for Bills Receivable reconciliation
434 | on closure, required by autoadjustments, and postbatch, this avoided having
435 | to change other C routines.
436 |
437 | PARAMETERS
438 | document_type IN Document Type
439 | document_id IN Document Id
440 | accounting_entity_level IN Entitity Level accounting
441 | source_table IN Source table
442 | source_id IN Source Id
443 | source_id_old IN Source Id Old
444 | other_flag IN Other Flag
445 *=======================================================================*/
446 PROCEDURE Create_Acct_Entry(
447 p_document_type IN VARCHAR2,
448 p_document_id IN NUMBER ,
449 p_accounting_entity_level IN VARCHAR2,
450 p_source_table IN VARCHAR2,
451 p_source_id IN NUMBER ,
452 p_source_id_old IN NUMBER ,
453 p_other_flag IN VARCHAR2,
454 p_pay_sched_upd_yn IN VARCHAR2,
455 p_client_server IN VARCHAR2,
456 --{HYUDETUPT
457 p_from_llca_call IN VARCHAR2 DEFAULT 'N',
458 p_gt_id IN NUMBER DEFAULT NULL
459 --}
460 ) IS
461
462 l_mode VARCHAR2(1);
463 l_ae_event_rec ae_event_rec_type ;
464 l_ae_doc_rec ae_doc_rec_type;
465
466 BEGIN
467
468 IF PG_DEBUG in ('Y', 'C') THEN
469 arp_standard.debug( 'Overloaded1 ARP_ACCT_MAIN.Create_Acct_Entry()+');
470 END IF;
471
472 l_ae_doc_rec.document_type := p_document_type ;
473 l_ae_doc_rec.document_id := p_document_id ;
474 l_ae_doc_rec.accounting_entity_level := p_accounting_entity_level ;
475 l_ae_doc_rec.source_table := p_source_table ;
476 l_ae_doc_rec.source_id := p_source_id ;
477 l_ae_doc_rec.source_id_old := p_source_id_old ;
478 l_ae_doc_rec.other_flag := p_other_flag ;
479 l_ae_doc_rec.pay_sched_upd_yn := p_pay_sched_upd_yn ;
480
481 Create_Acct_Entry(p_mode => l_mode,
482 p_ae_doc_rec => l_ae_doc_rec,
483 p_ae_event_rec => l_ae_event_rec,
484 p_client_server => p_client_server,
485 p_from_llca_call => p_from_llca_call,
486 p_gt_id => p_gt_id);
487
488 IF PG_DEBUG in ('Y', 'C') THEN
489 arp_standard.debug( 'Overloaded1 ARP_ACCT_MAIN.Create_Acct_Entry()-');
490 END IF;
491
492 EXCEPTION
493 WHEN OTHERS THEN
494 IF PG_DEBUG in ('Y', 'C') THEN
495 arp_standard.debug( 'EXCEPTION: Overloaded1 ARP_ACCT_MAIN.Create_Acct_Entry');
496 END IF;
497 RAISE;
498
499 END Create_Acct_Entry;
500
501 /*========================================================================
502 | PUBLIC PROCEDURE Create_Acct_Entry
503 |
504 | DESCRIPTION
505 | Create accounting entries for a document
506 | ----------------------------------------
507 | This is an overloaded procedure to which is passed a request_id
508 | from AUTORECEIPTS for processing the Receivable APPLICATION Rows
509 |
510 | PARAMETERS
511 | p_request_id IN Request_id
512 | p_called_from IN Either AUTOREC or AUTOINV
513 *=======================================================================*/
514 PROCEDURE Create_Acct_Entry(
515 p_request_id IN NUMBER,
516 p_called_from IN VARCHAR
517 ) IS
518
519 l_ae_event_rec ae_event_rec_type ;
520 l_ae_doc_rec ae_doc_rec_type;
521
522 CURSOR get_receipt_info(p_request_id IN number) IS
523 SELECT cash_receipt_id from ar_cash_receipts
524 where request_id = p_request_id;
525
526 CURSOR get_app_info(p_cash_receipt_id IN NUMBER) IS
527 SELECT receivable_application_id,
528 status
529 FROM ar_receivable_applications
530 where cash_Receipt_id = p_cash_receipt_id;
531
532 CURSOR get_cm_info (p_request_id IN number) IS
533 select rec.customer_trx_id customer_trx_id,
534 rec.receivable_application_id rec_app_id
535 from AR_RECEIVABLE_APPLICATIONS rec,
536 RA_CUSTOMER_TRX trx
537 where trx.customer_trx_id = rec.customer_trx_id
538 and trx.request_id = p_request_id;
539
540 CURSOR get_adj_info (p_request_id IN number) IS
541 SELECT adjustment_id, code_combination_id
542 FROM ar_adjustments
543 WHERE request_id = p_request_id;
544
545 old_rec_app_id ar_receivable_applications.receivable_application_id%TYPE;
546 --Bug#2750340
547 l_xla_ev_rec arp_xla_events.xla_events_type;
548 l_xla_doc_table VARCHAR2(20);
549
550 adj_exist boolean := FALSE;
551 cm_exist boolean := FALSE;
552
553 BEGIN
554
555 IF PG_DEBUG in ('Y', 'C') THEN
556 arp_standard.debug( 'Overloaded2 ARP_ACCT_MAIN.Create_Acct_Entry()+');
557 END IF;
558
559 IF (p_called_from = 'AUTOREC' ) THEN
560 IF PG_DEBUG in ('Y', 'C') THEN
561 arp_standard.debug( 'calling for AUTO RECEIPTS');
562 END IF;
563
564 l_ae_doc_rec.document_type := 'RECEIPT';
565 l_ae_doc_rec.accounting_entity_level := 'ONE';
566 l_ae_doc_rec.source_table := 'RA';
567
568 FOR receipt_info IN get_receipt_info(p_request_id) LOOP
569 l_ae_doc_rec.document_id := receipt_info.cash_receipt_id;
570 old_rec_app_id := NULL;
571
572 FOR app_info IN get_app_info(receipt_info.cash_receipt_id) LOOP
573
574 l_ae_doc_rec.source_id := app_info.receivable_application_id;
575
576 IF (app_info.status = 'APP') THEN
577 old_rec_app_id := app_info.receivable_application_id;
578 l_ae_doc_rec.source_id_old := NULL;
579 l_ae_doc_rec.other_flag := NULL;
580
581 ELSE
582 /* check to see if this is the final unapp or
583 the paired unapp */
584
585 IF (old_rec_app_id is not null ) THEN
586 /* we have a pairing.. */
587 l_ae_doc_rec.source_id_old := old_rec_app_id;
588 l_ae_doc_rec.other_flag := 'PAIR';
589
590 /* reset old rec app id */
591 old_rec_app_id := NULL;
592 ELSE
593 l_ae_doc_rec.source_id_old := NULL;
594 l_ae_doc_rec.other_flag := NULL;
595 END IF;
596 END IF;
597
598 /* call Accting engine */
599 arp_acct_main.Create_Acct_Entry(l_ae_doc_rec);
600
601 END LOOP;
602 END LOOP;
603
604 /*-- Commented this out based on Ramakant inputs autoreceipt will no longer be called
605 -- from ARZCAR -- but it will call ar_receipt_api_pub
606 -- XLA should be uptake in ar_receipt_api_pub
607 -- Bug#2750340 {
608 l_xla_ev_rec.xla_req_id := p_request_id;
609 l_xla_ev_rec.xla_mode := 'B';
610 l_xla_ev_rec.xla_call := 'B';
611
612 l_xla_ev_rec.xla_doc_table := 'CR';
613 ARP_XLA_EVENTS.create_events(p_xla_ev_rec => l_xla_ev_rec);
614
615 l_xla_ev_rec.xla_doc_table := 'APP';
616 ARP_XLA_EVENTS.create_events(p_xla_ev_rec => l_xla_ev_rec);
617 -- }
618 */
619 ELSE
620
621 -- 1st Adjustment and 2 CM APP
622
623 /* create adjustment entries */
624 FOR adj_info in get_adj_info(p_request_id) LOOP
625
626 adj_exist := TRUE; -- 4457617: call sla
627
628 arp_acct_main.Create_Acct_Entry('ADJUSTMENT',
629 adj_info.adjustment_id,
630 'ONE',
631 'ADJ',
632 adj_info.adjustment_id,
633 adj_info.code_combination_id,
634 'COMMITMENT');
635 END LOOP;
636
637
638 /* create credit memo entries */
639 FOR cm_info IN get_cm_info(p_request_id) LOOP
640
641 cm_exist := TRUE; -- 4457617: call sla
642
643 arp_acct_main.Create_Acct_Entry('CREDIT_MEMO',
644 cm_info.customer_trx_id,
645 'ONE',
646 'RA',
647 cm_info.rec_app_id,
648 NULL,
649 NULL);
650 END LOOP;
651
652 -- Bug#2750340
653 l_xla_ev_rec.xla_req_id := p_request_id;
654 l_xla_ev_rec.xla_mode := 'B';
655 l_xla_ev_rec.xla_call := 'B';
656
657 /* 4457617: only call sla if CMAPP or ADJ exists. Was raising a
658 generic error in autoinvoice (raacae) */
659
660 /* Auto inv will use wrapper to control XLA event creation
661 --
662 IF adj_exist
663 THEN
664 l_xla_ev_rec.xla_doc_table := 'ADJ';
665 ARP_XLA_EVENTS.create_events(p_xla_ev_rec => l_xla_ev_rec);
666 END IF;
667
668 IF cm_exist
669 THEN
670 l_xla_ev_rec.xla_doc_table := 'CMAPP';
671 ARP_XLA_EVENTS.create_events(p_xla_ev_rec => l_xla_ev_rec);
672 END IF;
673 --
674 */
675 END IF;
676 IF PG_DEBUG in ('Y', 'C') THEN
677 arp_standard.debug( 'Overloaded2 ARP_ACCT_MAIN.Create_Acct_Entry()-');
678 END IF;
679
680 END Create_Acct_Entry;
681
682
683 /*========================================================================
684 | PUBLIC PROCEDURE Delete_Acct_Entry
685 |
686 | DESCRIPTION
687 | Delete accounting entries for a document
688 | ----------------------------------------
689 | This procedure is the standard delete routine which calls packages
690 | for Receipts, Credit Memos and Adjustments to delete the accounting
691 | associated with the document for a source id
692 |
693 | PARAMETERS
694 | p_mode IN Document or Accounting Event mode
695 | p_ae_doc_rec IN Document Record
696 | p_ae_event_rec IN Event Record
697 *=======================================================================*/
698 PROCEDURE Delete_Acct_Entry(
699 p_mode IN VARCHAR2, -- DOCUMENT or ACCT_EVENT
700 p_ae_doc_rec IN OUT NOCOPY ae_doc_rec_type,
701 p_ae_event_rec IN ae_event_rec_type
702 ) IS
703 l_ae_deleted BOOLEAN := FALSE;
704 l_paired_id ar_receivable_applications.receivable_application_id%TYPE;
705 l_accounting_method ar_system_parameters.accounting_method%TYPE;
706
707 BEGIN
708 IF PG_DEBUG in ('Y', 'C') THEN
709 arp_standard.debug( 'ARP_ACCT_MAIN.Delete_Acct_Entry()+');
710 END IF;
711
712 Init_Curr_Details(p_accounting_method => l_accounting_method);
713
714 IF PG_DEBUG in ('Y', 'C') THEN
715 arp_standard.debug( 'ARP_ACCT_MAIN - Accounting Method ' || l_accounting_method);
716 END IF;
717
718 --begin 5655154, commented the accounting_method = 'ACCRUAL' check
719 -- IF l_accounting_method = 'ACCRUAL' THEN
720 --end 5655154
721 IF PG_DEBUG in ('Y', 'C') THEN
722 arp_standard.debug( 'Delete_Acct_Entry - Processing Accounting Method ' || l_accounting_method);
723 END IF;
724 /*------------------------------------------------------+
725 | Delete Accounting for Document |
726 +------------------------------------------------------*/
727 IF ( p_ae_doc_rec.document_type = 'RECEIPT' ) OR
728 (p_ae_doc_rec.document_type = 'CREDIT_MEMO') THEN
729
730 ARP_RECEIPTS_MAIN.Delete_Acct( p_mode,
731 p_ae_doc_rec,
732 p_ae_event_rec,
733 l_ae_deleted
734 );
735
736 ELSIF p_ae_doc_rec.document_type = 'ADJUSTMENT' OR
737 p_ae_doc_rec.document_type = 'FINANCE_CHARGES' THEN
738
739 ARP_ADJUSTMENTS_MAIN.Delete_Acct( p_mode,
740 p_ae_doc_rec,
741 p_ae_event_rec,
742 l_ae_deleted
743 );
744
745 ELSIF p_ae_doc_rec.document_type = 'BILLS_RECEIVABLE' THEN
746
747 ARP_BILLS_RECEIVABLE_MAIN.Delete_Acct( p_mode,
748 p_ae_doc_rec,
749 p_ae_event_rec,
750 l_ae_deleted
751 );
752
753 END IF; -- Document type
754 --begin 5655154, commented the endif condition
755 -- END IF; --end if Accounting method is accrual
756 --end 5655154
757
758 IF PG_DEBUG in ('Y', 'C') THEN
759 arp_standard.debug( 'ARP_ACCT_MAIN.Delete_Acct_Entry()-');
760 END IF;
761
762 EXCEPTION
763 WHEN OTHERS THEN
764 IF PG_DEBUG in ('Y', 'C') THEN
765 arp_standard.debug( 'EXCEPTION: ARP_ACCT_MAIN.Delete_Acct_Entry');
766 END IF;
767 RAISE;
768
769 END Delete_Acct_Entry;
770
771 /*========================================================================
772 | PUBLIC PROCEDURE Delete_Acct_Entry
773 |
774 | DESCRIPTION
775 | Delete accounting entries for a document
776 | ----------------------------------------
777 | This is an overloaded procedure which calls packages associated
778 | with a Receipt, Credit Memo or Adjustment document to delete the
779 | accounting for a source id.
780 |
781 | PARAMETERS
782 | p_ae_doc_rec IN Document Record
783 *=======================================================================*/
784 PROCEDURE Delete_Acct_Entry(
785 p_ae_doc_rec IN OUT NOCOPY ae_doc_rec_type
786 ) IS
787
788 l_mode VARCHAR2(1);
789 l_ae_event_rec ae_event_rec_type ;
790
791 BEGIN
792 IF PG_DEBUG in ('Y', 'C') THEN
793 arp_standard.debug( 'Overloaded ARP_ACCT_MAIN.Delete_Acct_Entry()+');
794 END IF;
795
796 Delete_Acct_Entry(l_mode, p_ae_doc_rec, l_ae_event_rec);
797
798 IF PG_DEBUG in ('Y', 'C') THEN
799 arp_standard.debug( 'Overloaded ARP_ACCT_MAIN.Delete_Acct_Entry()-');
800 END IF;
801
802 EXCEPTION
803 WHEN OTHERS THEN
804 IF PG_DEBUG in ('Y', 'C') THEN
805 arp_standard.debug( 'EXCEPTION: Overloaded ARP_ACCT_MAIN.Delete_Acct_Entry');
806 END IF;
807 RAISE;
808
809 END Delete_Acct_Entry;
810
811 /*========================================================================
812 | PUBLIC PROCEDURE Delete_Acct_Entry
813 |
814 | DESCRIPTION
815 | Delete accounting entries for a document
816 | ----------------------------------------
817 | This is an overloaded procedure which calls packages associated
818 | with a Receipt, Credit Memo or Adjustment document to delete the
819 | accounting for a source id. Required for C code delete calls.
820 |
821 | PARAMETERS
822 | p_ae_doc_rec IN Document Record
823 *=======================================================================*/
824 PROCEDURE Delete_Acct_Entry(
825 p_document_type IN VARCHAR2,
826 p_document_id IN NUMBER ,
827 p_accounting_entity_level IN VARCHAR2,
828 p_source_table IN VARCHAR2,
829 p_source_id IN NUMBER ,
830 p_source_id_old IN OUT NOCOPY NUMBER ,
831 p_other_flag IN VARCHAR2
832 ) IS
833
834 l_mode VARCHAR2(1);
835 l_ae_event_rec ae_event_rec_type;
836 l_ae_doc_rec ae_doc_rec_type;
837
838 BEGIN
839 IF PG_DEBUG in ('Y', 'C') THEN
840 arp_standard.debug( 'Overloaded ARP_ACCT_MAIN.Delete_Acct_Entry()+');
841 END IF;
842
843 l_ae_doc_rec.document_type := p_document_type ;
844 l_ae_doc_rec.document_id := p_document_id ;
845 l_ae_doc_rec.accounting_entity_level := p_accounting_entity_level ;
846 l_ae_doc_rec.source_table := p_source_table ;
847 l_ae_doc_rec.source_id := p_source_id ;
848 l_ae_doc_rec.source_id_old := p_source_id_old ;
849 l_ae_doc_rec.other_flag := p_other_flag ;
850
851 Delete_Acct_Entry(l_mode, l_ae_doc_rec, l_ae_event_rec);
852
853 p_source_id_old := l_ae_doc_rec.source_id_old;
854
855 IF PG_DEBUG in ('Y', 'C') THEN
856 arp_standard.debug( 'Overloaded ARP_ACCT_MAIN.Delete_Acct_Entry()-');
857 END IF;
858
859 EXCEPTION
860 WHEN OTHERS THEN
861 IF PG_DEBUG in ('Y', 'C') THEN
862 arp_standard.debug( 'EXCEPTION: Overloaded ARP_ACCT_MAIN.Delete_Acct_Entry');
863 END IF;
864 RAISE;
865
866 END Delete_Acct_Entry;
867
868 /*========================================================================
869 | PRIVATE PROCEDURE Insert_Ae_Lines
870 |
871 | DESCRIPTION
872 | Inserts into AR_DISTRIBUTIONS accounting lines
873 | ----------------------------------------------
874 | Calls the table handler for AR_DISTRIBUTIONS to insert accounting
875 | for a given document into the underlying table.
876 |
877 | PARAMETERS
878 | p_ae_line_tbl IN Accounting lines table
879 *=======================================================================*/
880 PROCEDURE Insert_Ae_Lines(p_ae_line_tbl IN ae_line_tbl_type) IS
881
882 l_ae_line_rec ar_distributions%ROWTYPE;
883 l_ae_line_rec_empty ar_distributions%ROWTYPE;
884 l_dummy ar_distributions.line_id%TYPE;
885
886 i BINARY_INTEGER := 1;
887
888 BEGIN
889
890 IF PG_DEBUG in ('Y', 'C') THEN
891 arp_standard.debug( 'ARP_ACCT_MAIN.Insert_Ae_Lines()+');
892 END IF;
893
894
895 -- Insert AE Lines
896 FOR i IN p_ae_line_tbl.FIRST .. p_ae_line_tbl.LAST LOOP
897
898 -- Initialize
899 l_ae_line_rec := l_ae_line_rec_empty;
900
901 -- Assign AE Line elements
902
903 l_ae_line_rec.source_type := p_ae_line_tbl(i).ae_line_type;
904 l_ae_line_rec.source_type_secondary := p_ae_line_tbl(i).ae_line_type_secondary;
905 l_ae_line_rec.source_id := p_ae_line_tbl(i).source_id;
906 l_ae_line_rec.source_table := p_ae_line_tbl(i).source_table;
907 l_ae_line_rec.code_combination_id := p_ae_line_tbl(i).account;
908 l_ae_line_rec.amount_dr := p_ae_line_tbl(i).entered_dr;
909 l_ae_line_rec.amount_cr := p_ae_line_tbl(i).entered_cr;
910 l_ae_line_rec.acctd_amount_dr := p_ae_line_tbl(i).accounted_dr;
911 l_ae_line_rec.acctd_amount_cr := p_ae_line_tbl(i).accounted_cr;
912 l_ae_line_rec.source_id_secondary := p_ae_line_tbl(i).source_id_secondary;
913 l_ae_line_rec.source_table_secondary := p_ae_line_tbl(i).source_table_secondary;
914 l_ae_line_rec.currency_code := p_ae_line_tbl(i).currency_code;
915 l_ae_line_rec.currency_conversion_rate := p_ae_line_tbl(i).currency_conversion_rate;
916 l_ae_line_rec.currency_conversion_type := p_ae_line_tbl(i).currency_conversion_type;
917 l_ae_line_rec.currency_conversion_date := p_ae_line_tbl(i).currency_conversion_date;
918 l_ae_line_rec.third_party_id := p_ae_line_tbl(i).third_party_id;
919 l_ae_line_rec.third_party_sub_id := p_ae_line_tbl(i).third_party_sub_id;
920 l_ae_line_rec.tax_group_code_id := p_ae_line_tbl(i).tax_group_code_id;
921 l_ae_line_rec.tax_code_id := p_ae_line_tbl(i).tax_code_id;
922 l_ae_line_rec.location_segment_id := p_ae_line_tbl(i).location_segment_id;
923 l_ae_line_rec.taxable_entered_dr := p_ae_line_tbl(i).taxable_entered_dr;
924 l_ae_line_rec.taxable_entered_cr := p_ae_line_tbl(i).taxable_entered_cr;
925 l_ae_line_rec.taxable_accounted_dr := p_ae_line_tbl(i).taxable_accounted_dr;
926 l_ae_line_rec.taxable_accounted_cr := p_ae_line_tbl(i).taxable_accounted_cr;
927 l_ae_line_rec.tax_link_id := p_ae_line_tbl(i).tax_link_id;
928 l_ae_line_rec.reversed_source_id := p_ae_line_tbl(i).reversed_source_id;
929 --{2979254
930 l_ae_line_rec.ref_customer_trx_line_id := p_ae_line_tbl(i).ref_customer_trx_line_id;
931 l_ae_line_rec.ref_cust_trx_line_gl_dist_id := p_ae_line_tbl(i).ref_cust_trx_line_gl_dist_id;
932 l_ae_line_rec.ref_line_id := p_ae_line_tbl(i).ref_line_id;
933 l_ae_line_rec.from_amount_dr := p_ae_line_tbl(i).from_amount_dr;
934 l_ae_line_rec.from_amount_cr := p_ae_line_tbl(i).from_amount_cr;
935 l_ae_line_rec.from_acctd_amount_dr := p_ae_line_tbl(i).from_acctd_amount_dr;
936 l_ae_line_rec.from_acctd_amount_cr := p_ae_line_tbl(i).from_acctd_amount_cr;
937 l_ae_line_rec.ref_account_class := p_ae_line_tbl(i).ref_account_class;
938 l_ae_line_rec.activity_bucket := p_ae_line_tbl(i).activity_bucket;
939 l_ae_line_rec.ref_dist_ccid := p_ae_line_tbl(i).ref_dist_ccid;
940 --}
941
942 Dump_Dist_Amts(l_ae_line_rec);
943
944
945 IF PG_DEBUG in ('Y', 'C') THEN
946 arp_standard.debug( 'sob type = ' || ARP_ACCT_MAIN.ae_sys_rec.sob_type);
947 END IF;
948
949 IF (NVL(ARP_ACCT_MAIN.ae_sys_rec.sob_type,'P') = 'P') THEN
950 arp_distributions_pkg.insert_p(l_ae_line_rec, l_dummy);
951 END IF;
952 END LOOP;
953
954 IF PG_DEBUG in ('Y', 'C') THEN
955 arp_standard.debug( 'ARP_ACCT_MAIN.Insert_Ae_Lines()-');
956 END IF;
957
958 EXCEPTION
959 WHEN OTHERS THEN
960 IF PG_DEBUG in ('Y', 'C') THEN
961 arp_standard.debug('EXCEPTION: ARP_ACCT_MAIN.Insert_Ae_Lines');
962 END IF;
963 RAISE;
964
965 END Insert_Ae_Lines;
966
967 /* ==========================================================================
968 | PROCEDURE Dump_Dist_Amts
969 |
970 | DESCRIPTION
971 | Dumps data accounting line data
972 |
973 | SCOPE - PRIVATE
974 |
975 | PARAMETERS
976 | p_ae_line_rec IN Accounting lines record
977 *==========================================================================*/
978 PROCEDURE Dump_Dist_Amts(p_ae_line_rec IN ar_distributions%ROWTYPE) IS
979 BEGIN
980
981 IF PG_DEBUG in ('Y', 'C') THEN
982 arp_standard.debug('ARP_ACCT_MAIN.Dump_Dist_Amts()+');
983 END IF;
984
985 IF PG_DEBUG in ('Y', 'C') THEN
986 arp_standard.debug( 'set_of_books_id = ' || ARP_ACCT_MAIN.ae_sys_rec.set_of_books_id);
987 arp_standard.debug( 'source_type = ' || p_ae_line_rec.source_type);
988 arp_standard.debug( 'source_type_secondary = ' || p_ae_line_rec.source_type_secondary);
989 arp_standard.debug( 'source_id = ' || p_ae_line_rec.source_id);
990 arp_standard.debug( 'source_table = ' || p_ae_line_rec.source_table);
991 arp_standard.debug( 'code_combination_id = ' || p_ae_line_rec.code_combination_id);
992 arp_standard.debug( 'amount_dr = ' || p_ae_line_rec.amount_dr);
993 arp_standard.debug( 'amount_cr = ' || p_ae_line_rec.amount_cr);
994 arp_standard.debug( 'acctd_amount_dr = ' || p_ae_line_rec.acctd_amount_dr);
995 arp_standard.debug( 'acctd_amount_cr = ' || p_ae_line_rec.acctd_amount_cr);
996 arp_standard.debug( 'source_id_secondary = ' || p_ae_line_rec.source_id_secondary);
997 arp_standard.debug( 'source_table_secondary = ' || p_ae_line_rec.source_table_secondary);
998 arp_standard.debug( 'source_table_secondary = ' || p_ae_line_rec.source_table_secondary);
999 arp_standard.debug( 'currency_code = ' || p_ae_line_rec.currency_code);
1000 arp_standard.debug( 'currency_conversion_rate = ' || p_ae_line_rec.currency_conversion_rate);
1001 arp_standard.debug( 'currency_conversion_type = ' || p_ae_line_rec.currency_conversion_type);
1002 arp_standard.debug( 'currency_conversion_date = ' || p_ae_line_rec.currency_conversion_date);
1003 arp_standard.debug( 'third_party_id = ' || p_ae_line_rec.third_party_id);
1004 arp_standard.debug( 'third_party_sub_id = ' || p_ae_line_rec.third_party_sub_id);
1005 arp_standard.debug( 'tax_group_code_id = ' || p_ae_line_rec.tax_group_code_id);
1006 arp_standard.debug( 'tax_code_id = ' || p_ae_line_rec.tax_code_id);
1007 arp_standard.debug( 'location_segment_id = ' || p_ae_line_rec.location_segment_id);
1008 arp_standard.debug( 'taxable_entered_dr = ' || p_ae_line_rec.taxable_entered_dr);
1009 arp_standard.debug( 'taxable_entered_cr = ' || p_ae_line_rec.taxable_entered_cr);
1010 arp_standard.debug( 'taxable_accounted_dr = ' || p_ae_line_rec.taxable_accounted_dr);
1011 arp_standard.debug( 'taxable_accounted_cr = ' || p_ae_line_rec.taxable_accounted_cr);
1012 arp_standard.debug( 'tax_link_id = ' || p_ae_line_rec.tax_link_id);
1013 arp_standard.debug( 'reversed_source_id = ' || p_ae_line_rec.reversed_source_id);
1014 --{2979254
1015 arp_standard.debug( 'ref_customer_trx_line_id = ' || p_ae_line_rec.ref_customer_trx_line_id);
1016 arp_standard.debug( 'ref_cust_trx_line_gl_dist_id = '
1017 || p_ae_line_rec.ref_cust_trx_line_gl_dist_id);
1018 arp_standard.debug( 'ref_line_id = ' || p_ae_line_rec.ref_line_id);
1019 arp_standard.debug( 'from_amount_dr = ' || p_ae_line_rec.from_amount_dr);
1020 arp_standard.debug( 'from_amount_cr = ' || p_ae_line_rec.from_amount_cr);
1021 arp_standard.debug( 'from_acctd_amount_dr = ' || p_ae_line_rec.from_acctd_amount_dr);
1022 arp_standard.debug( 'from_acctd_amount_cr = ' || p_ae_line_rec.from_acctd_amount_cr);
1023 arp_standard.debug( 'ref_account_class = ' || p_ae_line_rec.ref_account_class);
1024 arp_standard.debug( 'activity_bucket = ' || p_ae_line_rec.activity_bucket);
1025 arp_standard.debug( 'ref_dist_ccid = ' || p_ae_line_rec.ref_dist_ccid);
1026 --}
1027
1028 arp_standard.debug('ARP_ACCT_MAIN.Dump_Dist_Amts()-');
1029 END IF;
1030
1031 EXCEPTION
1032 WHEN OTHERS THEN
1033 IF PG_DEBUG in ('Y', 'C') THEN
1034 arp_standard.debug('EXCEPTION: ARP_ACCT_MAIN.Dump_Dist_Amts');
1035 END IF;
1036 RAISE;
1037
1038 END Dump_Dist_Amts;
1039
1040 /*========================================================================
1041 | PRIVATE PROCEDURE Init_Curr_Details
1042 |
1043 | DESCRIPTION
1044 | Retrieves Currency, precision and gain loss account details
1045 | -----------------------------------------------------------
1046 |
1047 | PARAMETERS
1048 | NONE
1049 *=======================================================================*/
1050 PROCEDURE Init_Curr_Details(p_accounting_method IN OUT NOCOPY ar_system_parameters.accounting_method%TYPE) IS
1051
1052 BEGIN
1053
1054 IF PG_DEBUG in ('Y', 'C') THEN
1055 arp_standard.debug('ARP_ACCT_MAIN.Init_Curr_Details(+)');
1056 END IF;
1057
1058 SELECT sob.set_of_books_id,
1059 sob.chart_of_accounts_id,
1060 sob.currency_code,
1061 c.precision,
1062 c.minimum_accountable_unit,
1063 sysp.code_combination_id_gain,
1064 sysp.code_combination_id_loss,
1065 sysp.code_combination_id_round,
1066 sysp.accounting_method
1067 INTO ae_sys_rec.set_of_books_id,
1068 ae_sys_rec.coa_id,
1069 ae_sys_rec.base_currency,
1070 ae_sys_rec.base_precision,
1071 ae_sys_rec.base_min_acc_unit,
1072 ae_sys_rec.gain_cc_id,
1073 ae_sys_rec.loss_cc_id,
1074 ae_sys_rec.round_cc_id,
1075 p_accounting_method
1076 FROM ar_system_parameters sysp,
1077 gl_sets_of_books sob,
1078 fnd_currencies c
1079 WHERE sob.set_of_books_id = sysp.set_of_books_id --would be the row returned from multi org view
1080 AND sob.currency_code = c.currency_code;
1081
1082 --{BUG4301323: The sob_type needs to be defaulted to 'P' Primary
1083 ae_sys_rec.sob_type := 'P';
1084 --}
1085
1086 IF PG_DEBUG in ('Y', 'C') THEN
1087 arp_standard.debug('ARP_ACCT_MAIN.Init_Curr_Details(-)');
1088 END IF;
1089
1090 EXCEPTION
1091 WHEN NO_DATA_FOUND THEN
1092 IF PG_DEBUG in ('Y', 'C') THEN
1093 arp_standard.debug('ARP_ACCT_MAIN.Init_Curr_Details - NO_DATA_FOUND' );
1094 END IF;
1095 RAISE;
1096
1097 WHEN OTHERS THEN
1098 IF PG_DEBUG in ('Y', 'C') THEN
1099 arp_standard.debug('EXCEPTION: ARP_ACCT_MAIN.constructor(-)');
1100 arp_standard.debug(SQLERRM);
1101 END IF;
1102 RAISE;
1103
1104 END Init_Curr_Details;
1105
1106 END ARP_ACCT_MAIN;